feat: waybar gpu usage and new style

This commit is contained in:
hesam-init 2024-02-23 18:20:31 +03:30
parent d44ffe82bc
commit 3732e50dd1
3 changed files with 43 additions and 74 deletions

View file

@ -8,6 +8,8 @@
"margin-left": 6,
"margin-right": 6,
"modules-right": [
"cpu",
"custom/gpu-usage",
"wireplumber",
"hyprland/language",
"clock"
@ -18,17 +20,15 @@
"tray"
],
"modules-center": [
"battery",
"cpu",
"memory",
"network#network-2"
// "network"
// "pulseaudio"
// "custom/snip"
// "custom/updater",
// "custom/wallpaper",
// "pulseaudio/slider",
// "keyboard-state",
"battery",
"memory",
"network#network-2",
"network"
],
"hyprland/language": {
"format": "{}",
@ -148,10 +148,15 @@
},
"cpu": {
"interval": 1,
"format": "{usage}% "
"format": "{usage}% "
},
"custom/gpu-usage": {
"exec": "~/.config/waybar/scripts/gpu-usage.sh",
"format": "{}% ",
"interval": 1
},
"memory": {
"format": "{used:0.1f}/{total:0.1f} GB",
"format": "{used:0.1f}/{total:0.1f} ",
"interval": 5
},
"backlight": {
@ -196,23 +201,11 @@
"format-wifi": " : {bandwidthDownBytes}  : {bandwidthUpBytes}",
"format-ethernet": " : {bandwidthDownBytes}  : {bandwidthUpBytes}",
"format-linked": "(No IP) ",
"format-disconnected": " 0.0B/s  0.0B/s",
"format-disconnected": " : {bandwidthDownBytes}  : {bandwidthUpBytes}",
"on-click-right": "~/.config/hypr/scripts/nmtui-launch.sh",
"tooltip": false,
"interval": 1
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"max-length": 20,
"format-icons": {
"spotify": " ",
"default": " "
},
"escape": true,
"exec": "~/.config/system_scripts/mediaplayer.py 2> /dev/null",
"on-click": "playerctl play-pause"
},
"custom/launcher": {
"format": "",
"on-click": "~/.config/hypr/scripts/rofi-launch.sh d",
@ -223,10 +216,6 @@
"on-click": "~/.config/hypr/scripts/rofi-launch.sh p",
"on-click-right": "pkill rofi"
},
"custom/snip": {
"format": " ",
"on-click": "grimshot --notify save area $HOME/Pictures/$(zenity --entry --text 'Set filename:' --entry-text '.png')"
},
"custom/wallpaper": {
"format": " ",
"on-click": "bash ~/.config/system_scripts/pkill_bc"

View file

@ -46,6 +46,7 @@ window#waybar.hidden {
#clock,
#battery,
#cpu,
#custom-gpu-usage,
#memory,
#disk,
#temperature,
@ -55,11 +56,7 @@ window#waybar.hidden {
#custom-media,
#custom-launcher,
#custom-power,
#custom-layout,
#custom-updater,
#custom-snip,
#custom-wallpaper,
#custom-playerlabel,
#tags,
#taskbar,
#tray,
@ -137,47 +134,11 @@ window#waybar.hidden {
font-size: 18px;
}
#custom-layout {
color: white;
font-size: 20px;
}
#custom-updater {
color: white;
}
#custom-snip {
color: skyblue;
font-size: 20px;
}
#custom-wallpaper {
color: pink;
font-size: 20px;
}
#tags {
font-size: 20px;
}
#tags button.occupied {
color: skyblue;
margin: 5px;
background-color: #272727;
}
#tags button.focused {
color: black;
margin: 5px;
background-color: white;
}
#tags button.urgent {
color: red;
margin: 5px;
background-color: white;
}
#temperature.critical {
background-color: #eb4d4b;
}
@ -190,17 +151,16 @@ window#waybar.hidden {
color: red;
}
#memory,
#cpu {
min-width: 90px;
}
#language,
#clock,
#wireplumber {
min-width: 70px;
#wireplumber,
#cpu,
#custom-gpu-usage {
min-width: 65px;
}
#memory {
min-width: 80px;
}
#wireplumber.muted {

View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
file_exists() {
if [ -f "$1" ]; then
return 0
else
return 1
fi
}
device_id="0"
gpu_busy_file="/sys/class/hwmon/hwmon$device_id/device/gpu_busy_percent"
if file_exists "$gpu_busy_file"; then
gpu_busy_percent=$(cat "$gpu_busy_file")
echo "$gpu_busy_percent"
else
echo "Error !" >&2
exit 1
fi