From f57f42d2e86d3c44b662ea0f587fb74d3f85ff4b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 7 Feb 2017 17:13:29 +0100 Subject: Add functionality for desktop renaming. --- workspace.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'workspace.lua') diff --git a/workspace.lua b/workspace.lua index 537345d..0ac91c3 100644 --- a/workspace.lua +++ b/workspace.lua @@ -6,12 +6,17 @@ local object = require("gears.object") local Workspace = {} -function Workspace:add_desktop(name, nb_pages) - idx = #self.desktops + 1 +function Workspace:add_desktop(idx, name, nb_pages) self.desktops[idx] = desktop.new(idx, name, nb_pages, self.layouts[1]) return idx end +function Workspace:rename_desktop(idx, name) + local desk = self.desktops[idx] + desk.name = name + desk:emit_signal("desktop:name", name) +end + function Workspace:_apply_state() orig_focus = mouse.screen @@ -105,7 +110,10 @@ end function Workspace:move_client(client, desk, page) print("move to " .. desk .. "/" .. page) - awful.client.movetotag(self.desktops[desk].pages[page], client) + local dst_page = self.desktops[desk].pages[page] + local dst_screen = awful.tag.getscreen(dst_page) + awful.client.movetoscreen(client, dst_screen) + awful.client.movetotag(dst_page, client) end function Workspace:new(layouts) -- cgit v1.2.3