summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
authorjoe <rbo@gmx.us>2025-11-09 20:08:02 +0100
committerjoe <rbo@gmx.us>2025-11-09 20:08:02 +0100
commite0d2d242853ab2f20683666bea97034594fae296 (patch)
treee3c8c92839a607eaa4a62f2930384987c10cb53c /.local
parentup (diff)
downloaddotfiles-bsd-e0d2d242853ab2f20683666bea97034594fae296.tar.gz
dotfiles-bsd-e0d2d242853ab2f20683666bea97034594fae296.tar.bz2
dotfiles-bsd-e0d2d242853ab2f20683666bea97034594fae296.tar.xz
dotfiles-bsd-e0d2d242853ab2f20683666bea97034594fae296.tar.zst
dotfiles-bsd-e0d2d242853ab2f20683666bea97034594fae296.zip
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/dmlog50
-rwxr-xr-x.local/bin/gotosleep4
2 files changed, 37 insertions, 17 deletions
diff --git a/.local/bin/dmlog b/.local/bin/dmlog
index 5b99d4f..c6a52f7 100755
--- a/.local/bin/dmlog
+++ b/.local/bin/dmlog
@@ -79,25 +79,49 @@ sub action
}
}
elsif ($var eq ${+LIST}[1]) {
+ notify("g'night, partner!");
+ sleep 1;
$pid = fork();
if (not $pid) {
- if (defined $ENV{WAYLAND_DISPLAY}) {
- exec("waylock",
- "-init-color", "0x1d2021",
- "-input-color", "0xd79921",
- "-fail-color", "0xcc241d");
- }
- else {
- exec(XSCREENSAVER_PATH, '-lock');
+ # if (defined $ENV{WAYLAND_DISPLAY}) {
+ # exec("waylock",
+ # "-init-color", "0x1d2021",
+ # "-input-color", "0xd79921",
+ # "-fail-color", "0xcc241d");
+ # }
+ # else {
+ # system(SLOCK_PATH);
+ # notify("g'day, partner!");
+ # return;
+ # }
+ if (HOSTNAME eq 'mother') {
+ # setsid();
+ # sleep 4;
+ # exec(LOGINCTL_PATH, 'suspend');
}
}
else {
- notify("g'night, partner!");
- sleep 2;
+ sleep 1;
if (HOSTNAME eq 'mother') {
- system(LOGINCTL_PATH, 'terminate-session', 'self');
- # system('umount', '-f', '/var/dev/ceres');
- sleep 2
+ my $user = 'jozan';
+ my $self = $$;
+ my @pids = map { s/^\s+|\s+$//gr } qx{ps -u $user -o pid=};
+ for my $pid (@pids) {
+ next unless $pid =~ /^\d+$/;
+ next if $pid == $self;
+ next if $pid == 1; # don't try to kill init
+ kill 'TERM', $pid;
+ }
+ sleep 1;
+ for my $pid (@pids) {
+ next unless $pid =~ /^\d+$/;
+ next if $pid == $self;
+ next if $pid == 1;
+ if (kill 0, $pid) { # process still exists
+ kill 'KILL', $pid;
+ }
+ }
+ sleep 1;
exec(LOGINCTL_PATH, 'suspend');
}
elsif (HOSTNAME eq 'po-rbo') {
diff --git a/.local/bin/gotosleep b/.local/bin/gotosleep
deleted file mode 100755
index 9fdc328..0000000
--- a/.local/bin/gotosleep
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/local/bin/dash
-
-slock &
-acpiconf -s 3