From f835448ed5a780e1cc2a6c25728eacc43a1ec96c Mon Sep 17 00:00:00 2001 From: krolxon Date: Wed, 6 Aug 2025 21:34:11 +0530 Subject: [PATCH] waybar: add gpumode module --- .config/waybar/config.jsonc | 6 ++++++ .config/waybar/scripts/gpu_mode.sh | 19 +++++++++++++++++ .config/waybar/style.css | 33 +++++++----------------------- 3 files changed, 32 insertions(+), 26 deletions(-) create mode 100755 .config/waybar/scripts/gpu_mode.sh diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc index 759314b..d5578ff 100644 --- a/.config/waybar/config.jsonc +++ b/.config/waybar/config.jsonc @@ -14,6 +14,7 @@ "hyprland/window" ], "modules-right": [ + "custom/gpumode", "tray", "pulseaudio", "battery", @@ -80,6 +81,11 @@ "interval": 1, "tooltip": false }, + "custom/gpumode": { + "exec": "~/.config/waybar/scripts/gpu_mode.sh", + "format": "{}", + "interval": "once", + }, "cpu": { "format": " {usage:2}%", "interval": 1, diff --git a/.config/waybar/scripts/gpu_mode.sh b/.config/waybar/scripts/gpu_mode.sh new file mode 100755 index 0000000..365e6be --- /dev/null +++ b/.config/waybar/scripts/gpu_mode.sh @@ -0,0 +1,19 @@ +#!/bin/bash +mode=$(envycontrol -q | awk '{print $NF}') + +case "$mode" in + integrated) + icon="" + ;; + hybrid) + icon="" + ;; + nvidia) + icon="" + ;; + *) + icon="" + ;; +esac + +echo "$icon $mode" diff --git a/.config/waybar/style.css b/.config/waybar/style.css index e6f30c7..d9b6dc0 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -4,7 +4,6 @@ * Maintainer: rubyowo * */ - @define-color base #1e1e2e; @define-color mantle #181825; @define-color crust #11111b; @@ -36,18 +35,8 @@ @define-color flamingo #f2cdcd; @define-color rosewater #f5e0dc; - - - -/* * { */ - /* `otf-font-awesome` is required to be installed for icons */ -/* font-family: JetBrains Mono Nerd Font, FontAwesome; */ -/* font-size: 13px; */ -/* font-weight: bold; */ -/* } */ - * { -font-family: "JetBrainsMono Nerd Font"; +font-family: "JetBrainsMono Nerd Font", "FontAwesome"; font-weight: bold; min-height: 0; /* set font-size to 100% if font scaling is set to 1.00 using nwg-look */ @@ -56,15 +45,6 @@ font-feature-settings: '"zero", "ss01", "ss02", "ss03", "ss04", "ss05", "cv31"'; padding: 0.03125rem; } -/* window#waybar { */ -/* background-color: rgba(0, 0, 0, 0); */ -/* color: #e3e3e3; */ -/* transition-property: background-color; */ -/* transition-duration: .5s; */ -/* border: none; */ -/* border-radius: 0; */ -/* } */ - window#waybar { transition-property: background-color; transition-duration: 0.5s; @@ -101,7 +81,7 @@ window#waybar.hidden { border: none; border-radius: 0; - color: #d8dee9; + color: @text; transition: all 0.2s ease; text-shadow: none; @@ -126,7 +106,7 @@ window#waybar.hidden { #workspaces button:hover { transition-duration: .2s; color: @base; - box-shadow: inset 0 -3px #e3e3e3; + box-shadow: inherit; /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ text-shadow: inherit; } @@ -164,6 +144,7 @@ window#waybar.hidden { #clock, #custom-date, +#custom-gpumode, #battery, #backlight, #cpu, @@ -196,7 +177,7 @@ window#waybar.hidden { } #window { - color: #e3e3e3 + color: @text } #clock { @@ -261,7 +242,7 @@ label:focus { } #pulseaudio { - color: #d8dee9; + color: @text; } @@ -274,7 +255,7 @@ label:focus { } #tray { - color: #eceff4; + color: @subtext0; }