diff options
author | joe <rbo@gmx.us> | 2025-10-01 22:33:48 +0200 |
---|---|---|
committer | joe <rbo@gmx.us> | 2025-10-01 22:33:48 +0200 |
commit | 8854fa0f8a831264ed815b3615038dec89c6f632 (patch) | |
tree | cb0eda5ade37b16adb72ee084e20fe284b2c90a1 /.local/bin/dmlog | |
parent | up (diff) | |
download | dotfiles-bsd-8854fa0f8a831264ed815b3615038dec89c6f632.tar.gz dotfiles-bsd-8854fa0f8a831264ed815b3615038dec89c6f632.tar.bz2 dotfiles-bsd-8854fa0f8a831264ed815b3615038dec89c6f632.tar.xz dotfiles-bsd-8854fa0f8a831264ed815b3615038dec89c6f632.tar.zst dotfiles-bsd-8854fa0f8a831264ed815b3615038dec89c6f632.zip |
up
Diffstat (limited to '.local/bin/dmlog')
-rwxr-xr-x | .local/bin/dmlog | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/.local/bin/dmlog b/.local/bin/dmlog index 3f31e8d..c31a270 100755 --- a/.local/bin/dmlog +++ b/.local/bin/dmlog @@ -12,7 +12,7 @@ use constant { KILL_PATH => '/usr/bin/killall', SHUTDOWN_PATH => '/sbin/shutdown', LOGINCTL_PATH => '/usr/bin/loginctl', - NOTIF_PATH => 'herbe', + NOTIF_PATH => '/usr/local/bin/herbe', HOSTNAME => (split /\./, hostname())[0] }; use constant LIST => [ @@ -34,6 +34,17 @@ $icon = " " if HOSTNAME eq 'mother'; $icon = " " if HOSTNAME eq 'po-rbo'; $icon = " " if HOSTNAME eq 'mars'; +sub notify +{ + my ($str) = @_; + + my $pid = fork(); + if (not $pid) { + exec(NOTIF_PATH, $str); + } + return; +}; + sub confirm { my ($var, $color) = @_; @@ -71,7 +82,7 @@ sub action "-fail-color", "0xcc241d"); } else { - exec(SLOCK_PATH . " && herbe '$icon welcome back, partner!'"); + exec(SLOCK_PATH . " && exec herbe '$icon welcome back, partner!'"); } } elsif ($var eq ${+LIST}[1]) { @@ -88,10 +99,7 @@ sub action } } else { - system( - NOTIF_PATH, - "$icon g'night, partner!" - ); + notify("$icon g'night, partner!"); sleep 2; if (HOSTNAME eq 'mother') { system('umount', '-f', '/var/dev/ceres'); @@ -120,19 +128,13 @@ sub action elsif (HOSTNAME eq 'po-rbo') { exec('doas', 'systemctl', 'reboot'); } - system( - NOTIF_PATH, - "$icon rebootin', partner!" - ); + notify("$icon rebootin', partner!"); exec(SHUTDOWN_PATH, '-r', 'now'); } } elsif ($var eq ${+LIST}[4]) { if (confirm($var, $color) == 1) { - system( - NOTIF_PATH, - "$icon farewell, partner!" - ); + notify("$icon farewell, partner!"); sleep 2; if (HOSTNAME eq 'mother') { exec(LOGINCTL_PATH, 'poweroff'); |