Wallpaper picker, wallust theming, waybar improvements
Browse files at this commit605b23ba3955f72966bd9a22ea4d1babf5c32eaaParent: 6529437- feat
- wallpaper picker, wallust theming, waybar improvements
8 changed files +254 -81
- .config/hypr/hyprland.conf +44 -30
- .config/hypr/hyprpaper.conf +1 -6
- .config/scripts/hyprland/toggle_monitors.sh +32 -0
- .config/scripts/hyprland/wallpaper_picker.sh +71 -0
- .config/scripts/shared/song_detail.sh +42 -23
- .config/scripts/shared/wallust_run.sh +35 -0
- .config/waybar/config +18 -1
- .config/waybar/style.css +11 -21
.config/hypr/hyprland.confmodified+44 -30
| @@ -4,6 +4,7 @@ monitor = DP-1, 2560x1440@180, 0x0, 1, bitdepth, 10 | |||
| 4 | monitor = HDMI-A-1, 1920x1080@75, 2560x0, 1, bitdepth, 10 | 4 | monitor = HDMI-A-1, 1920x1080@75, 2560x0, 1, bitdepth, 10 |
| 5 | # monitor = eDP-1, disable | 5 | # monitor = eDP-1, disable |
| 6 | # monitor = HDMI-A-1, disable | 6 | # monitor = HDMI-A-1, disable |
| 7 | +# monitor = DP-1, disable | ||
| 7 | bindl = , switch:on:Lid Switch, exec, hyprctl keyword monitor "eDP-1, disable" | 8 | bindl = , switch:on:Lid Switch, exec, hyprctl keyword monitor "eDP-1, disable" |
| 8 | bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, enable" | 9 | bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, enable" |
| 9 | bindl = , switch:on:Lid Switch, exec, hyprctl keyword input:touchdevice:enabled false | 10 | bindl = , switch:on:Lid Switch, exec, hyprctl keyword input:touchdevice:enabled false |
| @@ -11,6 +12,7 @@ bindl = , switch:off:Lid Switch, exec, hyprctl keyword input:touchdevice:enabled | |||
| 11 | bindl = , switch:off:Lid Switch, exec, hyprctl reload && hyprctl keyword input:touchdevice:enabled false | 12 | bindl = , switch:off:Lid Switch, exec, hyprctl reload && hyprctl keyword input:touchdevice:enabled false |
| 12 | # bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, 2880x1800@90, 0x1080, 2" monitor = HDMI-A-1, disable | 13 | # bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, 2880x1800@90, 0x1080, 2" monitor = HDMI-A-1, disable |
| 13 | 14 | ||
| 15 | +exec-once = hyprpm reload -n | ||
| 14 | exec-once = sleep 1 && /usr/libexec/polkit-mate-authentication-agent-1 | 16 | exec-once = sleep 1 && /usr/libexec/polkit-mate-authentication-agent-1 |
| 15 | exec-once = sleep 1 && waybar | 17 | exec-once = sleep 1 && waybar |
| 16 | # exec-once = sleep 1 && eww daemon | 18 | # exec-once = sleep 1 && eww daemon |
| @@ -53,6 +55,8 @@ $signal = flatpak run org.signal.Signal | |||
| 53 | $deezer = mullvad-exclude flatpak run io.github.ungoogled_software.ungoogled_chromium --no-first-run --app="https://deezer.com/" --class=chrome-deezer.com__-Default --name=chrome-deezer.com__-Default --user-data-dir=/home/tahinli/.var/app/io.github.ungoogled_software.ungoogled_chromium/data/web-app-hub/profiles/VjW8vTQ3 | 55 | $deezer = mullvad-exclude flatpak run io.github.ungoogled_software.ungoogled_chromium --no-first-run --app="https://deezer.com/" --class=chrome-deezer.com__-Default --name=chrome-deezer.com__-Default --user-data-dir=/home/tahinli/.var/app/io.github.ungoogled_software.ungoogled_chromium/data/web-app-hub/profiles/VjW8vTQ3 |
| 54 | $mainMod = SUPER | 56 | $mainMod = SUPER |
| 55 | $my_trigger = Alt | 57 | $my_trigger = Alt |
| 58 | +$monitor_left = DP-1 | ||
| 59 | +$monitor_right = HDMI-A-1 | ||
| 56 | 60 | ||
| 57 | # bind = $my_trigger, 0, exec, bluetoothctl disconnect 00:00:00:00:00:00 && bluetoothctl connect 00:00:00:00:00:00 | 61 | # bind = $my_trigger, 0, exec, bluetoothctl disconnect 00:00:00:00:00:00 && bluetoothctl connect 00:00:00:00:00:00 |
| 58 | # bind = $my_trigger, 1, exec, playerctl previous | 62 | # bind = $my_trigger, 1, exec, playerctl previous |
| @@ -75,6 +79,9 @@ bind = $my_trigger SHIFT, F, exec, $browser_unsafe | |||
| 75 | bind = Shift, Print, exec, $screenshot_with_area_selector | 79 | bind = Shift, Print, exec, $screenshot_with_area_selector |
| 76 | bind = $mainMod, L, exec, hyprlock | 80 | bind = $mainMod, L, exec, hyprlock |
| 77 | bind = $mainMod, Escape, exec, $power_menu | 81 | bind = $mainMod, Escape, exec, $power_menu |
| 82 | +bind = $mainMod, W, exec, ~/.config/scripts/hyprland/wallpaper_picker.sh | ||
| 83 | +bind = $mainMod, M, exec, ~/.config/scripts/hyprland/toggle_monitors.sh | ||
| 84 | +bindl = $mainMod SHIFT, M, exec, ~/.config/scripts/hyprland/toggle_monitors.sh on | ||
| 78 | 85 | ||
| 79 | $discord = flatpak run dev.vencord.Vesktop | 86 | $discord = flatpak run dev.vencord.Vesktop |
| 80 | $youtube = mullvad-exclude flatpak run io.freetubeapp.FreeTube | 87 | $youtube = mullvad-exclude flatpak run io.freetubeapp.FreeTube |
| @@ -121,47 +128,48 @@ binds { | |||
| 121 | } | 128 | } |
| 122 | bindr = $mainMod, Tab, bringactivetotop | 129 | bindr = $mainMod, Tab, bringactivetotop |
| 123 | binde = $mainMod, Tab, cyclenext | 130 | binde = $mainMod, Tab, cyclenext |
| 124 | -bind = Alt, Tab, workspace, previous | 131 | +bind = Alt, Tab, workspace, previous_per_monitor |
| 125 | -bind = $mainMod SHIFT, Tab, swapactiveworkspaces, DP-1 HDMI-A-1 | 132 | +bind = $mainMod SHIFT, Tab, split:swapactiveworkspaces, $monitor_left $monitor_right |
| 126 | bind = $mainMod, P, pseudo, # dwindle | 133 | bind = $mainMod, P, pseudo, # dwindle |
| 127 | bind = $mainMod, J, togglesplit, # dwindle | 134 | bind = $mainMod, J, togglesplit, # dwindle |
| 128 | bind = $mainMod, F, togglefloating, | 135 | bind = $mainMod, F, togglefloating, |
| 129 | -bind = $mainMod, Q, focusmonitor, l | 136 | +bind = $mainMod, Q, focusmonitor, $monitor_left |
| 130 | -bind = $mainMod, E, focusmonitor, r | 137 | +bind = $mainMod, E, focusmonitor, $monitor_right |
| 131 | -bind = $mainMod SHIFT, Q, movewindow, mon:l | 138 | +bind = $mainMod SHIFT, Q, movewindow, mon:$monitor_left |
| 132 | -bind = $mainMod SHIFT, E, movewindow, mon:r | 139 | +bind = $mainMod SHIFT, E, movewindow, mon:$monitor_right |
| 140 | +bind = $mainMod, I, split:grabroguewindows, | ||
| 133 | bind = $mainMod, left, movefocus, l | 141 | bind = $mainMod, left, movefocus, l |
| 134 | bind = $mainMod, right, movefocus, r | 142 | bind = $mainMod, right, movefocus, r |
| 135 | bind = $mainMod, up, movefocus, u | 143 | bind = $mainMod, up, movefocus, u |
| 136 | bind = $mainMod, down, movefocus, d | 144 | bind = $mainMod, down, movefocus, d |
| 137 | 145 | ||
| 138 | -bind = $mainMod, 1, workspace, 1 | 146 | +bind = $mainMod, 1, split:workspace, 1 |
| 139 | -bind = $mainMod, 2, workspace, 2 | 147 | +bind = $mainMod, 2, split:workspace, 2 |
| 140 | -bind = $mainMod, 3, workspace, 3 | 148 | +bind = $mainMod, 3, split:workspace, 3 |
| 141 | -bind = $mainMod, 4, workspace, 4 | 149 | +bind = $mainMod, 4, split:workspace, 4 |
| 142 | -bind = $mainMod, 5, workspace, 5 | 150 | +bind = $mainMod, 5, split:workspace, 5 |
| 143 | -bind = $mainMod, 6, workspace, 6 | 151 | +bind = $mainMod, 6, split:workspace, 6 |
| 144 | -bind = $mainMod, 7, workspace, 7 | 152 | +bind = $mainMod, 7, split:workspace, 7 |
| 145 | -bind = $mainMod, 8, workspace, 8 | 153 | +bind = $mainMod, 8, split:workspace, 8 |
| 146 | -bind = $mainMod, 9, workspace, 9 | 154 | +bind = $mainMod, 9, split:workspace, 9 |
| 147 | -bind = $mainMod, 0, workspace, 10 | 155 | +bind = $mainMod, 0, split:workspace, 10 |
| 148 | - | 156 | + |
| 149 | -bind = $mainMod SHIFT, 1, movetoworkspace, 1 | 157 | +bind = $mainMod SHIFT, 1, split:movetoworkspace, 1 |
| 150 | -bind = $mainMod SHIFT, 2, movetoworkspace, 2 | 158 | +bind = $mainMod SHIFT, 2, split:movetoworkspace, 2 |
| 151 | -bind = $mainMod SHIFT, 3, movetoworkspace, 3 | 159 | +bind = $mainMod SHIFT, 3, split:movetoworkspace, 3 |
| 152 | -bind = $mainMod SHIFT, 4, movetoworkspace, 4 | 160 | +bind = $mainMod SHIFT, 4, split:movetoworkspace, 4 |
| 153 | -bind = $mainMod SHIFT, 5, movetoworkspace, 5 | 161 | +bind = $mainMod SHIFT, 5, split:movetoworkspace, 5 |
| 154 | -bind = $mainMod SHIFT, 6, movetoworkspace, 6 | 162 | +bind = $mainMod SHIFT, 6, split:movetoworkspace, 6 |
| 155 | -bind = $mainMod SHIFT, 7, movetoworkspace, 7 | 163 | +bind = $mainMod SHIFT, 7, split:movetoworkspace, 7 |
| 156 | -bind = $mainMod SHIFT, 8, movetoworkspace, 8 | 164 | +bind = $mainMod SHIFT, 8, split:movetoworkspace, 8 |
| 157 | -bind = $mainMod SHIFT, 9, movetoworkspace, 9 | 165 | +bind = $mainMod SHIFT, 9, split:movetoworkspace, 9 |
| 158 | -bind = $mainMod SHIFT, 0, movetoworkspace, 10 | 166 | +bind = $mainMod SHIFT, 0, split:movetoworkspace, 10 |
| 159 | 167 | ||
| 160 | bind = $mainMod, S, togglespecialworkspace, magic | 168 | bind = $mainMod, S, togglespecialworkspace, magic |
| 161 | bind = $mainMod SHIFT, S, movetoworkspace, special:magic | 169 | bind = $mainMod SHIFT, S, movetoworkspace, special:magic |
| 162 | 170 | ||
| 163 | -bind = $mainMod, mouse_down, workspace, e+1 | 171 | +bind = $mainMod, mouse_down, split:workspace, e+1 |
| 164 | -bind = $mainMod, mouse_up, workspace, e-1 | 172 | +bind = $mainMod, mouse_up, split:workspace, e-1 |
| 165 | 173 | ||
| 166 | bindm = $mainMod, mouse:272, movewindow | 174 | bindm = $mainMod, mouse:272, movewindow |
| 167 | bindm = $mainMod, mouse:273, resizewindow | 175 | bindm = $mainMod, mouse:273, resizewindow |
| @@ -190,6 +198,9 @@ windowrule = match:class kitty, opacity 0.8 | |||
| 190 | windowrule = match:class .*wezterm.*, opacity 0.8 | 198 | windowrule = match:class .*wezterm.*, opacity 0.8 |
| 191 | windowrule = match:class .*dev.heppen.webapps.*, tile on | 199 | windowrule = match:class .*dev.heppen.webapps.*, tile on |
| 192 | 200 | ||
| 201 | +# Gaming: enable tearing for fullscreen games | ||
| 202 | +windowrule = match:fullscreen 1, immediate on | ||
| 203 | + | ||
| 193 | general { | 204 | general { |
| 194 | gaps_in = 3 | 205 | gaps_in = 3 |
| 195 | gaps_out = 10 | 206 | gaps_out = 10 |
| @@ -207,7 +218,8 @@ general { | |||
| 207 | } | 218 | } |
| 208 | 219 | ||
| 209 | render { | 220 | render { |
| 210 | - cm_fs_passthrough = 2 | 221 | + cm_fs_passthrough = 0 |
| 222 | + direct_scanout = 0 | ||
| 211 | } | 223 | } |
| 212 | 224 | ||
| 213 | decoration { | 225 | decoration { |
| @@ -251,6 +263,7 @@ misc { | |||
| 251 | force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers | 263 | force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers |
| 252 | disable_hyprland_logo = true # If true disables the random hyprland logo / anime girl background. :( | 264 | disable_hyprland_logo = true # If true disables the random hyprland logo / anime girl background. :( |
| 253 | vrr = 0 | 265 | vrr = 0 |
| 266 | + mouse_move_focuses_monitor = false | ||
| 254 | } | 267 | } |
| 255 | 268 | ||
| 256 | # =================================== | 269 | # =================================== |
| @@ -269,6 +282,7 @@ input { | |||
| 269 | kb_rules = | 282 | kb_rules = |
| 270 | 283 | ||
| 271 | follow_mouse = 0 | 284 | follow_mouse = 0 |
| 285 | + mouse_refocus = false | ||
| 272 | 286 | ||
| 273 | sensitivity = 0 # -1.0 - 1.0, 0 means no modification. | 287 | sensitivity = 0 # -1.0 - 1.0, 0 means no modification. |
| 274 | 288 | ||
.config/hypr/hyprpaper.confmodified+1 -6
| @@ -1,12 +1,7 @@ | |||
| 1 | -# $location = ~/Pictures/andrew-ruiz-RbIQ3YvUREw-unsplash.jpg | ||
| 2 | -# preload = $location | ||
| 3 | -# wallpaper = eDP-1,$location | ||
| 4 | -# wallpaper = HDMI-A-1,$location | ||
| 5 | splash = false | 1 | splash = false |
| 6 | 2 | ||
| 7 | wallpaper { | 3 | wallpaper { |
| 8 | monitor = | 4 | monitor = |
| 9 | - # path = ~/Pictures/andrew-ruiz-RbIQ3YvUREw-unsplash.jpg | 5 | + path = /home/tahinli/Pictures/Wallpapers/josh-hild-RR7j6oX_3lk-unsplash.jpg |
| 10 | - path = ~/Pictures/ryunosuke-kikuno-VXp-9HwN1eg-unsplash.jpg | ||
| 11 | fit_mode = cover | 6 | fit_mode = cover |
| 12 | } | 7 | } |
.config/scripts/hyprland/toggle_monitors.shadded+32 -0
| @@ -0,0 +1,32 @@ | |||
| 1 | +#!/bin/bash | ||
| 2 | + | ||
| 3 | +# Toggle monitors off via rofi, re-enable with keybinding | ||
| 4 | + | ||
| 5 | +DP1_CONFIG="DP-1, 2560x1440@180, 0x0, 1, bitdepth, 10" | ||
| 6 | +HDMI_CONFIG="HDMI-A-1, 1920x1080@75, 2560x0, 1, bitdepth, 10" | ||
| 7 | + | ||
| 8 | +case "${1:-menu}" in | ||
| 9 | + menu) | ||
| 10 | + menu=$(echo -e "🖥️ All Monitors Off\n🖥️ DP-1 Off\n🖥️ HDMI-A-1 Off\n❌ Cancel" | rofi -dmenu -p "Monitors" -i) | ||
| 11 | + | ||
| 12 | + case "$menu" in | ||
| 13 | + "🖥️ All Monitors Off") | ||
| 14 | + hyprctl keyword monitor "HDMI-A-1, disable" | ||
| 15 | + sleep 0.5 | ||
| 16 | + hyprctl dispatch dpms off DP-1 | ||
| 17 | + ;; | ||
| 18 | + "🖥️ DP-1 Off") | ||
| 19 | + hyprctl dispatch dpms off DP-1 | ||
| 20 | + ;; | ||
| 21 | + "🖥️ HDMI-A-1 Off") | ||
| 22 | + hyprctl dispatch dpms off HDMI-A-1 | ||
| 23 | + ;; | ||
| 24 | + "❌ Cancel") | ||
| 25 | + ;; | ||
| 26 | + esac | ||
| 27 | + ;; | ||
| 28 | + on) | ||
| 29 | + hyprctl dispatch dpms on DP-1 | ||
| 30 | + hyprctl keyword monitor "$HDMI_CONFIG" | ||
| 31 | + ;; | ||
| 32 | +esac | ||
.config/scripts/hyprland/wallpaper_picker.shadded+71 -0
| @@ -0,0 +1,71 @@ | |||
| 1 | +#!/bin/bash | ||
| 2 | +# Rofi wallpaper picker — updates hyprpaper, wallust, and waybar | ||
| 3 | + | ||
| 4 | +WALLPAPER_DIR="$HOME/Pictures/Wallpapers" | ||
| 5 | +HYPRPAPER_CONF="$HOME/.config/hypr/hyprpaper.conf" | ||
| 6 | +THUMB_DIR="$HOME/.cache/wallpaper_thumbs" | ||
| 7 | + | ||
| 8 | +# Generate thumbnail cache (only for new/changed images) | ||
| 9 | +mkdir -p "$THUMB_DIR" | ||
| 10 | + | ||
| 11 | +# Remove orphan thumbnails for deleted wallpapers | ||
| 12 | +for thumb in "$THUMB_DIR"/*.png; do | ||
| 13 | + [ -f "$thumb" ] || continue | ||
| 14 | + name=$(basename "$thumb" .png) | ||
| 15 | + if ! find "$WALLPAPER_DIR" -maxdepth 1 -name "$name" -print -quit | grep -q .; then | ||
| 16 | + rm -f "$thumb" | ||
| 17 | + fi | ||
| 18 | +done | ||
| 19 | + | ||
| 20 | +# Generate thumbnails for new/changed wallpapers | ||
| 21 | +find "$WALLPAPER_DIR" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) | while read -r img; do | ||
| 22 | + name=$(basename "$img") | ||
| 23 | + thumb="$THUMB_DIR/$name.png" | ||
| 24 | + if [ ! -f "$thumb" ] || [ "$img" -nt "$thumb" ]; then | ||
| 25 | + magick "$img" -thumbnail 128x80 "$thumb" & | ||
| 26 | + fi | ||
| 27 | +done | ||
| 28 | +wait | ||
| 29 | + | ||
| 30 | +# List image files with cached thumbnails in a grid rofi | ||
| 31 | +SELECTED=$(find "$WALLPAPER_DIR" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) | sort | while read -r img; do | ||
| 32 | + name=$(basename "$img") | ||
| 33 | + echo -en "${name}\0icon\x1f${THUMB_DIR}/${name}.png\n" | ||
| 34 | +done | rofi -dmenu -p "Wallpaper" -i -show-icons \ | ||
| 35 | + -theme-str 'listview { columns: 4; lines: 3; flow: horizontal; }' \ | ||
| 36 | + -theme-str 'element { orientation: vertical; }' \ | ||
| 37 | + -theme-str 'element-icon { size: 100px; }' \ | ||
| 38 | + -theme-str 'element-text { horizontal-align: 0.5; }') | ||
| 39 | + | ||
| 40 | +if [ -z "$SELECTED" ]; then | ||
| 41 | + exit 0 | ||
| 42 | +fi | ||
| 43 | + | ||
| 44 | +WALLPAPER="$WALLPAPER_DIR/$SELECTED" | ||
| 45 | + | ||
| 46 | +if [ ! -f "$WALLPAPER" ]; then | ||
| 47 | + notify-send "Wallpaper Picker" "File not found: $WALLPAPER" | ||
| 48 | + exit 1 | ||
| 49 | +fi | ||
| 50 | + | ||
| 51 | +# Update hyprpaper config and kill both processes | ||
| 52 | +cat > "$HYPRPAPER_CONF" << EOF | ||
| 53 | +splash = false | ||
| 54 | + | ||
| 55 | +wallpaper { | ||
| 56 | + monitor = | ||
| 57 | + path = $WALLPAPER | ||
| 58 | + fit_mode = cover | ||
| 59 | +} | ||
| 60 | +EOF | ||
| 61 | + | ||
| 62 | +pkill hyprpaper | ||
| 63 | +killall waybar 2>/dev/null | ||
| 64 | + | ||
| 65 | +# Run hyprpaper and wallust in parallel | ||
| 66 | +hyprpaper &disown | ||
| 67 | +wallust run -q "$WALLPAPER" & | ||
| 68 | +wait | ||
| 69 | + | ||
| 70 | +waybar &disown | ||
| 71 | +notify-send "Wallpaper Picker" "Applied: $SELECTED" | ||
.config/scripts/shared/song_detail.shmodified+42 -23
| @@ -1,10 +1,9 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | -# Get current playing song from playerctl, prioritizing the most recently active player | 2 | +# Get current playing song from playerctl with sticky player preference |
| 3 | 3 | ||
| 4 | if command -v playerctl &> /dev/null; then | 4 | if command -v playerctl &> /dev/null; then |
| 5 | # Check if any player is running | 5 | # Check if any player is running |
| 6 | if playerctl status &> /dev/null; then | 6 | if playerctl status &> /dev/null; then |
| 7 | - # Get list of all players and find the one with most recent activity | ||
| 8 | player_list=$(playerctl -l 2>/dev/null) | 7 | player_list=$(playerctl -l 2>/dev/null) |
| 9 | 8 | ||
| 10 | if [[ -z "$player_list" ]]; then | 9 | if [[ -z "$player_list" ]]; then |
| @@ -12,37 +11,57 @@ if command -v playerctl &> /dev/null; then | |||
| 12 | exit 0 | 11 | exit 0 |
| 13 | fi | 12 | fi |
| 14 | 13 | ||
| 15 | - # Track which player has the most recent activity | 14 | + PREFERRED_FILE="/tmp/playerctl_preferred_player" |
| 16 | - most_recent_player="" | ||
| 17 | - most_recent_time=0 | ||
| 18 | 15 | ||
| 16 | + # Find first Playing and first Paused player | ||
| 17 | + best_playing="" | ||
| 18 | + best_paused="" | ||
| 19 | while IFS= read -r player; do | 19 | while IFS= read -r player; do |
| 20 | player_status=$(playerctl -p "$player" status 2>/dev/null) | 20 | player_status=$(playerctl -p "$player" status 2>/dev/null) |
| 21 | - | 21 | + if [[ "$player_status" == "Playing" && -z "$best_playing" ]]; then |
| 22 | - # Only consider players that are Playing or Paused | 22 | + best_playing="$player" |
| 23 | - if [[ "$player_status" == "Playing" ]] || [[ "$player_status" == "Paused" ]]; then | 23 | + elif [[ "$player_status" == "Paused" && -z "$best_paused" ]]; then |
| 24 | - # Get the last activity time for this player | 24 | + best_paused="$player" |
| 25 | - activity_cache="/tmp/playerctl_activity_${player}" | ||
| 26 | - current_time=$(date +%s) | ||
| 27 | - | ||
| 28 | - # Always update timestamp for any Playing or Paused player | ||
| 29 | - # This ensures we track when a player was last active (Playing or just paused) | ||
| 30 | - echo "$current_time" > "$activity_cache" | ||
| 31 | - | ||
| 32 | - # Compare timestamps to find most recent | ||
| 33 | - if [[ $current_time -gt $most_recent_time ]]; then | ||
| 34 | - most_recent_time=$current_time | ||
| 35 | - most_recent_player="$player" | ||
| 36 | - fi | ||
| 37 | fi | 25 | fi |
| 38 | done <<< "$player_list" | 26 | done <<< "$player_list" |
| 39 | 27 | ||
| 40 | - # If no active player found, exit | 28 | + # Sticky player logic: prefer current player to avoid flickering |
| 41 | - if [[ -z "$most_recent_player" ]]; then | 29 | + preferred="" |
| 30 | + if [[ -f "$PREFERRED_FILE" ]]; then | ||
| 31 | + preferred=$(cat "$PREFERRED_FILE") | ||
| 32 | + pref_status=$(playerctl -p "$preferred" status 2>/dev/null) | ||
| 33 | + # Drop preferred if it's gone or stopped | ||
| 34 | + if [[ "$pref_status" != "Playing" && "$pref_status" != "Paused" ]]; then | ||
| 35 | + preferred="" | ||
| 36 | + fi | ||
| 37 | + fi | ||
| 38 | + | ||
| 39 | + # Choose player: | ||
| 40 | + # - If preferred is still Playing, keep it (prevents flickering) | ||
| 41 | + # - If preferred is Paused but something else is Playing, switch | ||
| 42 | + # - Otherwise fall back to best available | ||
| 43 | + chosen="" | ||
| 44 | + if [[ -n "$preferred" ]]; then | ||
| 45 | + pref_status=$(playerctl -p "$preferred" status 2>/dev/null) | ||
| 46 | + if [[ "$pref_status" == "Playing" ]]; then | ||
| 47 | + chosen="$preferred" | ||
| 48 | + elif [[ -n "$best_playing" ]]; then | ||
| 49 | + chosen="$best_playing" | ||
| 50 | + else | ||
| 51 | + chosen="$preferred" | ||
| 52 | + fi | ||
| 53 | + else | ||
| 54 | + chosen="${best_playing:-$best_paused}" | ||
| 55 | + fi | ||
| 56 | + | ||
| 57 | + if [[ -z "$chosen" ]]; then | ||
| 42 | echo "" | 58 | echo "" |
| 43 | exit 0 | 59 | exit 0 |
| 44 | fi | 60 | fi |
| 45 | 61 | ||
| 62 | + echo "$chosen" > "$PREFERRED_FILE" | ||
| 63 | + | ||
| 64 | + most_recent_player="$chosen" | ||
| 46 | status=$(playerctl -p "$most_recent_player" status 2>/dev/null) | 65 | status=$(playerctl -p "$most_recent_player" status 2>/dev/null) |
| 47 | 66 | ||
| 48 | # Exit if media is stopped | 67 | # Exit if media is stopped |
.config/scripts/shared/wallust_run.shadded+35 -0
| @@ -0,0 +1,35 @@ | |||
| 1 | +#!/bin/bash | ||
| 2 | +# Runs wallust and adjusts waybar transparency based on wallpaper top strip brightness | ||
| 3 | + | ||
| 4 | +if [ -z "$1" ]; then | ||
| 5 | + echo "Usage: wallust_run.sh <wallpaper_path>" | ||
| 6 | + exit 1 | ||
| 7 | +fi | ||
| 8 | + | ||
| 9 | +# Run wallust to generate colors | ||
| 10 | +wallust run "$1" | ||
| 11 | + | ||
| 12 | +# Read the generated background color from style.css | ||
| 13 | +BG=$(grep -oP 'alpha\(#\K[0-9A-Fa-f]{6}' ~/.config/waybar/style.css | head -1) | ||
| 14 | + | ||
| 15 | +if [ -z "$BG" ]; then | ||
| 16 | + exit 0 | ||
| 17 | +fi | ||
| 18 | + | ||
| 19 | +# Analyze the TOP STRIP of the wallpaper (top 5%) where waybar actually sits | ||
| 20 | +# Crop top strip, scale to 1x1 pixel, get average brightness | ||
| 21 | +TOP_BRIGHTNESS=$(magick "$1" -gravity North -crop 100%x5%+0+0 -resize 1x1! -format "%[fx:round((0.299*r + 0.587*g + 0.114*b) * 255)]" info:) | ||
| 22 | + | ||
| 23 | +# Map brightness to alpha: | ||
| 24 | +# Dark top area (0) -> low alpha (0.2) = more transparent | ||
| 25 | +# Light top area (255) -> high alpha (0.75) = more opaque, keep text readable | ||
| 26 | +ALPHA=$(awk "BEGIN { printf \"%.2f\", 0.45 + ($TOP_BRIGHTNESS / 255.0) * 0.45 }") | ||
| 27 | + | ||
| 28 | +# Replace the alpha value in style.css | ||
| 29 | +sed -i "s/alpha(#${BG}, [0-9.]*)/alpha(#${BG}, ${ALPHA})/" ~/.config/waybar/style.css | ||
| 30 | + | ||
| 31 | +# Restart waybar | ||
| 32 | +killall waybar 2>/dev/null | ||
| 33 | +waybar &disown | ||
| 34 | + | ||
| 35 | +echo "Top strip brightness: ${TOP_BRIGHTNESS}/255 | Alpha: ${ALPHA}" | ||
.config/waybar/configmodified+18 -1
| @@ -5,7 +5,7 @@ | |||
| 5 | "spacing": 16, | 5 | "spacing": 16, |
| 6 | "modules-left": ["hyprland/workspaces", "custom/music"], | 6 | "modules-left": ["hyprland/workspaces", "custom/music"], |
| 7 | "modules-center": ["clock"], | 7 | "modules-center": ["clock"], |
| 8 | - "modules-right": ["privacy", "cpu", "memory", "wireplumber", "tray", "battery"], | 8 | + "modules-right": ["privacy", "cpu", "memory", "wireplumber", "group/tray", "battery"], |
| 9 | 9 | ||
| 10 | "cava": { | 10 | "cava": { |
| 11 | "framerate": 30, | 11 | "framerate": 30, |
| @@ -161,6 +161,23 @@ | |||
| 161 | "on-click-right": "pavucontrol", | 161 | "on-click-right": "pavucontrol", |
| 162 | "format-muted": "\uf00d {volume}%" | 162 | "format-muted": "\uf00d {volume}%" |
| 163 | }, | 163 | }, |
| 164 | + "group/tray": { | ||
| 165 | + "orientation": "horizontal", | ||
| 166 | + "drawer": { | ||
| 167 | + "transition-duration": 300, | ||
| 168 | + "transition-left-to-right": false | ||
| 169 | + }, | ||
| 170 | + "modules": [ | ||
| 171 | + "custom/tray-toggle", | ||
| 172 | + "tray" | ||
| 173 | + ] | ||
| 174 | + }, | ||
| 175 | + | ||
| 176 | + "custom/tray-toggle": { | ||
| 177 | + "format": "\uf0c9", | ||
| 178 | + "tooltip": false | ||
| 179 | + }, | ||
| 180 | + | ||
| 164 | "tray": { | 181 | "tray": { |
| 165 | "icon-size": 20, | 182 | "icon-size": 20, |
| 166 | "spacing": 10 | 183 | "spacing": 10 |
.config/waybar/style.cssmodified+11 -21
| @@ -1,12 +1,11 @@ | |||
| 1 | #waybar { | 1 | #waybar { |
| 2 | color: #ffffff; | 2 | color: #ffffff; |
| 3 | - background-color: #000000; | 3 | + background-color: alpha(#020503, 0.8); |
| 4 | - /* opacity: 1; */ | ||
| 5 | border-radius: 1px; | 4 | border-radius: 1px; |
| 6 | } | 5 | } |
| 7 | 6 | ||
| 8 | #idle_inhibitor.activated { | 7 | #idle_inhibitor.activated { |
| 9 | - background-color: #285577; | 8 | + background-color: #B33625; |
| 10 | } | 9 | } |
| 11 | 10 | ||
| 12 | * { | 11 | * { |
| @@ -14,26 +13,12 @@ | |||
| 14 | font-size: 14px; | 13 | font-size: 14px; |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 17 | -#pulseaudio-slider slider { | 16 | +#workspaces button { |
| 18 | - min-height: 0px; | 17 | + color: #ffffff; |
| 19 | - min-width: 0px; | ||
| 20 | - opacity: 0; | ||
| 21 | - background-image: none; | ||
| 22 | - border: none; | ||
| 23 | - box-shadow: none; | ||
| 24 | -} | ||
| 25 | - | ||
| 26 | -#pulseaudio-slider trough { | ||
| 27 | - min-height: 10px; | ||
| 28 | - min-width: 80px; | ||
| 29 | - border-radius: 5px; | ||
| 30 | - background-color: black; | ||
| 31 | } | 18 | } |
| 32 | 19 | ||
| 33 | -#pulseaudio-slider highlight { | 20 | +#workspaces button.active { |
| 34 | - min-width: 10px; | 21 | + color: #ffffff; |
| 35 | - border-radius: 5px; | ||
| 36 | - background-color: white; | ||
| 37 | } | 22 | } |
| 38 | 23 | ||
| 39 | #custom-music { | 24 | #custom-music { |
| @@ -45,6 +30,11 @@ | |||
| 45 | box-shadow: none; | 30 | box-shadow: none; |
| 46 | } | 31 | } |
| 47 | 32 | ||
| 33 | +#custom-tray-toggle { | ||
| 34 | + color: #ffffff; | ||
| 35 | + padding: 0 6px; | ||
| 36 | +} | ||
| 37 | + | ||
| 48 | #custom-camera { | 38 | #custom-camera { |
| 49 | color: #ffffff; | 39 | color: #ffffff; |
| 50 | margin: 0; | 40 | margin: 0; |