dwm update in progress

This commit is contained in:
2023-05-09 20:21:49 +02:00
parent 61775f18e4
commit e65b5d797a
330 changed files with 26354 additions and 16 deletions

View File

@@ -0,0 +1,25 @@
#!/bin/sh
# A dwm_status function that displays upcoming alarms from alarm.sh
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: https://github.com/joestandring/alarm
dwm_alarm () {
for f in /tmp/alarm.*; do
if [ -e "$f" ]; then
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "⏰ %s" "$(cat /tmp/alarm.*)"
else
printf "ALM %s" "$(cat /tmp/alarm.*)"
fi
printf "%s\n" "$SEP2"
break
fi
done
}
dwm_alarm

View File

@@ -0,0 +1,43 @@
#!/bin/sh
# A dwm_bar function to show the master volume of ALSA
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: alsa-utils
dwm_alsa () {
STATUS=$(amixer sget Master | tail -n1 | sed -r "s/.*\[(.*)\]/\1/")
VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$STATUS" = "off" ]; then
printf "🔇"
else
#removed this line becuase it may get confusing
if [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "🔈 %s%%" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "🔉 %s%%" "$VOL"
else
printf "🔊 %s%%" "$VOL"
fi
fi
else
if [ "$STATUS" = "off" ]; then
printf "MUTE"
else
# removed this line because it may get confusing
if [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "VOL %s%%" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "VOL %s%%" "$VOL"
else
printf "VOL %s%%" "$VOL"
fi
fi
fi
printf "%s\n" "$SEP2"
}
dwm_alsa

View File

@@ -0,0 +1,13 @@
#!/bin/sh
# A dwm_bar module to display the current backlight brighness with xbacklight
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: xbacklight
dwm_backlight () {
printf "%s☀ %.0f%s\n" "$SEP1" "$(xbacklight)" "$SEP2"
}
dwm_backlight

View File

@@ -0,0 +1,26 @@
#!/bin/sh
# A dwm_bar function to read the battery level and status
# Joe Standring <git@joestandring.com>
# GNU GPLv3
dwm_battery () {
# Change BAT1 to whatever your battery is identified as. Typically BAT0 or BAT1
CHARGE=$(cat /sys/class/power_supply/BAT1/capacity)
STATUS=$(cat /sys/class/power_supply/BAT1/status)
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$STATUS" = "Charging" ]; then
printf "🔌 %s%% %s" "$CHARGE" "$STATUS"
else
printf "🔋 %s%% %s" "$CHARGE" "$STATUS"
fi
else
printf "BAT %s%% %s" "$CHARGE" "$STATUS"
fi
printf "%s\n" "$SEP2"
}
dwm_battery

View File

@@ -0,0 +1,24 @@
#!/bin/sh
# A dwm_bar function to show the closest appointment in calcurse
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: calcurse
dwm_ccurse () {
APTSFILE="$HOME/.calcurse/apts"
APPOINTMENT=$(head -n 1 "$APTSFILE" | sed -r 's/\[1\] //')
if [ "$APPOINTMENT" != "" ]; then
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "💡 %s" "$APPOINTMENT"
else
printf "APT %s" "$APPOINTMENT"
fi
printf "%s\n" "$SEP2"
fi
}
dwm_ccurse

View File

@@ -0,0 +1,52 @@
#!/bin/sh
# A dwm_bar function that shows the current artist, track, position, duration, and status from cmus
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: cmus
dwm_cmus () {
if ps -C cmus > /dev/null; then
CMUSDATA=$(cmus-remote -Q)
ARTIST=$(echo "$CMUSDATA" | grep -w '^tag artist' | awk '{gsub("tag artist ", "");print}')
TRACK=$(echo "$CMUSDATA" | grep -w '^tag title' | awk '{gsub("tag title ", "");print}')
POSITION=$(echo "$CMUSDATA" | grep -w '^position' | awk '{gsub("position ", "");print}')
DURATION=$(echo "$CMUSDATA" | grep -w '^duration' | awk '{gsub("duration ", "");print}')
STATUS=$(echo "$CMUSDATA" | grep -w '^status' | awk '{gsub("status ", "");print}')
SHUFFLE=$(echo "$CMUSDATA" | grep -w '^set shuffle' | awk '{gsub("set shuffle ", "");print}')
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$STATUS" = "playing" ]; then
STATUS="▶"
else
STATUS="⏸"
fi
if [ "$SHUFFLE" = "true" ]; then
SHUFFLE=" 🔀"
else
SHUFFLE=""
fi
else
if [ "$STATUS" = "playing" ]; then
STATUS="PLA"
else
STATUS="PAU"
fi
if [ "$SHUFFLE" = "true" ]; then
SHUFFLE=" S"
else
SHUFFLE=""
fi
fi
printf "%s%s %s - %s " "$SEP1" "$STATUS" "$ARTIST" "$TRACK"
printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60))
printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
printf "%s%s\n" "$SHUFFLE" "$SEP2"
fi
}
dwm_cmus

