Commit Graph

727 Commits

Author SHA1 Message Date
Tor Hedin Brønner
5f20007ff2 workspace label: react to changes in top bar font changes 2019-02-20 11:15:14 +01:00
Tor Hedin Brønner
48adf04ae7 workspace label: set explicit height
ref #95
2019-02-19 14:02:02 +01:00
Tor Hedin Brønner
adcfa414ad preference: add use-workspace-name switch
Defaults to true. If false uses gnome shell's `Activities` text and hides the
workspace labels.

Set to false like this:
```
Extension.imports.convenience.getSettings()
  .set_boolean('use-workspace-name', false)
```
2019-02-15 00:15:54 +01:00
Tor Hedin Brønner
81551d591a Use monitor's workarea to position windows
When eg. using dash-to-dock without autohide we would position windows under the
dock. Use the workarea instead of the monitor to figure out where we can
position windows.

TODO: re-layout on `display::workareas-changed`, unfortunately this is triggered
when focusing a fullscreen window, so we'll need to keep track of the workareas
ourself to make it performant. For now the user will have to «rejigger» the
windows manually.

closes #94
2019-02-14 16:32:33 +01:00
Ole Jørgen Brønner
09950f20a2 Cleanup: MetaWindow have a built-in 'is_override_redirect' method 2019-02-10 14:32:58 +01:00
Tor Hedin Brønner
0c5458a38a workspace menu label: fix width
Taken from gnome-shell's css files.
2019-02-09 16:53:57 +01:00
Tor Hedin Brønner
d7336e95fd Fix workspace label position 2019-02-08 19:32:12 +01:00
Ole Jørgen Brønner
e268e9ac11 Move winprop related code to settings.js
(leave a shim for backward compatibility)
2019-01-26 21:04:50 +01:00
Ole Jørgen Brønner
571a2d0680 Don't show actors of minimized scratch windows
Specifically fixes bug where whole scratch layer become visible (but only the
actors) when reloading (or disable/enable cycle) when at least on scratch window
was active.

This also sometimes crashed gnome-shell (confirmed on v3.28.3 - ubuntu 18.04)

Also remove some code who seem to partly work around the problem
2019-01-26 14:05:09 +01:00
Tor Hedin Brønner
f61d194487 fix bug: actually splice out the window 2019-01-13 12:42:40 +01:00
Tor Hedin Brønner
b2f30396b8 Use the clones' stack order to pick the top window
We need to raise one of the focused window neighbours preemptively to get sane
focus after closing a window (ie. one of the neighbours should always get
focus).

However we also use the windows' stacking order to decide eg. which window in
a vertical tiling to select when entering from the side. Raising the neighbours
on focus can easily break this behavior, as the top window no longer is the most
recently selected.

If we use the clones stacking order instead we avoid these issues as it's
unaffected by the unavoidable window raising we do on focus.
2019-01-13 10:40:17 +01:00
Tor Hedin Brønner
ef8c8a0df6 registerWindow: fix names, and set meta_window on metaWindow.clone 2019-01-13 10:34:15 +01:00
Tor Hedin Brønner
33431ce808 bug fix: place windows correctly when unmaking scratch
For some reason setting the clone's position before layout doesn't work.
2019-01-12 22:02:33 +01:00
Ole Jørgen Brønner
41a5028b61 Determine focused window in absence of display.focus_window
When a new window is created from the overview [1], `display.focus_window` is
null. This broke our "should-window-be-scratch" logic.

Behavior observed both on X11 and wayland

[1] or the 'switcher' extension. Probably in general if a shell modal is active
when the window is created?
2019-01-12 11:34:09 +01:00
Tor Hedin Brønner
63e74ada44 cleanup: remove spammy logging 2019-01-11 18:59:38 +01:00
Tor Hedin Brønner
c349c10c07 Transforms break on 0 sized actors...
eg. transform_stage_point will simply return `[false, 0, 0]`.
2019-01-11 18:57:02 +01:00
Tor Hedin Brønner
00f7b05ad2 insertWindow: inherit clone position if animating
This makes eg. takeWindow smooth if stopped in the middle of animation.
2019-01-11 17:12:31 +01:00
Tor Hedin Brønner
8deb96014e bug fix takeWindow: don't reset the taken windows 2019-01-11 17:12:31 +01:00
Ole Jørgen Brønner
6ed174e0ce Fade selection when scratch layer has focus 2019-01-10 20:48:51 +01:00
Ole Jørgen Brønner
b01d21484f Bugfix: Tolerate removal of monitor while extension is disabled
NPE in setMonitor if old monitor was gone on enable.

