Tiling-Assistant icon indicating copy to clipboard operation
Tiling-Assistant copied to clipboard

Add keybindings to directly tile windows to a layout spot and option to skip a layout spot on layout activation

Open reharik opened this issue 1 year ago • 5 comments

Hi, I've just started using Tiling-Assistant and so far I like it better. There are two features that would be really helpful.

  1. Better keybindings. Right now you have basically some arbitrary keybindings that have nothing to do with your selected layout. What I need is to be able to move a window from one slot in the layout to another, or from outside of the layout e.g. ctrl N on your browser, to a slot in the layout.
  2. The ability to have empty layout spots. So if I have a layout with 9 slots, there are selected apps for the last 6, and I trigger that layout, then I have to put a currently open window in each of the 3 first slots. What I would like is to have my grid such that I can snap windows to that grid ( via keybindings mentioned above ). I don't necessarily always need all 9, but if I want to move one window to a new spot it's there. Now, I can help build these features. If you are interested in adding them, could you give me a pointer to where, in the code I should start to look, and any thought our concerns you may have?
    Thank you Raif One Idea for the keybindings would be, in the layout setup, each rect has the option for a keybinding. Of course there would be a finite number key combos, and we would have to check a "master" list, but I suspect you have that already for all the other keybindings.

reharik avatar Jul 24 '22 16:07 reharik

So if I understand you correctly

Regarding 1)

you want to have keyboard shortcuts for specific spots in the layout. Let's say the user defines a 3x3 grid and Super+9 would directly tile the window to the bottom-right spot (if the user chose to assigne that shortcut to that spot), right?

Regarding 2)

What's the difference to 1 since you wrote

( via keybindings mentioned above )

?

Leleat avatar Jul 24 '22 19:07 Leleat

Sorry if I'm unclear.

  1. yes that's the idea, say I have a 3x3 I could assign Super+1-9 for all nine of the spots. I could also have a 3x2. For that I could do something like Ctrl+Super+1-6. etc.
  2. I may be missing something, but I have a grid like this 1 4 6

2 5 7

3 I guess you could say a 3,2,2. I have specified an app for 2,3,4,5,7. slots 1 and 6 are blank. But when I start that layout, it highlights slot 1 and shows me a list of the windows I have open, and I have to choose one. I just want it to be blank.

Please let me know if you have more questions.

reharik avatar Jul 25 '22 15:07 reharik

Ah, I see. So you want the ability to skip a spot in a layout? How do you think it should behave? Like pressing a key (like Tab)?

As for the other feature:

As far as I am aware it's not possible to dynamically create shortcuts. You need to declare all shortcuts in the schemas file like I did here. So trying to add a shortcut for each rect in the layout setup probably doesn't really work. The user probably wouldn't understand why at some point new layouts or rects no longer support shortcuts. Also, the layouts UI is already very cluttered.

How about adding it as new preference groups below the layouts to show the limited amount of shortcuts without adding more clutter? For example like this

scr

This is just a quick UI test. It could be nicer with a custom widget (instead of 3 AdwRows).

What do you think?

Leleat avatar Jul 25 '22 16:07 Leleat

Hi, yes, skip a spot. sort of . I would like the spot to be in the layout so I can snap an app, maybe an extra browser or an irc client in there should the need arise. But initially it would be blank. What you say about dynamic shortcuts makes sense. I have used gTile before and they have an area where they list a whole ton of possible short cuts e.g. Ctrl+Alt+KP0-9 Ctrl+Shift+KP0-9 etc. I thought it was weird but I guess it was to accommodate this issue.
I was thinking you could just add a button after the "select an app button" and rect definition, here Screenshot from 2022-07-25 11-59-56 When one clicks that button, they could choose from available bindings. It's a bit different than the traditional "type in your own key binding" but it should be pretty clear. Thanks

reharik avatar Jul 25 '22 17:07 reharik

I would like the spot to be in the layout so I can snap an app, [...] But initially it would be blank.

I am not a fan of that tbh. That means that the user would need to tile windows to the empty spots manually, if they want to fill it immediatly. I think the 'skip a spot' idea is more flexible since it leaves it up to the user in that moment.

I was thinking you could just add a button after the "select an app button" and rect definition, here

One problem would be that the layout setup is already very cramped. The main issue is however that the user wouldn't see which layout rectangles take which shortcut, if the shortcuts are spread over multiple layouts (since layout rects are folded initially to save space). So I think my suggestion of adding the shortcuts below the layout definitions would be better (either as separate rows like I showed in my previous comment or with a custom widget). With that all shortcuts would be immediately visible and it would be clear that the amount of shortcuts are limited.

Now, I can help build these features. If you are interested in adding them, could you give me a pointer to where, in the code I should start to look

I don't know how much experience you have with extension development but here are useful resources, if you don't have experience yet:

  • https://gjs.guide/extensions/
  • https://gjs-docs.gnome.org/

So if you are interested in adding this feature, the files of interest to you would be:

  • schemas file to define the settings or keyboard shortcuts
  • common.js creates a Settings singleton, which can be accessed on the shell side (but shouldn't be used in the preference window). You'd need to add the new shortcuts to the singleton and to Shortcuts.
  • layoutsManager.js as the main file on the gnome shell side responsible for the layouts.
  • tilingPopup.js as the file for the Tiling Popup. I. e. the Dash-looking thing which spawns for each layout rect, or otherwise when a window is tiled and there is free screen space
  • prefs.ui defines the UI for the preference window
  • prefs.js as the JS file, which creates the preference window and more (although I don't think you need to look at it for this feature)

Leleat avatar Jul 30 '22 16:07 Leleat