diff --git a/.config/hypr/configs/binds.conf b/.config/hypr/configs/binds.conf index 57033a9e..e462c2c1 100644 --- a/.config/hypr/configs/binds.conf +++ b/.config/hypr/configs/binds.conf @@ -80,40 +80,31 @@ bind = SUPER, C, exec, hyprctl dispatch centerwindow 1 # Workspaces # Focusing other workspaces -bind = SUPER, 1, exec, hyprsome workspace 1 -bind = SUPER, 2, exec, hyprsome workspace 2 -bind = SUPER, 3, exec, hyprsome workspace 3 -bind = SUPER, 4, exec, hyprsome workspace 4 -bind = SUPER, 5, exec, hyprsome workspace 5 -bind = SUPER, 6, exec, hyprsome workspace 6 -bind = SUPER, 7, exec, hyprsome workspace 7 -bind = SUPER, 8, exec, hyprsome workspace 8 -bind = SUPER, 9, exec, hyprsome workspace 9 -bind = SUPER, 0, exec, hyprsome workspace 10 +$workspace = ~/.config/hypr/scripts/awesome_workspaces +bind = SUPER, 1, exec, $workspace 1 switch +bind = SUPER, 2, exec, $workspace 2 switch +bind = SUPER, 3, exec, $workspace 3 switch +bind = SUPER, 4, exec, $workspace 4 switch +bind = SUPER, 5, exec, $workspace 5 switch +bind = SUPER, 6, exec, $workspace 6 switch +bind = SUPER, 7, exec, $workspace 7 switch +bind = SUPER, 8, exec, $workspace 8 switch +bind = SUPER, 9, exec, $workspace 9 switch +bind = SUPER, 0, exec, $workspace 10 switch # Moving windows to other workspaces -bind = SUPERSHIFT, 1, exec, hyprsome movefocus 1 -bind = SUPERSHIFT, 2, exec, hyprsome movefocus 2 -bind = SUPERSHIFT, 3, exec, hyprsome movefocus 3 -bind = SUPERSHIFT, 4, exec, hyprsome movefocus 4 -bind = SUPERSHIFT, 5, exec, hyprsome movefocus 5 -bind = SUPERSHIFT, 6, exec, hyprsome movefocus 6 -bind = SUPERSHIFT, 7, exec, hyprsome movefocus 7 -bind = SUPERSHIFT, 8, exec, hyprsome movefocus 8 -bind = SUPERSHIFT, 9, exec, hyprsome movefocus 9 -bind = SUPERSHIFT, 0, exec, hyprsome movefocus 10 +bind = SUPERSHIFT, 1, exec, $workspace 1 move +bind = SUPERSHIFT, 2, exec, $workspace 2 move +bind = SUPERSHIFT, 3, exec, $workspace 3 move +bind = SUPERSHIFT, 4, exec, $workspace 4 move +bind = SUPERSHIFT, 5, exec, $workspace 5 move +bind = SUPERSHIFT, 6, exec, $workspace 6 move +bind = SUPERSHIFT, 7, exec, $workspace 7 move +bind = SUPERSHIFT, 8, exec, $workspace 8 move +bind = SUPERSHIFT, 9, exec, $workspace 9 move +bind = SUPERSHIFT, 0, exec, $workspace 10 move # Moving windows to other workspaces (silent) -bind = SUPERALT, 1, exec, hyprsome move 1 -bind = SUPERALT, 2, exec, hyprsome move 2 -bind = SUPERALT, 3, exec, hyprsome move 3 -bind = SUPERALT, 4, exec, hyprsome move 4 -bind = SUPERALT, 5, exec, hyprsome move 5 -bind = SUPERALT, 6, exec, hyprsome move 6 -bind = SUPERALT, 7, exec, hyprsome move 7 -bind = SUPERALT, 8, exec, hyprsome move 8 -bind = SUPERALT, 9, exec, hyprsome move 9 -bind = SUPERALT, 0, exec, hyprsome move 10 # Moving to other wokspace with mouse control bind = SUPER, mouse_down, workspace,m-1 @@ -125,6 +116,16 @@ bind = SUPERCTRL, RIGHT, workspace,m+1 bind = SUPERCTRL, H, workspace,m-1 bind = SUPERCTRL, L, workspace,m+1 +bind = SUPERALT, 1, exec, $workspace 1 silent +bind = SUPERALT, 2, exec, $workspace 2 silent +bind = SUPERALT, 3, exec, $workspace 3 silent +bind = SUPERALT, 4, exec, $workspace 4 silent +bind = SUPERALT, 5, exec, $workspace 5 silent +bind = SUPERALT, 6, exec, $workspace 6 silent +bind = SUPERALT, 7, exec, $workspace 7 silent +bind = SUPERALT, 8, exec, $workspace 8 silent +bind = SUPERALT, 9, exec, $workspace 9 silent +bind = SUPERALT, 0, exec, $workspace 10 silent # Group control bind = SUPER, G, togglegroup diff --git a/.config/hypr/scripts/awesome_workspaces b/.config/hypr/scripts/awesome_workspaces new file mode 100755 index 00000000..a7a425ce --- /dev/null +++ b/.config/hypr/scripts/awesome_workspaces @@ -0,0 +1,32 @@ +#!/usr/bin/bash + +monitors=($(hyprctl monitors -j | jq -r '.[].id')) + +ws_per_monitor=10 + +monitor=$(hyprctl activeworkspace -j | jq -r '.monitorID') + +calculate_index() { + local index=$(($1 + $2 * ws_per_monitor)) + echo $index +} + +move_workspace() { + local index=$1 + local action=$2 + if [[ $action == "move" ]]; then + hyprctl dispatch movetoworkspace $index + elif [[ $action == "silent" ]]; then + hyprctl dispatch movetoworkspacesilent $index + else + hyprctl dispatch workspace $index + fi +} + +for ((i = 0; i < ${#monitors[@]}; i++)); do + if [[ $monitor == "${monitors[i]}" ]]; then + index=$(calculate_index $1 $i) + move_workspace $index $2 + break + fi +done