Eg. suspend, disconnect monitor, resume
2019-01-10 19:24:29 +01:00
Ole Jørgen Brønner
9287b349df Bugfix: toggle-maximize-width was broken for multimonitor configuration
Note: unmaximize is still broken if the window moved between monitors..
2019-01-10 17:33:30 +01:00
Tor Hedin Brønner
75e66de782 keybind: super-t take window and place at final destination
This also fixes the rather strange behavior of super-ctrl-above_tab which
actually didn't move to the previous workspace.
2019-01-09 11:51:04 +01:00
Ole Jørgen Brønner
4a927cc401 Never suppress showing of window actor when clone is deattached
This covers scratch windows too.

Note: Specifically fixes a bug where 'tilix --quake' didn't work. tilix creates
a "on all workspaces windows" that was hidden in showHandler and never shown
again
2019-01-06 14:40:58 +01:00
Ole Jørgen Brønner
492dc9ec15 Misc cleanup 2019-01-05 14:22:46 +01:00
Ole Jørgen Brønner
d5a7c81895 keybindings: cycle window height <super><shift>r 2019-01-05 12:52:52 +01:00
Tor Hedin Brønner
a586b230b3 doc: update the Space documentation 2019-01-05 10:25:06 +01:00
Tor Hedin Brønner
2e83128c4f Add floating window's clones to their space.actor
Introduces `Space.addFloating` and `Space.removeFloating`. `startAnimate` and
`moveDone` takes care of showing the clone, syncing its position and hiding it.

This makes floating windows follow the workspace in the workspace carousel,
removing the rather ugly hack in `spaces.switchWorkspace` and simplifying
`showHandler`.
2019-01-05 10:25:06 +01:00
Tor Hedin Brønner
907e832ae7 ensureViewport: raise window clone to the top 2019-01-05 10:25:06 +01:00
Tor Hedin Brønner
84550d6717 Reparent the selection highlight on the window clone
This makes selection logic a lot more centralized and robust. In particular the
selection highlight will now consitently track the window clone.

Also introduce `showWindow` `animateWindow` and `isWindowAnimating` to wrap some
potentially changing structure.
2019-01-05 10:25:06 +01:00
Ole Jørgen Brønner
8af34fef92 layout: use _targetHeight in default height allocation
This fixes (mostly) issues with layout of constrained wayland windows.

eg. (* marks the selected window) slurp B:

layout
  column A* B
  ...
resize of constrained window B finishes (before A)
  trigger new layout (since target was not met)
  `allocateDefault` strive to keep A's height (yet to be changed)
  causing A to get all the height

We still have problems when the slurping the last window X (while X selected)
into a column with two constrained windows.
2019-01-05 10:16:54 +01:00
Ole Jørgen Brønner
b504c95a0e Remove 'deferLayout' hack 2019-01-05 10:16:54 +01:00
Ole Jørgen Brønner
fc7f89fc99 layout: Don't re-request the currently requested window size again
- We never request the window's _current_ size again
- Each time a resize is requested we mark the window with the targets
- These are cleared IF the request cause a resize
- Some windows are constrained and does not resize even when request != current
- Resizes can be async

This means that layout sometimes reach the state where:

currentSize != targetSize
targetSize == window's marked target

Happens when

a. An async window get a new size and a subsequent layout happens very quickly
   (before the window is actually resized)
b. A constrained window is laid out and both its actual size and "layout
   size" is unchanged from last layout.

   Ie. we treat a constrained window as using infinite long time to fulfill a
   request that is constrained to the window's current size.

(a) probably doesn't happen very often (?)
(b) is nice to avoid assuming such size-requests have a non-trivial cost.

    It does assume that a constrained window always responds the same way to
    requests for size S. Which obviously is not guaranteed. A window is free to
    change its constraints at any time.

    A constraint change due to changing discrete size increments will most
    likely trigger a resize though - which will trigger a relayout.

    And since we can't subscribe to constraint changes and layout isn't done on
    every action it's not obvious that we want a constraint change to suddenly
    become visible either.
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner
e266004fb4 Regression after prev commit: fix layout of async wayland windows
The first async resize that completes cause a new layout which run using the
other async window's old size. This breaks layouts that request specific
heights (eg. slurp).

Most visible when slurping third window.

+ missing semicolons and treating targetHeight the same way in case of
un-resizable windows
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner
ecb1e5a6ca Support vertical tiling resizing
`Space.layout` not accepts custom "column allocators" (per column)

An allocator allocates the available vertical space of the column.

The default column layout allocates the vertical space proportionally to the
member's existing height, but strives to preserve the height of the selected
window.

During a grab the grabWindow's geometry is never changed (as this is very
jarring for the user) and the column is laid out accordingly.

The layout triggered from grabEnd cleans things up (eg. if the grab-resize freed
up space not possible to allocate without moving the grab window)

