Guest User

hyprland attach workspaces to monitors

a guest
Aug 16th, 2022
1,672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.84 KB | Software | 0 0
  1. #!/bin/sh
  2. mon1="DP-3" # Primary monitor
  3. mon2="DP-2" # Secondary
  4. ws_limit=4 # how many workspaces on the primary monitor
  5.  
  6. handleworkspaces() {
  7.     if [[ ${1:0:15} == "createworkspace" ]]; then
  8.         ws=$(( ${1:17:19} ))
  9.         if (( $(($ws <= $ws_limit)) )); then
  10.             hyprctl dispatch moveworkspacetomonitor "$ws $mon1"
  11.         else
  12.             hyprctl dispatch moveworkspacetomonitor  "$ws $mon2"
  13.         fi
  14.     elif [[ ${1:0:9} == "workspace" ]]; then
  15.         ws=$(( ${1:11:13} ))
  16.         if (( $(($ws <= $ws_limit)) )); then
  17.             hyprctl dispatch moveworkspacetomonitor  "$ws $mon1"
  18.         else
  19.             hyprctl dispatch moveworkspacetomonitor  "$ws $mon2"
  20.         fi
  21.     fi
  22. }
  23.  
  24. socat - UNIX-CONNECT:/tmp/hypr/$(echo $HYPRLAND_INSTANCE_SIGNATURE)/.socket2.sock | while read line; do handleworkspaces $line; done
  25.  
Advertisement
Add Comment
Please, Sign In to add comment