-
-
Save charlesvardeman/03f3b2e5da37055e572d51ead58c4cc4 to your computer and use it in GitHub Desktop.
Hyprland Workspace Manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Workspaces - Dynamic configuration | |
| source = ~/.config/hypr/workspaces.conf | |
| # Run workspace manager on startup and monitor changes | |
| exec-once = ~/.config/hypr/workspace-manager.sh | |
| exec-once = socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | \ | |
| while read line; do \ | |
| [[ "$line" =~ ^monitor ]] && ~/.config/hypr/workspace-manager.sh; \ | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Dynamic workspace manager for Hyprland | |
| # Assigns workspaces 1-5 to DP-1 (when available) and 6-10 to eDP-1 | |
| # If only eDP-1 is available, all workspaces go to eDP-1 | |
| # Check if monitors are connected | |
| dp1_connected=$(hyprctl monitors -j | jq -r '.[] | select(.name == "DP-1") | .name' 2>/dev/null) | |
| edp1_connected=$(hyprctl monitors -j | jq -r '.[] | select(.name == "eDP-1") | .name' 2>/dev/null) | |
| # Clear existing workspace assignments | |
| echo "# Dynamic workspace configuration - generated automatically" > ~/.config/hypr/workspaces.conf | |
| echo "# Generated at: $(date)" >> ~/.config/hypr/workspaces.conf | |
| echo "" >> ~/.config/hypr/workspaces.conf | |
| # Configure workspaces based on available monitors | |
| if [[ -n "$dp1_connected" && -n "$edp1_connected" ]]; then | |
| # Both monitors available | |
| echo "# Both DP-1 and eDP-1 are connected" >> ~/.config/hypr/workspaces.conf | |
| # Workspaces 1-5 on DP-1 | |
| for i in {1..5}; do | |
| echo "workspace=$i, monitor:DP-1, persistent:true" >> ~/.config/hypr/workspaces.conf | |
| done | |
| # Workspaces 6-10 (0) on eDP-1 | |
| for i in {6..9}; do | |
| echo "workspace=$i, monitor:eDP-1, persistent:true" >> ~/.config/hypr/workspaces.conf | |
| done | |
| echo "workspace=10, monitor:eDP-1, persistent:true" >> ~/.config/hypr/workspaces.conf | |
| # Set defaults | |
| echo "" >> ~/.config/hypr/workspaces.conf | |
| echo "# Default workspaces" >> ~/.config/hypr/workspaces.conf | |
| echo "workspace=1, monitor:DP-1, default:true" >> ~/.config/hypr/workspaces.conf | |
| echo "workspace=6, monitor:eDP-1, default:true" >> ~/.config/hypr/workspaces.conf | |
| elif [[ -n "$edp1_connected" ]]; then | |
| # Only eDP-1 available | |
| echo "# Only eDP-1 is connected - all workspaces on eDP-1" >> ~/.config/hypr/workspaces.conf | |
| # All workspaces 1-10 on eDP-1 | |
| for i in {1..9}; do | |
| echo "workspace=$i, monitor:eDP-1, persistent:true" >> ~/.config/hypr/workspaces.conf | |
| done | |
| echo "workspace=10, monitor:eDP-1, persistent:true" >> ~/.config/hypr/workspaces.conf | |
| # Set default | |
| echo "" >> ~/.config/hypr/workspaces.conf | |
| echo "# Default workspace" >> ~/.config/hypr/workspaces.conf | |
| echo "workspace=1, monitor:eDP-1, default:true" >> ~/.config/hypr/workspaces.conf | |
| elif [[ -n "$dp1_connected" ]]; then | |
| # Only DP-1 available | |
| echo "# Only DP-1 is connected - all workspaces on DP-1" >> ~/.config/hypr/workspaces.conf | |
| # All workspaces 1-10 on DP-1 | |
| for i in {1..9}; do | |
| echo "workspace=$i, monitor:DP-1, persistent:true" >> ~/.config/hypr/workspaces.conf | |
| done | |
| echo "workspace=10, monitor:DP-1, persistent:true" >> ~/.config/hypr/workspaces.conf | |
| # Set default | |
| echo "" >> ~/.config/hypr/workspaces.conf | |
| echo "# Default workspace" >> ~/.config/hypr/workspaces.conf | |
| echo "workspace=1, monitor:DP-1, default:true" >> ~/.config/hypr/workspaces.conf | |
| else | |
| echo "# No known monitors detected" >> ~/.config/hypr/workspaces.conf | |
| fi | |
| echo "Workspace configuration updated" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment