Add an option to choose wheter tag switches apply to all screens

This commit is contained in:
Manu Cornet 2022-01-22 06:49:57 +00:00
parent eb555a0e09
commit b4fb8f3785
2 changed files with 19 additions and 12 deletions

View File

@ -46,11 +46,12 @@ globalkeys = gears.table.join(globalkeys,
Arguments that can be passed to the contructor (all of them are optional): Arguments that can be passed to the contructor (all of them are optional):
| Arg | Default | Description | | Arg | Default | Description |
|-------------|----------------|-------------------------------------| |----------------------|----------------|------------------------------------------|
| `rows` | 2 | Number of rows (1 to 9) | | `rows` | 2 | Number of rows (1 to 9) |
| `columns` | 3 | Number of columns (1 to 9) | | `columns` | 3 | Number of columns (1 to 9) |
| `cycle` | `false` | Whether to cycle at grid edges | | `cycle` | `false` | Whether to cycle at grid edges |
| `icon_size` | 100 | Size of icon in notification | | `icon_size` | 100 | Size of icon in notification |
| `position` | `"top_middle"` | Notification position on the screen | | `position` | `"top_middle"` | Notification position on the screen |
| `visual` | `true` | Whether to show workspace changes | | `visual` | `true` | Whether to show workspace changes |
| `switch_all_screens` | `true` | Whether tag changes apply to all screens |

View File

@ -19,6 +19,7 @@ function workspace_grid:init(args)
self.visual = args.visual or true self.visual = args.visual or true
self.cycle = args.cycle or false self.cycle = args.cycle or false
self.icon_size = args.icon_size or 100 self.icon_size = args.icon_size or 100
self.switch_all_screens = args.switch_all_screens or true
if self.visual then if self.visual then
awful.screen.connect_for_each_screen(function(s) awful.screen.connect_for_each_screen(function(s)
@ -57,12 +58,17 @@ function workspace_grid:navigate(direction)
} }
local j = action[direction] local j = action[direction]
-- Switch tags on all screens at the same time. if self.switch_all_screens then
-- TODO: Add option to switch per-screen. -- Switch tags on all screens at the same time.
for s in screen do for s in screen do
t = s.tags[j] t = s.tags[j]
if t then t:view_only() end 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 end
function workspace_grid:on_tag_selected(t) function workspace_grid:on_tag_selected(t)