mirror of
https://github.com/zebrajr/dotfiles.git
synced 2025-12-06 00:20:05 +01:00
add work laptop workspaces handling via custom script
This commit is contained in:
parent
c2be36d002
commit
dabea51780
|
|
@ -81,3 +81,9 @@ bind = $mainMod, G, togglegroup
|
|||
#############
|
||||
|
||||
bind = $mainMod ALT, L, exec, hyprlock
|
||||
|
||||
#############
|
||||
### Custom Scripts
|
||||
#############
|
||||
|
||||
bind = $mainMod ALT, R, exec, ~/.config/hypr/scripts/monitor_handler.sh
|
||||
|
|
|
|||
|
|
@ -2,3 +2,5 @@
|
|||
# All sub directories are included
|
||||
#WALLPAPER_DIR="/mnt/data/Zebra/Photos/Edited"
|
||||
|
||||
# Device Identifier
|
||||
#DEVICE_IDENTIFIER="work-laptop"
|
||||
|
|
|
|||
34
config/hypr/scripts/monitor_handler.sh
Executable file
34
config/hypr/scripts/monitor_handler.sh
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Get the config file
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
source "$SCRIPT_DIR/config"
|
||||
|
||||
# Monitor names
|
||||
EXTERNAL_LEFT="DP-9"
|
||||
EXTERNAL_CENTER="DP-10"
|
||||
LAPTOP="eDP-1"
|
||||
|
||||
if [[ "$DEVICE_IDENTIFIER" == "work-laptop" ]]; then
|
||||
# Check if external monitors are connected
|
||||
external_left_connected=$(hyprctl monitors | grep -c "$EXTERNAL_LEFT")
|
||||
external_center_connected=$(hyprctl monitors | grep -c "$EXTERNAL_CENTER")
|
||||
|
||||
if [[ "$external_left_connected" -eq 1 && "$external_center_connected" -eq 1 ]]; then
|
||||
# Docked: Assign workspaces to externals and laptop
|
||||
for ws in {1..7}; do
|
||||
hyprctl dispatch moveworkspacetomonitor "$ws $EXTERNAL_CENTER"
|
||||
done
|
||||
hyprctl dispatch workspace 8
|
||||
hyprctl dispatch moveworkspacetomonitor "8 $EXTERNAL_LEFT"
|
||||
hyprctl dispatch workspace 9
|
||||
hyprctl dispatch moveworkspacetomonitor "9 $LAPTOP"
|
||||
# focus on center monitor
|
||||
hyprctl dispatch focusmonitor "$EXTERNAL_CENTER"
|
||||
else
|
||||
# Undocked: Move all workspaces to laptop
|
||||
for ws in {1..9}; do
|
||||
hyprctl dispatch moveworkspacetomonitor "$ws $LAPTOP"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
Loading…
Reference in New Issue
Block a user