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] Shortcuts bound to "window positions" #11

Open
thomasfinstad opened this issue Jul 24, 2022 · 15 comments
Open

[Feature request] Shortcuts bound to "window positions" #11

thomasfinstad opened this issue Jul 24, 2022 · 15 comments

Comments

@thomasfinstad
Copy link

It would be awesome if we could customize layouts to have a shortcut option bound to a window position, so we can quickly arrange windows.

If it is possible to have this in the layout config files that seem optimal in my mind, as we could then have default or custom layouts be "shortcutable".

@qewer33
Copy link
Owner

qewer33 commented Jul 24, 2022

Quite a cool idea but I'm not sure how I would find shortcuts to assign to every single default layout window without clashing with commonly used shortcuts. Could use the number keys maybe, any ideas?

@thomasfinstad
Copy link
Author

I think the best way would be to either just add a silly complicated set of hotkeys by default or, what I think is better, add them as options but don't add any default bindings. A compromise could be nothing by default and an optional configuration parameter in the layout config itself where you add the hotkey-able part you can also add a default binding for that hotkey.

I'm on mobile right now so in psedu config under the window position, maybe something like:

  • shortcut_enable
  • shortcut_default_binding=meta+ctrl+1

@Zetaphor
Copy link
Contributor

Zetaphor commented Jul 27, 2022

+1 to this suggestion. I came across this amazing extension while looking for a Linux alternative to Windows' Fancy Zones tool.

In that tool I have my layouts bound to LCTRL+META+LALT+Number. When I switch layouts it shows me an overlay of the layout and then you can SHIFT+Drag windows into each snap zone.

Do you have any suggestions on how to get started with Qt/Kwin? I'd like to see this functionality implemented (the overlay and shift dragging into zones) and I'm willing to take a crack at it.

Exquisite is the closest I've found so far to being able to replicate that functionality, thank you for creating this!

@thomasfinstad
Copy link
Author

@Zetaphor I am not the author of the kwin script, and don't know anything about it really, but I bet this will be a fine place to get started: https://develop.kde.org/docs/extend/plasma/kwin/

@qewer33
Copy link
Owner

qewer33 commented Jul 28, 2022

@Zetaphor , the link thomasfinstad provided is nice for getting started and the API reference covers a lot of useful things (although not everything sadly, it still lacks quite a bit of stuff, I also recommend you check out sources of popular KWin scripts)

That being said, someone in my reddit post mentioned that a similar feature to Powertoys' Fancy Zones was already being developed for KWin (https://invent.kde.org/plasma/kwin/-/merge_requests/2560), might want to take a look at that effort and see if you can help

@qewer33
Copy link
Owner

qewer33 commented Jul 31, 2022

I have done some work on this and it does seem doable but Plasma's global shortcut system is kind of weird. You can't delete shortcuts registered by KWin scripts easily (the easiest way is to log out, open tty and delete the entries from KWin's shortcut config file) and I haven't found a way to read keypresses/assign shortcuts without using registerShortcut

So for now I may keep this on hold until I find a better way to implement this (or KWin's shortcut registering system gets fixed)

@Asteroid33
Copy link

I was thinking that will be good if after a window is tiled, automatically select the other window and maybe arrange in the layout selected. I don't know if it's possible.

@imthenachoman
Copy link

imthenachoman commented May 17, 2023

Is it possible to call Exquisite from a command line? If so, add a feature where you can resize a window by calling Exquisite from the command line, and then users can add their own application shortcuts. For example:

exquisite --file 0.qml --window 2

And this says to size the current/active window to the 2nd object in the windows array of the 0.qml file. And:

exquisite --file 0.qml

Would resize all windows.

This would be the easiest/fastest way cause Exquisite wouldn't have to worry about shortcut management.

@Zetaphor
Copy link
Contributor

@imthenachoman This seems like the best approach, as it would also make window tiling easily scriptable

@qewer33
Copy link
Owner

qewer33 commented May 19, 2023

This is another great idea but sadly impossible (without a complete rewrite) due to the very nature of Exquisite being a KWin script. KWin scripts can't be invoked as executables.

@zelch
Copy link

zelch commented Feb 11, 2024

Hm, is there any way to make a kwin script receive dbus calls?

Because that would allow us to do stuff with dbus calls.

@zelch
Copy link

zelch commented May 19, 2024

So far, with a reasonable amount of digging, I'm sadly not convinced that this is possible without some extremely ugly hacks.

Because I can't see any way to trigger a function or signal from dbus and have it be received by a KWin script.

The only real option I see would be creating an 'API' where a new window with the correct title would be seen as an instruction for Exquisite, and that's way too much of a hack for me to ever want to do.

It is possible to register shortcuts, but not to list them or delete them.

Hm, alright, I have one less ugly idea:

Have Exquisite register shortcuts for window preset 0 - 9, defaulting to no shortcuts, and add a valid field in the layout files to say that a given window position should be assigned to a given shortcut number.

This will obviously work poorly if the same preset is claimed by more than one window position, but it's the best I can think of right now.

@imthenachoman
Copy link

@zelch You are talking about global shortcuts, that are available even when Exquisite is not visible, right? I like that idea. That is what I did with https://github.com/imthenachoman/ExquisiteW.

@zelch
Copy link

zelch commented May 19, 2024

@imthenachoman That was the thought.

I'm not entirely happy with the idea, simply because I really don't have a good answer for how to handle multiple windows in the layouts trying to claim the same shortcut number, but so far it's about the only option I can think of which we can actually implement.

@imthenachoman
Copy link

@zelch No issues. It's not a big deal for me personally. I'm happy with everything as is. As soon as the two bugs I mentioned are pushed, I'll be good to go. :)

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

6 participants