From 7407920ec262f67c4ae3cbd8b3de8a563122d63a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dias?= Date: Mon, 23 Sep 2024 13:21:24 -0300 Subject: [PATCH] :sparkles: feat(waybar): add window title back to window module, fix others --- waybar/config.jsonc | 44 ++++++++++++++++--------------- waybar/mediaplayer.py | 2 +- waybar/style.css | 60 ++++++++++++++++++++++++------------------- 3 files changed, 57 insertions(+), 49 deletions(-) diff --git a/waybar/config.jsonc b/waybar/config.jsonc index e675b53..17f956d 100644 --- a/waybar/config.jsonc +++ b/waybar/config.jsonc @@ -6,10 +6,10 @@ "reload_style_on_change": true, "modules-left": [ "custom/logo", - "hyprland/workspaces", - "hyprland/window" + "hyprland/workspaces" ], "modules-center": [ + "hyprland/window", "clock", "custom/media" ], @@ -36,40 +36,42 @@ }, "on-scroll-down": "hyprctl dispatch workspace e-1", - "on-scroll-up": "hyprctl dispatch workspace e+1" + "on-scroll-up": "hyprctl dispatch workspace e+1", + "escape": true }, "bluetooth": { "format": "", "format-on": "󰂯", "format-connected": "󰂱", - "tooltip-format": "{controller_alias}{controller_address}\n\n{num_connections} connected", - "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}", - "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}", - "tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}%" + "tooltip-format": "󰇄 {controller_alias}\n{controller_address}", + "tooltip-format-connected": " Controller(s):\n {controller_alias}\t{controller_address}\n\n󰂱 Devices ( {num_connections} ) :\n {device_enumerate}", + "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}\n", + "tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t󰁹 {device_battery_percentage}%\n" }, "keyboard-state": { "numlock": true, "capslock": true, - "format": "{name} {icon}", + "format": "{icon} {name}", "format-icons": { "locked": " ", "unlocked": " " } }, "hyprland/window": { - "format": "{class}", + "format": "{class} - {title}", "show-empty": false, "icon": true, "separate-outputs": true, "rewrite": { - "zen-alpha": "Zen Browser", - "firefox": "Firefox", - "kitty": "Kitty", - "spotify": "Spotify", - "(.*)spotube": "Spotube", - "(.*)discord": "Discord", - "(.*)vesktop": "Vesktop", - "org.gnome.(.*)": "$1" + " - ": "", + "zen-alpha(.*)": "Zen Browser", + "firefox(.*)": "Firefox", + "kitty - (.*)": "Kitty - $1", + "spotify(.*)": "Spotify", + "spotube": "Spotube", + "discord - Discord (.*)": "Discord $1", + "vesktop - Discord (.*)": "Vesktop $1", + "org.gnome.(.*) - (.*)": "$1 - $2" }, "escape": true @@ -103,7 +105,7 @@ "custom/control-center": { "format": "loading control center...", "return-type": "json", - "exec": "sh $HOME/.config/waybar/modules/control-center.sh" + "exec": "bash $HOME/.config/waybar/modules/control-center.sh" }, "idle_inhibitor": { "format": "{icon}", @@ -203,12 +205,12 @@ "firefox": "", "discord": "", "spotify": "", - "spotube": " ", + "spotube": "", "default": "󰎇" }, + "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null", "on-scroll-down": "playerctl previous", "on-scroll-up": "playerctl next", - "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null", // Script in resources folder - "on-click": "playerctl play-pause" // Change "spotify to your preferred player" + "on-click": "playerctl play-pause" } } diff --git a/waybar/mediaplayer.py b/waybar/mediaplayer.py index 84997a5..722520e 100755 --- a/waybar/mediaplayer.py +++ b/waybar/mediaplayer.py @@ -123,7 +123,7 @@ class PlayerManager: track_info = "Advertisement" elif artist != None and title != None: track_info = f"{artist} - {title}" - if(artist == "" or artist is " "): + if(artist == "" or artist == " "): track_info = f"{title}" else: track_info = title diff --git a/waybar/style.css b/waybar/style.css index 7b987cd..149d443 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -1,9 +1,6 @@ @import "../../.cache/wal/colors-waybar.css"; -@define-color default-workspace @color1; -@define-color active-workspace @color2; - * { color: @foreground; border-radius: 14px; @@ -23,40 +20,36 @@ window#waybar.hidden { } window > * > * { - padding: 2px; + padding: 4px; } +/* General */ .modules-left, .modules-center, .modules-right { - background: alpha(@background, .65); + background: alpha(@background, .80); } -.module, .widget { +.module { padding: 0 10px; font-weight: 500; } -widget > * { - padding-top: 1px; - padding-bottom: 1px; -} - -widget > *:hover:not(#window):not(#workspaces):not(#tray):not(#custom-media) { +widget > *:hover:not(#workspaces):not(#tray):not(#custom-media) { background: @color1; } button:hover { background: @color1; } +/***/ /* Workspaces */ #workspaces { - border-radius: 16px; padding: 4px; } #workspaces button { background: @color1; - border-radius: 24px; + border-radius: 14px; padding: 0 4px; margin: 0 2px; } @@ -69,7 +62,15 @@ button:hover { #workspaces button.urgent { animation: pick-attention; - animation-duration: .5s; + animation-duration: 2s; +} + +#workspaces button:first-child { + margin-left: 0px; +} + +#workspaces button:last-child { + margin-right: 0px; } /***/ @@ -81,18 +82,24 @@ button:hover { margin-right: 6px; } -#custom-notifications { +widget #custom-notifications { font-size: 16px; padding-left: 10px; padding-right: 12px; } -#battery.charging, #battery.plugged { +widget #window.empty { + margin: 0 0 0 0; + padding: 16px 0 0 0; +} + +widget #battery.charging, +widget #battery.plugged { color: @text; background-color: @background; } -#battery:not(.plugged):not(.charging) { +widget #battery:not(.plugged):not(.charging) { background-color: shade(@color1, .68); } @@ -119,14 +126,14 @@ button:hover { } #custom-media { - border: 2px solid @color1; + box-shadow: none; + border: 2px solid @color3; font-weight: 500; transition: 200ms ease-in; } #custom-media:hover { - border: 2px solid transparent; - background: @color2; + background: @color3; } #temperature.critical { @@ -143,25 +150,24 @@ button:hover { @keyframes blink { to { - background-color: alpha(@crust, .3); - color: @orange; + color: @color3; } } @keyframes pick-attention { 25% { - background: @color3; + background: @color4; } 50% { - background: @color2; + background: @color1; } 75% { - background: @color3; + background: @color4; } 100% { - background: @color2; + background: @color1; } }