updated waybar

This commit is contained in:
2025-08-28 19:45:40 +02:00
parent bd49925080
commit a1ac6850bb
7 changed files with 167 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
# preload = ~/Pictures/red_moon/red_moon-latte.jpg
preload = ~/Pictures/wallpapers/rem-latte.jpg
preload = ~/Pictures/wallpapers/rem.jpg
# wallpaper = ,~/Pictures/red_moon/red_moon-latte.jpg
wallpaper = ,~/Pictures/wallpapers/rem-latte.jpg
wallpaper = ,~/Pictures/wallpapers/rem.jpg

View File

@@ -2,13 +2,11 @@
{
"layer": "top",
"position": "top",
"height": 50,
"height": 36,
"modules-left": [
"hyprland/workspaces"
],
"modules-center": [
"tray",
"clock"
],
"modules-right": [
// "custom/bluetooth-audio",
@@ -16,11 +14,17 @@
"custom/mem",
"custom/cpu",
"custom/gpu",
"custom/disk-root",
"custom/disk-gdrive",
"custom/disk-data",
"custom/disk-games",
// "network",
"custom/gpu-screen-recorder",
"custom/gamemode",
"custom/audio-output",
"wireplumber",
"tray",
"custom/gpu-screen-recorder",
"custom/gamemode",
"clock"
],
"hyprland/workspaces": {
"format": "{icon}",
@@ -70,7 +74,7 @@
"return-type": "json",
"exec": "~/.config/waybar/scripts/bluetooth_audio.sh",
"interval": 3,
"on-click": "~/.config/waybar/scripts/bluetooth_audio.sh disconnect"
"on-click": "~/.config/waybar/scripts/bluetooth_audio.sh disconnect & disown"
},
"pulseaudio": {
@@ -85,7 +89,7 @@
"car": "",
"default": ["", ""]
},
"on-click": "pavucontrol"
"on-click": "pavucontrol & disown"
},
"tray": {
"icon-size": 18,
@@ -94,7 +98,7 @@
"custom/power": {
"format": "",
"tooltip": false,
"on-click": "~/.config/hypr/scripts/powermenu.sh"
"on-click": "~/.config/hypr/scripts/powermenu.sh & disown"
},
"custom/tlp": {
"format": "{}",
@@ -119,42 +123,44 @@
"return-type": "json",
"exec": "~/.config/waybar/scripts/pixelbuds_pro_control.sh",
"interval": 5,
"on-click": "~/.config/waybar/scripts/pixelbuds_pro_control.sh connect",
"on-click-right": "~/.config/waybar/scripts/pixelbuds_pro_control.sh cycle_anc"
"on-click": "~/.config/waybar/scripts/pixelbuds_pro_control.sh connect & disown",
"on-click-right": "~/.config/waybar/scripts/pixelbuds_pro_control.sh cycle_anc & disown"
},
"custom/audio-output": {
"format": "{}",
"return-type": "json",
"exec": "/home/narl/.config/waybar/scripts/audio.sh show",
"on-click": "/home/narl/.config/waybar/scripts/audio.sh cycle",
"on-click": "/home/narl/.config/waybar/scripts/audio.sh cycle & disown",
"interval": 1
},
"custom/gamemode": {
"format": "{}",
"return-type": "json",
"exec": "~/.config/waybar/scripts/gamemode_status.sh",
"on-click": "~/.config/hypr/scripts/gamemode.sh",
"on-click": "~/.config/hypr/scripts/gamemode.sh & disown",
"interval": 1
},
"custom/gpu-screen-recorder": {
"format": "{}",
"return-type": "json",
"exec": "~/.config/waybar/scripts/gpu-screen-recorder-status.sh",
"on-click-right": "~/.config/hypr/scripts/replay-ctrl.sh save",
"on-click-middle": "nautilus ~/Videos/replay",
"on-click": "~/.config/waybar/scripts/toggle-replay.sh",
"on-click-right": "~/.config/hypr/scripts/replay-ctrl.sh save & disown",
"on-click-middle": "nautilus ~/Videos/replay & disown",
"on-click": "~/.config/waybar/scripts/toggle-replay.sh & disown",
"interval": 1
},
"custom/gpu": {
"format": "{}",
"return-type": "json",
"exec": "~/.config/waybar/scripts/gpu_info.sh",
"on-click": "lact gui & disown",
"interval": 3
},
"custom/cpu": {
"format": "{}",
"return-type": "json",
"exec": "~/.config/waybar/scripts/cpu_info.sh",
"on-click": "zenmonitor & disown",
"interval": 3
},
"custom/mem": {
@@ -162,5 +168,35 @@
"return-type": "json",
"exec": "~/.config/waybar/scripts/memory.sh",
"interval": 3
},
"custom/btrfs": {
"format": "{}",
"exec": "~/.config/waybar/scripts/btrfs.sh",
"return-type": "json",
"interval": 30
},
"custom/disk-root": {
"format": "{}",
"return-type": "json",
"exec": "~/.config/waybar/scripts/disk_info.sh /",
"interval": 30
},
"custom/disk-gdrive": {
"format": "{}",
"return-type": "json",
"exec": "~/.config/waybar/scripts/disk_info.sh ~/gdrive",
"interval": 30
},
"custom/disk-data": {
"format": "{}",
"return-type": "json",
"exec": "~/.config/waybar/scripts/disk_info.sh ~/data",
"interval": 30
},
"custom/disk-games": {
"format": "{}",
"return-type": "json",
"exec": "~/.config/waybar/scripts/disk_info.sh ~/games",
"interval": 30
}
}

