@ -1,34 +0,0 @@ | |||
#!/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 () { | |||
VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/") | |||
if [ "$IDENTIFIER" = "unicode" ]; then | |||
if [ "$VOL" -eq 0 ]; then | |||
printf "[🔇 %s]\n" "$VOL]\n" | |||
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then | |||
printf "[🔈 %s]\n" "$VOL" | |||
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then | |||
printf "[🔉 %s]\n" "$VOL" | |||
else | |||
printf "[🔊 %s]\n" "$VOL" | |||
fi | |||
else | |||
if [ "$VOL" -eq 0 ]; then | |||
printf "[VOL %s]\n" "$VOL]\n" | |||
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then | |||
printf "[VOL %s]\n" "$VOL" | |||
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then | |||
printf "[VOL %s]\n" "$VOL" | |||
else | |||
printf "[VOL %s]\n" "$VOL" | |||
fi | |||
fi | |||
} | |||
dwm_alsa |
@ -1,51 +0,0 @@ | |||
#!/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 | |||
ARTIST=$(cmus-remote -Q | grep -a '^tag artist' | awk '{gsub("tag artist ", "");print}') | |||
TRACK=$(cmus-remote -Q | grep -a '^tag title' | awk '{gsub("tag title ", "");print}') | |||
POSITION=$(cmus-remote -Q | grep -a '^position' | awk '{gsub("position ", "");print}') | |||
DURATION=$(cmus-remote -Q | grep -a '^duration' | awk '{gsub("duration ", "");print}') | |||
STATUS=$(cmus-remote -Q | grep -a '^status' | awk '{gsub("status ", "");print}') | |||
SHUFFLE=$(cmus-remote -Q | grep -a '^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 " "$STATUS" "$ARTIST" "$TRACK" | |||
printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60)) | |||
printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60)) | |||
printf "%s]\n" "$SHUFFLE" | |||
fi | |||
} | |||
dwm_cmus |
@ -1,23 +0,0 @@ | |||
#!/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 | |||
if [ "$IDENTIFIER" = "unicode" ]; then | |||
printf "[⏳ %s]\n" "$(tail -1 /tmp/countdown.*)" | |||
else | |||
printf "[CDN %s]\n" "$(tail -1 /tmp/countdown.*)" | |||
fi | |||
break | |||
fi | |||
done | |||
} | |||
dwm_countdown |
@ -1,16 +0,0 @@ | |||
#!/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 () { | |||
if [ "$IDENTIFIER" = "unicode" ]; then | |||
printf "[📆 %s]\n" "$(date "+%a %d-%m-%y %T")" | |||
else | |||
printf "[DAT %s]\n" "$(date "+%a %d-%m-%y %T")" | |||
fi | |||
} | |||
dwm_date |
@ -1,17 +0,0 @@ | |||
#!/bin/sh | |||
# A dwm_bar function that displays the current keyboard layout | |||
# Joe Standring <git@joestandring.com> | |||
# GNU GPLv3 | |||
# Dependencies: xorg-setxkbmap | |||
dwm_keyboard () { | |||
if [ "$IDENTIFIER" = "unicode" ]; then | |||
printf "[⌨ %s]\n" "$(setxkbmap -query | awk '/layout/{print $2}')" | |||
else | |||
printf "[KEY %s]\n" "$(setxkbmap -query | awk '/layout/{print $2}')" | |||
fi | |||
} | |||
dwm_keyboard |
@ -1,23 +0,0 @@ | |||
#!/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) | |||
if [ "$IDENTIFIER" = "unicode" ]; then | |||
if [ "$MAILBOX" -eq 0 ]; then | |||
printf "[📪 %s]\n" "$MAILBOX" | |||
else | |||
printf "[📫 %s]\n" "$MAILBOX" | |||
fi | |||
else | |||
printf "[MAI %s]\n" "$MAILBOX" | |||
fi | |||
} | |||
dwm_mail |
@ -1,34 +0,0 @@ | |||
#!/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) | |||
if [ "$IDENTIFIER" = "unicode" ]; then | |||
if [ "$VOL" -eq 0 ]; then | |||
printf "[🔇 %s]\n" "$VOL]\n" | |||
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then | |||
printf "[🔈 %s]\n" "$VOL" | |||
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then | |||
printf "[🔉 %s]\n" "$VOL" | |||
else | |||
printf "[🔊 %s]\n" "$VOL" | |||
fi | |||
else | |||
if [ "$VOL" -eq 0 ]; then | |||
printf "[VOL %s]\n" "$VOL]\n" | |||
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then | |||
printf "[VOL %s]\n" "$VOL" | |||
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then | |||
printf "[VOL %s]\n" "$VOL" | |||
else | |||
printf "[VOL %s]\n" "$VOL" | |||
fi | |||
fi | |||
} | |||
dwm_pulse |
@ -1,25 +0,0 @@ | |||
#!/bin/sh | |||
# A dwm_bar function to display information regarding system memory, CPU temperature, and storage | |||
# Joe Standring <git@joestandring.com> | |||
# GNU GPLv3 | |||
dwm_resources () { | |||
# Used and total memory | |||
MEMUSED=$(free -h | awk '(NR == 2) {print $3}') | |||
MEMTOT=$(free -h |awk '(NR == 2) {print $2}') | |||
# CPU temperature | |||
CPU=$(sysctl -n hw.sensors.cpu0.temp0 | cut -d. -f1) | |||
# Used and total storage in /home (rounded to 1024B) | |||
STOUSED=$(df -h | grep '/home$' | awk '{print $3}') | |||
STOTOT=$(df -h | grep '/home$' | awk '{print $2}') | |||
STOPER=$(df -h | grep '/home$' | awk '{print $5}') | |||
if [ "$IDENTIFIER" = "unicode" ]; then | |||
printf "[💻 MEM %s/%s CPU %s STO %s/%s: %s]\n" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER" | |||
else | |||
printf "[STA | MEM %s/%s CPU %s STO %s/%s: %s]\n" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER" | |||
fi | |||
} | |||
dwm_resources |
@ -1,19 +0,0 @@ | |||
#!/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=city | |||
if [ "$IDENTIFIER" = "unicode" ]; then | |||
printf "[%s]\n" "$(curl -s wttr.in/$LOCATION?format=1)" | |||
else | |||
printf "[WEA %s]\n" "$(curl -s wttr.in/$LOCATION?format=1 | grep -o "[0-9].*")" | |||
fi | |||
} | |||
dwm_weather |