From b4fb8f3785b9114dc128b0a6f8d286ab0ee5247a Mon Sep 17 00:00:00 2001 From: Manu Cornet Date: Sat, 22 Jan 2022 06:49:57 +0000 Subject: [PATCH] Add an option to choose wheter tag switches apply to all screens --- README.md | 17 +++++++++-------- awesome-workspace-grid.lua | 14 ++++++++++---- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 12182b4..ed5e3ab 100644 --- a/README.md +++ b/README.md @@ -46,11 +46,12 @@ globalkeys = gears.table.join(globalkeys, Arguments that can be passed to the contructor (all of them are optional): -| Arg | Default | Description | -|-------------|----------------|-------------------------------------| -| `rows` | 2 | Number of rows (1 to 9) | -| `columns` | 3 | Number of columns (1 to 9) | -| `cycle` | `false` | Whether to cycle at grid edges | -| `icon_size` | 100 | Size of icon in notification | -| `position` | `"top_middle"` | Notification position on the screen | -| `visual` | `true` | Whether to show workspace changes | +| Arg | Default | Description | +|----------------------|----------------|------------------------------------------| +| `rows` | 2 | Number of rows (1 to 9) | +| `columns` | 3 | Number of columns (1 to 9) | +| `cycle` | `false` | Whether to cycle at grid edges | +| `icon_size` | 100 | Size of icon in notification | +| `position` | `"top_middle"` | Notification position on the screen | +| `visual` | `true` | Whether to show workspace changes | +| `switch_all_screens` | `true` | Whether tag changes apply to all screens | diff --git a/awesome-workspace-grid.lua b/awesome-workspace-grid.lua index 5e1275c..d4ea62b 100644 --- a/awesome-workspace-grid.lua +++ b/awesome-workspace-grid.lua @@ -19,6 +19,7 @@ function workspace_grid:init(args) self.visual = args.visual or true self.cycle = args.cycle or false self.icon_size = args.icon_size or 100 + self.switch_all_screens = args.switch_all_screens or true if self.visual then awful.screen.connect_for_each_screen(function(s) @@ -57,12 +58,17 @@ function workspace_grid:navigate(direction) } local j = action[direction] - -- Switch tags on all screens at the same time. - -- TODO: Add option to switch per-screen. - for s in screen do + if self.switch_all_screens then + -- Switch tags on all screens at the same time. + for s in screen do t = s.tags[j] if t then t:view_only() end - end + end + else + -- Switch tags on the focused screen only. + t = screen.focused.tags[j] + if t then t:view_only() end + end end function workspace_grid:on_tag_selected(t)