-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort windows by last access time #5
Comments
Good idea! That should probably be the default behavior, and if not, at the very least be an option. No promises about time frame, but I'll see if I can put something together in the next week or two. |
I'm still working on this btw in my free time and I want to see this happen. Might be another month or two before I get it done though :) |
Meantime I have found a workaround - a separate python script that returns the sorted list instead of the #!/usr/bin/env python
# encoding: UTF-8
#
# This is a simple script for sorting the wmctrl -lpx output by a last focus timestamp
import subprocess
# obtaining the list of windows initially sorted by the creation timestamp
wlist = subprocess.check_output( 'wmctrl -lpx', shell = True )
wlist = wlist.splitlines()
# getting the focus timestamp by the window id
def focustime( line ):
time = subprocess.check_output( 'xprop -id ' + line.split()[ 0 ] + ' _NET_WM_USER_TIME', shell = True )
if len( time.split( ' = ' ) ) > 1:
time = time.split( ' = ' )[ 1 ]
else:
time = '0'
return time
# using the focus timestamp as a sorting key
wlist.sort( key = focustime )
print( "\n".join( wlist ) ) Sure, it is possible to make the same in the jumpapp script directly, but I'm not good at bash. For now I only changed the line in |
Cool! Working code helps, even if it's in a different language. How's the speed with that script in place? My fear was that |
I didn't test it with many windows opened, but for a list of 10 processes there may be a slight delay, I think less than 0.1 s - it's almost unnoticeable. And there is a huge usability improvement in some workflows. |
Do you want to help me test the beta version of this functionality? I've created a new branch for my development work: sort-by-access If you already have the git repo cloned, you can test it with:
The code still needs a little polish, but I just wanted to get your thoughts about behavior + performance. |
Strange, but your code does not work for me. Only for Opera browser windows I get the expected behaviour, but for sakura, mucommander and atril (evince fork) jumpapping doesn't differ from the old (master branch) behaviour. |
Good to know. Thanks for testing. My guess is that the window access time logic isn't working on your desktop. Two questions:
The first column of output should be the window last access time, so if it's 0 or some other non-valid value, that would explain why it's not working. |
and for sakura:
That said, |
Think I figured it out: Openbox does not support _NET_WM_USER_TIME_WINDOW. Jumpapp needs to check _NET_WM_USER_TIME_WINDOW first, however, otherwise it won't work on Cinnamon (the window manager I use). As a workaround in case the _NET_WM_USER_TIME_WINDOW value is a lie (as seems to be the case in Openbox), Jumpapp will now fall back to trying _NET_WM_USER_TIME on the original window. Do you mind testing out the latest code? If you still have it checked out you can do:
|
It works, thank you! |
Cool, I need to clean up the code then I'll put together a new release with this change. If people complain about it being noticeably slower, I may have to make the new sorting optional, but I only plan to do that if people actually give feedback about it. |
Have you done it? It's not working for me.. |
Unfortunately, no. I only implemented a prototype. It would be really useful though, so give me a few weeks and I'll see if I can get the latest changes merged into the prototype, and add unit tests. |
Thanks for the enhancement, works in gnome! |
This feature just got released with the good work done in #13 and #14. Try it out and feel free to open a new issue if you find problems. |
There is a point at which jumpapping loses to alt-tabbing. When I work on a project I often has to switch between an editor and some pdf-documents in evince. With swift alt-tabbing I always get the most recent accessed pdf-document. When I use
jumpapp evince
I get the first (or, with-r
option, the last) opened pdf-document. It's not so handy.I think that it's possible to sort the list of windows returned by
wmctrl -lpx
by the last focus timestamp. Here is some code I googled from stackoverflow with minor edits:The text was updated successfully, but these errors were encountered: