From 261b359cc5f740bfd5bc0b51dbfa0c842ff790e0 Mon Sep 17 00:00:00 2001 From: Drauthius Date: Fri, 26 May 2017 09:17:21 +0200 Subject: [PATCH] Corrected configuration changes. Configuration when moving clients to other tags was not correct, causing them to only be movable to tags on the same screen, and based on the tag index on that screen. --- README.md | 61 ++++++++++++++++++++++++++++++++++++---------------- rc.lua.patch | 30 ++++++++++++++++++++------ 2 files changed, 67 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index a5501f9..00963d9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ awesome-sharedtags A simple implementation for creating tags shared on multiple screens for [awesome window manager](http://awesome.naquadah.org/). -This branch of the library is intended to work with *awesome* version 4.0 (and +This branch of the library is intended to work with *awesome* version 4 (for all minor versions), but there are other branches with support for other versions. @@ -57,29 +57,54 @@ Installation end) ``` 4. The code for handling tags and clients needs to be changed to use the - library. + library and pick the correct tag. ```lua for i = 1, 9 do - globalkeys = awful.util.table.join(globalkeys, + globalkeys = gears.table.join(globalkeys, -- View tag only. awful.key({ modkey }, "#" .. i + 9, - function () - local screen = awful.screen.focused() - local tag = tags[i] - if tag then - sharedtags.viewonly(tag, screen) - end - end), - -- Toggle tag. + function () + local screen = awful.screen.focused() + local tag = tags[i] + if tag then + sharedtags.viewonly(tag, screen) + end + end, + {description = "view tag #"..i, group = "tag"}), + -- Toggle tag display. awful.key({ modkey, "Control" }, "#" .. i + 9, - function () - local screen = awful.screen.focused() - local tag = tags[i] - if tag then - sharedtags.viewtoggle(tag, screen) - end - end)) + function () + local screen = awful.screen.focused() + local tag = tags[i] + if tag then + sharedtags.viewtoggle(tag, screen) + end + end, + {description = "toggle tag #" .. i, group = "tag"}), + -- Move client to tag. + awful.key({ modkey, "Shift" }, "#" .. i + 9, + function () + if client.focus then + local tag = tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + {description = "move focused client to tag #"..i, group = "tag"}), + -- Toggle tag on focused client. + awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, + function () + if client.focus then + local tag = tags[i] + if tag then + client.focus:toggle_tag(tag) + end + end + end, + {description = "toggle focused client on tag #" .. i, group = "tag"}) + ) end ``` 5. Lastly, any rules referencing the screen and tag should use the newly diff --git a/rc.lua.patch b/rc.lua.patch index a48796e..4ab7663 100644 --- a/rc.lua.patch +++ b/rc.lua.patch @@ -6,7 +6,7 @@ https://github.com/Drauthius/awesome-sharedtags --- orig/rc.lua 2016-01-01 13:45:26.000000000 +0100 +++ sharedtags/rc.lua 2016-01-05 20:09:21.428836239 +0100 -@@ -36,6 +36,10 @@ +@@ -38,6 +38,10 @@ end -- }}} @@ -17,7 +17,7 @@ https://github.com/Drauthius/awesome-sharedtags -- {{{ Variable definitions -- Themes define colours, icons, font and wallpapers. beautiful.init(awful.util.get_themes_dir() .. "default/theme.lua") -@@ -88,6 +94,18 @@ +@@ -90,6 +94,18 @@ end -- }}} @@ -36,7 +36,7 @@ https://github.com/Drauthius/awesome-sharedtags -- {{{ Menu -- Create a launcher widget and a main menu myawesomemenu = { -@@ -179,8 +197,9 @@ +@@ -181,8 +197,9 @@ -- Wallpaper set_wallpaper(s) @@ -48,7 +48,7 @@ https://github.com/Drauthius/awesome-sharedtags -- Create a promptbox for each screen s.mypromptbox = awful.widget.prompt() -@@ -372,9 +402,9 @@ +@@ -386,9 +403,9 @@ awful.key({ modkey }, "#" .. i + 9, function () local screen = awful.screen.focused() @@ -60,7 +60,7 @@ https://github.com/Drauthius/awesome-sharedtags end end, {description = "view tag #"..i, group = "tag"}), -@@ -382,9 +412,9 @@ +@@ -396,9 +413,9 @@ awful.key({ modkey, "Control" }, "#" .. i + 9, function () local screen = awful.screen.focused() @@ -72,7 +72,25 @@ https://github.com/Drauthius/awesome-sharedtags end end, {description = "toggle tag #" .. i, group = "tag"}), -@@ -469,9 +469,9 @@ +@@ -406,7 +423,7 @@ + awful.key({ modkey, "Shift" }, "#" .. i + 9, + function () + if client.focus then +- local tag = client.focus.screen.tags[i] ++ local tag = tags[i] + if tag then + client.focus:move_to_tag(tag) + end +@@ -417,7 +434,7 @@ + awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, + function () + if client.focus then +- local tag = client.focus.screen.tags[i] ++ local tag = tags[i] + if tag then + client.focus:toggle_tag(tag) + end +@@ -483,9 +500,9 @@ }, properties = { titlebars_enabled = true } },