diff options
-rw-r--r-- | .config/x11/xinitrc | 5 | ||||
-rwxr-xr-x | .local/bin/dmlog | 24 |
2 files changed, 20 insertions, 9 deletions
diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index 82bbdd2..42de16b 100644 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -56,7 +56,10 @@ startif picom startif mpd-notification pgrep $mpd >/dev/null || $mpd >/dev/null 2>&1 "$HOME"/.local/bin/setwp "$HOME"/pics/the_wall.png -"$HOME"/.local/bin/kb +for pid in $(ps aux | grep local/bin/kb | awk '{print $2}'); do + kill -9 $pid +done +"$HOME"/.local/bin/kb & xset s off xset -dpms startif $xscr diff --git a/.local/bin/dmlog b/.local/bin/dmlog index a4c0182..6117f55 100755 --- a/.local/bin/dmlog +++ b/.local/bin/dmlog @@ -2,6 +2,8 @@ use strict; use warnings; +use Sys::Hostname; + use constant OS => `uname | tr -d '\n'`; use constant { SLOCK_PATH => 'slock', @@ -11,7 +13,7 @@ use constant { SHUTDOWN_PATH => '/sbin/shutdown', LOGINCTL_PATH => '/usr/bin/loginctl', NOTIF_PATH => 'notify-send', - EMACS_PATH => 'emacsclient' + HOSTNAME => (split /\./, hostname()) }; use constant LIST => [ 'Lock screen', @@ -65,7 +67,10 @@ sub action ' G\'night, partner!' ); sleep 2; - if (OS eq 'Linux') { + if (HOSTNAME eq 'mother') { + exec(LOGINCTL_PATH, 'suspend'); + } + elsif (HOSTNAME eq 'po-rbo') { exec('systemctl', 'suspend'); } exec(ACPI_PATH, '-s', '3'); @@ -73,8 +78,7 @@ sub action } elsif ($var eq ${+LIST}[2]) { if (confirm($var) == 1) { - system(EMACS_PATH, '-e', '"(save-buffers-kill-terminal)"'); - if (OS eq 'Linux') { + if (HOSTNAME eq 'mother') { exec(LOGINCTL_PATH, 'terminate-session', 'self'); } exec(KILL_PATH, 'dwm'); @@ -82,8 +86,10 @@ sub action } elsif ($var eq ${+LIST}[3]) { if (confirm($var) == 1) { - system(EMACS_PATH, '-e', '"(save-buffers-kill-terminal)"'); - if (OS eq 'Linux') { + if (HOSTNAME eq 'mother') { + exec(LOGINCTL_PATH, 'reboot'); + } + elsif (HOSTNAME eq 'po-rbo') { exec('systemctl', 'reboot'); } system( @@ -98,7 +104,6 @@ sub action } elsif ($var eq ${+LIST}[4]) { if (confirm($var) == 1) { - system(EMACS_PATH, '-e', '"(save-buffers-kill-terminal)"'); system( NOTIF_PATH, '-u', @@ -107,7 +112,10 @@ sub action ' Farewell, partner!' ); sleep 2; - if (OS eq 'Linux') { + if (HOSTNAME eq 'mother') { + exec(LOGINCTL_PATH, 'poweroff'); + } + elsif (HOSTNAME eq 'po-rbo') { exec('systemctl', 'poweroff'); } exec(SHUTDOWN_PATH, '-p', 'now'); |