diff --git a/README.md b/README.md index cbd7910..3beff68 100644 --- a/README.md +++ b/README.md @@ -98,8 +98,8 @@ home.packages = with pkgs; [ | Action | Description | |--------|-------------| | **Super + Tab** | Toggle the overview | -| **Arrow Keys** | Navigate between workspaces | -| **h / j / k / l** | Vim-style navigation (left/down/up/right) | +| **Arrow Keys / h/l** | Navigate left/right within current row* | +| **Up/Down / j/k** | Navigate between workspace rows | | **1-9, 0** | Jump to Nth workspace in current group (0 = 10th) | | **Escape / Enter** | Close the overview | | **Click workspace** | Switch to that workspace | @@ -107,6 +107,8 @@ home.packages = with pkgs; [ | **Middle-click window** | Close that window | | **Drag window** | Move window to different workspace | +> *When `hideEmptyRows` is enabled, left/right navigation wraps within the current visible row for better UX + --- ## ⚙️ Configuration @@ -137,6 +139,7 @@ property QtObject overview: QtObject { - Set `hideEmptyRows: true` to automatically hide rows that have no windows - Keeps your overview clean by only showing rows with active workspaces - The current workspace row is always visible, even if empty +- Arrow key navigation (left/right) stays within the current row when enabled - Great for 2-row setups where you rarely use workspaces 6-10 ### Position diff --git a/modules/overview/Overview.qml b/modules/overview/Overview.qml index 9659b0e..1b7b433 100644 --- a/modules/overview/Overview.qml +++ b/modules/overview/Overview.qml @@ -92,16 +92,31 @@ Scope { const currentGroup = Math.floor((currentId - 1) / workspacesPerGroup); const minWorkspaceId = currentGroup * workspacesPerGroup + 1; const maxWorkspaceId = minWorkspaceId + workspacesPerGroup - 1; + + // When hideEmptyRows is enabled, constrain navigation to current row + const currentRow = Math.floor((currentId - minWorkspaceId) / Config.options.overview.columns); + const rowMinId = minWorkspaceId + currentRow * Config.options.overview.columns; + const rowMaxId = rowMinId + Config.options.overview.columns - 1; let targetId = null; // Arrow keys and vim-style hjkl if (event.key === Qt.Key_Left || event.key === Qt.Key_H) { targetId = currentId - 1; - if (targetId < minWorkspaceId) targetId = maxWorkspaceId; + // Wrap within visible workspaces + if (Config.options.overview.hideEmptyRows) { + if (targetId < rowMinId) targetId = rowMaxId; + } else { + if (targetId < minWorkspaceId) targetId = maxWorkspaceId; + } } else if (event.key === Qt.Key_Right || event.key === Qt.Key_L) { targetId = currentId + 1; - if (targetId > maxWorkspaceId) targetId = minWorkspaceId; + // Wrap within visible workspaces + if (Config.options.overview.hideEmptyRows) { + if (targetId > rowMaxId) targetId = rowMinId; + } else { + if (targetId > maxWorkspaceId) targetId = minWorkspaceId; + } } else if (event.key === Qt.Key_Up || event.key === Qt.Key_K) { targetId = currentId - Config.options.overview.columns; if (targetId < minWorkspaceId) targetId += workspacesPerGroup;