Commit Graph
361 Commits
Author SHA1 Message Date
Tor Hedin Brønner d8e6cb32ad Make debug local
Add `Extension` and `debug` to all the module scopes for convenience.

(also add var to non-used function)
2017-10-27 21:23:46 +02:00
Tor Hedin Brønner d9d3ab3241 Make stack_margin local 2017-10-27 21:16:32 +02:00
Tor Hedin Brønner 1a4e2271f3 Add owner object to as_key_handler
Some more globals that can go away :)
2017-10-27 21:12:36 +02:00
Tor Hedin Brønner e260fc25b7 Always pass an owner object to dynamic_function_ref
This way we can remove a bunch more globally declared variables.
2017-10-27 21:03:53 +02:00
Tor Hedin Brønner bfb4414cb9 Make most globals module local
Functions which are called from signals is left alone for now since
`dynamic_function_ref` depends on looking up things in `window`. `debug` is
also still a global.
2017-10-27 19:55:15 +02:00
Tor Hedin Brønner 5eba2cbe87 Fix hanging re-enabling in 3.26
Seems like init is only called once in 3.26, so enable will be recalled, which
kills the actionIds. This 'fixes' the problem.
2017-10-27 19:24:41 +02:00
Tor Hedin Brønner 0539a87ac1 Use a proper Map to store spaces 2017-10-26 13:50:10 +02:00
Tor Hedin Brønner 5306e6c1e4 Add minimap padding 2017-10-26 13:17:08 +02:00
Tor Hedin Brønner ee4b30f90c Don't look up workspace_index on _previewWorkspace
fixes #38 Removing workspaces while the multimap is active can cause crashing
2017-10-25 18:50:30 +02:00
Tor Hedin Brønner faf15c1ceb Index spaces with workspace instead of workspace_index
PreviewedWindowNavigator used `spaces.length` and the multimap used
`spaces.forEach` when using stable workspace order. That should be the last
usage of `spaces` as an array.

At the moment this doesn't improve things much as array indexing worked before.
And the multimap will still crash gnome-shell when going to removed workspaces.
2017-10-25 17:01:32 +02:00
Tor Hedin Brønner 687c541e04 Add spaces.spaceOf as an abstraction over spaces[index]
This sets us up to use a hash map instead of an array of spaces, which is much
more robust since `workspace_index` isn't well suited as an identifier for a
workspace.
2017-10-25 17:01:32 +02:00
Tor Hedin Brønner dd5545d3c7 Move spaceOf to spaces.spaceOfWindow 2017-10-25 17:01:32 +02:00
Tor Hedin Brønner 3f106cb559 Make spaces an object which can handle eg. adding/removing spaces 2017-10-25 17:00:39 +02:00
Tor Hedin Brønner 0af2f199d3 Force ensure on maximize 2017-10-25 14:20:08 +02:00
Tor Hedin Brønner 62ff5001ce Support dynamic workspaces
Fixes #35

Use n-workspaces signal to create/destroy new workspaces.

We're still using the workspace_index to lookup spaces. But indexes line up
since we're removing the space at index n when the workspace with index n was
removed.
2017-10-24 14:24:56 +02:00
Tor Hedin Brønner 63dd855fbb Fix the multimap when moving a window from/to an empty workspace 2017-10-23 20:39:16 +02:00
Tor Hedin Brønner 4f6330c025 Always force previewWorkspaceDone on finished alt tab
If we've previewed a workspace and then move onto another window in the same
workspace `_finish` will trigger a new workspace animation that we aren't
cancelling.
2017-10-23 11:53:41 +02:00
Tor Hedin Brønner 83ef703e3e Use the frame coordinates for fullscreen windows
(0, 0) is only correct if the monitor is aligned with the screen origin.
2017-10-22 14:14:13 +02:00
Tor Hedin Brønner 68389af07d Position maximized windows properly
We can just take the coordinates from the frame since it's not possible to
actually move a maximized window.
2017-10-22 14:08:18 +02:00
Ole Jørgen Brønner 2021b584e4 Put scratch windows first in LiveAltTab (when scratch is active)
(in scratch windwo MRU order of course)