View File

@@ -0,0 +1,42 @@
#!/bin/sh
# A dwm_bar function to show the current network connection/SSID, Wifi Strength, private IP using Connmanctl.
# procrastimax <heykeroth.dev@gmail.com>
# GNU GPLv3
# Dependencies: connman
dwm_connman () {
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "🌐 "
else
printf "NET "
fi
# get the connmanctl service name
# this is a UID starting with 'vpn_', 'wifi_', or 'ethernet_', we dont care for the vpn one
# if the servicename string is empty, there is no online connection
SERVICENAME=$(connmanctl services | grep -E "^\*AO|^\*O" | grep -Eo 'wifi_.*|ethernet_.*')
if [ ! "$SERVICENAME" ]; then
printf "OFFLINE"
printf "%s\n" "$SEP2"
return
else
STRENGTH=$(connmanctl services "$SERVICENAME" | sed -n -e 's/Strength =//p' | tr -d ' ')
CONNAME=$(connmanctl services "$SERVICENAME" | sed -n -e 's/Name =//p' | tr -d ' ')
IP=$(connmanctl services "$SERVICENAME" | grep 'IPv4 =' | awk '{print $5}' | sed -n -e 's/Address=//p' | tr -d ',')
fi
# if STRENGTH is empty, we have a wired connection
if [ "$STRENGTH" ]; then
printf "%s %s %s%%" "$IP" "$CONNAME" "$STRENGTH"
else
printf "%s %s" "$IP" "$CONNAME"
fi
printf "%s\n" "$SEP2"
}
dwm_connman

View File

@@ -0,0 +1,25 @@
#!/bin/sh
# A dwm_status function that displays the status of countdown.sh
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: https://github.com/joestandring/countdown
dwm_countdown () {
for f in /tmp/countdown.*; do
if [ -e "$f" ]; then
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "⏳ %s" "$(tail -1 /tmp/countdown.*)"
else
printf "CDN %s" "$(tail -1 /tmp/countdown.*)"
fi
printf "%s\n" "$SEP2"
break
fi
done
}
dwm_countdown

View File

@@ -0,0 +1,23 @@
#!/bin/sh
# A dwm_bar function to print the rate of CURRENCY/USD from rate.sx using rate.sx/1CURRENCY
# Creator of the project: Joe Standring <git@joestandring.com>
# Additional plugin added by Brayan de Albuquerque <brayandealbuquerque@gmail.com>
# GNU GPLv3
# Dependencies: curl
# Change the value of CURRENCY to match your currency code
dwm_currency() {
CURRENCY=EUR
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "%s" "$(curl -s rate.sx/1$CURRENCY)"
else
printf "%s %.5s" "$CURRENCY" "$(curl -s rate.sx/1$CURRENCY)"
fi
printf "%s\n" "$SEP2"
}
dwm_currency

View File

@@ -0,0 +1,18 @@
#!/bin/sh
# A dwm_bar function that shows the current date and time
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Date is formatted like like this: "[Mon 01-01-00 00:00:00]"
dwm_date () {
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "📆 %s" "$(date "+%a %d-%m-%y %T")"
else
printf "DAT %s" "$(date "+%a %d-%m-%y %T")"
fi
printf "%s\n" "$SEP2"
}
dwm_date

View File

@@ -0,0 +1,19 @@
#!/bin/sh
# A dwm_bar function that displays the current keyboard layout
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: xorg-setxkbmap
dwm_keyboard () {
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "⌨ %s" "$(setxkbmap -query | awk '/layout/{print $2}')"
else
printf "KEY %s" "$(setxkbmap -query | awk '/layout/{print $2}')"
fi
printf "%s\n" "$SEP2"
}
dwm_keyboard

