blueyed / awesome-cyclefocus

Alt-Tab for the awesome window manager (and more)
GNU General Public License v2.0
184 stars 17 forks source link

How the end cycling in the last focussed/raised window? #34

Closed offray closed 5 years ago

offray commented 5 years ago

Hi,

Thanks for cyclefocus. I'm trying it just now, but seems that I don't understand its default behavior.

I just commented the default Alt + Tab, and enabled the new one as proposed in the Readme's example 1. I can cycle to all windows using Alt + Tab, as expected, and each window raises and gets the focus, as expected, but I would expect also that the last window raised and focused is the one I'm going, if I stop cycling. Instead it brings me to the window/client where the cycling started. There is any way to change the defaults for ending the cycling in the last focused/raised client?

blueyed commented 5 years ago

Your expected behavior is correct, so there is a problem somewhere.

Have you checked awesome's stderr for any error? Otherwise I suggest to enable debug logging, and post your config here. Are you using the first example as-is?

offray commented 5 years ago

Thanks for your quick reponse.

Here is my Awesome config file ATM. Also, when cycling goes to an empty tag (because I closed the clients there), I got this error message:

Oops, and error happened!
/home/offray/.config/awesome/cyclefocus/init.lua:698 attempt to index local 'c_tag' (a nil value)

I don't know if this works for debugging purposes. How can I enable debug logging in awesome wm?

Cheers,

blueyed commented 5 years ago

It depends on how you start awesome, typically you would redirect its output, or get it in ~/.local/share/xorg/Xorg.0.log already. I assume you will see some error there already, but otherwise set cyclefocus.debug_level (see https://github.com/blueyed/awesome-cyclefocus#configuration), and tail -f your awesome/X logfile then.

Also, when cycling goes to an empty tag (because I closed the clients there), I got this error message:

How does it go there then? Are clients closed while cycling?

blueyed commented 5 years ago

I assume the following patch fixes your error, but I would like to reproduce it before committing:

diff --git i/init.lua w/init.lua
index fb1566d..afcc708 100644
--- i/init.lua
+++ w/init.lua
@@ -680,7 +680,7 @@ cyclefocus.show_client = function (c)
         -- Make the clients tag visible, if it currently is not.
         local sel_tags = c.screen.selected_tags
         local c_tag = c.first_tag or c:tags()[1]
-        if not awful.util.table.hasitem(sel_tags, c_tag) then
+        if c_tag and not awful.util.table.hasitem(sel_tags, c_tag) then
             -- Select only the client's first tag, after de-selecting
             -- all others.
offray commented 5 years ago

They way I go to the clients, is by clicking on them, once they have been raised. Some times I cycle on the clients to know which client to close, and I do that with the mouse also, and that's where the problem was happening, before your bug fix, that is working well (thanks for it). The client is no more in the cycling list, but still I can not get the desired behavior. It is supposed that I the last client is my current location once I press "Esc" key to stop cycling, isn't it?

Also after applying your fix, I'm getting a different error message:

Opps, an error happened!
/home/offray/.config/awesome/cyclefocus/init.lua:264: invalid object
blueyed commented 5 years ago

Thanks for the additional info. The normal/assumed use case is that you release your modifier key when on the desired client, while Escape is meant to abort (goes back to the initial client). Clicking a client is something I've never done myself.. :)

blueyed commented 5 years ago

As for the last error, this would probably help:

diff --git i/init.lua w/init.lua
index fb1566d..eaefb45 100644
--- i/init.lua
+++ w/init.lua
@@ -261,6 +261,8 @@ end
 local get_object_name = function (o)
     if not o then
         return '[no object]'
+    elseif not o.valid then
+        return '[invalid object]'
     elseif not o.name then
         return '[no object name]'
     else

Do you have a traceback for this? (should be in awesome's log) - would be good to see from where this was called.

blueyed commented 5 years ago

They way I go to the clients, is by clicking on them, once they have been raised. Some times I cycle on the clients to know which client to close, and I do that with the mouse also, and that's where the problem was happening,

I am not understanding this fully. You said that you are closing clients using the mouse while cycling. Is that via the close icon on the titlebar? I've just tried this while holding the modifier for cycling (so the list is still visible), but that would not close the client?! (the icon turns red, no idea what that means)

Can you provide steps to reproduce your first issue?

offray commented 5 years ago

You said that you are closing clients using the mouse while cycling. Is that via the close icon on the titlebar?

Yes, that's the way I close the clients.

The normal/assumed use case is that you release your modifier key when on the desired client, while Escape is meant to abort (goes back to the initial client).

Can you provide steps to reproduce your first issue?

Ummm... there is something I still don't get about the intended default behavior. These are the steps to reproduce the issue:

Could be this related, in some way to using several screens? (I'm going to logout and test with a single monitor right now, but I don't want to lose this report wrote in the web browser).

offray commented 5 years ago

Could be this related, in some way to using several screens?

No. It didn't work neither with a single enabled monitor. Still cycling raises the windows list popup. Still releasing the Mod key doesn't enable the last raised client, nor quits the cycling windows popup.

sclu1034 commented 5 years ago

If I release the Mod key, I see in the last client raised/focused, but the keyboard operations don't work there and the cycle focus popup is still over my windows (it doesn't disappear, as I would expect).

I also experienced this issue and fixed it by changing the value passed as modifier to cyclefocus.cycle. You said, you use Alt + Tab as key combination, so you need to pass Alt_L as modifier like so:

awful.key(
  { "Mod1" }, -- the example uses `modkey` == "Mod4", i.e. the `Super` key in the default rc.lua
  "Tab",
  function() cyclefocus.cycle({ modifier = "Alt_L" }) end, -- the example uses `Super_L` here
  { description = "cycle through clients", group = "client" }
)

I assume pressing Esc while the cycle popup is open is supposed to cancel the cycle action (similar to other DEs), so the fact that you end up at the previous window would be correct behavior.

blueyed commented 5 years ago

@SirAiedail You can also use cyclefocus.key instead of awful.key which should handle modifier etc.

offray commented 5 years ago

@blueyed,

I have tested @SirAiedail suggestion and seems working pretty fine. Now I release the Alt key and I'm located in the place I want to be after cycling through clients as expected.

Thank you both!

blueyed commented 5 years ago

Great, closing this then. Will commit the two patches I've posted above.