Commit Graph

117 Commits

Author SHA1 Message Date
Tor Hedin Brønner
a890ffc406 minimap: don't show highlight on empty workspace 2019-01-12 18:35:17 +01:00
Ole Jørgen Brønner
1d84820ab1 Minimap: react to new space signal "full-layout"
full-layout: everything in the space can have changed
2018-12-30 23:58:37 +01:00
Tor Hedin Brønner
2a4199029d minimap: Respect window-gap properly
There were some hardcoded values left which really should've observed the
`window-gap` preference.
2018-07-15 20:39:44 +02:00
Tor Hedin Brønner
3548f219a2 Rename prefs.js to settings.js
prefs.js causes issues as its used to lauch the settings gui from eg. tweaks.
2018-07-02 22:31:55 +02:00
Tor Hedin Brønner
a0b6cdf9d4 minimap: layout on window-removed
Allocate isn't run as much now so run it manually.
2018-07-02 15:01:04 +02:00
Tor Hedin Brønner
d310553715 minimap: position on correct monitor 2018-07-01 12:26:53 +02:00
Tor Hedin Brønner
ce58c1c2b6 Refactor signal handling into utils.Signals class
We use this pattern all over the place:
```
  signals = [ foo.connect('bar', handler) ];
  signals.forEach(id => foo.disconnect(id));
```
So we abstract it into a class that keeps track of the state automatically.
2018-06-29 13:56:06 +02:00
Tor Hedin Brønner
c1bc171491 navigator: Create minimaps on demand
Show a minimap when navigating a space while preview is active.
2018-06-29 13:56:06 +02:00
Tor Hedin Brønner
948d8230a8 minimap: simplify layout 2018-06-29 13:18:12 +02:00
Tor Hedin Brønner
ed2cebdddf minimap: Extend Array to mimic Space 2018-06-29 13:18:12 +02:00
Tor Hedin Brønner
bcee9acfb8 Move _reorder to Space.swap(direction, window)
Emit `Space::swapped`
2018-06-29 13:18:12 +02:00
Tor Hedin Brønner
204b8ffcb5 Let the minimap take care of its own position 2018-06-29 13:18:09 +02:00
Tor Hedin Brønner
6fda263957 Update the minimap through signals from the space
A space now emits four signals (supplying these arguments):

1. `select`, which runs on `ensureViewport`
2. `window-added` (metaWindow, index, row)
3. `window-removed` (metaWindow, index, row)
4. `monitor-changed`, currently not used

The minimap hooks into these signals updating as necessary. This is a lot
cleaner and goes a long way untangling the minimap from the navigator. One nice
effect is proper support of adding and removing windows when the minimap is
active.

It also works better on wayland as there's less reliance on synchronous updates.
2018-06-29 13:17:50 +02:00
Tor Hedin Brønner
e2daba83c9 minmap: Make room for vertical window gaps 2018-06-25 16:50:44 +02:00
Tor Hedin Brønner
aff871d783 navigate: Fix reordering 2018-06-25 16:50:44 +02:00
Tor Hedin Brønner
0db0bd81fd minimap: Render vertical tiling 2018-06-25 16:50:44 +02:00
Ole Jørgen Brønner
92d7974204 Only render first row of columns in minimap (instead of flattening everything) 2018-06-25 16:50:43 +02:00
Tor Hedin Brønner
fc3628bad4 Refactor space into an array of columns
This sets us up for supporting vertical tiling.
2018-06-25 16:50:43 +02:00
Tor Hedin Brønner
3e4d9901d5 minimap: Use a more visible style for selection highlight 2018-06-14 21:14:33 +02:00
Ole Jørgen Brønner
f6c8b902df Bugfix: selected window in minimap somtimes out of view for large maps
Happened if the minimap strip exceeded the monitor width and the initially
selected window was one of the rightmost windows.
2018-06-03 10:19:15 +02:00
Tor Hedin Brønner
170df6ba34 minimap: Use whole pixel values consistently 2018-05-21 22:31:14 +02:00
Tor Hedin Brønner
6942df947f Monitor preference changes
Introduces `prefs.js` with simple `settings::change` signal handling.

Also put workspace colors in the schema and draw them from there.
2018-05-15 16:31:01 +02:00
Tor Hedin Brønner
000881524a New minimap
Simple switcherlist styled minimap without any animations.

TODO: add fading at the edges
2018-05-10 22:30:40 +02:00
Tor Hedin Brønner
e2f0b84ce7 Only create a single minimap 2018-05-07 14:15:47 +02:00
Tor Hedin Brønner
92e9209518 minimap: Guard against realWindow being null
For some reason this can now trigger a whole bunch.
2018-05-02 11:14:24 +02:00
Tor Hedin Brønner
c80a8df1ad Show the minimap on the active monitor
There's a bug in SwitcherPopup where pushModal will sometimes fail on
`parent.show`. We therefor move most of the initialization to
`_initialSelection` which is run after the `pushModal` calls.

This also caused the issue where animations would randomly be blocked after a
navigation, which should be fixed now.
2018-05-02 11:02:09 +02:00
Tor Hedin Brønner
42aedba3b6 Use var for all top level declarations to avoid warnings
We're assessing all top level declarations from outside the original scope when
we're evaluating code. So everything should be `var`.

Classes are `let` bound so we should use var for `ClickOverlay` too, but there's
a bug in gnome-shell-mode making such statements not evaluate. We therefor wait
for that to be fixed.
2018-04-30 00:03:08 +02:00
Tor Hedin Brønner
cce3341afd Use correct coordinates when animating windows
Adds a `Space.monitor` property, hard coded to the primary monitor for the
moment. `move` needs to know about which space it's moving windows on.

It seems that we really don't have to worry about scaling, as it mutter should
take care of it automatically.

fixes #47
2018-04-30 00:03:08 +02:00
Tor Hedin Brønner
00ed83eb19 Spaces: add generic mru method 2018-04-22 15:01:57 +02:00
Tor Hedin Brønner
6e198425e7 minimap: remove noisy and useless debug print 2018-04-04 05:45:17 +02:00
Tor Hedin Brønner
ccf59e8a6b Don't access label after it's destroyed 2018-03-11 22:16:14 +01:00
Tor Hedin Brønner
56dac2a8b6 Get the Extension object via hardcoded uuid lookup
This enables reloading of a whole module.
2017-12-03 19:18:14 +01:00
Tor Hedin Brønner
a8bfae0333 Use less abrupt staggered scaling on fold 2017-10-30 15:16:48 +01:00
Tor Hedin Brønner
d7adf22ff2 Use proper function syntax
There's no longer any reason to use `var name = function()` or
`var name = ()=>{}`.
2017-10-29 16:12:53 +01:00
Tor Hedin Brønner
c18190c3a4 Make spaces local
`var spaces = Tiling.spaces` in minimap.js doesn't work for some reason.
2017-10-28 01:37:22 +02:00
Tor Hedin Brønner
a72767bfd2 Make primary local
We want to reference primary through `Tiling` as it can change on
`monitors-changed`.
2017-10-27 21:47:29 +02:00
Tor Hedin Brønner
fb360b5695 Everything but primary and spaces should be local now 2017-10-27 21:32:18 +02:00
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
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
5306e6c1e4 Add minimap padding 2017-10-26 13:17:08 +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
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
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
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
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
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