From 9ddf765a03fae63892644d11bb48112daeaf528a Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 26 Jan 2019 18:13:36 -0500 Subject: [PATCH] torrent wrap and other changes --- .config/i3/config | 2 +- .scripts/i3cmds/td-toggle | 13 ++++--------- .scripts/i3cmds/torwrap | 6 ++++++ 3 files changed, 11 insertions(+), 10 deletions(-) create mode 100755 .scripts/i3cmds/torwrap diff --git a/.config/i3/config b/.config/i3/config index c30ef9a..dfdf1e1 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -286,7 +286,7 @@ bindsym $mod+F2 restart bindsym $mod+F3 exec --no-startup-id displayselect bindsym $mod+F4 exec --no-startup-id prompt "Hibernate computer?" "$hibernate" bindsym $mod+F5 exec --no-startup-id $netrefresh -bindsym $mod+F6 exec --no-startup-id $term -e transmission-remote-cli +bindsym $mod+F6 exec --no-startup-id torwrap 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 diff --git a/.scripts/i3cmds/td-toggle b/.scripts/i3cmds/td-toggle index 6489626..729e697 100755 --- a/.scripts/i3cmds/td-toggle +++ b/.scripts/i3cmds/td-toggle @@ -1,15 +1,10 @@ #!/bin/sh - # If transmission-daemon is running, will ask to kill, else will ask to start. - -[ ! -f /usr/bin/transmission-daemon ] && notify-send "Transmission daemon not installed." && exit - -if pgrep -x transmission-da >/dev/null ; +if pgrep -x transmission-da >/dev/null ; then - yn=$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?") - [ "$yn" = "Yes" ] && killall transmission-da + [ "$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send -i "$PIX/torrent.svg" "transmission-daemon killed." else - yn=$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?") - [ "$yn" = "Yes" ] && transmission-daemon + ifinstalled transmission-cli || exit + [ "$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send -i "$PIX/torrent.svg" "tranmission-daemon started." fi sleep 3 && pkill -RTMIN+7 i3blocks diff --git a/.scripts/i3cmds/torwrap b/.scripts/i3cmds/torwrap new file mode 100755 index 0000000..6b501cc --- /dev/null +++ b/.scripts/i3cmds/torwrap @@ -0,0 +1,6 @@ +#!/bin/sh +ifinstalled transmission-remote-cli transmission-cli || exit + +! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send -i "$PIX/torrent.svg" "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks + +$TERMINAL -e transmission-remote-cli