View File

@@ -0,0 +1,26 @@
#!/bin/sh
# A dwm_bar function to read the average system load
# Alvar Penning <post@0x21.biz>
# GNU GPLv3
dwm_loadavg () {
# LOAD_FIELDS specifies the load average values to be displayed. Values
# within 1-3 are allowed, passed as a range (-) or comma-separated.
# - 1: load average within the last minute
# - 2: load average within the last five minutes
# - 3: load average within the last fifteen minutes
LOAD_FIELDS=1,2,3
LOAD_AVG=$(cut -d " " -f ${LOAD_FIELDS} /proc/loadavg)
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "⏱ %s" "$LOAD_AVG"
else
printf "AVG %s" "$LOAD_AVG"
fi
printf "%s\n" "$SEP2"
}
dwm_loadavg

View File

@@ -0,0 +1,25 @@
#!/bin/sh
# A dwm_bar function to display the number of emails in an inbox
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# To count mail in an inbox, change "/path/to/inbox" below to the location of your inbox. For example, "/home/$USER/.mail/new"
dwm_mail () {
MAILBOX=$(ls /path/to/inbox | wc -l)
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$MAILBOX" -eq 0 ]; then
printf "📪 %s" "$MAILBOX"
else
printf "📫 %s" "$MAILBOX"
fi
else
printf "MAI %s" "$MAILBOX"
fi
printf "%s\n" "$SEP2"
}
dwm_mail

View File

@@ -0,0 +1,48 @@
#!/bin/sh
# A dwm_bar function that shows the current artist, track, position, duration, and status from mpc
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: mpc
dwm_mpc () {
if ps -C mpd > /dev/null; then
ARTIST=$(mpc current -f %artist%)
TRACK=$(mpc current -f %title%)
POSITION=$(mpc status | grep "%)" | awk '{ print $3 }' | awk -F/ '{ print $1 }')
DURATION=$(mpc current -f %time%)
STATUS=$(mpc status | sed -n 2p | awk '{print $1;}')
SHUFFLE=$(mpc status | tail -n 1 | awk '{print $6}')
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$STATUS" = "[playing]" ]; then
STATUS="▶"
else
STATUS="⏸"
fi
if [ "$SHUFFLE" = "on" ]; then
SHUFFLE=" 🔀"
else
SHUFFLE=""
fi
else
if [ "$STATUS" = "[playing]" ]; then
STATUS="PLA"
else
STATUS="PAU"
fi
if [ "$SHUFFLE" = "on" ]; then
SHUFFLE=" S"
else
SHUFFLE=""
fi
fi
printf "%s%s %s - %s %s/%s%s%s" "$SEP1" "$STATUS" "$ARTIST" "$TRACK" "$POSITION" "$DURATION" "$SHUFFLE" "$SEP2"
fi
}
dwm_mpc

View File

@@ -0,0 +1,65 @@
#!/bin/sh
# A dwm_bar function to show the speed of download and upload.
# Johan Chane <johanchanex@gmail.com>
# GNU GPLv3
# Dependencies:
# This function parses /proc/net/dev file searching for a line containing $interface data.
# Within that line, the first and ninth numbers after ':' are respectively the received and transmited bytes.
# parameters: name_of_received_bytes, name_of_transmitted_bytes
function get_bytes {
# Find active network interface
#interface=$(ip route get 8.8.8.8 2>/dev/null | grep 'dev \S\+' -o | awk '{print $2}')
local interface=$(route | grep '^default' | grep -o '[^ ]*$')
local bytes_concat_args=$(grep ${interface:-lo} /proc/net/dev | cut -d ':' -f 2 | awk -v rb="$1" -v tb="$2" '{print rb"="$1, tb"="$9}')
eval $bytes_concat_args
}
# Function which calculates the speed using actual and old byte number.
# Speed is shown in KByte per second when greater or equal than 1 KByte per second.
# This function should be called each second.
# parameters: value, old_value, now, old_time
function get_velocity {
local timediff=$(($3 - $4))
local vel_kb=$(echo "1000000000 * ($1 - $2) / 1024 / $timediff" | bc)
if test "$vel_kb" -gt 1024; then
echo $(echo "scale = 2; $vel_kb / 1024" | bc)MB/s
else
echo ${vel_kb}KB/s
fi
}
function dwm_network_speed_record {
get_bytes 'received_bytes' 'transmitted_bytes'
old_received_bytes=$received_bytes
old_transmitted_bytes=$transmitted_bytes
old_time=$(date +%s%N)
}
function download_speed {
get_velocity $received_bytes $old_received_bytes $now $old_time
}
function upload_speed {
get_velocity $transmitted_bytes $old_transmitted_bytes $now $old_time
}
# The greater interval ($now - $old_time) is, the be exacter the speed is.
function dwm_network_speed {
get_bytes 'received_bytes' 'transmitted_bytes'
now=$(date +%s%N)
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "李 %s %s" "$(download_speed)" "$(upload_speed)"
else
printf "Net %s %s" "$(download_speed)" "$(upload_speed)"
fi
printf "%s\n" "$SEP2"
}
dwm_network_speed_record
dwm_network_speed

