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 | |
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 '')
-rwxr-xr-x | .local/bin/dmlog | 30 | ||||
-rwxr-xr-x | .local/bin/dmscrot | 13 | ||||
-rwxr-xr-x | .local/bin/fetch_mail.sh | 4 | ||||
-rwxr-xr-x | .local/bin/hddumnt | 12 | ||||
-rwxr-xr-x | .local/bin/kb | 3 | ||||
-rwxr-xr-x | .local/bin/mic | 1 | ||||
-rwxr-xr-x | .local/bin/mixer-set | 27 | ||||
-rwxr-xr-x | .local/bin/ref-newsboat | 20 | ||||
-rwxr-xr-x | .local/bin/setwp | 2 |
9 files changed, 63 insertions, 49 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'); diff --git a/.local/bin/dmscrot b/.local/bin/dmscrot index 6560d79..2746cd7 100755 --- a/.local/bin/dmscrot +++ b/.local/bin/dmscrot @@ -3,6 +3,7 @@ use strict; use warnings; use File::HomeDir qw(home); + use constant { SAVE_PATH => 'pics/scrot/', SCREENSHOT_PATH => 'scrot', @@ -33,12 +34,16 @@ sub show_img sub notify_img { my ($file) = @_; + my $pid; - system( - NOTIFY_PATH, - ' screenshot captured to ' . "\n" . - $file + $pid = fork(); + if (not $pid) { + system( + NOTIFY_PATH, + ' screenshot captured to ' . "\n" . + $file ); + } return; } diff --git a/.local/bin/fetch_mail.sh b/.local/bin/fetch_mail.sh index 5f68acc..115be53 100755 --- a/.local/bin/fetch_mail.sh +++ b/.local/bin/fetch_mail.sh @@ -17,7 +17,7 @@ else fi if ! echo test | gpg2 --sign --batch --no-tty --pinentry-mode error -o /dev/null >/dev/null 2>&1; then - herbe ' GPG locked' + herbe ' GPG locked' >/dev/null 2>&1 & exit 1 fi killall mbsync >/dev/null 2>&1 @@ -35,7 +35,7 @@ mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmx_shop/INBOX/new | wc -l 2>/dev/null)" # mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)" post_count="$((post_count + mb1))" if [ $post_count -gt $pre_count ]; then - herbe ' '$post_count' new mail(s)' & + herbe ' '$post_count' new mail(s)' >/dev/null 2>&1 & fi echo $post_count >$mc_file # sleep 1 diff --git a/.local/bin/hddumnt b/.local/bin/hddumnt index deba4ed..1b5da66 100755 --- a/.local/bin/hddumnt +++ b/.local/bin/hddumnt @@ -6,25 +6,25 @@ mountpoint="$HOME/$devname" case "$(hostname -s)" in mother|po-rbo) if ! doas umount "$mountpoint"; then - herbe " failed to dismount $mountpoint" + herbe " failed to dismount $mountpoint" & fi if ! doas cryptsetup close "$devname"; then - herbe " failed to close crypt dev $devname" + herbe " failed to close crypt dev $devname" & fi rmdir "$mountpoint" - herbe " crypt dev dismounted from $mountpoint" + herbe " crypt dev dismounted from $mountpoint" & ;; mars) if ! mount | grep -F /dev/da0p1; then - herbe ' HDD not mounted' + herbe ' HDD not mounted' & exit 1 fi if ! umount /dev/da0p1.eli; then - herbe ' failed to dismount hdd' + herbe ' failed to dismount hdd' & exit 1 fi geli detach da0p1.eli rmdir "$HOME"/hdd - herbe ' hdd dismounted from ~/hdd' + herbe ' hdd dismounted from ~/hdd' & ;; esac diff --git a/.local/bin/kb b/.local/bin/kb index 24f7285..d387233 100755 --- a/.local/bin/kb +++ b/.local/bin/kb @@ -57,13 +57,14 @@ config_keyboard() { xmodmap -e 'keycode 23 = Escape' xmodmap -e 'keycode 37 =' fi - herbe ' kb set' + herbe ' kb set' & } config_keyboard inotifywait -m /dev/input -e create | while read -r a; do config_keyboard + sleep 30 done # vim: filetype=sh diff --git a/.local/bin/mic b/.local/bin/mic index 19a0fd6..06597ff 100755 --- a/.local/bin/mic +++ b/.local/bin/mic @@ -53,7 +53,6 @@ sub mic notify(' microphone muted'); }; } - system('kill -68 $(pidof dwmblocks)'); return; } diff --git a/.local/bin/mixer-set b/.local/bin/mixer-set index 24d6f21..3979ff2 100755 --- a/.local/bin/mixer-set +++ b/.local/bin/mixer-set @@ -6,6 +6,17 @@ use Term::ANSIColor; use Capture::Tiny qw(capture); use Sys::Hostname qw(hostname); +sub notify +{ + my ($str) = @_; + + my $pid = fork(); + if (not $pid) { + exec('/usr/local/bin/herbe', $str); + } + return; +}; + sub main { my $argc = $#ARGV + 1; if ($argc == 0) { @@ -28,10 +39,6 @@ sub main { if ($host eq "po-rbo.ln.ysosecure.com") { $curr_vol_cmd = "/usr/bin/pactl get-sink-volume \@DEFAULT_SINK\@ | /usr/bin/awk '{print \$5}'"; } - my $ns = '/usr/local/bin/herbe'; - if (hostname() eq "po-rbo.ln.ysosecure.com") { - $ns = '/usr/local/bin/herbe'; - } if ($ARGV[0] eq "lower" || $ARGV[0] eq "raise") { if ($ARGV[0] eq "lower") { if ($host eq "po-rbo.ln.ysosecure.com") { @@ -55,8 +62,7 @@ sub main { } $curr_vol = `$curr_vol_cmd`; chomp $curr_vol; - system($ns, ' ' . $curr_vol); - system('kill -68 $(pidof dwmblocks)'); + notify(' ' . $curr_vol); exit; } elsif ($ARGV[0] eq "toggle") { @@ -79,11 +85,7 @@ sub main { ); }; } - system( - $ns, - ' muted' - ); - system('kill -68 $(pidof dwmblocks)'); + notify(' muted'); } else { open(my $fh, '<:encoding(UTF-8)', $tmp_file); @@ -102,8 +104,7 @@ sub main { ); }; } - system($ns, ' ' . $curr_vol); - system('kill -68 $(pidof dwmblocks)'); + notify(' ' . $curr_vol); } exit; } diff --git a/.local/bin/ref-newsboat b/.local/bin/ref-newsboat index 08ee614..e5d9848 100755 --- a/.local/bin/ref-newsboat +++ b/.local/bin/ref-newsboat @@ -5,8 +5,19 @@ use warnings; use Capture::Tiny qw(capture); use constant { - NEWSBOAT_PATH => 'newsboat', - NOTIFY_SEND_PATH => 'herbe' + NEWSBOAT_PATH => 'newsboat', + NOTIFYSEND_PATH => 'herbe' +}; + +sub notify +{ + my ($str) = @_; + + my $pid = fork(); + if (not $pid) { + exec(NOTIFYSEND_PATH, $str); + } + return; }; sub main @@ -27,10 +38,7 @@ sub main $stdout =~ s/\s.+//; chomp $stdout; if ($stdout != 0) { - system( - NOTIFY_SEND_PATH, - ' ' . $stdout . ' new articles' - ); + notify(' ' . $stdout . ' new articles'); } return; } diff --git a/.local/bin/setwp b/.local/bin/setwp index 0786461..647a332 100755 --- a/.local/bin/setwp +++ b/.local/bin/setwp @@ -5,7 +5,6 @@ use warnings; use File::HomeDir qw(home); use File::Copy; use File::Find; -use POSIX qw(setsid); use constant { WP_POOL => home() . '/pics/wp/' @@ -96,7 +95,6 @@ sub main if (@ARGV == 0 || (@ARGV != 0 && $ARGV[0] ne '-nw')) { my $arg = fork(); if (not $arg) { - setsid(); exec('herbe', ' wp set') if ($ret == 0); exec('herbe', ' wp is not a valid file') if ($ret != 0); } |