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

Added Switch Application #27

Merged
merged 1 commit into from
Sep 21, 2018
Merged

Conversation

edjoperez
Copy link
Contributor

@edjoperez edjoperez commented Feb 5, 2018

Adds functionality to toggle between windows applications

image

image

It doenst use its trigger, so it makes albert has a more natural experience when switch between applications or new ones. Like rofi

Adds functionality to toggle between windows applications
@ManuelSchneid3r
Copy link
Member

Did you notice that there is https://github.com/albertlauncher/python/pull/5/files

@edjoperez
Copy link
Contributor Author

The only difference is that this one gives you a more fluent experience when you select the app you want to launch, because it adds the applications that are already running and the applications that you would launch

@Raensul
Copy link

Raensul commented Mar 16, 2018

if i am switching from phpstorm to chrome it is no focused window. i must click to chrome's window and then press ctrl+T for example

@husimo
Copy link

husimo commented Aug 8, 2018

Hello. It works great here under Opensuse Leap 15.0.
Just a bug :

  • Firefox triggers the "Firefox" window where as firefox doesn't work.
  • Konsole triggers the "konsole" window, the same as konsole.
    So it seems the script cannot properly detect windows where their name contains a uppercase letter.
    Thank you

@albertlauncher albertlauncher locked and limited conversation to collaborators Aug 17, 2018
@ManuelSchneid3r ManuelSchneid3r requested a review from a team August 17, 2018 13:59
@albertlauncher albertlauncher unlocked this conversation Aug 31, 2018
SwitchApp.py Show resolved Hide resolved
SwitchApp.py Show resolved Hide resolved
SwitchApp.py Show resolved Hide resolved
SwitchApp.py Show resolved Hide resolved
SwitchApp.py Show resolved Hide resolved
SwitchApp.py Show resolved Hide resolved
SwitchApp.py Show resolved Hide resolved
@ManuelSchneid3r
Copy link
Member

There is further the question how the heck we can get the correct icon paths. E.g. spotify has the icon name spotify-client. However it has to be possible because the window manager show the icons correctly.

@ManuelSchneid3r ManuelSchneid3r merged commit 7d16d05 into albertlauncher:master Sep 21, 2018
@ed-fruty
Copy link

Works for almost all my applications, but won't switch to my PHPStorm running instance, only suggest to open a new one instance.

@capi1O
Copy link

capi1O commented Oct 29, 2018

Does not work for me, SwitchyApp 1.2 activated and wmctrl installed but no existing window appear in the results.

@divyanshu013
Copy link

Hey guys, how do I use this feature for switching apps?

@ManuelSchneid3r
Copy link
Member

I am not sure anymore is this extension shipped in 14.22? Otherwise you have to download and install it manually.

@offzale
Copy link

offzale commented Apr 21, 2019

@ManuelSchneid3r is this included in version 0.16.1? It is not working for me installing the rpm package in fedora 29

@kuamatzin
Copy link

I just enabled the extension but it does not work, I already install wmctrl, do I need some extra step?

@jason--liu
Copy link

Hey guys, Im still wondering how to trigger this feature? thanks.

@ManuelSchneid3r
Copy link
Member

I just enabled the extension but it does not work, I already install wmctrl, do I need some extra step?

What does stdout tell?

@squalou
Copy link

squalou commented Oct 22, 2021

Sorry to neco-bump this one but .... same issue as @jason--liu above.

at start

16:07:41 [debg:python.modulev1] Reading metadata of python module: window_switcher
16:07:41 [info:python.modulev1] Loading /usr/share/albert/org.albert.extension.python/modules/window_switcher

nothing more

when searching


16:10:54 [debg:core] ========== QUERY: something  ==========
16:10:54 [debg:core] TIME:    261 µs SESSION TEARDOWN OVERALL
16:10:54 [debg:core] TIME:      0 µs MATCHES [org.albert.extension.terminal]
16:10:54 [debg:core] TIME:    499 µs MATCHES [org.albert.extension.applications]
16:10:54 [debg:core] TIME:    446 µs MATCHES [org.albert.extension.firefoxbookmarks]
16:10:54 [debg:calculator] Muparser SetExpr exception:  Unexpected token "something" found at position 0.
16:10:54 [debg:core] TIME:    213 µs MATCHES [org.albert.extension.calculator]
16:10:54 [debg:core] TIME:    341 µs MATCHES [org.albert.extension.websearch]
16:10:54 [debg:core] TIME:     56 µs MATCHES [org.albert]
16:10:54 [debg:core] TIME:   5405 µs MATCHES [org.albert.extension.files]
16:10:54 [debg:core] TIME:  18878 µs MATCHES [org.albert.extension.python]
16:10:54 [debg:core] TIME:  24828 µs QUERY OVERALL

whatever the string, even when the exact title match, nothing is suggested

I've added some more debug in the plugin,
and here is the output of (win) returned by wmctrl

Window(wid='0x00e00012', desktop='-1', wm_class='xfce4-panel.Xfce4-panel', host='boxtal-0100', wm_name='xfce4-panel')
Window(wid='0x00e00003', desktop='-1', wm_class='xfce4-panel.Xfce4-panel', host='boxtal-0100', wm_name='xfce4-panel')
Window(wid='0x04a00002', desktop='0', wm_class='google-chat-linux.google-chat-linux', host='boxtal-0100', wm_name='Samuel Guérin messaged you - Chat')
Window(wid='0x06200039', desktop='0', wm_class='Mail.Thunderbird', host='boxtal-0100', wm_name='Inbox - pascal@ronecker.fr - Mozilla Thunderbird')
Window(wid='0x04c0002c', desktop='0', wm_class='Navigator.firefox', host='boxtal-0100', wm_name='Added Switch Application by edjoperez · Pull Request #27 · albertlauncher/python — Mozilla Firefox')
Window(wid='0x01000006', desktop
....

which proves that the code works

I've added some good old debug print.

Code does find things and return 'results', but no idea what albert does with em

@ManuelSchneid3r
Copy link
Member

@edjoperez ping

@rosaLux161
Copy link

Any updates on this?

@justpeanuts
Copy link

Sorry if this is a dumb question, but is this feature currently there in albert? - switch to an application window if it is already open instead of launching another instance (without using the seperate menu item to switch to an open window using the "window-switcher.py" python extension)

Thank you

@zoli
Copy link

zoli commented May 13, 2022

Sorry if this is a dumb question, but is this feature currently there in albert? - switch to an application window if it is already open instead of launching another instance (without using the seperate menu item to switch to an open window using the "window-switcher.py" python extension)

Thank you

Yes in python plugins there is a window switcher that you should enable. Then for example if you have firefox open, When you search firefox in albert it brings another entry other that switches to running instance of firefox.

@tuttiamore
Copy link

The problem appears to be related to faulty destructuring of the window names into variables - the code assumes that window names always consists of two elements seperated by a ., when in fact window names can consists of more than two elements.

A quick hack for people interested in making this work:
Change the code in the python module on line 28 from:
win_instance, win_class = win.wm_class.replace(' ', '-').split('.')
to
win_instance, win_class = win.wm_class.replace(' ', '-').rsplit('.',1)

@albertlauncher albertlauncher locked and limited conversation to collaborators Aug 29, 2023
@ManuelSchneid3r
Copy link
Member

Please continue any discussion here: https://github.com/orgs/albertlauncher/discussions/1299

@ManuelSchneid3r
Copy link
Member

albertlauncher/albert#123 (comment)

This poll decided on this plugin. If anyone interested in porting it to api v2.x please send a PR.

@albertlauncher albertlauncher unlocked this conversation Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet