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

Feature request: same shortcut for several applications + minimize all #75

Open
jvalrog opened this issue Feb 25, 2024 · 6 comments
Open

Comments

@jvalrog
Copy link

jvalrog commented Feb 25, 2024

I tried using the same shortcut to run 2 applications.

It works for running them, that's ok.
It doesn't work to minimize/hide both. Only minimizes one and the other stays there.

It would be great being able to launch several applications, since those apps can save their position on screen and you'd be able to show/hide some sort of virtual setup, like a terminal window, an editor and a browser.

As I understand, repeating the same actions to show/hide a window could be implemented with a for-loop for several actions that share a shortcut (haven't looked at the code though).

Something like this:

image

@e3rd
Copy link
Member

e3rd commented Feb 25, 2024

Interesting! Could you imagine the configuration for such request? What syntax should be written in the file?

@jvalrog
Copy link
Author

jvalrog commented Feb 25, 2024

Interesting! Could you imagine the configuration for such request? What syntax should be written in the file?

The configuration would be the same, with several apps sharing the same shortcut and mode, so they behave the same way and avoid possible conflicts between modes.

The extension could detect those cases and group them, using a for-loop to show/hide each app in the group.

@e3rd
Copy link
Member

e3rd commented Feb 28, 2024

Please elaborate more about conflicts between modes. How the app should distinguish which mode you want to ask. I'd really like to see a configuration example, mentioning these modes, thanks!

@jvalrog
Copy link
Author

jvalrog commented Feb 28, 2024

Please elaborate more about conflicts between modes. How the app should distinguish which mode you want to ask. I'd really like to see a configuration example, mentioning these modes, thanks!

ignore what I said about the possible mode conflicts, I think it's fine.

An example configuration would be:

<Super>x,code,/^Code/,

<Super>x,firefox,,

This would rise/hide both vscode and firefox with the same shortcut.

@e3rd
Copy link
Member

e3rd commented Feb 28, 2024

It does make sense to me, I'll have to take a look at it

@e3rd e3rd self-assigned this Feb 28, 2024
@e3rd
Copy link
Member

e3rd commented Mar 20, 2024

I see that task is more challenging than I previously though. First, let's discuss your example configuration.

<Super>x:minimize-when-unfocused,code,/^Code/,
<Super>x:minimize-when-unfocused,firefox,firefox,

You see, I've added matching wm class for firefox. In your version, the firefox is only launched but never matched again, by wm_class nor title. Second, I've added :minimize-when-unfocused modes because by default, an application is not minimized, only might be raised (or launched).

According to my observation, the modes are working perfectly for all the matched application. The problem is that only one window can get the focus.

Use-case:

  1. Hit `x
  2. Code is launched and gets focus
  3. Firefox is launched claims focus
  4. Hit `x
  5. Does Code have focus? No. Code is raised and gets focus.
  6. Does Firefox have focus? No. Firefox is raised and gets focus.
  7. Let's click to the Code, it has focus now.
  8. Hit `x
  9. Does Code have focus? Yes. It's minimized. (It seems that during the minimizing animation, the focus is held by the disappearing application.)
  10. Does Firefox have focus? No, because the minimizing animation is still in progress. It's get reraised.

While dealing such group of windows, we might for example consider as focused every window which is somewhat at the begginning of the last recent windows list. (That's possible, global.display.get_tab_list(0, active_workspace) returns such list.)
I'm afraid I might overlook all the consequences, and I would prefer not to make any hasty moves that could confuse current users.

  • What should happen while only two of a group of fours are in the focus (amongst the last 4 recently used windows).
  • What should happen while some of the group have the mode :minimize-when-unfocused and some not.
  • What should happen while some of the items in the group are just a launch commands without a matchable window to be raised.
  • ...

I'd welcome a meaningful PR but if there are no other community members showing interest it looks too time consuming for me to do this.

@e3rd e3rd removed their assignment Mar 20, 2024
@e3rd e3rd changed the title Feature request: allow same shortcut for several applications Feature request: same shortcut for several applications + minimize all Mar 20, 2024
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

No branches or pull requests

2 participants