summaryrefslogtreecommitdiff
path: root/ar/.local/bin/statusbar
diff options
context:
space:
mode:
Diffstat (limited to 'ar/.local/bin/statusbar')
-rwxr-xr-xar/.local/bin/statusbar/sb-brightness28
-rwxr-xr-xar/.local/bin/statusbar/sb-cpu2
-rwxr-xr-xar/.local/bin/statusbar/sb-forecast7
-rwxr-xr-xar/.local/bin/statusbar/sb-internet7
-rwxr-xr-xar/.local/bin/statusbar/sb-keyboard4
-rwxr-xr-xar/.local/bin/statusbar/sb-mailbox2
-rwxr-xr-xar/.local/bin/statusbar/sb-memory9
-rwxr-xr-xar/.local/bin/statusbar/sb-mpdup2
-rwxr-xr-xar/.local/bin/statusbar/sb-packages2
-rwxr-xr-xar/.local/bin/statusbar/sb-popupgrade2
-rwxr-xr-xar/.local/bin/statusbar/sb-price6
-rwxr-xr-xar/.local/bin/statusbar/sb-queues2
-rwxr-xr-xar/.local/bin/statusbar/sb-volume2
13 files changed, 51 insertions, 24 deletions
diff --git a/ar/.local/bin/statusbar/sb-brightness b/ar/.local/bin/statusbar/sb-brightness
index 909e676..e18fa2c 100755
--- a/ar/.local/bin/statusbar/sb-brightness
+++ b/ar/.local/bin/statusbar/sb-brightness
@@ -1,11 +1,31 @@
#!/bin/sh
+monitor=$(xrandr --query | grep -i '\sconnected' | grep '[0-9]x[0-9]' | grep -i 'primary' | cut -d ' ' -f1)
+[ -z "$monitor" ] && monitor=$(xrandr --query | grep -i '\sconnected' | grep '[0-9]x[0-9]' | cut -d ' ' -f1)
+case "$monitor" in
+*DP* | *HDMI*)
+ current_brightness=$(xrandr --verbose | grep -i "^$monitor connected" -A5 | grep -i "Brightness:" | cut -d ' ' -f2)
+ current_brightness=$(printf "%.0f\n" "$(echo "$current_brightness * 100" | bc -l)")
+ ;;
+esac
+
case $BLOCK_BUTTON in
3) notify-send "šŸ”† Backlight module
-- Scroll up & down changes backlight" ;;
-4) monbright -inc 5 ;;
-5) monbright -dec 5 ;;
+- Scroll up & down changes screen brightness
+- Shift + Scroll up & down changes monitor backlight" ;;
+4) pkexec brillo -A 5 -q ;;
+5) pkexec brillo -U 5 -q ;;
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
+7) monbright -inc 5 ;;
+8) monbright -dec 5 ;;
+9) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
-monitorbright
+if [ -r /sys/class/backlight/*/brightness ]; then
+ curr_brightness=$(cat /sys/class/backlight/*/brightness)
+ max_brightness=$(cat /sys/class/backlight/*/max_brightness)
+ brightness_per=$((100 * curr_brightness / max_brightness))
+ printf "%s %s\n" "šŸ’”${brightness_per}%" "🪟$current_brightness"
+else
+ printf "%s\n" "🪟$current_brightness"
+fi
diff --git a/ar/.local/bin/statusbar/sb-cpu b/ar/.local/bin/statusbar/sb-cpu
index 0cb6f4f..753542f 100755
--- a/ar/.local/bin/statusbar/sb-cpu
+++ b/ar/.local/bin/statusbar/sb-cpu
@@ -3,7 +3,7 @@
case $BLOCK_BUTTON in
1) notify-send "šŸ–„ CPU hogs" "$(ps axch -o cmd,%cpu | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' | sort -nrk2 | head)\\n(100% per core)" ;;
2) setsid -f "$TERMINAL" -e htop ;;
-3) notify-send "šŸ–„ CPU module " "\- Shows CPU temperature
+3) notify-send "🧁 CPU module " "\- Shows CPU temperature
- Left click to show intensive processes
- Middle click to open htop" ;;
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
diff --git a/ar/.local/bin/statusbar/sb-forecast b/ar/.local/bin/statusbar/sb-forecast
index 4f78303..65bcd1a 100755
--- a/ar/.local/bin/statusbar/sb-forecast
+++ b/ar/.local/bin/statusbar/sb-forecast
@@ -11,7 +11,8 @@ weatherreportjson="${XDG_CACHE_HOME:-${HOME}/.cache}/weatherreport.json"
error() {
rm -f "$weatherreport" "$weatherreportjson"
- notify-send -u critical "ā›” Failed to update 'weather$1'"
+ notify-send "ā›” Failed to update 'weather$1'"
+ echo "ā“"
exit 1
}
@@ -360,6 +361,6 @@ After $secs seconds, new clicks will also automatically update the doppler RADAR
8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
-checkforecast "$weatherreport" "3600" || { getweatherreport && pkill -RTMIN+15 "${STATUSBAR:-dwmblocks}" && sleep 3; }
-checkforecast "$weatherreportjson" "86400" || { getweatherreportjson && pkill -RTMIN+15 "${STATUSBAR:-dwmblocks}" && sleep 3; }
+checkforecast "$weatherreport" "3600" || { getweatherreport && pkill -RTMIN+13 "${STATUSBAR:-dwmblocks}" && sleep 3; }
+checkforecast "$weatherreportjson" "86400" || { getweatherreportjson && pkill -RTMIN+13 "${STATUSBAR:-dwmblocks}" && sleep 3; }
showweather
diff --git a/ar/.local/bin/statusbar/sb-internet b/ar/.local/bin/statusbar/sb-internet
index 1484f33..eeab61a 100755
--- a/ar/.local/bin/statusbar/sb-internet
+++ b/ar/.local/bin/statusbar/sb-internet
@@ -26,7 +26,7 @@ fi
case $BLOCK_BUTTON in
1)
"$TERMINAL" -e nmtui
- pkill -RTMIN+7 dwmblocks
+ pkill -RTMIN+6 dwmblocks
;;
2)
wifi_dev="$(nmcli -t -f DEVICE,TYPE device |
@@ -43,9 +43,10 @@ case $BLOCK_BUTTON in
notify-send "Wi-Fi" "Wi-Fi connected"
fi
- pkill -RTMIN+7 dwmblocks
+ pkill -RTMIN+6 dwmblocks
;;
3) notify-send "🌐 Internet module" "\- Left click to connect
+- Middle click to toggle wifi
āŒ: wifi disabled
šŸ“”: no wifi connection
šŸ›œ: wifi connection with quality
@@ -71,7 +72,7 @@ fi
grep -q 'up' /sys/class/net/e*/operstate && ethericon="🌐" || ethericon="āŽ"
# TUN
-grep -q 'up' /sys/class/net/tun*/operstate 2>/dev/null && tunicon="šŸ›°"
+[ -n "$(cat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon="šŸ›°"
icons=""
[ -n "$wifiicon" ] && icons="${icons}$wifiicon "
diff --git a/ar/.local/bin/statusbar/sb-keyboard b/ar/.local/bin/statusbar/sb-keyboard
index 67b5f6d..2257b1b 100755
--- a/ar/.local/bin/statusbar/sb-keyboard
+++ b/ar/.local/bin/statusbar/sb-keyboard
@@ -3,7 +3,7 @@
# works on any init system
# requirements: dmenu, xorg-setxkbmap
case $BLOCK_BUTTON in
-1) fcitx5-remote -t && kill -44 "$(pidof "${STATUSBAR:-dwmblocks}")" ;;
+1) fcitx5-remote -t && kill -43 "$(pidof "${STATUSBAR:-dwmblocks}")" ;;
2) remaps ;;
3) notify-send "⌨ Input Method module" "\- Shows current input method (defalt US)
- Left click to switch language (EN/KO)
@@ -14,7 +14,7 @@ case $BLOCK_BUTTON in
[ -z "$kb_choice" ] && exit 0
kb="$(echo "$kb_choice" | awk '{print $3}')"
setxkbmap "$kb"
- pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}"
+ pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
;;
esac
diff --git a/ar/.local/bin/statusbar/sb-mailbox b/ar/.local/bin/statusbar/sb-mailbox
index c772a0d..6926b6e 100755
--- a/ar/.local/bin/statusbar/sb-mailbox
+++ b/ar/.local/bin/statusbar/sb-mailbox
@@ -6,7 +6,7 @@
case $BLOCK_BUTTON in
1)
setsid -w -f "$TERMINAL" -e neomutt
- pkill -RTMIN+20 "${STATUSBAR:-dwmblocks}"
+ pkill -RTMIN+18 "${STATUSBAR:-dwmblocks}"
;;
2) setsid -f mw -Y >/dev/null ;;
3) notify-send "šŸ“¬ Mail module" "\- Shows unread mail
diff --git a/ar/.local/bin/statusbar/sb-memory b/ar/.local/bin/statusbar/sb-memory
index 01eb0e6..3b71f3c 100755
--- a/ar/.local/bin/statusbar/sb-memory
+++ b/ar/.local/bin/statusbar/sb-memory
@@ -3,9 +3,10 @@
case $BLOCK_BUTTON in
1) notify-send "šŸ Memory hogs" "$(ps axch -o cmd,%mem | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' | sort -nrk2 | head)" ;;
2) setsid -f "$TERMINAL" -e htop ;;
-3) notify-send "šŸ Memory module" "\- Shows Memory used/total
+3) notify-send "šŸ Memory module" "\- Shows Memory temperature and used/total
- Left click to show memory hogs
-- Middle click to open htop" ;;
+- Middle click to open htop
+šŸŒ”ļø: Memory temperature" ;;
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
@@ -16,9 +17,9 @@ nvme_temp=$(sensors 2>/dev/null |
if [ -n "$width" ] && [ "$width" -eq "$width" ] 2>/dev/null; then
if [ "$width" -lt 1920 ]; then
free --mebi | sed -n '2{p;q}' |
- awk -v t="$nvme_temp" '{printf "šŸ’¾%s° šŸ%d%%\n", t, ($3/$2)*100+0.5}'
+ awk -v t="$nvme_temp" '{printf "🌔%s° šŸ%d%%\n", t, ($3/$2)*100+0.5}'
else
free --mebi | sed -n '2{p;q}' |
- awk -v t="$nvme_temp" '{printf "šŸ’¾%s° šŸ%dGB/%dGB", t, $3/1000+0.5, $2/1000+0.5}'
+ awk -v t="$nvme_temp" '{printf "🌔%s° šŸ%dGB/%dGB", t, $3/1000+0.5, $2/1000+0.5}'
fi
fi
diff --git a/ar/.local/bin/statusbar/sb-mpdup b/ar/.local/bin/statusbar/sb-mpdup
index 90e9c7e..fa9b61b 100755
--- a/ar/.local/bin/statusbar/sb-mpdup
+++ b/ar/.local/bin/statusbar/sb-mpdup
@@ -4,5 +4,5 @@
# music player's status. mpd must be running on X's start for this to work.
while :; do
- mpc idle >/dev/null && kill -57 "$(pidof "${STATUSBAR:-dwmblocks}")" || break
+ mpc idle >/dev/null && kill -55 "$(pidof "${STATUSBAR:-dwmblocks}")" || break
done
diff --git a/ar/.local/bin/statusbar/sb-packages b/ar/.local/bin/statusbar/sb-packages
index 5955c75..467bfb3 100755
--- a/ar/.local/bin/statusbar/sb-packages
+++ b/ar/.local/bin/statusbar/sb-packages
@@ -15,7 +15,7 @@
# [Action]
# Description = Updating statusbar...
# When = PostTransaction
-# Exec = /usr/bin/pkill -RTMIN+16 dwmblocks # Or i3blocks if using i3.
+# Exec = /usr/bin/pkill -RTMIN+14 dwmblocks # Or i3blocks if using i3.
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e sb-popupgrade && remaps ;;
diff --git a/ar/.local/bin/statusbar/sb-popupgrade b/ar/.local/bin/statusbar/sb-popupgrade
index 14036eb..221c7db 100755
--- a/ar/.local/bin/statusbar/sb-popupgrade
+++ b/ar/.local/bin/statusbar/sb-popupgrade
@@ -3,7 +3,7 @@
printf "Beginning upgrade\\n"
yay -Syu
-pkill -RTMIN+16 "${STATUSBAR:-dwmblocks}"
+pkill -RTMIN+14 "${STATUSBAR:-dwmblocks}"
printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
read -r _
diff --git a/ar/.local/bin/statusbar/sb-price b/ar/.local/bin/statusbar/sb-price
index 84d86b6..70703f8 100755
--- a/ar/.local/bin/statusbar/sb-price
+++ b/ar/.local/bin/statusbar/sb-price
@@ -64,4 +64,8 @@ esac
notify-send "$icon Update complete" "$name price is now
\$$(cat "$pricefile")"
-[ -f "$pricefile" ] && printf "%s%s%0.2f" "$icon" "$symb" "$(cat "$pricefile")"
+[ -f "$pricefile" ] && {
+ price=$(cat "$pricefile")
+ formatted_price=$(printf "%0.2f" "$price" | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta')
+ printf "%s%s%s" "$icon" "$symb" "$formatted_price"
+}
diff --git a/ar/.local/bin/statusbar/sb-queues b/ar/.local/bin/statusbar/sb-queues
index 40445f8..477fa7f 100755
--- a/ar/.local/bin/statusbar/sb-queues
+++ b/ar/.local/bin/statusbar/sb-queues
@@ -18,7 +18,7 @@ EOF
if [ -z "$url" ]; then
notify-send "šŸ’¤ No active yt-dlp downloads"
fi
- pkill -RTMIN+21 "${STATUSBAR:-dwmblocks}"
+ pkill -RTMIN+19 "${STATUSBAR:-dwmblocks}"
}
# This block displays the number of running and queued background tasks. Requires tsp.
diff --git a/ar/.local/bin/statusbar/sb-volume b/ar/.local/bin/statusbar/sb-volume
index 7881bfd..291e78d 100755
--- a/ar/.local/bin/statusbar/sb-volume
+++ b/ar/.local/bin/statusbar/sb-volume
@@ -5,7 +5,7 @@
case $BLOCK_BUTTON in
1)
setsid -w -f "$TERMINAL" -e pulsemixer
- pkill -RTMIN+5 "${STATUSBAR:-dwmblocks}"
+ pkill -RTMIN+4 "${STATUSBAR:-dwmblocks}"
;;
2) wpctl set-mute @DEFAULT_SINK@ toggle ;;
3) notify-send "šŸ“¢ Volume module" "\- Shows volume šŸ”Š, šŸ”‡ if muted