View File

@@ -0,0 +1,25 @@
#!/bin/sh
# A dwm_bar function to show the current network connection/SSID, private IP, and public IP using NetworkManager
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: NetworkManager, curl
dwm_networkmanager () {
CONNAME=$(nmcli -a | grep 'Wired connection' | awk 'NR==1{print $1}')
if [ "$CONNAME" = "" ]; then
CONNAME=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -c 5-)
fi
PRIVATE=$(nmcli -a | grep 'inet4 192' | awk '{print $2}')
PUBLIC=$(curl -s https://ipinfo.io/ip)
if [ "$IDENTIFIER" = "unicode" ]; then
export __DWM_BAR_NETWORKMANAGER__="${SEP1}🌐 ${CONNAME} ${PRIVATE} ${PUBLIC}${SEP2}"
else
export __DWM_BAR_NETWORKMANAGER__="${SEP1}NET ${CONNAME} ${PRIVATE} ${PUBLIC}${SEP2}"
fi
}
dwm_networkmanager

View File

@@ -0,0 +1,38 @@
#!/bin/sh
# A dwm_bar function to show the master volume of PulseAudio
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: pamixer
dwm_pulse () {
VOL=$(pamixer --get-volume)
STATE=$(pamixer --get-mute)
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$STATE" = "true" ] || [ "$VOL" -eq 0 ]; then
printf "🔇"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "🔈 %s%%" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "🔉 %s%%" "$VOL"
else
printf "🔊 %s%%" "$VOL"
fi
else
if [ "$STATE" = "true" ] || [ "$VOL" -eq 0 ]; then
printf "MUTE"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "VOL %s%%" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "VOL %s%%" "$VOL"
else
printf "VOL %s%%" "$VOL"
fi
fi
printf "%s\n" "$SEP2"
}
dwm_pulse

View File

@@ -0,0 +1,33 @@
#!/bin/sh
# A dwm_bar function to display information regarding system memory, CPU temperature, and storage
# Joe Standring <git@joestandring.com>
# GNU GPLv3
df_check_location='/home'
dwm_resources () {
# get all the infos first to avoid high resources usage
free_output=$(free -h | grep Mem)
df_output=$(df -h $df_check_location | tail -n 1)
# Used and total memory
MEMUSED=$(echo $free_output | awk '{print $3}')
MEMTOT=$(echo $free_output | awk '{print $2}')
# CPU temperature
CPU=$(top -bn1 | grep Cpu | awk '{print $2}')%
#CPU=$(sysctl -n hw.sensors.cpu0.temp0 | cut -d. -f1)
# Used and total storage in /home (rounded to 1024B)
STOUSED=$(echo $df_output | awk '{print $3}')
STOTOT=$(echo $df_output | awk '{print $2}')
STOPER=$(echo $df_output | awk '{print $5}')
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "💻 MEM %s/%s CPU %s STO %s/%s: %s" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER"
else
printf "STA | MEM %s/%s CPU %s STO %s/%s: %s" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER"
fi
printf "%s\n" "$SEP2"
}
dwm_resources

View File

