diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-10-26 18:52:13 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-10-26 18:52:13 +0200 |
commit | 871204a041cddf127149ef8e5fd1d5eb54784f51 (patch) | |
tree | c0148a959043fc2da28fad54be4d915233e1c605 /workspace.lua | |
parent | 6866499f3561ae5a9f3939abd6102710676baada (diff) |
bindings: factor out swapping two screens
Diffstat (limited to 'workspace.lua')
-rw-r--r-- | workspace.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/workspace.lua b/workspace.lua index 63fad94..654b118 100644 --- a/workspace.lua +++ b/workspace.lua @@ -4,6 +4,7 @@ local awful = require("awful") local object = require("gears.object") local stack = require("stack") local timer = require("gears.timer") +local utils = require("utils") local Workspace = {} @@ -168,6 +169,16 @@ function Workspace:client_move_relative(client, offset) end end +function Workspace:swap_screens(phys_idx) + local screen_dst = mouse.screen + local screen_src = utils.screen_physical(phys_idx) + if screen_src and screen_src ~= screen_dst then + local ss = workspace.screen_state[screen_src] + self:view(screen_dst, ss.desktop_idx, ss.page_idx) + timer.delayed_call(awful.screen.focus, screen_src) + end +end + function Workspace:new(layouts) local o = setmetatable({}, self) self.__index = self |