dswitcher icon indicating copy to clipboard operation
dswitcher copied to clipboard

Recent window sorting

Open orschiro opened this issue 10 years ago • 5 comments

Hi there,

One cool idea I came up with is sorting the windows according to their recent use.

Let's say you have 5 open windows but recently switched from Firefox to Thunderbird. Could this information somehow be reflected in the following sorting order?

1. Firefox
2. Thunderbird 
3. Window 3
4. Window 4
5. Window 5

Do you find such a feature useful?

Thanks,

Robert

orschiro avatar Nov 27 '14 14:11 orschiro

I don't think its possible to get windows in any particular order using wmctrl. You could possibly maintain a list of recently used windows, but that would require having a program constantly running and listening for focus change events. I wrote a tool that outputs changes in the active window (for my i3bar) which could be used to keep the list of windows sorted by most recently active, but your idea would also need to notice when windows are closed so they don't stay in the list.

jtsymon avatar Nov 28 '14 06:11 jtsymon

@jtsymon,

Thanks for outlining. I see that this is far more complex and I doubt that it justifies the effort to implement.

Please feel free to close it if you think the same.

orschiro avatar Nov 28 '14 17:11 orschiro

I just tried writing a program to listen for window close events, and it looks like only the window manager and the process which created the window can receive those. So it doesn't seem to be possible to know when windows are closed without either hooking into the window manager (which would of course only work for certain WMs), or polling for events (e.g. running wmctrl -l in a loop - which I would avoid because its inefficient and slow to receive updates).

I can't close the issue (only you or Antithesisx can do that), but its not really resolved so it might as well stay open.

jtsymon avatar Nov 29 '14 00:11 jtsymon

It's interesting to know how Rof does this.

orschiro avatar Nov 29 '14 07:11 orschiro

It doesn't seem to have proper history for window focus (looks like that's just for the run/ssh menu), although it does group windows by their workspace and somehow sorts the workspaces by last focused (seems to be handled by the X server rather than Rofi, because I can kill Rofi and switch workspaces in an order, then start Rofi and it shows my workspaces in that same order even though it couldn't have known).

jtsymon avatar Nov 29 '14 08:11 jtsymon