@@ -0,0 +1,55 @@
#!/bin/bash
# This module can get data from a SMA Inverter.
# Its purpose is to show you how much Watts are being produced
# To make it work change the INVERTER_IP variable and your User password
# Vincenzo Petrolo <vincenzo.petrolo99@gmail.com>
# For infos on how i made it, and help or bugs, you cant contact me or
# open an issue
# GNU GPLv3
# P.s: Be careful when trying to modify urls, as they contains special
# characters that may change the behaviour of the query
dwm_solar_panel () {
INVERTER_IP="YOUR INVERTER IP"
PASSWORD="YOUR PASSWORD"
if [[ -f ~/.cache/solar_panel.cache ]];
then
read SID < ~/.cache/solar_panel.cache
if [ "$SID" == "null" ];
then
#Getting session id
SID=$( curl -s --location --request POST "http://$INVERTER_IP/dyn/login.json" \
--header 'Content-Type: text/plain' \
--data-raw "{\"right\":\"usr\",\"pass\":\""$PASSWORD\""}" | jq .result.sid)
SID=${SID//\"}
fi
#checks if it got a session token
if [ "$SID" != "" ] && [ "$SID" != "null" ];
then
echo $SID > ~/.cache/solar_panel.cache
WATTS=$(curl -s --location --request POST "http://$INVERTER_IP/dyn/getValues.json?sid=$SID" \
--header 'Content-Type: text/plain' \
--data-raw '{"destDev":[],"keys":["6100_00543100","6800_008AA200","6100_40263F00","6800_00832A00","6180_08214800","6180_08414900","6180_08522F00","6400_00543A00","6400_00260100","6800_08811F00","6400_00462E00"]}' | jq '.result."0156-76BC3EC6"."6100_40263F00"."1"[0].val')
if [ "$WATTS" == "" ] || [ "$WATTS" == "null" ];
then
echo "null" > ~/.cache/solar_panel.cache
else
printf "%s💡 $WATTS W %s" "$SEP1" "$SEP2"
fi
fi
else
touch ~/.cache/solar_panel.cache
echo "null" > ~/.cache/solar_panel.cache
fi
}
dwm_solar_panel

View File

@@ -0,0 +1,65 @@
#!/bin/sh
# A dwm_bar function that shows the current artist, track, duration, and status from Spotify using playerctl
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: spotify/spotifyd, playerctl
# NOTE: The official spotify client does not provide the track position or shuffle status through playerctl. This does work through spotifyd however.
dwm_spotify () {
if ps -C spotify > /dev/null; then
PLAYER="spotify"
elif ps -C spotifyd > /dev/null; then
PLAYER="spotifyd"
fi
if [ "$PLAYER" = "spotify" ] || [ "$PLAYER" = "spotifyd" ]; then
ARTIST=$(playerctl metadata artist)
TRACK=$(playerctl metadata title)
POSITION=$(playerctl position | sed 's/..\{6\}$//')
DURATION=$(playerctl metadata mpris:length | sed 's/.\{6\}$//')
STATUS=$(playerctl status)
SHUFFLE=$(playerctl shuffle)
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$STATUS" = "Playing" ]; then
STATUS="▶"
else
STATUS="⏸"
fi
if [ "$SHUFFLE" = "On" ]; then
SHUFFLE=" 🔀"
else
SHUFFLE=""
fi
else
if [ "$STATUS" = "Playing" ]; then
STATUS="PLA"
else
STATUS="PAU"
fi
if [ "$SHUFFLE" = "On" ]; then
SHUFFLE=" S"
else
SHUFFLE=""
fi
fi
if [ "$PLAYER" = "spotify" ]; then
printf "%s%s %s - %s " "$SEP1" "$STATUS" "$ARTIST" "$TRACK"
printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
printf "%s\n" "$SEP2"
else
printf "%s%s %s - %s " "$SEP1" "$STATUS" "$ARTIST" "$TRACK"
printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60))
printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
printf "%s%s\n" "$SHUFFLE" "$SEP2"
fi
fi
}
dwm_spotify

View File

