From 234db0eb0dc09ef8278c035f78a8f5fa5a8fd97d Mon Sep 17 00:00:00 2001 From: GaspardCulis Date: Thu, 19 Oct 2023 13:32:23 +0200 Subject: [PATCH] Enhanced waybar Switched back from tlp to asusd --- bar/waybar/config.jsonc | 41 ++++-- bar/waybar/scripts/powerprofile.sh | 3 + bar/waybar/style.css | 194 +++++++++++++++++------------ 3 files changed, 149 insertions(+), 89 deletions(-) create mode 100755 bar/waybar/scripts/powerprofile.sh diff --git a/bar/waybar/config.jsonc b/bar/waybar/config.jsonc index 4f71443..a9afa2d 100755 --- a/bar/waybar/config.jsonc +++ b/bar/waybar/config.jsonc @@ -6,17 +6,18 @@ "passthrough": false, "gtk-layer-shell": true, "height": 50, - "modules-left": ["clock","custom/weather","wlr/workspaces"], + "modules-left": ["clock","custom/weather","hyprland/workspaces"], "modules-center": ["hyprland/window"], - "modules-right": ["network", "bluetooth", "temperature","custom/power_profile","battery","pulseaudio","pulseaudio#microphone","tray"], + "modules-right": ["network", "bluetooth", "memory", "cpu", "temperature","custom/power_profile","battery","pulseaudio","pulseaudio#microphone","tray"], "hyprland/window": { "format": "{}" }, - "wlr/workspaces": { + "hyprland/workspaces": { "disable-scroll": true, "all-outputs": true, "on-click": "activate", + /* "persistent_workspaces": { "1": [], "2": [], @@ -28,14 +29,16 @@ "8": [], "9": [], "10": [] - } + }*/ }, "custom/power_profile":{ //shows the current power profile and switches to next on click - "exec": "asusctl profile -p | sed s:'Active profile is'::", + "exec": "~/.config/waybar/scripts/powerprofile.sh", + "return-type": "json", "interval": 30, - "format": "󰈐{}", + "tooltip": false, + "format": "󰈐 {}", "on-click": "asusctl profile -n; pkill -SIGRTMIN+8 waybar", "signal": 8 }, @@ -107,14 +110,16 @@ "on-click": "pamixer --default-source -t", "on-scroll-up": "pamixer --default-source -i 5", "on-scroll-down": "pamixer --default-source -d 5", - "scroll-step": 5 + "scroll-step": 5, + "tooltip": false }, "temperature": { "thermal-zone": 0, "critical-threshold": 80, "format": "{temperatureC}°C ", - "format-critical": "{temperatureC}°C " + "format-critical": "{temperatureC}°C ", + "tooltip": false }, "network": { @@ -126,6 +131,26 @@ "format-disconnected": "Disconnected ⚠", "format-alt": "{ifname}:{essid} {ipaddr}/{cidr}" }, + + "cpu": { + "interval": 1, + "format": "󰻠 {usage:>2}%", + "format-icons": ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"], + "states": { + "critical": 90, + "warning": 50 + }, + }, + + "memory": { + "interval": 1, + "format": "󰍛 {used:0.1f}G/{total:0.1f}G", + "states": { + "critical": 90, + "warning": 50 + }, + "tooltip": false + }, "bluetooth": { "format": " {status}", diff --git a/bar/waybar/scripts/powerprofile.sh b/bar/waybar/scripts/powerprofile.sh new file mode 100755 index 0000000..e859f40 --- /dev/null +++ b/bar/waybar/scripts/powerprofile.sh @@ -0,0 +1,3 @@ +#!/bin/bash +profile=$(asusctl profile -p | sed s:'Active profile is '::) +echo "{\"text\": \"$profile\", \"class\": \"$profile\"}" diff --git a/bar/waybar/style.css b/bar/waybar/style.css index 98b1476..f1df6b1 100755 --- a/bar/waybar/style.css +++ b/bar/waybar/style.css @@ -1,51 +1,46 @@ * { - border: none; - border-radius: 0; - font-family: "JetBrainsMono Nerd Font", "Font Awesome 6 Free"; - font-weight: bold; - font-size: 16px; - min-height: 0; + border: none; + border-radius: 0; + font-family: "JetBrainsMono Nerd Font", "Font Awesome 6 Free"; + font-weight: bold; + font-size: 16px; + min-height: 0; } window#waybar { - background: rgba(21, 18, 27, 0); - color: #cdd6f4; + background: rgba(21, 18, 27, 0); + color: #cdd6f4; } tooltip { - background: #1e1e2e; - border-radius: 10px; - border-width: 2px; - border-style: solid; - border-color: #11111b; + background: #1e1e2e; + border-radius: 10px; + border-width: 2px; + border-style: solid; + border-color: #11111b; } #workspaces button { - padding: 5px; - color: #313244; - margin-right: 5px; + padding: 5px; + color: #313244; + margin-right: 5px; } #workspaces button.active { - color: #a6adc8; -} - -#workspaces button.focused { - color: #a6adc8; - background: #eba0ac; - border-radius: 10px; + color: #a6adc8; + background: #3F84E5; + border-radius: 10px; } #workspaces button.urgent { - color: #11111b; - background: #a6e3a1; - border-radius: 10px; + color: #11111b; + background: #FC6471; + border-radius: 10px; } -#workspaces button:hover { - background: #11111b; - color: #cdd6f4; - border-radius: 10px; +#workspaces button:hover:not(.active) { + background: #1e1e2e; + color: #cdd6f4; } #custom-power_profile, @@ -59,96 +54,133 @@ tooltip { #temperature, #workspaces, #tray, +#memory, +#cpu, #backlight { - background: #1e1e2e; - opacity: 0.8; - padding: 0px 10px; - margin: 3px 0px; - margin-top: 10px; - border: 1px solid #181825; + background: #1e1e2e; + opacity: 0.8; + padding: 0px 10px; + margin: 3px 0px; + margin-top: 10px; + border: 1px solid #181825; +} + +#memory { + border-radius: 10px 0px 0px 10px; + border-right: 0px; +} + +#memory.warning { + color: #EDAE49; +} + +#memory.critical { + color: #FC6471; +} + +#cpu { + border-left: 0px; + border-right: 0px; +} + +#cpu.warning { + color: #EDAE49; +} + +#cpu.critical { + color: #FC6471; } #temperature { - border-radius: 10px 0px 0px 10px; + border-left: 0px; + border-right: 0px; } #temperature.critical { - color: #eba0ac; + color: #FC6471; } #backlight { - border-radius: 10px 0px 0px 10px; + border-radius: 10px 0px 0px 10px; } #tray { - border-radius: 10px; - margin-right: 10px; + border-radius: 10px; + margin-right: 10px; } #workspaces { - background: #1e1e2e; - border-radius: 10px; - margin-left: 10px; - padding-right: 0px; - padding-left: 5px; + background: #1e1e2e; + border-radius: 10px; + margin-left: 10px; + padding-right: 0px; + padding-left: 5px; } #custom-power_profile { - color: #a6e3a1; - border-left: 0px; - border-right: 0px; + color: #a6e3a1; + border-left: 0px; + border-right: 0px; +} + +#custom-power_profile.Performance { + color: #FC6471; +} + +#custom-power_profile.Balanced { + color: #EDAE49; } #window { - border-radius: 10px; - margin-left: 60px; - margin-right: 60px; + border-radius: 10px; + margin-left: 60px; + margin-right: 60px; } #clock { - color: #fab387; - border-radius: 10px 0px 0px 10px; - margin-left: 10px; - border-right: 0px; + color: #fab387; + border-radius: 10px 0px 0px 10px; + margin-left: 10px; + border-right: 0px; } #network { - color: #f9e2af; - border-radius: 10px 0px 0px 10px; - border-left: 0px; - border-right: 0px; + color: #f9e2af; + border-radius: 10px 0px 0px 10px; + border-left: 0px; + border-right: 0px; } #bluetooth { - color: #89b4fa; - border-radius: 0px 10px 10px 0px; - margin-right: 10px -} + color: #89b4fa; + border-radius: 0px 10px 10px 0px; + margin-right: 10px +} #pulseaudio { - color: #89b4fa; - border-left: 0px; - border-right: 0px; + color: #89b4fa; + border-left: 0px; + border-right: 0px; + border-radius: 10px 0px 0px 10px; } #pulseaudio.microphone { - color: #cba6f7; - border-left: 0px; - border-right: 0px; - border-radius: 0px 10px 10px 0px; - margin-right: 10px; + color: #cba6f7; + border-left: 0px; + border-right: 0px; + border-radius: 0px 10px 10px 0px; + margin-right: 10px; } #battery { - color: #a6e3a1; - border-radius: 0 10px 10px 0; - margin-right: 10px; - border-left: 0px; + color: #a6e3a1; + border-radius: 0 10px 10px 0; + margin-right: 10px; + border-left: 0px; } #custom-weather { - border-radius: 0px 10px 10px 0px; - border-right: 0px; - margin-left: 0px; -} - + border-radius: 0px 10px 10px 0px; + border-left: 0px; + margin-left: 0px; +} \ No newline at end of file