diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2022-04-08 23:14:16 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2022-04-08 23:14:16 +0200 |
commit | 18e9819ff1db796d5495955809556ca73970359b (patch) | |
tree | 136b20682f30635dd06627d4ca4a519cf98c1b0d /.local/bin/shutup | |
parent | In progress (diff) | |
download | dotfiles-bsd-18e9819ff1db796d5495955809556ca73970359b.tar.gz dotfiles-bsd-18e9819ff1db796d5495955809556ca73970359b.tar.bz2 dotfiles-bsd-18e9819ff1db796d5495955809556ca73970359b.tar.xz dotfiles-bsd-18e9819ff1db796d5495955809556ca73970359b.tar.zst dotfiles-bsd-18e9819ff1db796d5495955809556ca73970359b.zip |
in progress
Diffstat (limited to '')
-rwxr-xr-x | .local/bin/shutup | 26 |
1 files changed, 24 insertions, 2 deletions
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 $/; <FH> }; 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; } |