From 5ab3c4d70b736bc145fa74c16faba275ae956835 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Tue, 14 Nov 2023 22:33:03 +0100 Subject: [PATCH] [waybar] Move config --- arch/stow/waybar/.config/waybar/modules.json | 156 ----------------- nixos/users/tdpeuter/dotfiles.nix | 4 + .../waybar/.config/waybar/config | 14 +- .../waybar/.config/waybar/default.json | 5 +- .../waybar/.config/waybar/left.json | 3 + .../waybar/.config/waybar/mediaplayer.py | 0 stow/waybar/.config/waybar/modules.json | 162 ++++++++++++++++++ .../waybar/.config/waybar/round.css | 0 .../waybar/.config/waybar/sharp.css | 0 .../waybar/.config/waybar/style.css | 18 +- .../waybar/.config/waybar/transparent.css | 0 11 files changed, 188 insertions(+), 174 deletions(-) delete mode 100644 arch/stow/waybar/.config/waybar/modules.json rename {arch/stow => stow}/waybar/.config/waybar/config (77%) rename {arch/stow => stow}/waybar/.config/waybar/default.json (88%) rename {arch/stow => stow}/waybar/.config/waybar/left.json (74%) rename {arch/stow => stow}/waybar/.config/waybar/mediaplayer.py (100%) create mode 100644 stow/waybar/.config/waybar/modules.json rename {arch/stow => stow}/waybar/.config/waybar/round.css (100%) rename {arch/stow => stow}/waybar/.config/waybar/sharp.css (100%) rename {arch/stow => stow}/waybar/.config/waybar/style.css (82%) rename {arch/stow => stow}/waybar/.config/waybar/transparent.css (100%) diff --git a/arch/stow/waybar/.config/waybar/modules.json b/arch/stow/waybar/.config/waybar/modules.json deleted file mode 100644 index 3bd3ba4..0000000 --- a/arch/stow/waybar/.config/waybar/modules.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - - "battery": { - "format": "{capacity}% {icon}", - "format-alt": "{time} {icon}", - "format-charging": "{capacity}% \uf0e7 {icon}", - "format-icons": ["\uf244", "\uf243", "\uf242", "\uf241", "\uf240"], - "format-plugged": "{capacity}% \ue55c", - "states": { - "warning": 30, - "critical": 15 - } - }, - - - "disk": { - "interval": 30, - "format": "{percentage_used}% \uf0a0", - "on-click": "alacritty -e ncdu /", - "path": "/", - "tooltip-format": "{used} used out of {total} on {path} ({percentage_free}% or {free} free)" - }, - - - "bluetooth": { - "format-disabled": "\uf294", - "format-off": "\uf294", - "format-on": "\uf294", - "format-connected": "\uf294c", - "max-length": 10.3, - "on-click": "alacritty --title 'FZF-Jump' -e ~/.scripts/fzf-jump/standalone.sh ~/.scripts/fzf-jump/modules/bluetooth.sh", - "tooltip-format": "{status}", - "tooltip-format-on": "{status}, no devices connected", - "tooltip-format-connected": "{status} ({num_connections}):\n{device_enumerate}", - "tooltip-format-enumerate-connected": "{device_alias} ({device_address})", - "tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}" - }, - - - "clock": { - "format": "{:%H:%M}", - "format-alt": "{:%d/%m/%Y %H:%M}", - // "timezone": "Europe/Brussels", - "tooltip-format": "{:%Y %B}\n{calendar}" - }, - - - "custom/browser": { - "format": "\uf120", - "on-click": "alacritty -t 'FZF-Jump' -e ~/.scripts/fzf-jump/launcher.sh", - "tooltip-format": "Launch an application" - }, - - - "custom/media": { - "escape": true, - "exec": "~/.config/waybar/mediaplayer.py 2> /dev/null", - "format": "{icon} {}", - "format-icons": { - "default": "\uf51f", - "spotify": "\uf1bc" - }, - "max-length": 40, - "on-click": "playerctl play-pause", - "return-type": "json" - }, - - - "cpu": { - "format": "{usage}% \uf2db", - "on-click": "alacritty -e htop", - "tooltip": true - }, - - - "idle_inhibitor": { - "format": "{icon}", - "format-icons": { - "activated": "\uf06e", - "deactivated": "\uf070" - }, - "tooltip": false - }, - - - "memory": { - "format": "{}% \uf1c0", - "on-click": "alacritty -e htop" - }, - - - "network": { - "format-disconnected": "\uf127", - "format-ethernet": "\uf6ff {ifname}: {ipadds}/{cidr}", - "format-wifi": "\uf1eb", - "interval": 5, - "on-click-right": "alacritty -e nmtui", - "tooltip-format": "{ifname}: {ipaddr}", - "tooltip-format-disconnected": "Disconnected", - "tooltip-format-wifi": "{essid} ({signalStrength}%)\n{ifname}: {ipaddr}" - }, - - - "sway/window": { - "max-length": 85 - }, - - - "sway/workspaces": { - "all-outputs": false, - "disable-scroll": true, - "format": "{icon}{name}", - "format-icons": { - "default": "", // Prevent showing workspace name literal. - "urgent": "\uf071 " - }, - // "persistent_workspaces": { - // "0:¯\\_(ツ)_/¯": [] - // } - }, - - - "pulseaudio": { - "format": "{volume}% {icon}{format_source}", - "format-bluetooth": "{volume}% {icon}\uf294{format_source}", - "format-bluetooth-muted": "\uf6a9 {icon}\uf294{format_source}", - "format-muted": "\uf6a9{format_source}", - "format-source": " {volume}% \uf130", - "format-source-muted": "", - "format-icons": { - "headphone": "\uf58f", - "hands-free": "\uf590", - "headset": "\uf590", - "phone": "\uf3ce", - "portable": "\uf3ce", - "car": "\uf1b9", - "default": ["\uf026", "\uf027", "\uf028 "] - }, - "on-click": "pamixer --toggle-mute", - "on-click-right": "pavucontrol", - "scroll-step": 2 - }, - - - "temperature": { - "critical-threshold": 70, - "format": "{temperatureC}°C {icon}", - "format-icons": ["\uf2cb", "\uf2c9", "\uf2c7"] - }, - - - "tray": { - "spacing": 10 - } - -} diff --git a/nixos/users/tdpeuter/dotfiles.nix b/nixos/users/tdpeuter/dotfiles.nix index 34db407..0603830 100644 --- a/nixos/users/tdpeuter/dotfiles.nix +++ b/nixos/users/tdpeuter/dotfiles.nix @@ -49,6 +49,10 @@ in { source = ../../../stow/vifm/.config/vifm; recursive = true; # Fix history and all working }; + ".config/waybar" = { + enable = config.sisyphus.desktop.sway.enable; + source = ../../../stow/waybar/.config/waybar; + }; ".config/zellij" = { enable = (builtins.elem pkgs.zellij installedPkgs); source = ../../../stow/zellij/.config/zellij; diff --git a/arch/stow/waybar/.config/waybar/config b/stow/waybar/.config/waybar/config similarity index 77% rename from arch/stow/waybar/.config/waybar/config rename to stow/waybar/.config/waybar/config index a8198f5..45b047a 100644 --- a/arch/stow/waybar/.config/waybar/config +++ b/stow/waybar/.config/waybar/config @@ -3,15 +3,14 @@ // [{ - "name": "toggle", "mode": "hide", - "ipc": true, + "ipc": true, "position": "top", - "height": 25, - "spacing": 4, + "height": 25, + "spacing": 4, "margin": "-25px 0 0 0", // Show this bar on top of the other one, seemingly the "same" one. "custom/sep": { @@ -28,18 +27,15 @@ }, { - "name": "keep", "position": "top", "height": 25, - "modules-left": ["sway/mode", "custom/browser"], - "modules-center": ["sway/window"], - "modules-right": ["clock"], + "modules-left": ["sway/mode"], + "modules-center": ["clock"], "include": [ // Import modules (!) "~/.config/waybar/modules.json" ], - }] diff --git a/arch/stow/waybar/.config/waybar/default.json b/stow/waybar/.config/waybar/default.json similarity index 88% rename from arch/stow/waybar/.config/waybar/default.json rename to stow/waybar/.config/waybar/default.json index d045a28..7a3f71c 100644 --- a/arch/stow/waybar/.config/waybar/default.json +++ b/stow/waybar/.config/waybar/default.json @@ -1,13 +1,12 @@ - { - "modules-left": [ + "modules-left": [ "idle_inhibitor", "custom/media" ], "modules-center": [ "sway/workspaces" ], - "modules-right": [ + "modules-right": [ "disk", "memory", "cpu", diff --git a/arch/stow/waybar/.config/waybar/left.json b/stow/waybar/.config/waybar/left.json similarity index 74% rename from arch/stow/waybar/.config/waybar/left.json rename to stow/waybar/.config/waybar/left.json index d8948f0..23b4b5d 100644 --- a/arch/stow/waybar/.config/waybar/left.json +++ b/stow/waybar/.config/waybar/left.json @@ -2,6 +2,9 @@ "modules-left": [ "sway/workspaces", "idle_inhibitor", + "custom/light-dark-toggle", + "custom/night-light-toggle", + "custom/toggle-notifications", "custom/media" ], "modules-right": [ diff --git a/arch/stow/waybar/.config/waybar/mediaplayer.py b/stow/waybar/.config/waybar/mediaplayer.py similarity index 100% rename from arch/stow/waybar/.config/waybar/mediaplayer.py rename to stow/waybar/.config/waybar/mediaplayer.py diff --git a/stow/waybar/.config/waybar/modules.json b/stow/waybar/.config/waybar/modules.json new file mode 100644 index 0000000..39e2d9e --- /dev/null +++ b/stow/waybar/.config/waybar/modules.json @@ -0,0 +1,162 @@ +{ + "battery": { + "format": "{capacity}% {icon}", + "format-alt": "{time} {icon}", + "format-charging": "{capacity}% \uf0e7 {icon}", + "format-icons": ["\uf244", "\uf243", "\uf242", "\uf241", "\uf240"], + "format-plugged": "{capacity}% \ue55c", + "states": { + "warning": 30, + "critical": 15 + } + }, + + "disk": { + "interval": 30, + "format": "{percentage_used}% \uf0a0", + "on-click": "kitty -e duf /", + "path": "/", + "tooltip-format": "{used} used out of {total} on {path} ({percentage_free}% or {free} free)" + }, + + "bluetooth": { + "format-disabled": "\uf294", + "format-off": "\uf294", + "format-on": "\uf294", + "format-connected": "\uf294c", + "max-length": 10.3, + "on-click": "bluetoothctl power $( bluetoothctl show | sed -n 's/\\s*Powered: \\(yes\\|no\\)/\\1/p' | sed 's/yes/off/;s/no/on/' )", + "on-click-right": "kitty -e bluetoothctl", + "tooltip-format": "{status}", + "tooltip-format-on": "{status}, no devices connected", + "tooltip-format-connected": "{status} ({num_connections}):\n{device_enumerate}", + "tooltip-format-enumerate-connected": "{device_alias} ({device_address})", + "tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}" + }, + + "clock": { + "format": "{:%H:%M}", + "format-alt": "{:%d/%m/%Y %H:%M}", + "timezone": "Europe/Brussels", + "tooltip-format": "{:%Y %B}\n{calendar}" + }, + + "custom/browser": { + "format": "\uf120", + "on-click": "dmenu_run", + "tooltip-format": "Launch an application" + }, + + "custom/media": { + "escape": true, + "exec": "~/.config/waybar/mediaplayer.py 2> /dev/null", + "format": "{icon} {}", + "format-icons": { + "default": "\uf51f", + "spotify": "\uf1bc" + }, + "max-length": 40, + "on-click": "playerctl play-pause", + "return-type": "json" + }, + + "custom/light-dark-toggle": { + "on-click": "bash ${SCRIPT_DIR}/toggle-light-dark.sh", + "tooltip-format": "Toggle between light and dark mode", + "format": "\uf042 ", + "tooltip": true + }, + + "custom/night-light-toggle": { + "on-click": "bash ${SCRIPT_DIR}/sunset.sh", + "tooltip-format": "Toggle night-light on or off", + "format": "\uf0eb ", + "tooltip": true + }, + + "custom/toggle-notifications": { + "on-click": "bash ${SCRIPT_DIR}/do-not-disturb.sh", + "tooltip-format": "Toggle notifications", + "format": "\uf1f6 ", + "tooltip": true + }, + + "cpu": { + "format": "{usage}% \uf2db", + "on-click": "kitty -e htop", + "tooltip": true + }, + + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "\uf06e", + "deactivated": "\uf070" + }, + "tooltip": false + }, + + "memory": { + "format": "{}% \uf1c0", + "on-click": "kitty -e zenith" + }, + + "network": { + "format-disconnected": "\uf127", + "format-ethernet": "\uf6ff {ifname}: {ipadds}/{cidr}", + "format-wifi": "\uf1eb", + "interval": 5, + "on-click-right": "kitty -e nmtui", + "tooltip-format": "{ifname}: {ipaddr}", + "tooltip-format-disconnected": "Disconnected", + "tooltip-format-wifi": "{essid} ({signalStrength}%)\n{ifname}: {ipaddr}" + }, + + "sway/window": { + "max-length": 85 + }, + + "sway/workspaces": { + "all-outputs": false, + "disable-scroll": true, + "format": "{icon}{name}", + "format-icons": { + "default": "", // Prevent showing workspace name literal. + "urgent": "\uf071 " + }, + // "persistent_workspaces": { + // "0:¯\\_(ツ)_/¯": [] + // } + }, + + "pulseaudio": { + "format": "{volume}% {icon}{format_source}", + "format-muted": "\uf6a9{format_source}", + "format-bluetooth": "{volume}% {icon}\uf294{format_source}", + "format-bluetooth-muted": "\uf6a9 {icon}\uf294{format_source}", + "format-source": " {volume}% \uf130", + "format-source-muted": "", + "format-icons": { + "headphone": "\uf58f", + "hands-free": "\uf590", + "headset": "\uf590", + "phone": "\uf3ce", + "portable": "\uf3ce", + "car": "\uf1b9", + "default": ["\uf026", "\uf027", "\uf028 "] + }, + "on-click": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle", + "on-click-right": "pavucontrol", + "scroll-step": 2 + }, + + "temperature": { + "critical-threshold": 70, + "format": "{temperatureC}°C {icon}", + "format-icons": ["\uf2cb", "\uf2c9", "\uf2c7"] + }, + + "tray": { + "spacing": 10 + } +} diff --git a/arch/stow/waybar/.config/waybar/round.css b/stow/waybar/.config/waybar/round.css similarity index 100% rename from arch/stow/waybar/.config/waybar/round.css rename to stow/waybar/.config/waybar/round.css diff --git a/arch/stow/waybar/.config/waybar/sharp.css b/stow/waybar/.config/waybar/sharp.css similarity index 100% rename from arch/stow/waybar/.config/waybar/sharp.css rename to stow/waybar/.config/waybar/sharp.css diff --git a/arch/stow/waybar/.config/waybar/style.css b/stow/waybar/.config/waybar/style.css similarity index 82% rename from arch/stow/waybar/.config/waybar/style.css rename to stow/waybar/.config/waybar/style.css index 499b543..a922899 100644 --- a/arch/stow/waybar/.config/waybar/style.css +++ b/stow/waybar/.config/waybar/style.css @@ -15,8 +15,9 @@ @define-color accent #00897b; window#waybar { - font-family: Letter; /* This is my personal font. */ + font-family: font-awesome, letter, monospace; font-size: 13px; + -webkit-font-smoothing: antialiased; transition-property: background-color; transition-duration: .5s; } @@ -32,22 +33,26 @@ window#waybar { padding: 0 5px; } -#workspaces button:hover, #workspaces button.focused { background-color: transparent; color: @white; } +#workspaces button:hover { + background-color: transparent; + color: @transparent-black; +} + #workspaces button.urgent { color: @white; background-color: @warning-red; } /* All modules individually. */ -#backlight, #battery, #bluetooth, #clock, #cpu, -#custom-browser, #custom-media, #disk, #idle_inhibitor, -#memory, #mode, #mpd, #network, #pulseaudio, -#temperature, #tray { +#backlight, #battery, #bluetooth, #clock, #cpu, +#custom-browser, #custom-media, #custom-light-dark-toggle, #custom-night-light-toggle, #custom-toggle-notifications, +#disk, #idle_inhibitor, #memory, #mode, #mpd, #network, +#pulseaudio, #temperature, #tray { padding: 0 5px; } @@ -114,6 +119,7 @@ label:focus { background-color: #eb4d4b; } +#custom_light-dark-toggle.activated, #idle_inhibitor.activated { background-color: #ecf0f1; color: #2d3436; diff --git a/arch/stow/waybar/.config/waybar/transparent.css b/stow/waybar/.config/waybar/transparent.css similarity index 100% rename from arch/stow/waybar/.config/waybar/transparent.css rename to stow/waybar/.config/waybar/transparent.css