fix scratchpad closeing issue (#63)
* Add an option to disable client floating state when closing the scratchpad * Fix an issue where a scratchpad can't be toggled with dont_focus_before_close unless doing so from the first tag
This commit is contained in:
parent
8b245f7ef3
commit
75ff07a47e
|
@ -163,10 +163,18 @@ end
|
|||
--- Turns the scratchpad off if it is focused otherwise it raises the scratchpad
|
||||
function Scratchpad:toggle()
|
||||
local is_turn_off = false
|
||||
if self.dont_focus_before_close then
|
||||
local matches = self:find()
|
||||
if matches[1] and matches[1].first_tag then
|
||||
is_turn_off = matches[1].first_tag.selected
|
||||
if self.dont_focus_before_close then
|
||||
if matches[1] then
|
||||
local current_tag = matches[1].screen.selected_tag
|
||||
for k, tag in pairs(matches[1]:tags()) do
|
||||
if tag == current_tag then
|
||||
is_turn_off = true
|
||||
break
|
||||
else
|
||||
is_turn_off = false
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
is_turn_off = client.focus and
|
||||
|
@ -174,6 +182,9 @@ function Scratchpad:toggle()
|
|||
end
|
||||
|
||||
if is_turn_off then
|
||||
if self.disable_floating_on_close and matches[1].floating == true then
|
||||
matches[1].floating = false
|
||||
end
|
||||
self:turn_off()
|
||||
else
|
||||
self:turn_on()
|
||||
|
|
Loading…
Reference in New Issue