add nvidia module

This commit is contained in:
Kopatz
2024-07-24 18:37:15 +02:00
parent 45d93bc672
commit bbcc7320be
3 changed files with 21 additions and 1 deletions

2
.config/waybar/nvidia.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
nvidia-smi --query-gpu=utilization.gpu,power.draw,temperature.gpu --format=csv,noheader | xargs -I {} echo "GPU: {}°C"

View File

@@ -1,3 +1,5 @@
@define-color nvidia-green #76b900;
#other, #other,
#other-drawer, #other-drawer,
#stats, #stats,
@@ -16,6 +18,7 @@
#memory, #memory,
#temperature, #temperature,
#disk, #disk,
#nvidia,
#network { #network {
padding: 0 0.5em; padding: 0 0.5em;
} }
@@ -36,6 +39,10 @@
color: @blue; color: @blue;
} }
#custom-nvidia {
color: @nvidia-green;
}
#network.disconnected { #network.disconnected {
background-color: #f53c3c; background-color: #f53c3c;
} }

View File

@@ -11,6 +11,11 @@ in {
statsStyle = builtins.readFile ./styles/stats.css; statsStyle = builtins.readFile ./styles/stats.css;
workspacesStyle = builtins.readFile ./styles/workspaces.css; workspacesStyle = builtins.readFile ./styles/workspaces.css;
in lib.mkIf cfg.enable { in lib.mkIf cfg.enable {
home.file.".config/waybar" = {
recursive = true;
source = ../../.config/waybar;
};
programs.waybar = { programs.waybar = {
enable = true; enable = true;
#systemd.enable = true; #systemd.enable = true;
@@ -29,7 +34,7 @@ in {
modules-right = [ "group/stats" "group/other" ]; modules-right = [ "group/stats" "group/other" ];
"group/stats" = { "group/stats" = {
"orientation" = "horizontal"; "orientation" = "horizontal";
"modules" = [ "network" "cpu" "memory" "disk" "temperature" ]; "modules" = [ "network" "cpu" "memory" "disk" "temperature" "custom/nvidia" ];
}; };
"group/other" = { "group/other" = {
"orientation" = "horizontal"; "orientation" = "horizontal";
@@ -136,6 +141,12 @@ in {
}; };
"status-icons" = { "paused" = ""; }; "status-icons" = { "paused" = ""; };
}; };
"custom/nvidia" = {
"format" = "{}";
"interval" = 5;
"exec" = "~/.config/waybar/nvidia.sh";
"exec-if" = "nvidia-smi";
};
"tray".icon-size = 21; "tray".icon-size = 21;
"tray".spacing = 10; "tray".spacing = 10;
"hyprland/window" = { "hyprland/window" = {