Browse Source

Added dwm_transmission

patch-fontkeys
joestandring 5 years ago
parent
commit
1bf216b0c9
3 changed files with 61 additions and 4 deletions
  1. +11
    -3
      README.md
  2. +48
    -0
      bar-functions/dwm_transmission.sh
  3. +2
    -1
      dwm_bar.sh

+ 11
- 3
README.md View File

@ -17,6 +17,7 @@ A modular statusbar for DWM
- [dwm_network](#dwm_network)
- [dwm_vpn](#dwm_vpn)
- [dwm_ccurse](#dwm_ccurse)
- [dwm_transmission](#dwm_transmission)
- [Installation](#installation)
- [Usage](#usage)
- [Customizing](#customizing)
@ -95,11 +96,17 @@ Displays the current VPN connection
```
Dependencies: ```NetworkManager-openvpn```
### dwm_ccurse
Shows the next appointment from calcurse
Displays the next appointment from calcurse
```
[💡 18/04/19 19:00 20:00 Upload dwm_ccurse]
```
Dependencies: ```calcurse```
### dwm_transmission
Displays the current status of a torrent with transmission-remote
```
[⏬ archlinux-2019.06.01... | 92% 1min ⬆3.4 ⬇1.5]
```
Dependencies: ```transmission-remote```
## Installation
1. Clone and enter the repository:
```
@ -129,7 +136,7 @@ dwm-bar is completley modular, meaning you can mix and match functions to your h
If you want to make your own function, for example dwm_myfunction.sh, you should create it in the functions/ subdirectory before including it in dwm_bar.sh and adding it to the xsetroot command:
```
# Import the modules
. "$DIR/functions/dwm_myfucntion"
. "$DIR/bar-functions/dwm_myfucntion"
while true
do
@ -143,7 +150,7 @@ You can also decide to use unicode or plaintext identifiers for functions by alt
```
Whereas, if it is not set it will display:
```
[MAI 0]
[MAIL 0]
```
## Acknowledgements
Code for some functions was modified from:
@ -153,3 +160,4 @@ Code for some functions was modified from:
* [suckless.org](https://dwm.suckless.org/status_monitor/)
## More to come!
* dwm_bluez function to show currently connected Bluetooth device using bluez
* dwm_mpd

+ 48
- 0
bar-functions/dwm_transmission.sh View File

@ -0,0 +1,48 @@
#!/bin/sh
# A dwm_bar function to show the status of a torrent woth transmission-remote
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: transmission-remote
dwm_transmission () {
TORRENT=$(transmission-remote -l | sed '2q;d' | sed 's/\(.\) /\1/g')
ID=$(printf "%s" "$TORRENT" | awk '{print $1;}')
STATUS=$(printf "%s" "$TORRENT" | awk '{print $8;}')
ETA=$(printf "%s" "$TORRENT" | awk '{print $4;}')
NAME=$(printf "%s" "$TORRENT" | awk '{for(i=9;i<=NF;++i)print $i}' | tr -d "\n" | head -c 20; printf "...")
DONE=$(printf "%s" "$TORRENT" | awk '{print $2;}')
UP=$(printf "%s" "$TORRENT" | awk '{print $5;}')
DOWN=$(printf "%s" "$TORRENT" | awk '{print $5;}')
if [ "$ID" != "Sum:" ]; then
if [ "$IDENTIFIER" = "unicode" ]; then
case "$STATUS" in
"Idle")
printf "[🛑 %s | %s %s ⬆%s ⬇%s]\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;;
"Seeding")
printf "[🌱 %s | ⬆%s ⬇%s]\n" "$NAME" "$UP" "$DOWN"
;;
"Downloading")
printf "[⏬ %s | %s %s ⬆%s ⬇%s]\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;;
esac
else
case "$STATUS" in
"Idle")
printf "[IDLE %s | %s %s ⬆%s ⬇%s]\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;;
"Seeding")
printf "[SEEDING %s | ⬆%s ⬇%s]\n" "$NAME" "$UP" "$DOWN"
;;
"Downloading")
printf "[DOWNLOADING %s | %s %s ⬆%s ⬇%s]\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;;
esac
fi
fi
}
dwm_transmission

+ 2
- 1
dwm_bar.sh View File

@ -19,6 +19,7 @@ export IDENTIFIER="unicode"
# Import the modules
. "$DIR/bar-functions/dwm_countdown.sh"
. "$DIR/bar-functions/dwm_transmission.sh"
. "$DIR/bar-functions/dwm_cmus.sh"
. "$DIR/bar-functions/dwm_resources.sh"
. "$DIR/bar-functions/dwm_battery.sh"
@ -34,6 +35,6 @@ export IDENTIFIER="unicode"
# Update dwm status bar every second
while true
do
xsetroot -name "$(dwm_countdown)$(dwm_cmus)$(dwm_resources)$(dwm_battery)$(dwm_mail)$(dwm_alsa)$(dwm_weather)$(dwm_vpn)$(dwm_network)$(dwm_keyboard)$(dwm_date)"
xsetroot -name "$(dwm_countdown)$(dwm_transmission)$(dwm_cmus)$(dwm_resources)$(dwm_battery)$(dwm_mail)$(dwm_alsa)$(dwm_weather)$(dwm_vpn)$(dwm_network)$(dwm_keyboard)$(dwm_date)"
sleep 1
done

Loading…
Cancel
Save