]> git.rmz.io Git - dotfiles.git/commitdiff
awesome: add mapping for swapping screens
authorSamir Benmendil <me@rmz.io>
Tue, 31 Oct 2023 21:20:05 +0000 (21:20 +0000)
committerSamir Benmendil <me@rmz.io>
Tue, 31 Oct 2023 23:08:50 +0000 (23:08 +0000)
awesome/bindings.lua

index ae2ebafd055ef7036ec50b2063b03f5578e184db..50e723107cc21ae36b1436bfd46b8a185b590785 100644 (file)
@@ -49,6 +49,25 @@ globalkeys = gears.table.join(globalkeys,
               {description = "focus the next screen", group = "screen"}),
     awful.key({ modkey,           }, "=",     function () awful.screen.focus_relative( 1) end, -- that's the key left of 1 (kinesis)
               {description = "focus the next screen", group = "screen"}),
+    awful.key({ modkey, "Control" }, "=",
+              function ()
+                -- swap tags in screens
+                local c = client.focus
+                local this_screen = awful.screen.focused();
+                -- TODO: only works with two screens
+                local next_screen = this_screen:get_next_in_direction("right") or this_screen:get_next_in_direction("left")
+                local this_screen_tag = this_screen.selected_tag;
+                local next_screen_tag = next_screen.selected_tag;
+
+                this_screen_tag:swap(next_screen_tag)
+
+                this_screen_tag:view_only()
+                next_screen_tag:view_only()
+
+                awful.screen.focus(this_screen)
+                c:jump_to(true)
+              end,
+              {description = "swap screens", group = "screen"}),
     awful.key({ modkey, "Control" }, "Right", function () awful.screen.focus_relative(-1) end,
               {description = "focus the next screen", group = "screen"}),
     awful.key({ modkey, "Control" }, "Left",  function () awful.screen.focus_relative(-1) end,