From 4e34c50b93b571493c63abb9c506612d00e01b92 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 15 Sep 2018 09:11:24 -0400 Subject: [PATCH] transmission-daemon toggle script --- .config/i3/config | 2 +- .scripts/td-toggle | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 .scripts/td-toggle diff --git a/.config/i3/config b/.config/i3/config index 7ae2e63..0b24cdf 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -292,7 +292,7 @@ bindsym $mod+F3 exec --no-startup-id displayselect bindsym $mod+F4 exec --no-startup-id $hibernate bindsym $mod+F5 exec --no-startup-id $netrefresh bindsym $mod+F6 exec --no-startup-id $term -e transmission-remote-cli -##bindsym $mod+F7 +bindsym $mod+F7 exec --no-startup-id td-toggle bindsym $mod+F8 exec --no-startup-id ~/.config/mutt/etc/mailsync.sh bindsym $mod+F9 exec --no-startup-id dmenumount bindsym $mod+F10 exec --no-startup-id dmenuumount diff --git a/.scripts/td-toggle b/.scripts/td-toggle new file mode 100755 index 0000000..42b5f1f --- /dev/null +++ b/.scripts/td-toggle @@ -0,0 +1,13 @@ +#!/bin/sh + +# If transmission-daemon is running, will ask to kill, else will ask to start. + +if pgrep -x transmission-da ; +then + yn=$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?") + [ "$yn" = "Yes" ] && killall transmission-daemon +else + yn=$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?") + [ "$yn" = "Yes" ] && transmission-daemon +fi +sleep 3 && pkill -RTMIN+7 i3blocks