PaperWM icon indicating copy to clipboard operation
PaperWM copied to clipboard

Option to center a window in focus.

Open gavr123456789 opened this issue 4 years ago • 4 comments

New option in settings. If the Windows are centered immediately, it will make it much easier to navigate with the mouse on two monitors.

Now it is very difficult to aim the mouse at the very edge of the screen to switch to the next window without accidentally clicking on the second monitor.

gavr123456789 avatar Jul 28 '20 21:07 gavr123456789

isn't the point to use the keyboard rather than the mouse?

super+arrow left/right to focus another window and super+c to center

rayjanoka avatar Jul 30 '20 18:07 rayjanoka

I was looking to do this not because of easier mouse navigation but because I find that having the focused window in the centre is better for ergonomics. @gavr123456789 It's easy to tweak the extension code to add this. Just add this line to the end of the focus_handler function in tiling.js (around line 2745):

centerWindowHorizontally(metaWindow);

johnfraney avatar Aug 05 '20 12:08 johnfraney

I've made a test branch for this: sticky-center, which will continue to center windows if the current window is centered.

hedning avatar Aug 15 '20 15:08 hedning

Is there a way to achieve this without having to fork PaperWM?

srid avatar Feb 02 '21 16:02 srid

Is this still of value to others? I can see the value in it. Let me know and I can create a PR for this - maybe with a toggle to enable/disable this functionality.

jtaala avatar Mar 02 '23 20:03 jtaala

I think this sounds like a nice feature. I can see myself liking this behavior.

terlar avatar Mar 03 '23 09:03 terlar

Hey all, please have a look at #482 which implements this - need some feedback there!

jtaala avatar Mar 04 '23 05:03 jtaala

Now it is very difficult to aim the mouse at the very edge of the screen to switch to the next window without accidentally clicking on the second monitor.

This seems like it could be solved by increasing the "horizontal margin" setting.

isn't the point to use the keyboard rather than the mouse?

Mouse support makes for a smooth onboarding experience for people more used to navigating that way. Also, when my hand is already on the mouse (e.g. for clicking something in the browser) it's sometimes more convenient to use the mouse to switch windows than switching back to the keyboard. In short, mouse support is good as long as it doesn't make keyboard support worse.

Is this still of value to others? I can see the value in it.

I also see the value, particularly for the ergonomics, as @johnfraney mentioned. Normally this is pretty easy to do with the keyboard (Meta-C after changing active windows), but not so easy with the mouse.

There is still a question of how it should be implemented.

  • Toggle in the settings?
  • Runtime toggle via hotkey?
    • Global, per-monitor, per-workspace, or per-window?
    • Meta-Ctrl-C and Meta-Shift-C are open

smichel17 avatar Mar 04 '23 18:03 smichel17

@jtaala already create a PR (#482) and I made a comment there too, but to give an opinion on how it could be implemented, I think:

  • Add a toggle in the settings to enable this "centering mode" by default (but keep it off by default)
  • Add a keybinding to toggle it (maybe Super-Shift-C, because Ctrl already means "move" in my mind)
  • I think it should be scoped to the workspace or global because that is probably the easiest to implement (per-window doesn't make much sense IMO, but per-monitor would probably also be ok)
  • Also add an indicator if the mode is active to the WorkspaceMenu (the thing that says "Workspace X") in the topbar

In PR #482 it is currently scoped to per-workspace (kind of, actually the mode is active as long as the current window is centered). And it uses the keybinding Super+C.

Lythenas avatar Mar 04 '23 19:03 Lythenas

Thanks all,

Appreciate the comments and feedback! Maybe to start we can implement a a user option for whether it's enabled by default (I won't create a toggle in settings yet but you'll able to change it via dconf), and implement a new key-binding (will usemeta+shfit+c for default) to toggle the mode. I'll make it workspace scoped (that makes sense to me since some on one workspace might want to have side-by-side view; but on another might want centered view).

We can test it out after that and see what we think for going forward.

Jay.

jtaala avatar Mar 05 '23 04:03 jtaala

All, #482 is ready for review. I've implemented a "focus mode" (with topbar icon showing current mode - also the icon it clickable to toggle focus mode). Also implemented (default) super+Shift+c shortcut to toggle modes.

jtaala avatar Mar 07 '23 12:03 jtaala