summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmlog
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/dmlog')
-rwxr-xr-x.local/bin/dmlog47
1 files changed, 21 insertions, 26 deletions
diff --git a/.local/bin/dmlog b/.local/bin/dmlog
index d209ee5..a5f9b15 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 => 'notify-send',
+ NOTIF_PATH => '/usr/local/bin/herbe',
HOSTNAME => (split /\./, hostname())[0]
};
use constant LIST => [
@@ -27,6 +27,17 @@ use constant CONFIRM => [
"yes"
];
+sub notify
+{
+ my ($str) = @_;
+
+ my $pid = fork();
+ if (not $pid) {
+ exec(NOTIF_PATH, $str);
+ }
+ return;
+};
+
sub confirm
{
my ($var, $color) = @_;
@@ -64,7 +75,7 @@ sub action
"-fail-color", "0xcc241d");
}
else {
- exec(XSCREENSAVER_PATH, '-lock');
+ exec(SLOCK_PATH . " && exec herbe 'welcome back, partner!'");
}
}
elsif ($var eq ${+LIST}[1]) {
@@ -81,19 +92,14 @@ sub action
}
}
else {
- system(
- NOTIF_PATH,
- '-u',
- 'normal',
- 'shutdown',
- ' g\'night, partner!'
- );
+ notify("g'night, partner!");
sleep 2;
if (HOSTNAME eq 'mother') {
+ system('umount', '-f', '/var/dev/ceres');
exec(LOGINCTL_PATH, 'suspend');
}
elsif (HOSTNAME eq 'po-rbo') {
- exec('systemctl', 'suspend');
+ exec('doas', 'systemctl', 'suspend');
}
exec(ACPI_PATH, '-s', '3');
}
@@ -109,36 +115,25 @@ sub action
elsif ($var eq ${+LIST}[3]) {
if (confirm($var, $color) == 1) {
if (HOSTNAME eq 'mother') {
+ system('umount', '-f', '/var/dev/ceres');
exec(LOGINCTL_PATH, 'reboot');
}
elsif (HOSTNAME eq 'po-rbo') {
- exec('systemctl', 'reboot');
+ exec('doas', 'systemctl', 'reboot');
}
- system(
- NOTIF_PATH,
- '-u',
- 'normal',
- 'shutdown',
- ' rebootin\', partner!'
- );
+ notify("rebootin', partner!");
exec(SHUTDOWN_PATH, '-r', 'now');
}
}
elsif ($var eq ${+LIST}[4]) {
if (confirm($var, $color) == 1) {
- system(
- NOTIF_PATH,
- '-u',
- 'normal',
- 'shutdown',
- ' farewell, partner!'
- );
+ notify("farewell, partner!");
sleep 2;
if (HOSTNAME eq 'mother') {
exec(LOGINCTL_PATH, 'poweroff');
}
elsif (HOSTNAME eq 'po-rbo') {
- exec('systemctl', 'poweroff');
+ exec('doas', 'systemctl', 'poweroff');
}
exec(SHUTDOWN_PATH, '-p', 'now');
}