diff --git a/brave-flags.conf b/brave-flags.conf index 7d00f51..120593b 100644 --- a/brave-flags.conf +++ b/brave-flags.conf @@ -1 +1,4 @@ ---enable-features=AcceleratedVideoDecodeLinuxGL,DefaultANGLEVulkan,VaapiIgnoreDriverChecks,Vulkan,VulkanFromANGLE,PlatformHEVCDecoderSupport,AcceleratedVideoDecodeLinuxGL,AcceleratedVideoDecodeLinuxZeroCopyGL,AcceleratedVideoEncoder --use-angle=vulkan --use-gl=angle --ozone-platform=wayland +--enable-features=AcceleratedVideoDecodeLinuxGL,DefaultANGLEVulkan,VaapiIgnoreDriverChecks,Vulkan,VulkanFromANGLE,PlatformHEVCDecoderSupport,AcceleratedVideoDecodeLinuxGL,AcceleratedVideoDecodeLinuxZeroCopyGL,AcceleratedVideoEncoder +--use-angle=vulkan +--use-gl=angle +--ozone-platform=wayland diff --git a/btop/btop.conf b/btop/btop.conf index 71caf6d..694fb6a 100644 --- a/btop/btop.conf +++ b/btop/btop.conf @@ -57,7 +57,7 @@ update_ms = 2000 #* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", #* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. -proc_sorting = "pid" +proc_sorting = "cpu direct" #* Reverse sorting order, True or False. proc_reversed = False diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 5ac20b5..1914970 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -1,5 +1,6 @@ # narls hyprland dotfiles +source = ~/.config/hypr/modules/plugins.conf source = ~/.config/hypr/modules/monitors.conf @@ -16,3 +17,4 @@ source = ~/.config/hypr/modules/input.conf source = ~/.config/hypr/modules/keybinds.conf source = ~/.config/hypr/modules/window_rules.conf + diff --git a/hypr/modules/env.conf b/hypr/modules/env.conf index bdfa8d8..a16fbad 100644 --- a/hypr/modules/env.conf +++ b/hypr/modules/env.conf @@ -11,3 +11,4 @@ env = QT_QPA_PLATFORMTHEME,qt6ct env = LIBVA_DRIVER_NAME,radeonsi env = VDPAU_DRIVER,radeonsi env = MOZ_ENABLE_WAYLAND,1 +env = ELECTRON_OZONE_PLATFORM_HINT,wayland diff --git a/hypr/modules/plugins.conf b/hypr/modules/plugins.conf new file mode 100644 index 0000000..f324253 --- /dev/null +++ b/hypr/modules/plugins.conf @@ -0,0 +1,38 @@ +exec-once = hyprpm reload -n + +# plugin:hyprfocus { +# enabled = yes +# animate_floating = yes +# animate_workspacechange = yes +# focus_animation = shrink +# # Beziers for focus animations +# bezier = bezIn, 0.5,0.0,1.0,0.5 +# bezier = bezOut, 0.0,0.5,0.5,1.0 +# bezier = overshot, 0.05, 0.9, 0.1, 1.05 +# bezier = smoothOut, 0.36, 0, 0.66, -0.56 +# bezier = smoothIn, 0.25, 1, 0.5, 1 +# bezier = realsmooth, 0.28,0.29,.69,1.08 +# # Flash settings +# flash { +# flash_opacity = 0.95 +# in_bezier = realsmooth +# in_speed = 0.5 +# out_bezier = realsmooth +# out_speed = 3 +# } +# # Shrink settings +# shrink { +# shrink_percentage = 0.95 +# in_bezier = realsmooth +# in_speed = 1 +# out_bezier = realsmooth +# out_speed = 2 +# } +# } +# +# plugin:csgo-vulkan-fix { +# res_w = 1280 +# res_h = 960 +# class = gamescope +# fix_mouse = true +# } diff --git a/hypr/modules/window_rules.conf b/hypr/modules/window_rules.conf index d35d215..1e5a1bc 100644 --- a/hypr/modules/window_rules.conf +++ b/hypr/modules/window_rules.conf @@ -11,56 +11,74 @@ windowrulev2=noblur,class:^()$,title:^()$ # games for tearing add the immediate rule -windowrule = immediate, class:^(cs2)$ -windowrule = immediate, class:^(gamescope)$ # Float Windows -windowrule=float,title:^(Open File)$ -windowrule=float,title:^(Select a File)$ -windowrule=float,title:^(Choose a file)$ -windowrule=float,title:^(Save As)$ -windowrule=float,title:^(Save File)$ -windowrule=float,title:^(branchdialog)$ -windowrule=float,title:^(pinentry-gtk-2)$ -windowrule=float,title:^(Confirm to replace files)$ -windowrule=float,title:^(File Operation Progress)$ -windowrule=float,class:^(pavucontrol|blueman-manager|nm-connection-editor)$ +windowrulev2=float,title:^(Open File)$ +windowrulev2=float,title:^(Select a File)$ +windowrulev2=float,title:^(Choose a file)$ +windowrulev2=float,title:^(Save As)$ +windowrulev2=float,title:^(Save File)$ +windowrulev2=float,title:^(branchdialog)$ +windowrulev2=float,title:^(pinentry-gtk-2)$ +windowrulev2=float,title:^(Confirm to replace files)$ +windowrulev2=float,title:^(File Operation Progress)$ +windowrulev2=float,class:^(pavucontrol|blueman-manager|nm-connection-editor)$ # Center and Resize Windows -windowrule=size 800 600,title:^(Open File)$ -windowrule=size 800 600,title:^(Select a File)$ -windowrule=size 800 600,title:^(Choose a file)$ -windowrule=size 800 600,title:^(Save As)$ -windowrule=size 800 600,title:^(Save File)$ -windowrule=size 800 600,title:^(branchdialog)$ -windowrule=size 800 600,title:^(pinentry-gtk-2)$ -windowrule=size 800 600,title:^(Confirm to replace files)$ -windowrule=size 800 600,title:^(File Operation Progress)$ -windowrule=size 800 600,class:^(pavucontrol|blueman-manager|nm-connection-editor)$ -windowrule=center,title:^(Open File)$ -windowrule=center,title:^(Select a File)$ -windowrule=center,title:^(Choose a file)$ -windowrule=center,title:^(Save As)$ -windowrule=center,title:^(Save File)$ -windowrule=center,title:^(branchdialog)$ -windowrule=center,title:^(pinentry-gtk-2)$ -windowrule=center,title:^(Confirm to replace files)$ -windowrule=center,title:^(File Operation Progress)$ -windowrule=center,class:^(pavucontrol|blueman-manager|nm-connection-editor)$ -windowrule=noblur,title:^(Open File)$ -windowrule=noblur,title:^(Select a File)$ -windowrule=noblur,title:^(Choose a file)$ -windowrule=noblur,title:^(Save As)$ -windowrule=noblur,title:^(Save File)$ -windowrule=noblur,title:^(branchdialog)$ -windowrule=noblur,title:^(pinentry-gtk-2)$ -windowrule=noblur,title:^(Confirm to replace files)$ -windowrule=noblur,title:^(File Operation Progress)$ -windowrule=noblur,class:^(pavucontrol|blueman-manager|nm-connection-editor)$ +windowrulev2=size 800 600,title:^(Open File)$ +windowrulev2=size 800 600,title:^(Select a File)$ +windowrulev2=size 800 600,title:^(Choose a file)$ +windowrulev2=size 800 600,title:^(Save As)$ +windowrulev2=size 800 600,title:^(Save File)$ +windowrulev2=size 800 600,title:^(branchdialog)$ +windowrulev2=size 800 600,title:^(pinentry-gtk-2)$ +windowrulev2=size 800 600,title:^(Confirm to replace files)$ +windowrulev2=size 800 600,title:^(File Operation Progress)$ +windowrulev2=size 800 600,class:^(pavucontrol|blueman-manager|nm-connection-editor)$ +windowrulev2=center,title:^(Open File)$ +windowrulev2=center,title:^(Select a File)$ +windowrulev2=center,title:^(Choose a file)$ +windowrulev2=center,title:^(Save As)$ +windowrulev2=center,title:^(Save File)$ +windowrulev2=center,title:^(branchdialog)$ +windowrulev2=center,title:^(pinentry-gtk-2)$ +windowrulev2=center,title:^(Confirm to replace files)$ +windowrulev2=center,title:^(File Operation Progress)$ +windowrulev2=center,class:^(pavucontrol|blueman-manager|nm-connection-editor)$ +windowrulev2=noblur,title:^(Open File)$ +windowrulev2=noblur,title:^(Select a File)$ +windowrulev2=noblur,title:^(Choose a file)$ +windowrulev2=noblur,title:^(Save As)$ +windowrulev2=noblur,title:^(Save File)$ +windowrulev2=noblur,title:^(branchdialog)$ +windowrulev2=noblur,title:^(pinentry-gtk-2)$ +windowrulev2=noblur,title:^(Confirm to replace files)$ +windowrulev2=noblur,title:^(File Operation Progress)$ +windowrulev2=noblur,class:^(pavucontrol|blueman-manager|nm-connection-editor)$ # Workspace Rules # windowrule=workspace 1,class:^(firefox)$ # windowrule=workspace 2,class:^(kitty)$ # windowrule=workspace 3,class:^(Code)$ -# windowrule=workspace 4,class:^(steam)$ -# windowrule=workspace 5,class:^(discord)$ + + +windowrulev2=workspace special:magic silent,class:^(Spotify)$ +windowrulev2=workspace special:magic silent,class:^(discord|vesktop)$ + +# steam rules + +windowrulev2=workspace 3 silent, class:^(steam)$, title:^(Steam)$ +windowrulev2=workspace 4, class:^(gamescope)$ + +# fixed sizes for different windows +windowrulev2=size 400 800,title:^(Friends List)$ class:^(steam)$ +windowrulev2=size 1000 800,title:^(Steam Settings)$ class:^(steam)$ +windowrulev2=size 1000 800,title:^(Add Non-Steam Game)$ class:^(steam)$ + +# float windows that arent the main steam window +windowrulev2 = float, class:^(steam)$, title:negative:^(Steam)$ +windowrulev2 = noblur, class:^(steam)$, title:negative:^(Steam)$ +# windowrulev2 = center, class:^(steam)$, title:negative:^(Steam)$ + +# allow tearing for games started with gamescope +windowrulev2 = immediate, class:^(gamescope)$ diff --git a/waybar/config.jsonc b/waybar/config.jsonc index 1ce5a0d..573f86d 100644 --- a/waybar/config.jsonc +++ b/waybar/config.jsonc @@ -3,23 +3,24 @@ "layer": "top", "position": "top", "height": 50, - "modules-left": ["hyprland/workspaces"], + "modules-left": [ + "hyprland/workspaces" + ], "modules-center": [], "modules-right": [ - "custom/bluetooth-audio", - "custom/pixelbuds_pro", + // "custom/bluetooth-audio", + // "custom/pixelbuds_pro", + "custom/mem", + "custom/cpu", + "custom/gpu", "network", - "cpu", - "memory", - "custom/gpu-usage", + "custom/audio-output", + "wireplumber", + "tray", "custom/gpu-screen-recorder", "custom/gamemode", - "tray", - "wireplumber", "clock" ], - - "hyprland/workspaces": { "format": "{icon}", "on-click": "activate" @@ -34,18 +35,14 @@ "on-click-right": "xdg-open https://calendar.proton.me/u/0/month &> /dev/null & disown", "tooltip": false, }, - "custom/gpu": { - "format": "GPU: {}%", - "exec": "~/.config/waybar/scripts/gpu_usage.sh", - "interval": 1, - "tooltip": true - }, "cpu": { "format": "CPU: {usage}%", - "tooltip": true + "tooltip": true, + "interval": 1 }, "memory": { - "format": "MEM: {used}/{total}GB" + "format": "MEM: {used}/{total}GB", + "interval": 3 }, "network": { "format-wifi": "{essid} ({signalStrength}%): {ipaddr}", @@ -55,14 +52,14 @@ }, "wireplumber": { "format": "{volume}% {icon}", - "format-muted": "{node_name} ", + "format-muted": "--- ", "format-icons": { "headphone": "", "hands-free": "", "default": ["", "", ""] }, "on-click": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle", - "on-click-right": "~/.config/waybar/scripts/cycle_audio_output.sh", + "on-click-right": "~/.config/waybar/scripts/audio.sh cycle", "on-click-middle": "pavucontrol", "scroll-step": 1 }, @@ -127,29 +124,42 @@ "custom/audio-output": { "format": "{}", "return-type": "json", - "exec": "/home/narl/.config/waybar/scripts/get_audio_output.sh", - "on-click": "/home/narl/.config/waybar/scripts/cycle_audio_output.sh", - "interval": 1 + "exec": "/home/narl/.config/waybar/scripts/audio.sh show", + "on-click": "/home/narl/.config/waybar/scripts/audio.sh cycle", + "interval": 5 }, "custom/gamemode": { "format": "{}", "return-type": "json", "exec": "~/.config/waybar/scripts/gamemode_status.sh", "on-click": "~/.config/hypr/scripts/gamemode.sh", - "interval": 1 + "interval": 5 }, "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", - "interval": 1 + "interval": 5 }, - "custom/gpu-usage": { + "custom/gpu": { "format": "{}", "return-type": "json", - "exec": "~/.config/waybar/scripts/gpu_usage.sh", - "interval": 5 + "exec": "~/.config/waybar/scripts/gpu_info.sh", + "interval": 3 + }, + "custom/cpu": { + "format": "{}", + "return-type": "json", + "exec": "~/.config/waybar/scripts/cpu_info.sh", + "interval": 3 + }, + "custom/mem": { + "format": "{}", + "return-type": "json", + "exec": "~/.config/waybar/scripts/memory.sh", + "interval": 3 } } diff --git a/waybar/scripts/audio.sh b/waybar/scripts/audio.sh new file mode 100755 index 0000000..d94086a --- /dev/null +++ b/waybar/scripts/audio.sh @@ -0,0 +1,40 @@ +#!/bin/bash +DEFAULT_SINK=$(pactl info | grep 'Default Sink' | cut -d ' ' -f3) +DESCRIPTION=$(pactl list sinks | grep -A2 "Name: $DEFAULT_SINK" | grep "Description:" | cut -d ' ' -f2-) + + +case $1 in + cycle) + SINKS=($(pactl list short sinks | awk '{print $2}')) + NUM_SINKS=${#SINKS[@]} + CURRENT_SINK=$(pactl info | grep 'Default Sink' | cut -d ' ' -f3) + + for i in "${!SINKS[@]}"; do + if [[ "${SINKS[$i]}" == "$CURRENT_SINK" ]]; then + NEXT_INDEX=$(( (i + 1) % NUM_SINKS )) + pactl set-default-sink "${SINKS[$NEXT_INDEX]}" + exit 0 + fi + done + ;; + show) + TEXT=$(echo "$DESCRIPTION" | cut -c -20) + if [ -z "$DESCRIPTION" ]; then + DESCRIPTION=$DEFAULT_SINK + fi + CLASS="" + case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in + yes) + CLASS="muted" + ;; + no) + CLASS="unmuted" + ;; + esac + + printf '{"text": "%s", "tooltip": "%s", "class": "%s"}' "$TEXT" "$DESCRIPTION" "$CLASS" + ;; + *) + echo "usage audio.sh {cycle|show}" + ;; +esac diff --git a/waybar/scripts/cpu_info.sh b/waybar/scripts/cpu_info.sh new file mode 100755 index 0000000..942670f --- /dev/null +++ b/waybar/scripts/cpu_info.sh @@ -0,0 +1,21 @@ +#!/bin/bash +USAGE=$(mpstat 1 1 | awk '/Average:/ {print 100 - $12}') +TEMP=$(cat /sys/class/hwmon/hwmon3/temp1_input) +TEXT="$(printf "%.1f" $(echo "$USAGE"))% TEMP: $(printf "%.1f" $(echo "scale=2; $TEMP"/1000 | bc -l))C" +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=$(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="" + +if (( $(echo "$USAGE > 95" | bc -l) )); then + CLASS="max" +elif (( $(echo "$USAGE > 75" | bc -l) )); then + CLASS="high" +else + CLASS="normal" +fi + +echo "{\"text\":\"CPU: $TEXT\", \"tooltip\": \"$TOOLTIP\", \"class\":\"$CLASS\"}" diff --git a/waybar/scripts/cycle_audio_output.sh b/waybar/scripts/cycle_audio_output.sh deleted file mode 100755 index 4cc214c..0000000 --- a/waybar/scripts/cycle_audio_output.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -SINKS=($(pactl list short sinks | awk '{print $2}')) -CURRENT_SINK=$(pactl info | grep 'Default Sink' | cut -d ' ' -f3) -NUM_SINKS=${#SINKS[@]} - -for i in "${!SINKS[@]}"; do - if [[ "${SINKS[$i]}" == "$CURRENT_SINK" ]]; then - NEXT_INDEX=$(( (i + 1) % NUM_SINKS )) - pactl set-default-sink "${SINKS[$NEXT_INDEX]}" - break - fi -done diff --git a/waybar/scripts/gamemode_status.sh b/waybar/scripts/gamemode_status.sh index 8079ef7..1d54671 100755 --- a/waybar/scripts/gamemode_status.sh +++ b/waybar/scripts/gamemode_status.sh @@ -1,7 +1,10 @@ #!/usr/bin/env sh + +FORMAT_ACTIVATED="󰊖" +FORMAT_DEACTIVATED="" HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}') if [ "$HYPRGAMEMODE" = 1 ] ; then - echo '{"text": "Gamemode", "tooltip": "Gamemode deactivated"}' + printf "{\"text\": \"$FORMAT_DEACTIVATED\", \"tooltip\": \"Gamemode deactivated\"}" else - echo '{"text": "Gamemode", "tooltip": "Gamemode activated", "class": "active"}' + printf "{\"text\": \"$FORMAT_ACTIVATED\", \"tooltip\": \"Gamemode activated\", \"class\": \"active\"}" fi diff --git a/waybar/scripts/get_audio_output.sh b/waybar/scripts/get_audio_output.sh deleted file mode 100755 index 30d10bb..0000000 --- a/waybar/scripts/get_audio_output.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -DEFAULT_SINK=$(pactl info | grep 'Default Sink' | cut -d ' ' -f3) -DESCRIPTION=$(pactl list sinks | grep -A2 "Name: $DEFAULT_SINK" | grep "Description:" | cut -d ' ' -f2-) - -if [ -z "$DESCRIPTION" ]; then - DESCRIPTION=$DEFAULT_SINK -fi - -TEXT=$(echo "$DESCRIPTION" | cut -c -20) - -printf '{"text": "%s", "tooltip": "%s"} -' "$TEXT" "$DESCRIPTION" diff --git a/waybar/scripts/gpu-screen-recorder-status.sh b/waybar/scripts/gpu-screen-recorder-status.sh index ad498d0..3f67326 100755 --- a/waybar/scripts/gpu-screen-recorder-status.sh +++ b/waybar/scripts/gpu-screen-recorder-status.sh @@ -1,18 +1,20 @@ #!/bin/bash PID_FILE="/tmp/gpu-screen-recorder.pid" +FORMAT_RECORDING="" +FORMAT_STOPPED="" if [ -f "$PID_FILE" ]; then PID=$(cat "$PID_FILE") if ps -p "$PID" > /dev/null; then - echo '{"text": "Replay", "tooltip": "Replay running", "class": "recording"}' + echo "{\"text\": \"$FORMAT_RECORDING\", \"tooltip\": \"Replay running\", \"class\": \"recording\"}" else # The process is not running, but the PID file exists. # This can happen if the process crashed. # We'll remove the stale PID file. rm "$PID_FILE" - echo '{"text": "Replay", "tooltip": "Replay paused"}' + echo "{\"text\": \"$FORMAT_STOPPED\", \"tooltip\": \"Replay paused\"}" fi else - echo '{"text": "Replay", "tooltip": "Replay paused"}' + echo "{\"text\": \"$FORMAT_STOPPED\", \"tooltip\": \"Replay paused\"}" fi diff --git a/waybar/scripts/gpu_info.sh b/waybar/scripts/gpu_info.sh new file mode 100755 index 0000000..7b23ff7 --- /dev/null +++ b/waybar/scripts/gpu_info.sh @@ -0,0 +1,22 @@ +#!/bin/bash +USAGE=$(cat /sys/class/drm/card1/device/gpu_busy_percent) +MEM_USED=$(cat /sys/class/drm/card1/device/mem_info_vram_used) +MEM_TOTAL=$(cat /sys/class/drm/card1/device/mem_info_vram_total) +EDGE_TEMP=$(cat /sys/class/drm/card1/device/hwmon/hwmon2/temp1_input) +JUNC_TEMP=$(cat /sys/class/drm/card1/device/hwmon/hwmon2/temp2_input) +MEM_TEMP=$(cat /sys/class/drm/card1/device/hwmon/hwmon2/temp3_input) +GPU=$(/opt/rocm/bin/rocm-smi --showproductname | grep "Card Series" | awk -F':' '{print $3}' | xargs) +TEXT="$USAGE% $(printf "%.1f" $(echo "scale=2; $MEM_USED/1024/1024/1024" | bc -l))/$(printf "%.1f" $(echo "scale=2; $MEM_TOTAL/1024/1024/1024" | bc -l))GB TEMP: $(printf "%.1f" $(echo "scale=2; $EDGE_TEMP/1000" | bc -l))/$(printf "%.1f" $(echo "scale=2; $JUNC_TEMP/1000" | bc -l))/$(printf "%.1f" $(echo "scale=2; $MEM_TEMP/1000" | bc -l))C" +RATIO=$(echo "$MEM_USED/ $MEM_TOTAL" | bc -l) + +CLASS="" + +if (( $(echo "$USAGE > 95" | bc -l) )); then + CLASS="max" +elif (( $(echo "$USAGE > 75" | bc -l) )); then + CLASS="high" +else + CLASS="normal" +fi + +echo "{\"text\":\"GPU: $TEXT\", \"tooltip\": \"$GPU\", \"class\":\"$CLASS\"}" diff --git a/waybar/scripts/gpu_usage.sh b/waybar/scripts/gpu_usage.sh deleted file mode 100755 index 49a7d0c..0000000 --- a/waybar/scripts/gpu_usage.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -USAGE=$(cat /sys/class/drm/card1/device/gpu_busy_percent) -MEM_USED=$(cat /sys/class/drm/card1/device/mem_info_vram_used) -MEM_TOTAL=$(cat /sys/class/drm/card1/device/mem_info_vram_total) -GPU=$(/opt/rocm/bin/rocm-smi --showproductname | grep "Card Series" | awk -F':' '{print $3}' | xargs) -TEXT="$USAGE% $(printf "%.2f\n" $(echo "scale=2; $MEM_USED/1024/1024/1024" | bc -l))/$(echo "scale=2; $MEM_TOTAL/1024/1024/1024" | bc -l)GB" -RATIO=$(echo "$MEM_USED/ $MEM_TOTAL" | bc -l) - -CLASS="" - -if (( $(echo "$USAGE > 95" | bc -l) )); then - CLASS="max_usage" -elif (( $(echo "$USAGE > 75" | bc -l) )); then - CLASS="high_usage" -else - CLASS="normal_usage" -fi - -echo "{\"text\":\"GPU: $TEXT\", \"tooltip\": \"$GPU\", \"class\":\"$CLASS\"}" diff --git a/waybar/scripts/memory.sh b/waybar/scripts/memory.sh new file mode 100755 index 0000000..6c3cb39 --- /dev/null +++ b/waybar/scripts/memory.sh @@ -0,0 +1,18 @@ +#!/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}') +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) + +CLASS="" + +if (( $(echo "$RATIO> 95" | bc -l) )); then + CLASS="max" +elif (( $(echo "$RATIO> 75" | bc -l) )); then + CLASS="high" +else + CLASS="normal" +fi + +printf '{"text": "MEM: %s/%sGB", "tooltip": "%s", "class": "%s"}' "$USED" "$TOTAL" "$TOOLTIP" "$CLASS" diff --git a/waybar/scripts/pixelbuds-anc-ctrl.sh b/waybar/scripts/pixelbuds-anc-ctrl.sh deleted file mode 100755 index ab981b7..0000000 --- a/waybar/scripts/pixelbuds-anc-ctrl.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -# --- CONFIGURATION --- -# Your Pixel Buds Pro's MAC Address -MAC_ADDRESS="B4:23:A2:09:D3:53" -# --- END CONFIGURATION --- - -# First, check if the device is connected using bluetoothctl. -if bluetoothctl info "$MAC_ADDRESS" | grep -q "Connected: yes"; then - # --- DEVICE IS CONNECTED --- - - # This function gets the current ANC status and formats it for Waybar. - get_status() { - # Get the mode from pbpctrl. Redirect errors to null in case of a temporary glitch. - current_mode=$(pbpctrl get anc 2>/dev/null) - - # Fallback: If pbpctrl fails or returns 'unknown', hide the module. - # This handles cases where buds are connected but not fully ready. - if [[ $? -ne 0 || "$current_mode" == "unknown (0)"* || -z "$current_mode" ]]; then - echo "{}" - exit 0 - fi - - # Set icon and tooltip based on the current mode. - case "$current_mode" in - "active") - icon="ANC: Active" - class="anc-active" - ;; - "aware") - icon="ANC: Aware" - class="anc-aware" - ;; - "off") - icon="ANC: Off" - class="anc-off" - ;; - *) - # Failsafe to hide the module if the mode is unrecognized. - echo "{}" - exit 0 - ;; - esac - echo "{\"text\":\"$icon\", \"class\":\"$class\"}" - } - - # Handle click actions passed from Waybar. - case "$1" in - # Right-click: Cycle between active and aware modes. - cycle) - current_mode=$(pbpctrl get anc 2>/dev/null) - if [[ "$current_mode" == "active" ]]; then - pbpctrl set anc aware - else - pbpctrl set anc active - fi - sleep 0.1 # Brief pause for the state to update. - ;; - # Left-click: Turn ANC off. - off) - pbpctrl set anc off - sleep 0.1 # Brief pause for the state to update. - ;; - esac - - # Always display the current status after any action or on a scheduled interval. - get_status - -else - # --- DEVICE IS NOT CONNECTED --- - # Output an empty JSON object to completely hide the Waybar module. - echo "{}" -fi diff --git a/waybar/scripts/pixelbuds.sh b/waybar/scripts/pixelbuds.sh deleted file mode 100755 index e30f826..0000000 --- a/waybar/scripts/pixelbuds.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# --- CONFIGURATION --- -# Your Pixel Buds Pro's MAC Address -MAC_ADDRESS="B4:23:A2:09:D3:53" -# --- END CONFIGURATION --- - -# Check if the device is connected using bluetoothctl. -if bluetoothctl info "$MAC_ADDRESS" | grep -q "Connected: yes"; then - - # If connected, get battery info from pbpctrl. - if battery_output=$(pbpctrl show battery); then - # Use awk to grab the third field, which is the percentage or "unknown". - left_bud=$(echo "$battery_output" | grep "left bud:" | awk '{print $3}') - right_bud=$(echo "$battery_output" | grep "right bud:" | awk '{print $3}') - - # If both buds are unknown (e.g., case is closed and buds are out of range), - # or if the command output is empty, hide the module. - if ([[ "$left_bud" == "unknown" ]] && [[ "$right_bud" == "unknown" ]]) || \ - [[ -z "$left_bud" && -z "$right_bud" ]]; then - echo "{}" - exit 0 - fi - - # Prepare the display string for the left bud. - if [[ "$left_bud" == "unknown" ]]; then - left_display="L: ---" - else - left_display="L: $left_bud" - fi - - # Prepare the display string for the right bud. - if [[ "$right_bud" == "unknown" ]]; then - right_display="R: ---" - else - right_display="R: $right_bud" - fi - - # Format the final output for Waybar as JSON. - printf '{"text": "%s | %s", "tooltip": "Pixel Buds Pro 2", "class": "connected"}\n' "$left_display" "$right_display" - - else - # pbpctrl failed to run, so hide the module. - echo "{}" - fi -else - # Not connected, output an empty JSON object to hide the module. - echo "{}" -fi diff --git a/waybar/scripts/power.sh b/waybar/scripts/power.sh deleted file mode 100755 index b567daa..0000000 --- a/waybar/scripts/power.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -wlogout -p layer-shell diff --git a/waybar/style.css b/waybar/style.css index 6239226..caca738 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -51,12 +51,14 @@ window#waybar.hidden { } #workspaces button.urgent { - border-bottom: 3px solid @red; + border-bottom: 3px solid @maroon; } #memory, #cpu, -#custom-gpu-usage, +#custom-gpu, +#custom-cpu, +#custom-mem, #custom-power, #custom-gamemode, #custom-tlp, @@ -77,7 +79,7 @@ window#waybar.hidden { color: @text; } -#wireplumber.muted, #custom-pixelbuds_pro { +#wireplumber.muted, #custom-pixelbuds_pro, #custom-audio-output.muted { background-color: @base; color: @subtext1; border-bottom: 3px solid @subtext1; @@ -88,6 +90,17 @@ window#waybar.hidden { padding-left: 12px; } +#custom-gpu-screen-recorder, +#custom-gpu-screen-recorder.recording { + padding-right: 18px; + padding-left: 10px; +} + +#custom-gamemode { + padding-right: 15px; + padding-left: 11px; +} + #custom-pixelbuds_pro.anc-active { color: @sapphire; border-bottom: 3px solid @sapphire; @@ -110,16 +123,19 @@ window#waybar.hidden { #custom-gpu-screen-recorder, #custom-gamemode { - color: @teal; + background-color: @base; + color: @subtext1; + border-bottom: 3px solid @subtext1; } #custom-power { - color: @red; + color: @maroon; } #custom-gpu-screen-recorder.recording, #custom-gamemode.active { - color: @red; + color: @teal; + border-bottom: 3px solid @teal; } #custom-tlp { @@ -160,24 +176,28 @@ window#waybar.hidden { } } -#custom-gpu-usage.max_usage { +#custom-gpu.max, +#custom-cpu.max, +#custom-mem.max { color: @maroon; - border-bottom: 3px solid @maroon; + /* border-bottom: 3px solid @maroon; */ } -#custom-gpu-usage.high_usage { +#custom-gpu.high, +#custom-gpu.high, +#custom-mem.high { color: @yellow; - border-bottom: 3px solid @yellow; + /* border-bottom: 3px solid @yellow; */ } -#custom-gpu-usage.normal_usage { - color: @teal; - border-bottom: 3px solid @teal; -} - -#memory, #cpu, #network { - color: @mauve; - border-bottom: 3px solid @mauve; +#memory, +#cpu, +#network, +#custom-gpu.normal, +#custom-cpu.normal, +#custom-mem.normal { + color: @lavender; + /* border-bottom: 3px solid @mauve; */ } @@ -186,12 +206,18 @@ window#waybar.hidden { } #wireplumber { - padding-right: 15px; + padding-right: 16px; } -#clock, #custom-audio-output, #wireplumber { - color: @teal; - border-bottom: 3px solid @teal; +#custom-audio-output.unmuted, #wireplumber { + color: @maroon; + border-bottom: 3px solid @maroon; +} + + + +#clock { + color: @maroon; } #network {