Commit Graph

36 Commits

Author SHA1 Message Date
Ole Jørgen Brønner
09950f20a2 Cleanup: MetaWindow have a built-in 'is_override_redirect' method 2019-02-10 14:32:58 +01:00
Ole Jørgen Brønner
492dc9ec15 Misc cleanup 2019-01-05 14:22:46 +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
Tor Hedin Brønner
7a9548bbba fix typo 2018-12-17 22:21:57 +01:00
Tor Hedin Brønner
8c086081a0 Get rid of pointer.get_position
pointer.get_position can report the wrong coordinates, use the simpler
global.get_pointer() instead.
2018-12-17 22:21:57 +01:00
Tor Hedin Brønner
8ab7e79820 print_stacktrace: adapt to gnome-shell-mode's log handling 2018-12-14 13:14:53 +01:00
Ole Jørgen Brønner
8d8591d3c1 Ignore override-redirect windows completely
After a99c151 the we caused lots of
  meta_window_make_above: assertion '!window->override_redirect' failed
warnings in the log.

Most likely best to leave such windows alone.
2018-12-10 19:28:29 +01:00
Ole Jørgen Brønner
2137dddfa0 Bugfix: SSD frame buttons (minimize, ...) stopped working after 5d0f037d3
button-press on these buttons trigger a grab (GrabOp.FRAME_BUTTON).

Our grab handler run startAnimate which tracks the background -> the
button-press is stolen

Only happened for server-side-decorated windows (make sense that the grab is not
triggered for CSD windows)

Regression after: 5d0f037d3
2018-12-09 11:25:17 +01:00
Tor Hedin Brønner
e701bd48f0 extension: wrap all init/enable/disable in try blocks 2018-11-27 14:23:02 +01:00
Tor Hedin Brønner
145a8d3347 Polyfill global.workspace_manager 2018-08-27 20:33:34 +02:00
Ole Jørgen Brønner
a64860bb47 Remove utils.as_key_handler 2018-07-18 22:37:34 +02:00
Tor Hedin Brønner
fc260da22d Consistently declare and use screen and display
Makes things shorter and removes language warnings of using undeclared
variables.
2018-07-12 16:14:26 +02:00
Tor Hedin Brønner
c723fa2a4d Use new workspace settings schema
Per workspace settings can be accessed through `space.settings`.

A setting's path is stored under its uuid in
`/org/gnome/shell/extensions/paperwm/workspaces/${uuid}/`. When modifying a
workspace setting the uuid will be recorded in
`org.gnome.Shell.Extensions.PaperWM.WorkspaceList`.

Spaces get their settings by looking for an uuid with an `index` key
corrosponding to its `workspace.index()`. If such a setting can't be found the
space will be given a fresh uuid and the name and color will be assigned as
before.
2018-07-08 12:09:47 +02:00
Ole Jørgen Brønner
e1bc0853a2 Disable and enable our keybindings more robustly 2018-07-06 12:16:37 +02:00
Ole Jørgen Brønner
71b6ee8f56 Unify regular keybinding api an schemaless keybinding api
Try to make it a bit more "action oriented":

  An action exists independently of its binding. It could conceivable be invoked
  by other means too.

Some weirdness from the marriage remain to weed out, but this is a working
stepping stone.
2018-07-06 12:16:37 +02:00
Ole Jørgen Brønner
01e9161922 debug-util: function to visually distinguish window actors and clones 2018-07-03 13:48:09 +02:00
Ole Jørgen Brønner
eb975ec811 centerWindow: only warp pointer if it's inside the selected window 2018-07-02 20:14:42 +02:00
Tor Hedin Brønner
ea77c4609f Disconnect destroyed windows and actors 2018-07-02 18:28:25 +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
Ole Jørgen Brønner
cca3038957 Center window function (with mouse warp)
I find myself centering the focus window quite often since it's more
comfortable looking straight ahead.
2018-06-21 22:21:26 +02:00
Tor Hedin Brønner
b058154cb8 Turn off debugging by default 2018-04-30 20:20:13 +02:00
Tor Hedin Brønner
20bd85fb9e utility: Add space as dev global 2018-02-17 18:05:11 +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
Ole Jørgen Brønner
f1ed8d5d27 Fix stupid bug 2017-10-29 12:38:57 +01:00
Ole Jørgen Brønner
51fd7c1930 Set workspace name utility function
Arguments ordered for convenience for now since the repl is the UI atm.
2017-10-29 11:39:04 +01: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
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
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
Tor Hedin Brønner
8a4aeb82ab Arrow functions doesn't have arguments in newer spidermonkey
Gnome-shell 3.26 uses a newer spidermonkey engine which doesn't give arrow
functions access to the `arguments` keyword. Using `function` instead fixes
this.

Also use [...arguments] to copy arguments as slice apparently can have a
performance penalty:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments
2017-10-05 14:12:43 +02:00
Ole Jørgen Brønner
a5f683d9f1 Allow printing stacktraces of existing errors too 2017-10-02 19:45:09 +02:00
Ole Jørgen Brønner
a08d6e0be7 Some development utils: eg. update global variables command: Super-Insert
+ A function to visualize the window boxes (frame_rect and buffer_rect)
2017-09-29 16:09:40 +02:00
Ole Jørgen Brønner
d7fa57592c (empty) Minimap for all spaces!
Not hooked up to 'window-added/removed' so the map will be empty.
2017-09-27 21:26:08 +02:00
Ole Jørgen Brønner
367a9430f4 Use global.get_current_time for timestamps
Probably fixes WM warnings about timestamps.
2017-09-21 16:11:12 +02:00
Ole Jørgen Brønner
e002d02e50 Move utils to separate file 2017-09-21 16:01:21 +02:00