Pending changes/cleanups:
- Rewrite `deferLayout` hack

Resolves #62
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner
7e0122cf86 Update selection height on resize
In preparation for vertical-tiling resizing
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner
5e4ef9478a Bugfix: moveDone triggered before all layout animations have started
`Space.layout` can cause a resize, causes a move_to, triggering `moveDone`
_before_ all layout animations are started. The actor and clones of the windows
to the right is swapped and subsequent layout animations are broken. (animating
the hidden clone)

Observable when slurping / barfing when there's 2-3 windows visible to the
right (NB: without the navigator visible)

EDIT: This fix assume layouts affecting the selected window run `ensureViewport`
manually if necessary, but note that `Space.layout` actually ensures the
selected window (although only when animating)
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner
03f21d81d8 layout: Use prefs.animation_time
ref: 529102add1
2018-12-29 04:27:50 +01:00
Tor Hedin Brønner
e90e2787d9 grab: delay changing workspace until grab-op-end
`inGrab` is now an object containing some information when a grab is running.

Closes #90
2018-12-28 00:21:55 +01:00
Tor Hedin Brønner
9a53f29551 removeWindow: remove any clip on the actor
Move it from remove_handler
2018-12-27 23:10:58 +01:00
Tor Hedin Brønner
1efffd4d4a allocateClone: only set the clone's position, not size 2018-12-27 20:43:27 +01:00
Tor Hedin Brønner
d04fcb372b Don't hide floating windows on visible workspaces 2018-12-21 16:26:44 +01:00
Ole Jørgen Brønner
e9c51f30dd Minor regression: fix 2b61a909d 2018-12-20 14:21:29 +01:00
Tor Hedin Brønner
2b61a909db Another wrong global.get_pointer() usage 2018-12-19 21:28:47 +01:00
Ole Jørgen Brønner
21039ec6ec Bugfix: Pointer always warped when moving it to the bottom monitor 2018-12-19 21:24:04 +01:00
Ole Jørgen Brønner
0f745e0c86 Kill the built-in workspace animation more reliably (v3.28)
Specifically fixes (only in v3.28) that built-in workspace animation is visible
when moving mouse between monitors (changing the active monitor).

This problem appeared in 18eb343, disappeared in a8b23aa, and
reappeared in 9389d90 (consecutive commits)

I assume that prior to 18eb343 our own animation was active during the workspace
change. 18eb343 prevented a bunch of animations that didn't have any effect from
starting. Eg. ensureViewport and layout when they don't change anything. No
("paperwm") animation is thus run when changing the active monitor.

The workspace animation (v3.28) can also be suppressed by using
wm._blockAnimations prior to changing workspace.

Doing this when the navigator is active is easy, but there doesn't seem to be
suitable signals to catch all cases. (eg. we can't force our "workspace-changed"
handler to run before other handlers)

PS: This fix does not work for dialog windows so they're still
"workspace-animated" on monitor changes.
2018-12-19 21:07:29 +01:00
Ole Jørgen Brønner
1cc4c2f0d6 Regression: Prev commit (af3623e) broke new window animation
Try removing the Navigator.navigating and inPreview checks. In those cases the
clone should be visible.

Without those checks (together with the clone.get_parent check?) dialogs created
during animation is not hidden.

Also note that the unmapped description in af362e was wrong - unmapped is only
true a short period after the window is created.
2018-12-19 20:05:12 +01:00
Ole Jørgen Brønner
af3632e900 Bugfix: dialogs created during animation was hidden
To reproduce: Close a window with a confirmation dialog while the minimap is
open (eg. gnome-terminal with a running program)

A umapped window is either
1. a window that has not yet been inserted into a space/the scratch layer
2. a window we don't manage (eg. dialogs) meaning its clone is unused and should
   not be shown.

Note that it's not unlikely that we'll start to manage dialog-clones in the
future (#92)
2018-12-19 17:10:50 +01:00
Ole Jørgen Brønner
7ade1ef1de Revert "Mark windows as unmapped while changing between monitors"
This reverts commit 48ac0268f6.

Did not seem to resolve the issue and it sometimes causes windows to be stuck in
a "unmapped" state. Eg. when suspending, resuming and unlocking on ubuntu 18.04
gnome 3.28 windowEnteredMonitor is called on the visible windows - marking them
as unmapped.
2018-12-19 16:39:39 +01:00
Tor Hedin Brønner
33db8b137b Fix typo 2018-12-19 13:03:38 +01:00
Tor Hedin Brønner
57cbc3f586 focus_handler: raise the first window in a space too
Starting on the first window in a space, creating a new window and then closing
it would leave the user with the second window active instead of the first as
expected. This happened because we would never fix the stack order of the first
window.
2018-12-18 17:40:22 +01:00