From 43db6a3449c7849bff496183f64485a0212ebef3 Mon Sep 17 00:00:00 2001 From: Manu Cornet Date: Sat, 25 Dec 2021 09:34:55 +0000 Subject: [PATCH] Add an option for the notification position. Update documentation. --- README.md | 18 +++++++++++++++--- awesome-workspace-grid.lua | 6 ++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a7b1008..32e3f8d 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,26 @@ cd ~/.config/awesome git clone https://github.com/lmanul/awesome-workspace-grid.git ``` +Arguments to pass 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) | +| `position` | `"top_middle"` | Notification position on the screen | +| `visual` | `true` | Whether to show workspace changes | +---------------------------------- + +Please make sure that `rows` × `columns` is equal to your number of tags, as +defined by the call to `awful.tag()` in your configuration. + Sample usage in `rc.lua`: ``` local workspace_grid = require("awesome-workspace-grid") grid = workspace_grid({ - rows = 2, -- supported: 1 to 9 - columns = 3, -- supported: 1 to 9 - visual = true, -- whether to show workspace changes + rows = 3, + columns = 3, }) -- Insert after 'globalkeys' is defined but before it is passed to 'root': diff --git a/awesome-workspace-grid.lua b/awesome-workspace-grid.lua index e897153..cc0976b 100644 --- a/awesome-workspace-grid.lua +++ b/awesome-workspace-grid.lua @@ -15,8 +15,10 @@ end function workspace_grid:init(args) self.rows = args.rows or 2 self.columns = args.columns or 3 + self.position = args.position or "top_middle" + self.visual = args.visual or true - if args.visual then + if self.visual then awful.screen.connect_for_each_screen(function(s) s.workspace_notification_id = nil end) @@ -80,7 +82,7 @@ function workspace_grid:on_tag_selected(t) icon = script_path() .. icon_path, icon_size = 100, margin = 0, - position = "top_middle", + position = self.position, preset = naughty.config.presets.normal, replaces_id = s.workspace_notification_id, screen = i,