45
waybar/scripts/btrfs.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
# Get BTRFS filesystems
btrfs_filesystems=$(df -hT | grep btrfs)
# Initialize variables
total_used=0
total_size=0
# Process each BTRFS filesystem
while read -r line; do
size_str=$(echo "$line" | awk '{print $3}')
used_str=$(echo "$line" | awk '{print $4}')
size=$(echo "$size_str" | sed 's/[GT]//')
used=$(echo "$used_str" | sed 's/[GT]//')
if [[ $size_str == *T ]]; then
size=$(awk -v s="$size" 'BEGIN {print s*1024}')
fi
if [[ $used_str == *T ]]; then
used=$(awk -v u="$used" 'BEGIN {print u*1024}')
fi
total_size=$(awk -v total="$total_size" -v size="$size" 'BEGIN {print total+size}')
total_used=$(awk -v total="$total_used" -v used="$used" 'BEGIN {print total+used}')
done <<< "$btrfs_filesystems"
# Calculate usage percentage
usage_percentage=$(awk -v used="$total_used" -v total="$total_size" 'BEGIN {printf "%.0f", (used/total)*100}')
# Set class based on usage
if [ "$usage_percentage" -gt 95 ]; then
class="max"
elif [ "$usage_percentage" -gt 80 ]; then
class="high"
else
class="normal"
fi
text="$(printf "%.0f" $total_used)G / $(printf "%.0f" $total_size)G"
# Manually construct the JSON output
echo "{\"text\": \"$text\", \"tooltip\": \"\", \"class\": \"$class\"}"

View File

@@ -5,7 +5,7 @@ TEXT="$(printf "%.1f" $(echo "$USAGE"))% $(printf "%.1f" $(echo "scale=2; $TEMP"
CPU=$(lscpu | grep 'Model name' | awk -F': ' '{print $2}' | sed 's/^[ \t]*//')
# TOOLTIP=$(ps -eo %cpu,comm --sort=-%cpu | head -n 6 | sed '1d' | awk '{output = output sprintf("%.1f%%\t%s\\n", $1, $2)} END {printf "%s", output}')
# TOOLTIP=$(ps -eo %cpu,comm --sort=-%cpu | head -n 6 | sed '1d' | awk -v ncores=$(nproc) '{printf "%.1f%%\t%s\n", $1/ncores, $2}')
TOOLTIP=$(ps -eo %cpu,comm --sort=-%cpu | head -n 6 | sed '1d' | awk -v ncores=$(nproc) '{printf "%.1f%%\t%s\\n", $1/ncores, $2}')
# TOOLTIP=$(ps -eo %cpu,comm --sort=-%cpu | head -n 6 | sed '1d' | awk -v ncores=$(nproc) '{printf "%.1f%%\t%s\\n", $1/ncores, $2}')
# TOOLTIP=$(top -b -n 1 | sed '1,7d' | head -n 5 | awk '{output = output sprintf("%.1f%%\t%s\\n", $9, $12)} END {printf "%s", output}')
CLASS=""
@@ -18,4 +18,5 @@ else
CLASS="normal"
fi
echo "{\"text\":\"CPU: $TEXT\", \"tooltip\": \"$TOOLTIP\", \"class\":\"$CLASS\"}"
# echo "{\"text\":\"CPU: $TEXT\", \"tooltip\": \"$TOOLTIP\", \"class\":\"$CLASS\"}"
echo "{\"text\":\"CPU: $TEXT\", \"class\":\"$CLASS\"}"

