From 873b5bbc6441715682ca367e928cf0cca97c2c26 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Tue, 13 Oct 2026 18:33:47 -0400 Subject: [PATCH] feat(config): adjust workspace layout toggle defaults and add window centering command --- dot_config/hypr/bindings.lua | 41 ++++++++++++++++++++++++++++------- dot_config/hypr/looknfeel.lua | 24 ++++++++++++++------ 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/dot_config/hypr/bindings.lua b/dot_config/hypr/bindings.lua index 9e317bc..b9cd7dc 100644 --- a/dot_config/hypr/bindings.lua +++ b/dot_config/hypr/bindings.lua @@ -15,12 +15,11 @@ hl.unbind("SUPER + Q") o.bind("SUPER + Q", "Close window", hl.dsp.window.close()) -- Mod+W was tabbed display. Here it flips the workspace layout, and sets every --- column to 75% of the screen when the workspace turns to scrolling. Dwindle --- needs no widths, because it re-tiles on its own. --- Needs ~/.local/bin/omarchy-toggle-layout. Pass another fraction to change --- the width, e.g. "omarchy-toggle-layout 0.6". +-- column to 50% of the screen (niri's default-column-width) when the +-- workspace turns to scrolling. Dwindle needs no widths, because it re-tiles +-- on its own. Needs ~/.local/bin/omarchy-toggle-layout. hl.unbind("SUPER + W") -- was: close window -o.bind("SUPER + W", "Toggle workspace layout", "omarchy-toggle-layout") +o.bind("SUPER + W", "Toggle workspace layout", "omarchy-toggle-layout 0.5") -- Mod+BackSpace -> last window. hl.unbind("SUPER + BACKSPACE") -- was: toggle window transparency @@ -125,9 +124,8 @@ o.bind("SUPER + CTRL + K", "Previous workspace", hl.dsp.focus({ workspace = "e-1 -- Scratch workspaces. Omarchy's SUPER + S is taken by the region screenshot -- below, so the main toggle (Tern) lands on SUPER + CTRL + S, with -- SUPER + A (free in Omarchy) as the home-row alias. Claude Desktop has its --- own scratch workspace on SUPER + SHIFT + A and SUPER + C (the latter --- replaces Omarchy's universal copy). SUPER + ALT + S (send window to the --- scratchpad) is still the Omarchy default and needs no line. +-- own scratch workspace on SUPER + CTRL + ALT + L. SUPER + ALT + S (send +-- window to the scratchpad) is still the Omarchy default and needs no line. -- -- All of them go through ~/.local/bin/omarchy-toggle-scratch rather than the -- raw special-workspace toggle: it opens each workspace on its home monitor @@ -202,6 +200,33 @@ o.bind("SUPER + SHIFT + BACKSPACE", "Dismiss last notification", "omarchy-shell o.bind("SUPER + ALT + C", "Fit active column", hl.dsp.layout("fit active")) o.bind("SUPER + SHIFT + ALT + C", "Fit visible columns", hl.dsp.layout("fit visible")) +-- Super+C (niri center-column). Floating windows go through centerwindow. +-- On a scrolling workspace the column is re-focused with focus_fit_method +-- briefly set to 0 (center), then restored, so plain focus moves keep +-- niri's center-focused-column "never". A relative "move" can't do this: the +-- tape stops at its first column, so the leftmost window never reaches the +-- middle. Dwindle and master have nothing to scroll; the key does nothing. +local function center_window() + local window = hl.get_active_window() + if not window then + return + end + if window.floating then + hl.dispatch(hl.dsp.window.center()) + return + end + if not window.workspace or window.workspace.tiled_layout ~= "scrolling" then + return + end + local fit_method = hl.get_config("scrolling.focus_fit_method") + hl.config({ scrolling = { focus_fit_method = 0 } }) + hl.dispatch(hl.dsp.focus({ window = window })) + hl.config({ scrolling = { focus_fit_method = fit_method } }) +end + +hl.unbind("SUPER + C") -- was: universal copy +o.bind("SUPER + C", "Center window / column", center_window) + -- ─── Applications ─────────────────────────────────────────────────────────── -- Same modifier block as the niri config. Each one focuses an open window -- before it launches a new one. The launch command uses the same desktop diff --git a/dot_config/hypr/looknfeel.lua b/dot_config/hypr/looknfeel.lua index 853770d..37f701c 100644 --- a/dot_config/hypr/looknfeel.lua +++ b/dot_config/hypr/looknfeel.lua @@ -120,10 +120,20 @@ hl.animation({ leaf = "borderangle", enabled = true, speed = 100, bezier = "line -- }, -- }) --- https://wiki.hypr.land/Configuring/Layouts/Scrolling-Layout/ --- hl.config({ --- scrolling = { --- -- See only one column per screen instead of two. --- column_width = 0.97, --- }, --- }) +-- Scrolling layout, matched to niri's layout block +-- (~/.config/niri/config.d/20-layout-and-overview.kdl). Wins over Omarchy's +-- column_width = 0.49. +hl.config({ + scrolling = { + -- default-column-width { proportion 0.5; } + column_width = 0.5, + -- preset-column-widths; SUPER + R / SUPER + SHIFT + R cycle these + -- (colresize +conf / -conf via omarchy-cycle-window-size). + explicit_column_widths = "0.333, 0.5, 0.667", + -- center-focused-column "never": scroll only as far as needed to fit the + -- focused column. SUPER + C centers on demand. + focus_fit_method = 1, + -- niri keeps a lone column at its own width instead of filling the screen. + fullscreen_on_one_column = false, + }, +})