summaryrefslogtreecommitdiff
path: root/users/ryan/linux/waybar
diff options
context:
space:
mode:
Diffstat (limited to 'users/ryan/linux/waybar')
-rw-r--r--users/ryan/linux/waybar/config112
-rwxr-xr-xusers/ryan/linux/waybar/modules/storage.sh77
-rw-r--r--users/ryan/linux/waybar/style.css2
3 files changed, 140 insertions, 51 deletions
diff --git a/users/ryan/linux/waybar/config b/users/ryan/linux/waybar/config
index 62e6b20..4459ce7 100644
--- a/users/ryan/linux/waybar/config
+++ b/users/ryan/linux/waybar/config
@@ -5,50 +5,69 @@
5 5
6 "modules-left": ["hyprland/workspaces", "hyprland/submap"], 6 "modules-left": ["hyprland/workspaces", "hyprland/submap"],
7 "modules-center": ["hyprland/window"], 7 "modules-center": ["hyprland/window"],
8 "modules-right": ["tray", "custom/spotify", "privacy", "custom/weather", "custom/mail", "custom/storage", "backlight", "bluetooth", "pulseaudio", "network", "idle_inhibitor", "battery", "battery#num2", "clock"], 8 "modules-right": ["tray", "privacy", "custom/weather", "custom/mail", "custom/storage", "backlight", "bluetooth", "pulseaudio", "network", "idle_inhibitor", "battery", "battery#num2", "clock"],
9
9 "hyprland/submap": { 10 "hyprland/submap": {
10 "format": " {}" 11 "format": " {}"
11 }, 12 },
13
12 "hyprland/workspaces": { 14 "hyprland/workspaces": {
13 "format": "{id}", 15 "format": "{id}",
14 "all-outputs": false, 16 "all-outputs": false,
15 "disable-scroll": true 17 "disable-scroll": true
16 }, 18 },
19
17 "hyprland/window": { 20 "hyprland/window": {
18 "max-length": 80, 21 "max-length": 80,
19 "tooltip": false, 22 "tooltip": false,
20 "separate-outputs": true 23 "separate-outputs": true
21 }, 24 },
25
22 "clock": { 26 "clock": {
23 "format": "{:%a %d %b %H:%M}", 27 "format": "{:%a %d %b %H:%M}",
24 "tooltip": false 28 "tooltip": false
25 }, 29 },
30
26 "battery": { 31 "battery": {
27 "format": "{capacity}% {icon}", 32 "format": "{capacity}% {icon}",
28 "format-alt": "{time} {icon}", 33 "format-alt": "{time} {icon}",
29 "format-icons": ["", "", "", "", ""], 34 "format-icons": [
30 "format-charging": "{capacity}% ", 35 "󰁺",
36 "󰁻",
37 "󰁼",
38 "󰁽",
39 "󰁹"
40 ],
41 "format-charging": "{capacity}% 󰂄",
31 "interval": 30, 42 "interval": 30,
32 "states": { 43 "states": {
33 "warning": 25, 44 "warning": 25,
34 "critical": 10 45 "critical": 10
35 }, 46 },
36 "tooltip": false, 47 "tooltip": false,
37 "bat":"BAT0" 48 "bat": "BAT0"
38 }, 49 },
50
39 "battery#num2": { 51 "battery#num2": {
40 "format": "{capacity}% {icon}", 52 "format": "{capacity}% {icon}",
41 "format-alt": "{time} {icon}", 53 "format-alt": "{time} {icon}",
42 "format-icons": ["", "", "", "", ""], 54 "format-icons": [
43 "format-charging": "{capacity}% ", 55 "󰁺",
56 "󰁻",
57 "󰁼",
58 "󰁽",
59 "󰁹"
60 ],
61 "format-charging": "{capacity}% 󰂄",
44 "interval": 30, 62 "interval": 30,
45 "states": { 63 "states": {
46 "warning": 25, 64 "warning": 25,
47 "critical": 10 65 "critical": 10
48 }, 66 },
49 "tooltip": false, 67 "tooltip": false,
50 "bat":"BAT1" 68 "bat": "BAT1"
51 }, 69 },
70
52 "bluetooth": { 71 "bluetooth": {
53 "format": "󰂯", 72 "format": "󰂯",
54 "format-disabled": "󰂲", 73 "format-disabled": "󰂲",
@@ -56,60 +75,75 @@
56 "format-connected-battery": "󰂱 {device_battery_percentage}%", 75 "format-connected-battery": "󰂱 {device_battery_percentage}%",
57 "on-click": "foot bluetui", 76 "on-click": "foot bluetui",
58 "tooltip-format": "{controller_alias}\t{controller_address}\n\n{num_connections} connected", 77 "tooltip-format": "{controller_alias}\t{controller_address}\n\n{num_connections} connected",
59 "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}", 78 "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}",
60 "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}", 79 "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}",
61 "tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}%" 80 "tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}%"
62 }, 81 },
82
63 "network": { 83 "network": {
64 "format-alt": "{ipaddr}/{cidr} {icon} {bandwidthTotalBytes}󰹹", 84 "format-alt": "{ipaddr}/{cidr} {icon} {bandwidthTotalBytes}󰹹",
65 "format": "{ipaddr}/{cidr} {icon}", 85 "format": "{ipaddr}/{cidr} {icon}",
66 "format-alt-click": "click-right", 86 "format-alt-click": "click-right",
67 "format-icons": { 87 "format-icons": {
68 "wifi": ["󰤟", "󰤢" ,"󰤥", "󰤨"], 88 "wifi": [
69 "ethernet": [""], 89 "󰤟",
70 "disconnected": ["󰤭"] 90 "󰤢",
91 "󰤥",
92 "󰤨"
93 ],
94 "ethernet": [
95 "󰈀"
96 ],
97 "disconnected": [
98 "󰤭"
99 ]
71 }, 100 },
72 "on-click": "foot -t alacritty doas nmtui", 101 "on-click": "foot -t alacritty doas nmtui",
73 "tooltip": false 102 "tooltip": false
74 }, 103 },
104
75 "privacy": { 105 "privacy": {
76 "icon-spacing":4, 106 "icon-spacing": 4,
77 "icon-size":18, 107 "icon-size": 18,
78 "transition-duration":250, 108 "transition-duration": 250,
79 "modules": [ 109 "modules": [
80 { 110 {
81 "type":"screenshare", 111 "type": "screenshare",
82 "tooltip":true, 112 "tooltip": true,
83 "tooltip-icon-size":24 113 "tooltip-icon-size": 24
84 }, 114 },
85 { 115 {
86 "type":"audio-in", 116 "type": "audio-in",
87 "tooltip":true, 117 "tooltip": true,
88 "tooltip-icon-size":24 118 "tooltip-icon-size": 24
89 } 119 }
90 ] 120 ]
91 }, 121 },
122
92 "pulseaudio": { 123 "pulseaudio": {
93 "format-alt": "{icon}", 124 "format-alt": "{icon}",
94 "format": "{volume} {icon}", 125 "format": "{volume} {icon}",
95 "format-alt-click": "click-right", 126 "format-alt-click": "click-right",
96 "format-muted": "", 127 "format-muted": "",
97 "format-icons": { 128 "format-icons": {
98 "phone": [" ", " ", " ", " "], 129 "phone": [
99 "default": ["", "", "", ""] 130 " ",
131 " ",
132 " ",
133 " "
134 ],
135 "default": [
136 "",
137 "",
138 "",
139 ""
140 ]
100 }, 141 },
101 "scroll-step": 1, 142 "scroll-step": 1,
102 "on-click": "pavucontrol", 143 "on-click": "pavucontrol",
103 "tooltip": false 144 "tooltip": false
104 }, 145 },
105 "custom/spotify": { 146
106 "interval": 2,
107 "return-type": "json",
108 "exec": "~/.config/waybar/modules/spotify.sh",
109 "exec-if": "~/.config/waybar/modules/check-for-music.sh",
110 "escape": true,
111 "on-click": "playerctl play-pause"
112 },
113 "custom/storage": { 147 "custom/storage": {
114 "format-alt": "{} ", 148 "format-alt": "{} ",
115 "format": "{percentage}% ", 149 "format": "{percentage}% ",
@@ -118,14 +152,19 @@
118 "interval": 60, 152 "interval": 60,
119 "exec": "~/.config/waybar/modules/storage.sh" 153 "exec": "~/.config/waybar/modules/storage.sh"
120 }, 154 },
155
121 "backlight": { 156 "backlight": {
122 "format-alt": "{icon}", 157 "format-alt": "{icon}",
123 "format": "{percent}% {icon}", 158 "format": "{percent}% {icon}",
124 "format-alt-click": "click-right", 159 "format-alt-click": "click-right",
125 "format-icons": ["", ""], 160 "format-icons": [
161 "",
162 "󰃞"
163 ],
126 "on-scroll-up": "light -A 1", 164 "on-scroll-up": "light -A 1",
127 "on-scroll-down": "light -U 1" 165 "on-scroll-down": "light -U 1"
128 }, 166 },
167
129 "custom/weather_OLD": { 168 "custom/weather_OLD": {
130 "format-alt": "{}", 169 "format-alt": "{}",
131 "format": "{alt}: {}", 170 "format": "{alt}: {}",
@@ -136,14 +175,16 @@
136 "exec": "~/.config/waybar/modules/weather.sh", 175 "exec": "~/.config/waybar/modules/weather.sh",
137 "exec-if": "ping wttr.in -c1" 176 "exec-if": "ping wttr.in -c1"
138 }, 177 },
178
139 "custom/weather": { 179 "custom/weather": {
140 "format": "{} °F", 180 "format": "{} °F",
141 "tooltip": true, 181 "tooltip": true,
142 "interval": 3600, 182 "interval": 3600,
143 "exec": "exit=101; while [ $exit = 101 ]; do wttrbar --main-indicator temp_F --fahrenheit; exit=$(echo $?); sleep 1; done", 183 "exec": "exit=101; while [ $exit = 101 ]; do wttrbar --main-indicator temp_F --fahrenheit --nerd; exit=$(echo $?); sleep 1; done",
144 "on-click": "foot -a ala-wttr -H curl https://v2.wttr.in", 184 "on-click": "foot -a ala-wttr -H curl https://v2.wttr.in",
145 "return-type": "json" 185 "return-type": "json"
146 }, 186 },
187
147 "idle_inhibitor": { 188 "idle_inhibitor": {
148 "format": "{icon}", 189 "format": "{icon}",
149 "format-icons": { 190 "format-icons": {
@@ -152,6 +193,7 @@
152 }, 193 },
153 "tooltip": false 194 "tooltip": false
154 }, 195 },
196
155 "custom/mail": { 197 "custom/mail": {
156 "format": "", 198 "format": "",
157 "format-alt": "{alt} ", 199 "format-alt": "{alt} ",
@@ -161,7 +203,9 @@
161 "exec": "~/.config/waybar/modules/mail.py", 203 "exec": "~/.config/waybar/modules/mail.py",
162 "tooltip": false 204 "tooltip": false
163 }, 205 },
206
164 "tray": { 207 "tray": {
165 "icon-size": 18 208 "icon-size": 18
166 } 209 }
167} 210}
211
diff --git a/users/ryan/linux/waybar/modules/storage.sh b/users/ryan/linux/waybar/modules/storage.sh
index 90cc3dc..7cb7249 100755
--- a/users/ryan/linux/waybar/modules/storage.sh
+++ b/users/ryan/linux/waybar/modules/storage.sh
@@ -1,25 +1,70 @@
1#!/bin/sh 1#!/bin/sh
2 2
3mount="/" 3set -eu
4
5mountpoint="/"
4warning=20 6warning=20
5critical=10 7critical=10
6 8
7df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical ' 9error() {
8/\/.*/ { 10 jq -cn --arg message "$1" '{
9 text=$4 11 text: "N/A",
10 tooltip="Filesystem: "$1"\rSize: "$2"\rUsed: "$3"\rAvail: "$4"\rUse%: "$5"\rMounted on: "$6 12 percentage: 0,
11 use=$5 13 tooltip: $message,
12 exit 0 14 class: "critical"
15 }'
16 exit 0
13} 17}
14END { 18
15 class="" 19line=$(df -hP -l "$mountpoint" 2>/dev/null | tail -n 1) ||
16 gsub(/%$/,"",use) 20 error "Unable to read filesystem statistics"
17 if ((100 - use) < critical) { 21
22# df -P guarantees a single line per filesystem.
23set -- $line
24
25[ "$#" -ge 6 ] || error "Unable to parse filesystem statistics"
26
27filesystem=$1
28size=$2
29used=$3
30available=$4
31use=${5%\%}
32mounted=$6
33
34case "$use" in
35 ''|*[!0-9]*) error "Invalid filesystem usage percentage: $use%" ;;
36esac
37
38free=$((100 - use))
39
40if [ "$free" -le "$critical" ]; then
18 class="critical" 41 class="critical"
19 } else if ((100 - use) < warning) { 42elif [ "$free" -le "$warning" ]; then
20 class="warning" 43 class="warning"
21 } 44else
22 print "{\"text\":\""text"\", \"percentage\":"use",\"tooltip\":\""tooltip"\", \"class\":\""class"\"}" 45 class=""
23} 46fi
24' 47
48jq -cn \
49 --arg text "${use}%" \
50 --argjson percentage "$use" \
51 --arg filesystem "$filesystem" \
52 --arg size "$size" \
53 --arg used "$used" \
54 --arg available "$available" \
55 --arg mounted "$mounted" \
56 --arg class "$class" \
57 '{
58 text: $text,
59 percentage: $percentage,
60 tooltip: (
61 "Filesystem: " + $filesystem +
62 "\rSize: " + $size +
63 "\rUsed: " + $used +
64 "\rAvail: " + $available +
65 "\rUse%: " + $text +
66 "\rMounted on: " + $mounted
67 ),
68 class: $class
69 }'
25 70
diff --git a/users/ryan/linux/waybar/style.css b/users/ryan/linux/waybar/style.css
index 682a14e..ac78984 100644
--- a/users/ryan/linux/waybar/style.css
+++ b/users/ryan/linux/waybar/style.css
@@ -1,7 +1,7 @@
1* { 1* {
2 border: none; 2 border: none;
3 border-radius: 0; 3 border-radius: 0;
4 font-family: AnonymicePro Nerd Font; 4 font-family: FiraCode Nerd Font;
5 font-size: 15px; 5 font-size: 15px;
6 box-shadow: none; 6 box-shadow: none;
7 text-shadow: none; 7 text-shadow: none;