paperwm / PaperWM

Tiled scrollable window management for Gnome Shell
GNU General Public License v3.0
3k stars 127 forks source link

Enhanced shortcuts for PaperWM #303

Open EGmux opened 4 years ago

EGmux commented 4 years ago

Problem

While using PaperWM some actions require a lot of key presses.

Proposed solution

The following keybinds could be used to save time

Use cases

For splitting

For Maximized by default

olejorgenb commented 4 years ago

Horizontal splitting: Ie. move a window out of a column into a new column (or simply move it if it's already a single column)? I can try to find some time to implement a example action.

Vertical splitting: Extension.imports.examples.keybindings.tileInto(); binds keys (super-</> (configurable by passing in two keystrings) to tile the selected window into the left/right column. (ref.: user config)

Maximized by default: I think this could be part of more comprehensive "winprop" support. (ref.: #304)

EGmux commented 4 years ago

Thank you for the pointers,

Horizontal splitting is basically default i3 behavior,however would be triggered by a shortcut .

The main ideia is the actual window get squashed or expanded to fit the 0.5 screen ratio and the shortcut will determine which window,the one to the left or right of it,is going to get the same treatment.

If possible would also be interesting to add an undo horizontal splitting shortcut as well,both windows would return to the previous ratio,similar to the o key behavior.If not in the Gnome settings,maybe as user config?

olejorgenb commented 4 years ago

This is my branch where I test out layout actions: https://github.com/paperwm/PaperWM/tree/virtual-tiling-playground

I think the cycle-layout-direction roughly correspond to the suggested super+u bindings. The tile-into is close to Super+Shift+i have but have slots for left and right and will untile (ie. move to a separate column) a window in the given direction if it's already vertically tiled.

I recommend adding <Super><Alt>Up/Down to move the window up down in a column for better erogonomics.

fit-available will expand/shrink the given window to occupy "available" space. (ie. space not occupied by fully visible windows)

user.js@init:

    Extension.imports.examples.layouts.bindCycleLayoutDirection("<Super><Shift>u", "<Super>u")
    Extension.imports.examples.layouts.bindFitAvailable("<Super>j", "<Super>k", "<Super>l")  // left, focus, right
    Extension.imports.examples.layouts.bindTileInto("<Super><Alt>Left", "<Super><Alt>Right")
gustavo-hms commented 4 years ago

Hi!

Do you have any plan to merge that branch into master? For my workflow, these features would be a usability improvement.

I'm playing with it right now. I tried to simply copy the scripts to my user.js using the current master branch, but the only feature currently working seems to be tileInto. I'm actually very interested in cycleLayoutDirection and fitAvailable. Unfortunately, I have no knowledge about the API and don't know why the aforementioned actions don't work, since they fail silently.

Thanks!

hedning commented 4 years ago

@gustavo-hms, you'll have to check out the virtual-tiling-playground branch for it to work (git checkout virtual-tiling-playground). You'll then have to restart gnome-shell (Alt-F2 restart on X11 and logout/login on Wayland).

We'll hopefully get the time soon to merge in some of the stuff we've been using locally for a while.

gustavo-hms commented 4 years ago

Thanks for the fast response!

The problem with running the code from that branch is that I get an error:

-En PaperWM
Error occured in user @init:

keymap is null

devirtualizeMask@/home/gustavo/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/keybindings.js:396:30
rawMaskOfKeystr@/home/gustavo/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/keybindings.js:405:12
openNavigatorHandler@/home/gustavo/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/keybindings.js:409:18
enableAction@/home/gustavo/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/keybindings.js:515:33
bindkey@/home/gustavo/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/keybindings.js:351:9
bindCycleLayoutDirection@/home/gustavo/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/examples/layouts.js:259:17
init@/home/gustavo/.config/paperwm/user.js:25:22
safeCall@/home/gustavo/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/extension.js:59:52
run@/home/gustavo/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/extension.js:49:9
init@/home/gustavo/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/extension.js:98:9
_callExtensionInit@resource:///org/gnome/shell/ui/extensionSystem.js:433:50
loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:346:27
_loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:599:18
collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:17
_loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:574:19
_enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:608:18
_sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:639:18
init@resource:///org/gnome/shell/ui/extensionSystem.js:56:14
_initializeUI@resource:///org/gnome/shell/ui/main.js:257:22
start@resource:///org/gnome/shell/ui/main.js:146:5
@<main>:1:47

It seems the call const keymap = Gdk.Keymap.get_default(); from keybindings.js returns null. At least that doesn't happen on master.

gustavo-hms commented 4 years ago

It seems the call const keymap = Gdk.Keymap.get_default(); from keybindings.js returns null. At least that doesn't happen on master.

OK. I must have done something wrong. I tried again and this time it worked.

Thanks!

mrspikeroot commented 3 years ago

Please forgive me for necro-bumping this thread...

I have an idea of some additional functionality that would improve my workflow with paperwm, and I'm wondering if "tile-into" is the same thing. What I would like to see is a binding that would move the focused window either right or left. If the window is in a stack, it would move it into a full-height new column, and if the window is full-height, then move it into a stack with the adjacent window(s).

Is that what "tile-into" is?

If so, has it progressed at all since August?

I've tried adding

Extension.imports.examples.layouts.bindTileInto("<Super><Alt>Left", "<Super><Alt>Right")

into my user.js and restarting gnome-shell, but I didn't see any effect. Perhaps I'm adding it in the wrong place?

olejorgenb commented 3 years ago

No problem (personally have nothing against necro-bumping and find it annoying when threads are locked just because they're old..) :)

It should work if you add it to the init function in user.js (but remember: those actions are only available in the virtual-tiling-playground branch). Perhaps the keys are already bound? (we do try to give a notification when that's the case though)

A mentioned earlier in the thread - master has a similar tile action example (Extension.imports.examples.keybindings.tileInto()) (but that action never untiles the window)

We've been quite busy with work this fall, so no progress, but hope to carve out some time to work on paperwm during the holiday.

indigoviolet commented 3 years ago

Just want to add a vote for merging the actions from https://github.com/paperwm/PaperWM/issues/303#issuecomment-636313932 -- I have been using this branch for the past few weeks and I find these very useful, especially cycle-layout-direction. Thanks for your work on Paperwm.

Btw @olejorgenb do you have a Sponsors or Patreon or other way that I can contribute in a small way to support your work?