From 66c5393cfef6a5b7cf0c2f7a4dc2e7428c8b2fd3 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Mon, 25 May 2026 23:26:29 +0545 Subject: [PATCH] feat(config/hypr): extend workspace keybinds to support up to 10 workspaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switched from a hard‑coded 1‑9 range to a dynamic 1‑10 range, allowing more workspaces and cleaning up the keybinding logic; also removed stray "No emojis." comment. New Features - Switch and move active windows using workspace numbers 1‑10. Enhancements - Loop now calculates key via modulo to support cyclic indexing. - Introduced `workspaces` variable for readability. Bug Fixes - Removed the leftover comment "No emojis." --- config/hypr/configs/keybinds.lua | 14 ++++++++------ config/hypr/hyprland.lua | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/config/hypr/configs/keybinds.lua b/config/hypr/configs/keybinds.lua index 0168debc..637e3832 100644 --- a/config/hypr/configs/keybinds.lua +++ b/config/hypr/configs/keybinds.lua @@ -131,12 +131,14 @@ for key, val in pairs({ hl.bind("ALT + SHIFT + " .. key, hl.dsp.window.resize({ x = val[2], y = val[3], relative = true })) -- Resize end --- Switch workspaces with mainMod + [0-9] --- Move active window to a workspace with mainMod + SHIFT + [0-9] -for i = 1, 9 do - hl.bind(mainMod .. " + " .. i, hl.dsp.focus({ workspace = i })) - hl.bind("ALT + SHIFT + " .. i, hl.dsp.window.move({ workspace = i, follow = false })) - hl.bind(mainMod .. " + SHIFT + " .. i, hl.dsp.window.move({ workspace = i })) +-- Switch workspaces with mainMod + [0-10] +-- Move active window to a workspace with mainMod + SHIFT + [0-10] +local workspaces = 10 +for i = 1, workspaces do + local key = i % 10 + hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i })) + hl.bind("ALT + SHIFT + " .. key, hl.dsp.window.move({ workspace = i, follow = false })) + hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i })) end -- Move/resize windows with SUPER + LMB/RMB and dragging diff --git a/config/hypr/hyprland.lua b/config/hypr/hyprland.lua index e5d72ce4..aedaeb8c 100644 --- a/config/hypr/hyprland.lua +++ b/config/hypr/hyprland.lua @@ -7,4 +7,3 @@ require("configs.startup_apps") require("configs.misc") dofile("/home/sankalp/.config/Modus/config/hypr/modus.lua") -