From a61cb7c6061afe7857b916ea244e2cbd2a4eeebe Mon Sep 17 00:00:00 2001 From: Sravan Balaji Date: Sun, 12 Jun 2022 11:15:17 -0400 Subject: [PATCH] Fish Shell CMD Done Notification & Update Startup List - Remove nyrna from startup list - Add udiskie to startup list to automount external drives - Add command finished notification to fish shell --- .config/fish/conf.d/notification.fish | 18 ++++++++++++++++++ .scripts/startup.sh | 4 ++-- README.org | 27 +++++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 .config/fish/conf.d/notification.fish diff --git a/.config/fish/conf.d/notification.fish b/.config/fish/conf.d/notification.fish new file mode 100644 index 0000000..13755af --- /dev/null +++ b/.config/fish/conf.d/notification.fish @@ -0,0 +1,18 @@ +# This function allows you to switch to a different task +# when an interactive command takes too long +# by notifying you when it is finished. +# +# It is invoked by the fish shell automatically using its event system. +function __postexec_notify_on_long_running_commands --on-event fish_postexec + set --function interactive_commands 'vim' 'vlc' 'zathura' 'gitk' 'man' 'less' + set --function command (string split ' ' $argv[1]) + if contains $command $interactive_commands + # We quit interactive commands manually, + # no need for a notification. + return + end + + if test $CMD_DURATION -gt 5000 + notify-send 'command finished' "$argv" + end +end diff --git a/.scripts/startup.sh b/.scripts/startup.sh index 8e8f39b..1327c97 100755 --- a/.scripts/startup.sh +++ b/.scripts/startup.sh @@ -30,7 +30,7 @@ declare -a delay_array=(\ "/usr/bin/flameshot" \ # Flameshot Screenshot Tool "/usr/bin/xfce4-power-manager" \ # XFCE4 Power Manager "/usr/bin/volctl" \ # PulseAudio Volume Control - "/usr/bin/nyrna" \ # Nyrna + "/usr/bin/udiskie -a -n -s" \ # Udiskie "/usr/bin/openrgb" \ # OpenRGB # System Restore Processes "/usr/bin/autorandr --change --force" \ # Auto restore screen layout @@ -46,7 +46,7 @@ declare -a kill_delay_array=(\ "killall flameshot" \ # Flameshot Screenshot Tool "killall xfce4-power-manager" \ # XFCE4 Power Manager "killall volctl" \ # PulseAudio Volume Control - "killall nyrna" \ # Nyrna + "killall udiskie" \ # Udiskie "killall openrgb" \ # OpenRGB ) diff --git a/README.org b/README.org index d610ded..364adcd 100644 --- a/README.org +++ b/README.org @@ -4468,6 +4468,29 @@ set -g fish_pager_color_completion $foreground set -g fish_pager_color_description $comment #+END_SRC +**** Notification + +#+BEGIN_SRC fish :tangle .config/fish/conf.d/notification.fish +# This function allows you to switch to a different task +# when an interactive command takes too long +# by notifying you when it is finished. +# +# It is invoked by the fish shell automatically using its event system. +function __postexec_notify_on_long_running_commands --on-event fish_postexec + set --function interactive_commands 'vim' 'vlc' 'zathura' 'gitk' 'man' 'less' + set --function command (string split ' ' $argv[1]) + if contains $command $interactive_commands + # We quit interactive commands manually, + # no need for a notification. + return + end + + if test $CMD_DURATION -gt 5000 + notify-send 'command finished' "$argv" + end +end +#+END_SRC + ** Terminal *** Kitty @@ -7947,7 +7970,7 @@ declare -a delay_array=(\ "/usr/bin/flameshot" \ # Flameshot Screenshot Tool "/usr/bin/xfce4-power-manager" \ # XFCE4 Power Manager "/usr/bin/volctl" \ # PulseAudio Volume Control - "/usr/bin/nyrna" \ # Nyrna + "/usr/bin/udiskie -a -n -s" \ # Udiskie "/usr/bin/openrgb" \ # OpenRGB # System Restore Processes "/usr/bin/autorandr --change --force" \ # Auto restore screen layout @@ -7963,7 +7986,7 @@ declare -a kill_delay_array=(\ "killall flameshot" \ # Flameshot Screenshot Tool "killall xfce4-power-manager" \ # XFCE4 Power Manager "killall volctl" \ # PulseAudio Volume Control - "killall nyrna" \ # Nyrna + "killall udiskie" \ # Udiskie "killall openrgb" \ # OpenRGB )