Commit Graph

50 Commits

Author SHA1 Message Date
Tor Hedin Brønner
384dd6dab6 registerClass: Support passing extra spec as first arg 2019-10-20 19:05:43 +02:00
Ole Jørgen Brønner
5ea58aabcb utility: add app as dev global 2019-10-18 19:21:45 +02:00
Tor Hedin Brønner
076cbb655e Fix new window handling in gnome shell version 3.28 to 3.32
The opacity hack does not work in 3.32 and less. In fact setting opacity on
`queue-redraw` can kill a windows visibility entirely for some reason. The
windowactor property are fine, but the actor still doesn't show up.

So lets just kludge this for compatibility :P

fixes #184
2019-10-14 16:55:29 +02:00
Tor Hedin Brønner
8daee7ce38 Remove transition from tween calls 2019-09-28 16:20:42 +02:00
Tor Hedin Brønner
18fd713900 Use clutter animations
There's a few differences in how onComplete is run:
- We need to run moveDone on every clone transition, as the transitions aren't
done when cloneContainer's transition finishes
- We cannot run layout until startup is done. For some reason onComplete runs
before monitor setup is done properly.

squash! Use clutter animations

- Can't use addTween as a timeout, but transitions are now finished when
onComplete is run, so there's no need for this anymore.
2019-09-28 15:06:57 +02:00
Tor Hedin Brønner
d95acdfdbd Add a tweener to clutter dispatch 2019-09-28 15:06:57 +02:00
Tor Hedin Brønner
7fb9f4a0c1 Fix full hot code reload
`getCurrentExtension()` does not work with gnome-shell-mode's eval. Use a
somewhat verbose feature detection to work around the changes made in 3.34.
2019-09-03 17:36:37 +02:00
Rasmus Eneman
f949799c37 Fix crash under Gnome 3.34 2019-08-30 08:16:23 +02:00
Ole Jørgen Brønner
2a0da27f9f Bugfix: connectOneShot signals didn't disconnect on Signals.disconnect
Prevented 2364308681 from working in all
cases. (ie. windows could still be registered twice)
2019-08-14 22:27:12 +02:00
Ole Jørgen Brønner
2364308681 Ensure 'startup-complete' is not connected twice
Windows sometimes was registered (`registerWindow`) twice on startup (observed
on X11 3.28) causing all sorts of problems.

Seems like the extension sometimes is enabled/disabled twice on startup causing
the 'startup-complete' signal to be connected twice. Use the `Signals` class to
manage the signal to guard against this scenario.

I added a one-shot function to `Signals` since it's an error to disconnect an
already disconnected signal and that would happen on disable if the
'startup-complete' signal disconnected the signal itself.

assoc: d8069078f2
2019-07-09 18:47:06 +02:00
Ole Jørgen Brønner
040be580ac Configurable cycle-width/height steps 2019-07-01 22:11:01 +02:00
Tor Hedin Brønner
073986344a Polyfill GObject.registerClass
Register the WorkspaceMenu and LiveAltTab
2019-03-24 03:49:36 +01:00
Ole Jørgen Brønner
2174981cfc scratch: remember previous "scratch geometry" and restore it on detach 2019-02-27 22:41:00 +01:00
Tor Hedin Brønner
5d9f3d59e4 liveAltTab: instant preview 2019-02-22 11:13:39 +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
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