From 18e9819ff1db796d5495955809556ca73970359b Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 8 Apr 2022 23:14:16 +0200 Subject: in progress --- .local/bin/shutup | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to '.local/bin/shutup') diff --git a/.local/bin/shutup b/.local/bin/shutup index 47812bb..6c53484 100755 --- a/.local/bin/shutup +++ b/.local/bin/shutup @@ -5,23 +5,45 @@ use warnings; use File::HomeDir qw(home); use constant { - DUNSTRC_PATH => home() . '/.config/dunst/dunstrc', - NOTIFYSEND_PATH => '/usr/local/bin/notify-send' + BSDSETSID_PATH => '/usr/local/bin/bsdsetsid', + DUNSTRC_PATH => home() . '/.config/dunst/dunstrc', + DUNSTRC_PATH => '/usr/local/bin/dunst', + MPD_NOTIFICATION_PATH => '/usr/local/bin/mpd-notification', + NOTIFYSEND_PATH => '/usr/local/bin/notify-send', + PKILL_PATH => '/bin/pkill' }; +sub kill_programs() { + system(PKILL_PATH, 'espeak'); + system(PKILL_PATH, 'mpd-notification'); + system(PKILL_PATH, 'dunst'); +} + +sub start_programs() { + system(BSDSETSID_PATH, DUNST_PATH); + system(BSDSETSID_PATH, MPD_NOTIFICATION_PATH); +} + sub main() { + my $i; my @lines; + kill_programs(); open(FH, '<', DUNSTRC_PATH) or die $!; @lines = do { local $/; }; close(FH); + for ($i = 0; $i < @lines, $i++) { + last if $lines[$i]; + } + print $lines[$i]; open(FH, '>', home() . '/tmp') or die $!; print FH @lines; close(FH); + start_programs(); return; } -- cgit v1.2.3