Well, now that I've added some logging I see that the attribute is in fact 
set, but it appears to be false for every window when I go to close it, 
even the Scratchpad windows. 

Also, and I'm not sure if this is related or something else I've done 
wrong, but when I close a Scratchpad window I get the folllowing errors in 
my qtile.log: (Apologies for the straight paste, but it was smaller than 
the files and for some reason I can't submit pastes to any of my normal 
pastes sites on my current network.)

2019-06-10 16:27:24,118 WARNING libqtile bindings.py:_inner():L48 
on_scratchpad: False
2019-06-10 16:27:24,154 ERROR libqtile scratchpad.py:unsubscribe():L136 
Scratchpad failed to unsubscribe on_focus_change: Tried to unsubscribe a 
hook that was not currently subscribed
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/libqtile/hook.py", line 356, in 
_subscribe
    lst.remove(func)
ValueError: list.remove(x): x not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/libqtile/scratchpad.py", line 133, 
in unsubscribe
    hook.unsubscribe.client_focus(self.on_focus_change)
  File "/usr/lib/python3.7/site-packages/libqtile/hook.py", line 243, in 
client_focus
    return self._subscribe("client_focus", func)
  File "/usr/lib/python3.7/site-packages/libqtile/hook.py", line 359, in 
_subscribe
    "Tried to unsubscribe a hook that was not"
libqtile.utils.QtileError: Tried to unsubscribe a hook that was not 
currently subscribed
2019-06-10 16:27:24,155 ERROR libqtile scratchpad.py:unsubscribe():L141 
Scratchpad failed to unsubscribe on_focus_change: Tried to unsubscribe a 
hook that was not currently subscribed
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/libqtile/hook.py", line 356, in 
_subscribe
    lst.remove(func)
ValueError: list.remove(x): x not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/libqtile/scratchpad.py", line 138, 
in unsubscribe
    hook.unsubscribe.setgroup(self.on_focus_change)
  File "/usr/lib/python3.7/site-packages/libqtile/hook.py", line 107, in 
setgroup
    return self._subscribe("setgroup", func)
  File "/usr/lib/python3.7/site-packages/libqtile/hook.py", line 359, in 
_subscribe
    "Tried to unsubscribe a hook that was not"
libqtile.utils.QtileError: Tried to unsubscribe a hook that was not 
currently subscribed

On Monday, June 10, 2019 at 10:11:06 AM UTC-4, Tycho Andersen wrote:
>
> On Sun, Jun 09, 2019 at 08:27:30PM -0700, Aaron Helton wrote: 
> > 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 
>
> The logic looks reasonable. If you log in the kill_window() function, 
> does it actually have the attribute set? 
>
> Tycho 
>

-- 
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/5f6826c5-8baa-49fc-bb2a-22c8550b5e3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to