From a95cd6feeda370a7b877566d7584ae38c9bafe0c Mon Sep 17 00:00:00 2001 From: Johannes Knopp Date: Sat, 13 Sep 2025 15:28:12 +0200 Subject: [PATCH] update hyprland conf --- roles/hyprland/files/hypr/hyprland.conf | 53 ++++++ roles/hyprland/files/hypr/monitors.conf | 4 +- roles/hyprland/files/waybar/config.jsonc | 163 ++++++++++++------ roles/hyprland/files/waybar/scripts/groups.sh | 40 +++++ roles/hyprland/files/waybar/scripts/page.sh | 150 ---------------- roles/hyprland/files/waybar/style.css | 49 ++---- 6 files changed, 220 insertions(+), 239 deletions(-) create mode 100755 roles/hyprland/files/waybar/scripts/groups.sh delete mode 100755 roles/hyprland/files/waybar/scripts/page.sh diff --git a/roles/hyprland/files/hypr/hyprland.conf b/roles/hyprland/files/hypr/hyprland.conf index 09a50c4..4614cc3 100644 --- a/roles/hyprland/files/hypr/hyprland.conf +++ b/roles/hyprland/files/hypr/hyprland.conf @@ -348,6 +348,59 @@ bind = SUPER, 0, exec, hyprctl --batch " \ dispatch focusmonitor HDMI-A-2; dispatch workspace 30; \ dispatch focusmonitor DP-1" +bind = SUPER SHIFT, 1, exec, hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace 1; \ + dispatch focusmonitor DP-2; dispatch workspace 2; \ + dispatch focusmonitor HDMI-A-2; dispatch workspace 3; \ + dispatch focusmonitor DP-1" +bind = SUPER SHIFT, 2, exec, hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace 4; \ + dispatch focusmonitor DP-2; dispatch workspace 5; \ + dispatch focusmonitor HDMI-A-2; dispatch workspace 6; \ + dispatch focusmonitor DP-1" +bind = SUPER SHIFT, 3, exec, hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace 7; \ + dispatch focusmonitor DP-2; dispatch workspace 8; \ + dispatch focusmonitor HDMI-A-2; dispatch workspace 9; \ + dispatch focusmonitor DP-1" +bind = SUPER SHIFT, 4, exec, hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace 10; \ + dispatch focusmonitor DP-2; dispatch workspace 11; \ + dispatch focusmonitor HDMI-A-2; dispatch workspace 12; \ + dispatch focusmonitor DP-1" +bind = SUPER SHIFT, 5, exec, hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace 13; \ + dispatch focusmonitor DP-2; dispatch workspace 14; \ + dispatch focusmonitor HDMI-A-2; dispatch workspace 15; \ + dispatch focusmonitor DP-1" +bind = SUPER SHIFT, 6, exec, hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace 16; \ + dispatch focusmonitor DP-2; dispatch workspace 17; \ + dispatch focusmonitor HDMI-A-2; dispatch workspace 18; \ + dispatch focusmonitor DP-1" +bind = SUPER SHIFT, 7, exec, hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace 19; \ + dispatch focusmonitor DP-2; dispatch workspace 20; \ + dispatch focusmonitor HDMI-A-2; dispatch workspace 21; \ + dispatch focusmonitor DP-1" +bind = SUPER SHIFT, 8, exec, hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace 22; \ + dispatch focusmonitor DP-2; dispatch workspace 23; \ + dispatch focusmonitor HDMI-A-2; dispatch workspace 24; \ + dispatch focusmonitor DP-1" +bind = SUPER SHIFT, 9, exec, hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace 25; \ + dispatch focusmonitor DP-2; dispatch workspace 26; \ + dispatch focusmonitor HDMI-A-2; dispatch workspace 27; \ + dispatch focusmonitor DP-1" +bind = SUPER SHIFT, 0, exec, hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace 28; \ + dispatch focusmonitor DP-2; dispatch workspace 29; \ + dispatch focusmonitor HDMI-A-2; dispatch workspace 30; \ + dispatch focusmonitor DP-1" + + + bind = $mainMod SHIFT, 1, movetoworkspace, 1 bind = $mainMod SHIFT, 2, movetoworkspace, 4 bind = $mainMod SHIFT, 3, movetoworkspace, 7 diff --git a/roles/hyprland/files/hypr/monitors.conf b/roles/hyprland/files/hypr/monitors.conf index 0fcf6a9..d0957cb 100644 --- a/roles/hyprland/files/hypr/monitors.conf +++ b/roles/hyprland/files/hypr/monitors.conf @@ -1,8 +1,8 @@ -# Generated by nwg-displays on 2025-09-07 at 18:49:18. Do not edit manually. +# Generated by nwg-displays on 2025-09-09 at 19:00:43. Do not edit manually. monitor=DP-1,2560x1440@165.0,6626x876,1.0 monitor=DP-2,2560x1440@165.0,4066x876,1.0 -monitor=HDMI-A-1,3840x2160@60.0,226x156,1.0 +monitor=HDMI-A-1,0x0@60.0,-1x-1,1.0 monitor=HDMI-A-1,disable monitor=HDMI-A-2,1920x1080@60.0,9186x396,1.0 monitor=HDMI-A-2,transform,3 diff --git a/roles/hyprland/files/waybar/config.jsonc b/roles/hyprland/files/waybar/config.jsonc index 1ac391a..1cb4e03 100644 --- a/roles/hyprland/files/waybar/config.jsonc +++ b/roles/hyprland/files/waybar/config.jsonc @@ -9,60 +9,121 @@ "margin-bottom": 0, /* order: 1-2-3 | window-title | tray + clock */ - "modules-left": [ "custom/page1", "custom/page2", "custom/page3", "custom/page4","custom/page5","custom/page6","custom/page7","custom/page8","custom/page9","custom/page10"], + "modules-left": [ "custom/group1", "custom/group2", "custom/group3", "custom/group4","custom/group5","custom/group6","custom/group7","custom/group8","custom/group9","custom/group10"], "modules-center": [ "hyprland/window" ], "modules-right": [ "tray", "custom/separator", "network", "bluetooth", "custom/separator", "disk", "cpu", "memory", "pulseaudio", "custom/separator", "clock"], - "custom/page1": { - "exec": "~/.config/waybar/scripts/page.sh 1", - "exec-persistent": true, - "return-type": "json" - }, - "custom/page2": { - "exec": "~/.config/waybar/scripts/page.sh 2", - "exec-persistent": true, - "return-type": "json" - }, - "custom/page3": { - "exec": "~/.config/waybar/scripts/page.sh 3", - "exec-persistent": true, - "return-type": "json" - }, - "custom/page4": { - "exec": "~/.config/waybar/scripts/page.sh 4", - "exec-persistent": true, - "return-type": "json" - }, - "custom/page5": { - "exec": "~/.config/waybar/scripts/page.sh 5", - "exec-persistent": true, - "return-type": "json" - }, - "custom/page6": { - "exec": "~/.config/waybar/scripts/page.sh 6", - "exec-persistent": true, - "return-type": "json" - }, - "custom/page7": { - "exec": "~/.config/waybar/scripts/page.sh 7", - "exec-persistent": true, - "return-type": "json" - }, - "custom/page8": { - "exec": "~/.config/waybar/scripts/page.sh 8", - "exec-persistent": true, - "return-type": "json" - }, - "custom/page9": { - "exec": "~/.config/waybar/scripts/page.sh 9", - "exec-persistent": true, - "return-type": "json" - }, - "custom/page10": { - "exec": "~/.config/waybar/scripts/page.sh 10", - "exec-persistent": true, - "return-type": "json" - }, + "custom/group1": { + "exec": "~/.config/waybar/scripts/groups.sh 1", + "return-type": "json", + "interval": 1, + "on-click": "~/.config/waybar/scripts/groups.sh click 1" + }, + "custom/group2": { + "exec": "~/.config/waybar/scripts/groups.sh 2", + "return-type": "json", + "interval": 1, + "on-click": "~/.config/waybar/scripts/groups.sh click 2" + }, + "custom/group3": { + "exec": "~/.config/waybar/scripts/groups.sh 3", + "return-type": "json", + "interval": 1, + "on-click": "~/.config/waybar/scripts/groups.sh click 3" + }, + "custom/group4": { + "exec": "~/.config/waybar/scripts/groups.sh 4", + "return-type": "json", + "interval": 1, + "on-click": "~/.config/waybar/scripts/groups.sh click 4" + }, + "custom/group5": { + "exec": "~/.config/waybar/scripts/groups.sh 5", + "return-type": "json", + "interval": 1, + "on-click": "~/.config/waybar/scripts/groups.sh click 5" + }, + "custom/group6": { + "exec": "~/.config/waybar/scripts/groups.sh 6", + "return-type": "json", + "interval": 1, + "on-click": "~/.config/waybar/scripts/groups.sh click 6" + }, + "custom/group7": { + "exec": "~/.config/waybar/scripts/groups.sh 7", + "return-type": "json", + "interval": 1, + "on-click": "~/.config/waybar/scripts/groups.sh click 7" + }, + "custom/group8": { + "exec": "~/.config/waybar/scripts/groups.sh 8", + "return-type": "json", + "interval": 1, + "on-click": "~/.config/waybar/scripts/groups.sh click 8" + }, + "custom/group9": { + "exec": "~/.config/waybar/scripts/groups.sh 9", + "return-type": "json", + "interval": 1, + "on-click": "~/.config/waybar/scripts/groups.sh click 9" + }, + "custom/group10": { + "exec": "~/.config/waybar/scripts/groups.sh 10", + "return-type": "json", + "interval": 1, + "on-click": "~/.config/waybar/scripts/groups.sh click 10" + }, + + // "custom/page1": { + // "exec": "~/.config/waybar/scripts/page.sh 1", + // "exec-persistent": true, + // "return-type": "json" + // }, + // "custom/page2": { + // "exec": "~/.config/waybar/scripts/page.sh 2", + // "exec-persistent": true, + // "return-type": "json" + // }, + // "custom/page3": { + // "exec": "~/.config/waybar/scripts/page.sh 3", + // "exec-persistent": true, + // "return-type": "json" + // }, + // "custom/page4": { + // "exec": "~/.config/waybar/scripts/page.sh 4", + // "exec-persistent": true, + // "return-type": "json" + // }, + // "custom/page5": { + // "exec": "~/.config/waybar/scripts/page.sh 5", + // "exec-persistent": true, + // "return-type": "json" + // }, + // "custom/page6": { + // "exec": "~/.config/waybar/scripts/page.sh 6", + // "exec-persistent": true, + // "return-type": "json" + // }, + // "custom/page7": { + // "exec": "~/.config/waybar/scripts/page.sh 7", + // "exec-persistent": true, + // "return-type": "json" + // }, + // "custom/page8": { + // "exec": "~/.config/waybar/scripts/page.sh 8", + // "exec-persistent": true, + // "return-type": "json" + // }, + // "custom/page9": { + // "exec": "~/.config/waybar/scripts/page.sh 9", + // "exec-persistent": true, + // "return-type": "json" + // }, + // "custom/page10": { + // "exec": "~/.config/waybar/scripts/page.sh 10", + // "exec-persistent": true, + // "return-type": "json" + // }, "hyprland/window": { "format": "{title}", "max-length": 60 }, // "tray": { "icon-size": 16, "spacing": 6 }, diff --git a/roles/hyprland/files/waybar/scripts/groups.sh b/roles/hyprland/files/waybar/scripts/groups.sh new file mode 100755 index 0000000..50c8aa2 --- /dev/null +++ b/roles/hyprland/files/waybar/scripts/groups.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +current=$(hyprctl activeworkspace -j | jq -r '.id') + +if [ "$1" = "click" ]; then + group=$2 + start=$(( (group - 1) * 3 + 1 )) + + hyprctl --batch " \ + dispatch focusmonitor DP-1; dispatch workspace $start; \ + dispatch focusmonitor DP-2; dispatch workspace $((start+1)); \ + dispatch focusmonitor HDMI-A-2; dispatch workspace $((start+2)); \ + dispatch focusmonitor DP-1" + +else + # Display button state + group=$1 + start=$(( (group - 1) * 3 + 1 )) + end=$(( start + 2 )) + case $group in + 1) range="1-3"; icon="" ;; + 2) range="4-6"; icon="" ;; + 3) range="7-9"; icon="" ;; + 4) range="10-12"; icon="" ;; + 5) range="13-15"; icon="" ;; + 6) range="16-18"; icon="" ;; + 7) range="19-21"; icon="" ;; + 8) range="22-24"; icon="" ;; + 9) range="25-27"; icon="󰝚" ;; + 10) range="28-30"; icon="" ;; + esac + + if [ $current -ge $start ] && [ $current -le $end ]; then + # Active group - return with active class + echo "{\"text\": \"$icon\", \"class\": \"active\"}" + else + # Inactive group + echo "{\"text\": \"$icon\", \"class\": \"inactive\"}" + fi +fi diff --git a/roles/hyprland/files/waybar/scripts/page.sh b/roles/hyprland/files/waybar/scripts/page.sh deleted file mode 100755 index 246e400..0000000 --- a/roles/hyprland/files/waybar/scripts/page.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env bash -# page.sh 1‒10 – Waybar “page” indicator -# deps: socat, awk, sed, grep - -page=$1 -icons=( "" "" "" "" "" "" "" "" "" "" "󰝚" ) - -to_page() { - (( $1 <= 3 )) && echo 1 && return - (( $1 <= 6 )) && echo 2 && return - (( $1 <= 9 )) && echo 3 && return - (( $1 <= 12 )) && echo 4 && return - (( $1 <= 15 )) && echo 5 && return - (( $1 <= 18 )) && echo 6 && return - (( $1 <= 21 )) && echo 7 && return - (( $1 <= 24 )) && echo 8 && return - (( $1 <= 27 )) && echo 9 && return - echo 10 -} - -# Return 0 if THIS page has at least one window, else 1 -is_occupied() { - # Get workspace id + windows count pairs from JSON - # Example snippets: {"id":1,"windows":3, ...} - while read -r id windows; do - (( $(to_page "$id") == page )) && (( windows > 0 )) && return 0 - done < <( - hyprctl -j workspaces \ - | grep -o '"id":[0-9]\+|"windows":[0-9]\+' \ - | sed -n 'N;s/"id":\([0-9]\+\)\n"windows":\([0-9]\+\)/\1 \2/p' - ) - return 1 -} - -emit() { - local classes=() - if (( $1 == page )); then - classes+=(active) - else - is_occupied && classes+=(occupied) - fi - - if ((${#classes[@]})); then - printf '{"text":"%s","class":"%s"}\n' \ - "${icons[page]}" "$(IFS=' '; echo "${classes[*]}")" - else - printf '{"text":"%s"}\n' "${icons[page]}" - fi -} - -# Initial state -active_ws=$(hyprctl activeworkspace | awk '/^ID /{print $2}') -current_page=$(to_page "${active_ws:-1}") -emit "$current_page" -current_occ=$(is_occupied && echo 1 || echo 0) - -# Live updates -socket="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" -socat -U - UNIX-CONNECT:"$socket" | while read -r line; do - [[ $line =~ ^(workspace|openwindow|closewindow|movewindow) ]] || continue - if [[ $line == workspace* ]]; then - ws=${line#*>>}; ws=${ws%% *} - new_page=$(to_page "$ws") - else - new_page=$current_page - fi - new_occ=$(is_occupied && echo 1 || echo 0) - if (( new_page != current_page || new_occ != current_occ )); then - emit "$new_page" - current_page=$new_page - current_occ=$new_occ - fi -done - - -# # page.sh 1‒10 – Waybar “page” indicator -# # deps: socat, awk • (still no jq) -# -# page=$1 # this script instance’s page (1‒10) -# -# # ── icon lookup table ──────────────────────────────────────────── -# icons=( "" "" "" "" "" "" "" "" "" "" "󰝚" ) -# -# # map numeric workspace → page (1‒10) -# to_page() { -# (( $1 <= 3 )) && echo 1 && return -# (( $1 <= 6 )) && echo 2 && return -# (( $1 <= 9 )) && echo 3 && return -# (( $1 <= 12 )) && echo 4 && return -# (( $1 <= 15 )) && echo 5 && return -# (( $1 <= 18 )) && echo 6 && return -# (( $1 <= 21 )) && echo 7 && return -# (( $1 <= 24 )) && echo 8 && return -# (( $1 <= 27 )) && echo 9 && return -# echo 10 -# } -# -# # does THIS page contain at least one window? -# is_occupied() { -# while read -r ws_id; do -# (( $(to_page "$ws_id") == page )) && return 0 -# done < <(hyprctl clients | awk '/workspace:/ {print $2}') -# return 1 -# } -# -# emit() { -# local classes=() -# -# if (( $1 == page )); then # ← is THIS instance the active page? -# classes+=(active) # yes → mark it only “active” -# else -# is_occupied && classes+=(occupied) # no → maybe “occupied” -# fi -# -# if ((${#classes[@]})); then -# printf '{"text":"%s","class":"%s"}\n' \ -# "${icons[page]}" "$(IFS=' '; echo "${classes[*]}")" -# else -# printf '{"text":"%s"}\n' "${icons[page]}" -# fi -# } -# -# # ── initial state ──────────────────────────────────────────────── -# active_ws=$(hyprctl activeworkspace | awk '/^ID /{print $2}') -# current_page=$(to_page "${active_ws:-1}") -# emit "$current_page" -# current_occ=$(is_occupied && echo 1 || echo 0) -# -# # ── live updates via Hyprland socket2 ─────────────────────────── -# socket="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" -# socat -U - UNIX-CONNECT:"$socket" | while read -r line; do -# [[ $line =~ ^(workspace|openwindow|closewindow) ]] || continue -# -# # recompute state if anything relevant changed -# if [[ $line == workspace* ]]; then -# ws=${line#*>>}; ws=${ws%% *} -# new_page=$(to_page "$ws") -# else -# new_page=$current_page -# fi -# new_occ=$(is_occupied && echo 1 || echo 0) -# -# # update Waybar only when something actually changed -# if (( new_page != current_page || new_occ != current_occ )); then -# emit "$new_page" -# current_page=$new_page -# current_occ=$new_occ -# fi -# done -# diff --git a/roles/hyprland/files/waybar/style.css b/roles/hyprland/files/waybar/style.css index 480cb85..6b90f27 100644 --- a/roles/hyprland/files/waybar/style.css +++ b/roles/hyprland/files/waybar/style.css @@ -13,7 +13,7 @@ window#waybar { background: @glass; color: @fg; border-radius: 12px; - margin: 6px 8px; + /* margin: 6px 8px; */ border: none; /* ← removed border */ box-shadow: 0 10px 34px rgba(0,0,0,0.34); -gtk-outline-radius: 12px; @@ -45,38 +45,29 @@ window#waybar { padding: 0 4px; } -/* --- PAGE BUTTONS --------------------------------------------------------- */ -#custom-page1, #custom-page2, #custom-page3, #custom-page4, #custom-page5, -#custom-page6, #custom-page7, #custom-page8, #custom-page9, #custom-page10 { +/* --- group BUTTONS --------------------------------------------------------- */ +#custom-group1, #custom-group2, #custom-group3, #custom-group4, #custom-group5, +#custom-group6, #custom-group7, #custom-group8, #custom-group9, #custom-group10 { background: transparent; min-width: 18px; padding-left: 2px; - color: @fg_dim; + /* color: @fg_dim; */ } -/* Active page: glass chip, no border */ -#custom-page1.active, #custom-page2.active, #custom-page3.active, #custom-page4.active, -#custom-page5.active, #custom-page6.active, #custom-page7.active, #custom-page8.active, -#custom-page9.active, #custom-page10.active { +/* Active group: glass chip, no border */ +#custom-group1.active, #custom-group2.active, #custom-group3.active, #custom-group4.active, +#custom-group5.active, #custom-group6.active, #custom-group7.active, #custom-group8.active, +#custom-group9.active, #custom-group10.active { background: @glass_strong; border-radius: 8px; - color: @fg; + color: #a8557f; box-shadow: inset 0 0 0 9999px rgba(255,255,255,0.015); } -/* Occupied (not active): cyan glyph */ -#custom-page1.occupied:not(.active), #custom-page2.occupied:not(.active), -#custom-page3.occupied:not(.active), #custom-page4.occupied:not(.active), -#custom-page5.occupied:not(.active), #custom-page6.occupied:not(.active), -#custom-page7.occupied:not(.active), #custom-page8.occupied:not(.active), -#custom-page9.occupied:not(.active), #custom-page10.occupied:not(.active) { - color: @accent2; -} - /* Hover feedback (very light) */ -#custom-page1:hover, #custom-page2:hover, #custom-page3:hover, #custom-page4:hover, -#custom-page5:hover, #custom-page6:hover, #custom-page7:hover, #custom-page8:hover, -#custom-page9:hover, #custom-page10:hover { +#custom-group1:hover, #custom-group2:hover, #custom-group3:hover, #custom-group4:hover, +#custom-group5:hover, #custom-group6:hover, #custom-group7:hover, #custom-group8:hover, +#custom-group9:hover, #custom-group10:hover { background: rgba(255,255,255,0.03); border-radius: 8px; } @@ -118,17 +109,3 @@ window#waybar { /* text-align: center; */ } -.workspace.occupied { - color: #a855f7; /* purple for occupied workspaces */ - border-color: #a855f7; -} - -.workspace.focused { - background-color: rgba(168, 85, 247, 0.2); /* light purple background for focused */ - color: #a855f7; - border-color: #a855f7; -} - -.workspace:hover { - background-color: rgba(168, 85, 247, 0.1); -}