dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit f90970f7483494b866d6b73497f5a10680337670
parent 2bc9ea6237cbdda42409b90e9f97fa97d74ebe7a
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Sat, 29 Dec 2018 11:46:03 +0100

Add transmission i3 integration

Diffstat:
Mlinks/.config/i3/config | 1+
Mlinks/.config/i3/i3blocks | 5+++++
Mlinks/.config/i3/i3scripts/i3torrent | 24++++++++++++++++++++++--
Alinks/bin/t-daemon-toggle | 15+++++++++++++++
4 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/links/.config/i3/config b/links/.config/i3/config @@ -88,6 +88,7 @@ bindsym XF86AudioMicMute exec --no-startup-id amixer set 'Mic Mute' toggle && pk # interactive dialogs #bindsym $mod+grave exec --no-startup-id dmenuunicode bindsym $mod+u exec --no-startup-id dmenuunicode +bindsym $mod+F7 exec --no-startup-id t-daemon-toggle bindsym $mod+F9 exec --no-startup-id dmenumount bindsym $mod+F10 exec --no-startup-id dmenuumount diff --git a/links/.config/i3/i3blocks b/links/.config/i3/i3blocks @@ -25,6 +25,11 @@ separator_block_width=14 markup=pango command=~/.config/i3/i3scripts/$BLOCK_NAME +[i3torrent] +label= +interval=20 +signal=16 + [i3mpd] label= interval=10 diff --git a/links/.config/i3/i3scripts/i3torrent b/links/.config/i3/i3scripts/i3torrent @@ -1,6 +1,26 @@ #!/bin/sh + +transmission-remote -l | grep % | + sed " # This first sed command is to ensure a desirable order with sort + s/.*Stopped.*/A/g; + s/.*Seeding.*/Z/g; + s/.*100%.*/N/g; + s/.*Idle.*/B/g; + s/.*%.*/M/g" | + sort -h | uniq -c | sed " # Now we replace the standin letters with icons. + s/A/🛑/g; + s/B/⌛️/g; + s/M/🔽/g; + s/N/✅/g; + s/Z/🌱/g" | awk '{print $2, $1}' | tr '\n' ' ' | sed -e "s/ $//g" + case $BLOCK_BUTTON in - 1) $TERMINAL -e transmission-remote-cli + 1) st ;; + 3) pgrep -x dunst >/dev/null && notify-send "<b>Torrent module:</b> +🛑: paused +⏳: waiting +🔽: downloading +✅: done +🌱: done and seeding" ;; esac -transmission-remote -l | grep % | sed -e "s/.*100%.*/Z/g;s/.*Idle.*/A/g;s/.*%.*/M/g" | sort -h | uniq -c | sed -e "s/Z/🌱/g;s/M/⬇️/g;s/A/⌛️/g" | awk '{print $2, $1}' | tr '\n' ' ' | sed -e "s/ $//g" diff --git a/links/bin/t-daemon-toggle b/links/bin/t-daemon-toggle @@ -0,0 +1,15 @@ +#!/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 ; +then + yn=$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?") + [ "$yn" = "Yes" ] && killall transmission-da +else + yn=$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?") + [ "$yn" = "Yes" ] && transmission-daemon +fi +sleep 3 && pkill -RTMIN+16 i3blocks