Ideally the scratch layer would somehow mutate the MRU itself on
activation, but it seems the only way to do this is to actually focus
the windows in turn. That might be slowish(?) and also messes with the
stacking order (I think). Ie. would need to restore the stacking order
after doing the focus dance.
2017-10-19 18:16:57 +02:00
Tor Hedin Brønner 9824bae0f4 Move window-added/remove signal connection to Space
Cleaner and makes it obvious to store the signal id on the space.
2017-10-19 16:33:45 +02:00
Ole Jørgen Brønner e956a0d2b5 Load ~/.config/paperwm-rc.js if present 2017-10-19 15:06:37 +02:00
Ole Jørgen Brønner bd8f2c6fee Keep an explicit "isStacked" flag on metawindows + stackoverlay fixes
onCompleted of the tween of the active window didn't always finish before all
other windows was done animating (seemingly at least). This caused a wrong
overlay position/width since it used `is_scaled` to find the top of the stack.

In general it's probably useful to be able to know which windows are stacked
before animations are done. Windows might be scaled for other reasons too.

Also fixes a bug where the left overlay was active even though the neighbor
fully obscured the left stack. (that caused a small region of the left most
unstacked window to unresponsive). (due to setting negative width being a noop)
2017-10-19 14:51:46 +02:00
Tor Hedin Brønner b68e79e372 Revert "Make the stack protrude the same amount on the right as left"
This reverts commit 3e8415f104.

This wasn't actually correct.
2017-10-19 11:57:33 +02:00
Ole Jørgen Brønner eb9ac72d4c Reset pivot point of ensured windows
Certain gnome-shell/mutter animations expect default pivot point.
Fullscreen for example looks weird with other pivot points.

It would be more correct to reset pivot point of all non-stacked
windows, but it's unlikely that eg. fullscreen animation will be
triggered on a window that hasn't been ensured since focus calls
ensure.

NB: Resetting before the tween is done causes subtle artifacts if the
window is stacked to begin with.
2017-10-18 23:54:08 +02:00
Tor Hedin Brønner 6e24596a42 Use staggered scaling when folding the minimaps 2017-10-18 19:09:23 +02:00
Ole Jørgen Brønner 1031767832 Naming: More descriptive name 2017-10-18 15:54:25 +02:00
Ole Jørgen Brønner df85ba89c6 Workspace labels in multimap 2017-10-18 15:16:29 +02:00
Ole Jørgen Brønner 69f456d1fb Bugfix: this/that 2017-10-18 13:40:55 +02:00
Tor Hedin Brønner 78fd7c4e66 Never move windows that are fully visible 2017-10-18 13:35:57 +02:00
Tor Hedin Brønner 79359d7ffb Use exact pixels for the width and height of minimap selection
Floating point width can cause the right border to become smaller than
intended.
2017-10-18 13:35:57 +02:00
Ole Jørgen Brønner 037a3394fb Size and position stack overlay exactly above the _visible_ portion of the stack
We have to do this since mutter/gnome-shell does not account for stacking order
when handling mouse input. Ie. the overlay region ask to receive mouse input
from mutter. It does this even when it's below a window actor. (Only affects
X11, not wayland)
2017-10-18 13:27:13 +02:00
Ole Jørgen Brønner e84e2d93e3 Working stackoverlay (incl. semi-broken icon support)
Turned out to be a bit more difficult than expected to make icons
visually pleasing. Mainly during animations. Icons are thus disabled.

Problems:
- The overlay prevents the cursor from changing shape to "resize" when
  hovering the left/right side of the left/right-most non-stacked
  window. It still works to resize though.
- Icon support semi-broken and ugly during transitions.

Ref: #10
2017-10-18 13:27:13 +02:00
Ole Jørgen Brønner 8a63404c1e Proof of concept: stackoverlay
Some code to manually create overlays

