Skip to content
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

try _NET_CLIENT_LIST if _NET_CLIENT_LIST_STACKING doesn't work #62

Merged
merged 2 commits into from Jun 11, 2021

Conversation

MaxGyver83
Copy link
Contributor

In window managers that don't support _NET_CLIENT_LIST_STACKING (dwm), jumpapp emit this error message:

/usr/bin/jumpapp: line 248: [[: found.: syntax error: invalid arithmetic operator (error token is ".")

With this PR, jumpapp queries _NET_CLIENT_LIST when _NET_CLIENT_LIST_STACKING doesn't contain any values. This fixes #54 in a sense that this error message doesn't occur anymore.

But it still doesn't work as expected. When you run jumpapp firefox:

  • ✔ start firefox when it's not yet running
  • ✔ jump to firefox when another program is active
  • ✔ jump to second firefox window when first firefox window is active
  • ✘ jump to the most recent firefox window (when there are more than one), coming from another program

When firefox is not active, jumpapp brings you always to the firefox window created first. (Without this PR, the firefox window created last.) Maybe dwm doesn't update _NET_CLIENT_LIST. Nevertheless, I think this PR brings an improvement to dwm users.

@MaxGyver83
Copy link
Contributor Author

I have tested it on another PC and now I get the error message again. I need to analyze why it happens.

@gitlerat
Copy link

Hi do you have any news on this? It would be really cool to use dwm with jumpapp :)

@MaxGyver83
Copy link
Contributor Author

For me it works well with the limitation that I can't toggle between windows of the same application. But I use only one Firefox window and one terminal window (with tmux/byobu) anyway. If this is okay for you, you can simply clone/download my bugfix branch: https://github.com/MaxGyver83/jumpapp/tree/feature/better-dwm-support

Copy link
Owner

@mkropat mkropat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Good explanation in your description. Even if the behavior isn't perfect, it seems good enough (not to mention better than how it works today on dwm), so I'm going to go ahead and merge this.

Maybe I'll let it sit in master for a little bit to see if anyone discovers issues with this change, and if all is quiet I'll draft a new release with this change so it's in the easily downloaded version.

@@ -379,6 +379,10 @@ get_active_windowid() {
list_stacking_order() {
local name ids
read -r name ids < <(xprop -root ' $0+\n' _NET_CLIENT_LIST_STACKING)
if [[ "$ids" == 'not found.' ]] || [[ "$ids" =~ 'no such atom' ]]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing this on multiple machines to catch the multiple messages. Another idea is instead of trying to match on specific error messages, we could invert the match and look for something that only appears in the success output (maybe (WINDOW) or 0x?). I like what you have though, let's try it and see if anyone reports issues.

BTW I double checked to see if we could use the process return status code, but it looks like it's always 0 whether the property exists or not.

@mkropat mkropat merged commit c3cda40 into mkropat:master Jun 11, 2021
@mkropat mkropat mentioned this pull request Mar 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when using jumpapp in dwm
3 participants