feat: add a indicator for light/dark mode in waybar
This commit is contained in:
parent
f3ab9e4091
commit
ebf091c9e4
3 changed files with 32 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
"modules-right": [
|
"modules-right": [
|
||||||
"idle_inhibitor",
|
"idle_inhibitor",
|
||||||
"custom/ddcbrightness",
|
"custom/ddcbrightness",
|
||||||
|
"custom/light-dark-mode",
|
||||||
"pulseaudio",
|
"pulseaudio",
|
||||||
"network",
|
"network",
|
||||||
"bluetooth",
|
"bluetooth",
|
||||||
|
@ -210,5 +211,16 @@
|
||||||
"format-ok": "",
|
"format-ok": "",
|
||||||
"system": true, // Monitor failed systemwide units.
|
"system": true, // Monitor failed systemwide units.
|
||||||
"user": true // Ignore failed user units.
|
"user": true // Ignore failed user units.
|
||||||
|
},
|
||||||
|
"custom/light-dark-mode": {
|
||||||
|
"exec": "/home/bca/.config/waybar/darkman",
|
||||||
|
"return-type": "json",
|
||||||
|
"format": "{icon}",
|
||||||
|
"tooltip": true,
|
||||||
|
"on-click": "darkman toggle",
|
||||||
|
"format-icons": {
|
||||||
|
"light": " ",
|
||||||
|
"dark": " "
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
19
waybar/.config/waybar/darkman
Executable file
19
waybar/.config/waybar/darkman
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# vim: ft=bash
|
||||||
|
|
||||||
|
print_json() {
|
||||||
|
case "$1" in
|
||||||
|
prefer-dark)
|
||||||
|
echo '{"text": "dark", "alt": "dark", "class": "dark", "tooltip": "Dark mode"}'
|
||||||
|
;;
|
||||||
|
prefer-light)
|
||||||
|
echo '{"text": "light", "alt": "light", "class": "light", "tooltip": "Light mode"}'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
print_json "$(gsettings get org.gnome.desktop.interface color-scheme | cut -nd"'" -f 2)"
|
||||||
|
gsettings monitor org.gnome.desktop.interface color-scheme | while read -r l; do
|
||||||
|
print_json "$(echo "$l" | cut -d"'" -f 2)"
|
||||||
|
done
|
||||||
|
|
|
@ -97,6 +97,7 @@ button:hover {
|
||||||
#idle_inhibitor,
|
#idle_inhibitor,
|
||||||
#scratchpad,
|
#scratchpad,
|
||||||
#power-profiles-daemon,
|
#power-profiles-daemon,
|
||||||
|
#customcustom-light-dark-mode,
|
||||||
#custom-ddcbrightness,
|
#custom-ddcbrightness,
|
||||||
#idle_inhibitor,
|
#idle_inhibitor,
|
||||||
#mpd {
|
#mpd {
|
||||||
|
|
Loading…
Add table
Reference in a new issue