vibe_desktop_shortcut 0.1.1
vibe_desktop_shortcut: ^0.1.1 copied to clipboard
Registers a system-wide keyboard shortcut that runs a command on Linux desktops (KDE Plasma, GNOME, Hyprland), with conflict check and read-back verification.
example/vibe_desktop_shortcut_example.dart
import 'package:vibe_desktop_shortcut/vibe_desktop_shortcut.dart';
Future<void> main() async {
final registrar = ShortcutRegistrar();
final spec = ShortcutSpec(
id: 'myapp-quick',
name: 'MyApp Quick Access',
executable: '/usr/bin/myapp',
args: ['--quick'],
);
final key = KeyCombo.parse('Ctrl+Alt+K')!;
print('desktop: ${registrar.desktop.name}');
final result = await registrar.apply(spec, key);
switch (result.status) {
case RegistrationStatus.registered:
print('done');
case RegistrationStatus.written:
print('saved, but log out and in to load it');
case RegistrationStatus.conflict:
print('already used by: ${result.conflicts.join(', ')}');
case RegistrationStatus.manual:
print('bind this command yourself: ${result.command}');
case RegistrationStatus.missing:
print('not registered');
}
if (result.note.isNotEmpty) print(result.note);
}