@@ -0,0 +1,50 @@
#!/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
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
case "$STATUS" in
"Idle")
printf "🛑 %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;;
"Seeding")
printf "🌱 %s | ⬆%s ⬇%s" "$NAME" "$UP" "$DOWN"
;;
"Downloading")
printf "⏬ %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;;
esac
else
case "$STATUS" in
"Idle")
printf "IDLE %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;;
"Seeding")
printf "SEEDING %s | ⬆%s ⬇%s" "$NAME" "$UP" "$DOWN"
;;
"Downloading")
printf "DOWNLOADING %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;;
esac
fi
printf "%s\n" "$SEP2"
fi
}
dwm_transmission

View File

@@ -0,0 +1,28 @@
#!/bin/sh
# A dwm_bar function to show VPN connections with OpenVPN or WireGuard (if any are active)
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: NetworkManager, NetworkManager-openvpn (for OpenVPN connections)
dwm_vpn () {
VPN=$(nmcli -a | grep 'VPN connection' | sed -e 's/\( VPN connection\)*$//g')
if [ "$VPN" = "" ]; then
VPN=$(nmcli connection | grep 'wireguard' | sed 's/\s.*$//')
fi
if [ "$VPN" != "" ]; then
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "🔒 %s" "$VPN"
else
printf "VPN %s" "$VPN"
fi
printf "%s\n" "$SEP2"
fi
}
dwm_vpn

View File

@@ -0,0 +1,22 @@
#!/bin/sh
# A dwm_bar function to print the weather from wttr.in
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: curl
# Change the value of LOCATION to match your city
dwm_weather() {
LOCATION=London
if [ "$IDENTIFIER" = "unicode" ]; then
DATA=$(curl -s wttr.in/$LOCATION?format=1)
export __DWM_BAR_WEATHER__="${SEP1} ${DATA} ${SEP2}"
else
DATA=$(curl -s wttr.in/$LOCATION?format=1 | grep -o ".[0-9].*")
export __DWM_BAR_WEATHER__="${SEP1} WEA ${DATA} ${SEP2}"
fi
}
dwm_weather

View File

@@ -0,0 +1,82 @@
#!/bin/sh
# Dependancies: wpa_cli
dwm_wpa() {
CONSTATE=$(wpa_cli status | sed -n '/wpa_state/s/^.*=//p')
case $CONSTATE in
'COMPLETED')
CONSSID=$(wpa_cli status | sed -n '/\<ssid\>/s/^.*=//p')
CONIP=$(wpa_cli status | sed -n '/ip_address/s/^.*=//p')
CONRSSI=$(wpa_cli signal_poll | sed -n '/AVG_RSSI/s/^.*=//p')
if [ "$CONRSSI" -gt -35 ]; then
printf "%s" "$SEP1"
printf "\uF927 %s %s" "$CONSSID" "$CONIP"
printf "%s\n" "$SEP2"
elif [ "$CONRSSI" -ge -55 ] && [ "$CONRSSI" -lt -35 ]; then
printf "%s" "$SEP1"
printf "\uF924 %s %s" "$CONSSID" "$CONIP"
printf "%s\n" "$SEP2"
elif [ "$CONRSSI" -ge -75 ] && [ "$CONRSSI" -lt -55 ]; then
printf "%s" "$SEP1"
printf "\uF921 %s %s" "$CONSSID" "$CONIP"
printf "%s\n" "$SEP2"
else
printf "%s" "$SEP1"
printf "\uF91E %s %s" "$CONSSID" "$CONIP"
printf "%s\n" "$SEP2"
fi
;;
#======================================================================#
'DISCONNECTED')
printf "%s" "$SEP1"
printf "\uF92D %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'INTERFACE_DISABLED')
printf "%s" "$SEP1"
printf "\uF92D %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
#======================================================================#
'SCANNING')
printf "%s" "$SEP1"
printf "\uF92A %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'ASSOCIATING')
printf "%s" "$SEP1"
printf "\uF92A %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'ASSOCIATED')
printf "%s" "$SEP1"
printf "\uF92A %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'AUTHENTICATING')
printf "%s" "$SEP1"
printf "\uF92A %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
#======================================================================#
'4WAY_HANDSHAKE')
printf "%s" "$SEP1"
printf "\uF92B %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'GROUP_HANDSHAKE')
printf "%s" "$SEP1"
printf "\uF92B %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'INACTIVE')
printf "%s" "$SEP1"
printf "\uF92B %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
esac
}
dwm_wpa