Ref: #10
2017-10-18 13:27:13 +02:00
Tor Hedin Brønner 46bb92240a Animate the label width in the minimap
Need to make a new label every time so that we can access the required width to
display the whole text.
2017-10-18 11:49:20 +02:00
Tor Hedin Brønner 3e8415f104 Make the stack protrude the same amount on the right as left
There's `clone.length` - `around` windows to the right of `around`.
2017-10-18 10:16:03 +02:00
Tor Hedin Brønner 79d65273b3 Select the whole viewport with chrome on empty workspace 2017-10-18 10:04:37 +02:00
Tor Hedin Brønner aca9d73c47 Actually scale the minimap background instead of setting size 2017-10-18 09:24:30 +02:00
Ole Jørgen Brønner 2af91c789d Notes: clutter/mutter input tracking gotchas 2017-10-18 03:10:00 +02:00
Tor Hedin Brønner 934286db1f Label on bottom with increased minimap height
Also put the border chrome on the minimap wrappers
2017-10-17 18:43:44 +02:00
Ole Jørgen Brønner 241a46c999 Prototype: Add a window label to selection-chrome in minimap/multimap
Also increased the minimap scale - otherwise there's almost no space for the
label.
2017-10-16 22:02:08 +02:00
Ole Jørgen Brønner 340b8201dd Notes: z-index/stacking 2017-10-16 18:58:03 +02:00
Ole Jørgen Brønner 31a14520ea Support most of our own actions in "supermode"
As a consequence the metawindows now keep track of their destination
when animated by `move_to`.

Ideally the minimap/multimap should listen for changes to the space
and react accordingly instead of doing a manual sync like this.

"most actions" means actions that is registered as PER_WINDOW and
doesn't mutate the space.
2017-10-16 07:49:53 +02:00
Ole Jørgen Brønner 32ff62d59b Keybinding actions: Keep track of action handler (+refactor)
Mutter don't share that info(??)

In anticipation of supporting more actions in "supermode".
2017-10-16 07:17:32 +02:00
Ole Jørgen Brønner ee3fe3433b Cleanup: Remove actors argument from Minimap.layout
Unlikely that we'll need to specify anything else. Direct motivation
was to make it less awkward to layout after external changes trying to
integrate resize actions with "supermode".
2017-10-16 05:54:32 +02:00
Ole Jørgen Brønner f0741fe543 New action: simple tiling of all partially visible windows
Tentative keybinding: <super>t

Probably need some more work to be useful: Almost fully hidden windows
should probably be excluded for instance. Could also utilize
minimum-width per window-class, historic window size, heuristics to
determine how many of the windows to tile.

The name could be better since we're always tiled in some sense.
"distribute", "reallocate", etc.

Might be that a `tile-neighbour`[1] is better, or that a couple more
resize commands would make it quick enough to allocate space more
manually:
- `expand-width`: increase the the width of the current window by the
   amount available from partially visible windows. If/when we make
   resize commands work in "super-mode" one could quickly reallocate
   space without messing up the MRU list too.
- `slurp`: squeeze the fist partially visible window fully into the
   view port, probably stealing at least some space from the existing
   windows.

[1] need two bindings though
2017-10-15 15:59:28 +02:00
Ole Jørgen Brønner 758103d263 Don't move ensured window if it's already fully visible
This avoids situations such as when two windows are tiled, both fully
visible, but in sum a bit too wide to fulfill `minimumMargin` on both
sides. Then switching between them cause movement each time.

Could arguably be solved by setting minimumMargin to ~0 but that has
other effects too.

Note: intentionally ignored the case when _all_ windows are fully
visible. In that case we allow movement.

Note: Assumes window is on primary display
2017-10-15 00:33:03 +02:00
Ole Jørgen Brønner c335cb68a7 New action: cycle-width
Cycle through 3 predefined window widths

Note: if we made this a mini mode, maybe 'center' could be the first
state we cycle through? Without a mode it becomes a bit annoying to
keep track of which state we're in. eg. need to remember the original
size to cycle properly.
2017-10-14 23:54:47 +02:00
Tor Hedin Brønner daad98a383 Use the actual background for minimap backgrounds
Setting `vignette` to true gives the same dimmed lightbulb effect as on the
overview, which is a possibly a better default.
2017-10-13 13:56:05 +02:00
Tor Hedin Brønner e21b19d315 Only set space.moving on ensure_viewport
This fixes a bug where new windows sometimes gets the wrong initial position.
2017-10-13 13:54:59 +02:00