BlingCorp / bling

Utilities for the awesome window manager
https://blingcorp.github.io/bling/
MIT License
852 stars 49 forks source link

Scratchpads not working the properway #172

Closed Stefanomarton closed 2 years ago

Stefanomarton commented 2 years ago

Hi there, I'm playing with scratchpads modules but I think I'm not getting something. I created a scratchpad using the example in the docs

local` term_scratch = bling.module.scratchpad {
    command = "alacritty",           -- How to spawn the scratchpad
    rule = { instance = "spad" },                     -- The rule that the scratchpad will be searched by
    sticky = true,                                    -- Whether the scratchpad should be sticky
    autoclose = true,                                 -- Whether it should hide itself when losing focus
    floating = true,                                  -- Whether it should be floating (MUST BE TRUE FOR ANIMATIONS)
    geometry = {x=360, y=90, height=900, width=1200}, -- The geometry in a floating state
    reapply = true,                                   -- Whether all those properties should be reapplied on every new opening of the scratchpad (MUST BE TRUE FOR ANIMATIONS)
    dont_focus_before_close  = true,                 -- When set to true, the scratchpad will be closed by the toggle function regardless of whether its focused or not. When set to false, the toggle function will first bring the scratchpad into focus and only close it on a second call
}

And i thought it would be nice to use a shortcuts

awful.key({modkey}, "z", function() term_scratch:toggle() end),

It works just fine when opening, but when unfocused and recalled with the "toggle" it reopen another terminal. Scratchpads should recall the same window again and again, or am I missing somethings?

Nooo37 commented 2 years ago

The rule doesn't apply to the command. The rule is used by the module to "find" your scratchpad after it got spawned. There should be flags to set the window instance name from alacritty through a flag though

Stefanomarton commented 2 years ago

Thanks for your kindness