feat: add a indicator for light/dark mode in waybar
This commit is contained in:
parent
1e947632d7
commit
7e0796842a
3 changed files with 32 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
"modules-right": [
|
||||
"idle_inhibitor",
|
||||
"custom/ddcbrightness",
|
||||
"custom/light-dark-mode",
|
||||
"pulseaudio",
|
||||
"network",
|
||||
"bluetooth",
|
||||
|
@ -210,5 +211,16 @@
|
|||
"format-ok": "",
|
||||
"system": true, // Monitor failed systemwide 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,
|
||||
#scratchpad,
|
||||
#power-profiles-daemon,
|
||||
#customcustom-light-dark-mode,
|
||||
#custom-ddcbrightness,
|
||||
#idle_inhibitor,
|
||||
#mpd {
|
||||
|
|
Loading…
Add table
Reference in a new issue