31
waybar/scripts/disk_info.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 <mountpoint>"
exit 1
fi
MOUNTPOINT=$1
# Get disk usage info
USED=$(df -h --output=used "$MOUNTPOINT" | sed '1d' | awk '{print $1}')
TOTAL=$(df -h --output=size "$MOUNTPOINT" | sed '1d' | awk '{print $1}')
PERCENTAGE=$(df --output=pcent "$MOUNTPOINT" | sed '1d' | tr -d '%' | awk '{print $1}')
# Set class based on usage
CLASS="normal"
if [ "$PERCENTAGE" -gt 95 ]; then
CLASS="max"
elif [ "$PERCENTAGE" -gt 80 ]; then
CLASS="high"
fi
# Create tooltip with more details
TOOLTIP=$(df -h "$MOUNTPOINT" | sed '1d' | awk '{printf "Used: %s\nTotal: %s\nFree: %s", $3, $2, $4}')
# Output JSON for Waybar using jq
jq -n -c \
--arg text "$1 $USED/$TOTAL" \
--arg tooltip "$TOOLTIP" \
--arg class "$CLASS" \
'{"text": $text, "tooltip": $tooltip, "class": $class}'

View File

@@ -1,6 +1,6 @@
#!/bin/sh
TOOLTIP=$(ps -eo rss,comm --sort=-rss | head -n 6 | sed '1d' | awk '{output = output sprintf("%.2f GB\t%s\\n", $1/1024/1024, $2)} END {printf "%s", output}')
# TOOLTIP=$(ps -eo rss,comm --sort=-rss | head -n 6 | sed '1d' | awk '{output = output sprintf("%.2f GB\t%s\\n", $1/1024/1024, $2)} END {printf "%s", output}')
TOTAL=$(awk '/MemTotal/ {printf "%.2f\n", $2/1024/1024}' /proc/meminfo)
USED=$(awk '/MemTotal/ {total=$2} /MemAvailable/ {available=$2} END {printf "%.2f\n", (total-available)/1024/1024}' /proc/meminfo)
RATIO=$(echo "$USED/ $TOTAL" | bc -l)
@@ -15,4 +15,5 @@ else
CLASS="normal"
fi
printf '{"text": "%s/%sGB", "tooltip": "%s", "class": "%s"}' "$USED" "$TOTAL" "$TOOLTIP" "$CLASS"
# printf '{"text": "%s/%sGB", "tooltip": "%s", "class": "%s"}' "$USED" "$TOTAL" "$TOOLTIP" "$CLASS"
printf '{"text": "%s/%sGB", "class": "%s"}' "$USED" "$TOTAL" "$CLASS"

View File

@@ -21,9 +21,6 @@ window#waybar.hidden {
opacity: 0.5;
}
#workspaces {
}
#workspaces button {
all: initial;
/* Remove GTK theme values (waybar #1351) */
@@ -32,8 +29,8 @@ window#waybar.hidden {
box-shadow: inset 0 -3px transparent;
/* Use box-shadow instead of border so the text isn't offset */
padding: 6px 18px;
margin: 6px 3px;
border-radius: 4px;
margin: 0px 3px;
border-radius: 10px;
background-color: @base;
color: @subtext0;
}
@@ -68,12 +65,17 @@ window#waybar.hidden {
#network,
#clock,
#tray,
#custom-disk-root,
#custom-disk-gdrive,
#custom-disk-games,
#custom-disk-data,
#custom-pixelbuds_pro,
#custom-bluetooth-audio,
#custom-audio-output,
#custom-btrfs,
#custom-gpu-screen-recorder {
border-radius: 4px;
margin: 6px 3px;
border-radius: 10px;
margin: 0px 3px;
padding: 6px 12px;
background-color: @base;
color: @text;
@@ -134,8 +136,8 @@ window#waybar.hidden {
#custom-gpu-screen-recorder.recording,
#custom-gamemode.active {
color: @blue;
border-bottom: 3px solid @blue;
color: @maroon;
border-bottom: 3px solid @maroon;
}
#custom-tlp {
@@ -178,23 +180,39 @@ window#waybar.hidden {
#custom-gpu.max,
#custom-cpu.max,
#custom-mem.max {
#custom-mem.max,
#custom-btrfs.max,
#custom-disk-root.max,
#custom-disk-gdrive.max,
#custom-disk-games.max,
#custom-disk-data.max {
color: @maroon;
/* border-bottom: 3px solid @maroon; */
}
#custom-gpu.high,
#custom-gpu.high,
#custom-mem.high {
#custom-mem.high,
#custom-btrfs.high,
#custom-disk-root.high,
#custom-disk-gdrive.high,
#custom-disk-games.high,
#custom-disk-data.high {
color: @yellow;
/* border-bottom: 3px solid @yellow; */
}
#memory,
#cpu,
#cpu,
#disk,
#custom-gpu.normal,
#custom-cpu.normal,
#custom-mem.normal {
#custom-mem.normal,
#custom-btrfs.normal,
#custom-disk-root.normal,
#custom-disk-gdrive.normal,
#custom-disk-games.normal,
#custom-disk-data.normal {
color: @blue;
/* border-bottom: 3px solid @mauve; */
}
@@ -226,7 +244,7 @@ window#waybar.hidden {
}
tooltip {
border-radius: 8px;
border-radius: 10px;
padding: 15px;
background-color: @base;
}