Hey all! Relatively new to Qtile here, but I love it already and have 
almost got it perfectly fitting how I would like to use it. :)

The one problem I have is more of a convenience issue where I want to 
create a keybinding that intelligent determines if a window should actually 
close, or be sent to the scratchpad. I have a nasty habit of hitting my 
close button when I'm done with a browser window, which mostly comes from 
not working very commonly with Scratchpad until Qtile, but I end up causing 
myself a lot of headache when I mean to send the window back to the 
scratchpad instead of closing it.

I thought it would be fun to write my own python function to attempt to 
handle the keybinding, but this is proving more difficult than I thought. I 
started by working with someone else's config (namely sminez's over at 
https://github.com/sminez/qtile-config), which was mostly already the way I 
wanted mine setup. 

What I've attempted to do is basically capture anytime a window is assigned 
a group with the client_managed hook and given the window a new property, 
'on_scratchpad', which I set to True if window.group.name is 'scratchpad', 
the name of my group. Otherwise, it's false. Then, in my keybinding, 
instead of using lazy directly, I call a function kill_window(), which 
returns an inner function that checks the boolean and either calls 
window.kill or window.togroup('scratchpad'). I'm not sure if this is the 
proper or best way to do these, or even halfway correct, as I had issues 
following the documentation or finding info on how to write my own 
keybinding hook rather than using lazy, so I tried to copy what was already 
in the config files in sminez's config. It seems to work okay in terms of 
actually closing windows, which is good, but it fails to produce the 
desired behavior of moving windows that were on the Scratchpad to the 
actual scratchpad. Instead it also closes them. So either my attribute is 
being lost or I'm not actually working with the same object that I assigned 
it to, or I've made some other misunderstanding of the system. All very 
likely! 

I apologize for a bit of a ramble. I'm still new to this, and Python is not 
a language I'm super familiar with either. Links to my bindings.py, 
config.py, and groups.py file pastebins are below. I can provide other 
pastebins or info as necessary if the other files are useful, although I 
haven't altered any of the other files I got from sminez's config, though. 

Config.py: https://pastebin.com/9y0LfJzE
Bindings.py: https://pastebin.com/kWrHLUh5
Groups.py: https://pastebin.com/rY9yxTnG

*[Edit: *In the pastes I made above, for some reason the kill_window 
function uses current_win.togroup('scratchpad') instead of 
qtile.currentWindow.togroup('scratchpad'). That's fixed in my files, but 
the issues remains exactly the same. *]*

-- 
You received this message because you are subscribed to the Google Groups 
"qtile-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qtile-dev/5f1ad5ef-7561-45bc-bdd4-87357683c6c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to