quake: replicated full scratchdrop behaviour

This commit is contained in:
copycat-killer 2016-06-25 13:12:50 +02:00
parent 7bd82a18a8
commit a9c5cf23b2
1 changed files with 13 additions and 5 deletions

View File

@ -20,6 +20,7 @@ local string = string
local pairs = pairs local pairs = pairs
local setmetatable = setmetatable local setmetatable = setmetatable
local tostring = tostring
module("quake") module("quake")
@ -54,7 +55,7 @@ function QuakeConsole:display()
if not client then if not client then
-- The client does not exist, we spawn it -- The client does not exist, we spawn it
awful.util.spawn(self.app .. " " .. string.format(self.argname, self.name), awful.util.spawn(self.app .. " " .. string.format(self.argname, self.name),
false, self.screen) false, self.screen)
return return
end end
@ -64,11 +65,11 @@ function QuakeConsole:display()
client.size_hints_honor = false client.size_hints_honor = false
client:geometry(self.geometry) client:geometry(self.geometry)
-- Sticky and on top -- Not sticky and on top
client.ontop = true client.ontop = true
client.above = true client.above = true
client.skip_taskbar = true client.skip_taskbar = true
client.sticky = true client.sticky = false
-- This is not a normal window, don't apply any specific keyboard stuff -- This is not a normal window, don't apply any specific keyboard stuff
client:buttons({}) client:buttons({})
@ -78,6 +79,7 @@ function QuakeConsole:display()
if self.visible then if self.visible then
client.hidden = false client.hidden = false
client:raise() client:raise()
self.last_tag = tostring(awful.tag.selected(self.screen))
client:tags({awful.tag.selected(self.screen)}) client:tags({awful.tag.selected(self.screen)})
capi.client.focus = client capi.client.focus = client
else else
@ -89,6 +91,7 @@ function QuakeConsole:display()
client:tags(ctags) client:tags(ctags)
end end
return client
end end
-- Create a console -- Create a console
@ -146,8 +149,13 @@ end
-- Toggle the console -- Toggle the console
function QuakeConsole:toggle() function QuakeConsole:toggle()
self.visible = not self.visible current_tag = awful.tag.selected(self.screen)
self:display() if self.last_tag ~= tostring(current_tag) and self.visible then
awful.client.movetotag(current_tag, self:display())
else
self.visible = not self.visible
self:display()
end
end end
setmetatable(_M, { __call = function(_, ...) return QuakeConsole:new(...) end }) setmetatable(_M, { __call = function(_, ...) return QuakeConsole:new(...) end })