PaperWM

用于 Gnome Shell 的平铺式可滚动窗口管理。「Tiled scrollable window management for Gnome Shell」

Github stars Tracking Chart

PaperWM

project chat

PaperWM is an experimental Gnome Shell extension providing scrollable tiling of windows and per monitor workspaces. It's inspired by paper notebooks and tiling window managers.

Supports Gnome Shell from 3.28 to 3.38 on X11 and wayland.

While technically an extension it's to a large extent built on top of the Gnome desktop rather than merely extending it.

We hang out on zulip.

Installation

Clone the repo and run the
install.sh script
from the repository. The installer will create a link to the repo in
$XDG_DATA_HOME/gnome-shell/extensions/. It will then ask if you want to apply
the recommended settings (see Recommended
Settings
) and lastly it will ask to enable PaperWM.

./install.sh # install, load and enable paperwm

To uninstall simply run ./uninstall.sh.

You'll by default follow the
develop branch. If you want a
possibly more stable experience you can follow the releases by checking out the
master branch.

Cloning the repo directly into $XDG_DATA_HOME also works (you can then run
install.sh to enable PaperWM):

git clone 'https://github.com/paperwm/PaperWM.git' \
    "${XDG_DATA_HOME:-$HOME/.local/share}/gnome-shell/extensions/paperwm@hedning:matrix.org"

Running the extension will automatically install a user config file as described in Development & user configuration.

Note for Ubuntu users

There's three different gnome-desktop variants in Ubuntu:

The default ubuntu-desktop ships with desktop-icons which doesn't work
correctly with PaperWM (#145,
#218). Turning the extension
off in gnome-tweaks should work in
19.10
,
but there's reports of this not
working

in 19.04, so your milage my vary.

For the easiest out of the box experience we reccommend ubuntu-gnome-desktop.
vanilla-gnome-desktop adds some keybindings which plays badly with PaperWM
(#233), making it unsuitable at
the moment.

Usage

Most functionality is available using a mouse, eg. activating a window at the edge of the monitor by clicking on it. In wayland its possible to navigate with 3-finger swipes on the trackpad. But the primary focus is making an environment which works well with a keyboard.

All keybindings start with the Super modifier. On most keyboards it's the Windows key, on mac keyboards it's the Command key. It's possible to modify the keyboard layout so that Super is switched with Alt making all the keybindings easier to reach. This can be done through Gnome Tweaks under Keybard & MouseAdditional Layout OptionsAlt/Win key behaviorLeft Alt is swapped with Left Win.

Most keybindings will grab the keyboard while Super is held down, only switching focus when Super is released. Escape will abort the navigation taking you back to the previously active window.

Adding Ctrl to a keybinding will take the current window with you when navigating.

Window management and navigation is based around the three following concepts.

Scrollable window tiling

The window tiling with the minimap shown

New windows are automatically tiled to the right of the active window, taking up as much height as possible. SuperReturn will open a new window of the same type as the active window.

Activating a window will ensure it's fully visible, scrolling the tiling if necessary. Pressing Super. activates the window to the right. Super, activates the window to the left. On a US keyboard these keys are intuitively marked by < and >, they are also ordered the same way on almost all keyboard layouts. A minimap will be shown when Super is continually being pressed, as can be seen in the above screenshot.

Pressing SuperI will move the window to the right below the active window, tiling them vertically in a column. SuperO will do the opposite, pushing the bottom window out of the current column.

Swiping the trackpad horizontally with three fingers will scroll the tiling (only available in Wayland).

AltTab is of course also available.

PaperWM doesn't handle attached modal dialogs very well, so it's best to turn it off in Gnome Tweaks (under Windows)., Keybindings, ------, -------, Super, or Super., Activate the next or previous window, SuperLeft or SuperRight, Activate the window to the left or right, SuperUp or SuperDown, Activate the window above or below, SuperHome or SuperEnd, Activate the first or last window, SuperCtrl, or SuperCtrl., Move the current window to the left or right, SuperCtrlLeft or SuperCtrlRight, Move the current window to the left or right, SuperCtrlUp or SuperCtrlDown, Move the current window up or down, Supert, Take the window, placing it when finished navigating, SuperTab or AltTab, Cycle through the most recently used windows, SuperShiftTab or AltShiftTab, Cycle backwards through the most recently used windows, SuperC, Center the active window horizontally, SuperR, Resize the window (cycles through useful widths), SuperShiftR, Resize the window (cycles through useful heights), SuperF, Maximize the width of a window, SuperShiftF, Toggle fullscreen, SuperReturn or SuperN, Create a new window from the active application, SuperBackspace, Close the active window, SuperI, Absorb the window to the right into the active column, SuperO, Expel the bottom window out to the right, ### The workspace stack & monitors ###

Pressing SuperAbove_Tab will slide the active workspace down revealing the stack as shown in the above screenshot. You can then flip through the most recently used workspaces with repeated Above_Tab presses while holding Super down. Above_Tab is the key above Tab (` in a US qwerty layout). Like alt-tab Shift is added to move in reverse order:

The most recently used workspace stack

Pressing SuperPage_Down and SuperPage_Up will slide between workspaces sequentially:

Sequential workspace navigation

The workspace name is shown in the top left corner replacing the Activities button adding a few enhancements. Scrolling on the name will let you browse the workspace stack just like SuperAbove_Tab. Right clicking the name lets you access and change the workspace name and the background color:

The workspace menu

Swiping the trackpad vertically with three fingers lets you navigate the workspace stack (only available in Wayland).

There's a single scrollable tiling per workspace. Adding another monitor simply makes it possible to have another workspace visible. The workspace stack is shared among all the monitors, windows being resized vertically as necessary when workspace is displayed on another monitor.

PaperWM currently works best using the workspaces span monitors preference, this can be turned on with Gnome Tweaks under Workspaces. If you want to use workspaces only on primary you need to place the secondary monitor either below or above the primary (with the best result having it below)., Workspace Keybindings, ------, -------, SuperAbove_Tab, Cycle through the most recently used workspaces, SuperShiftAbove_Tab, Cycle backwards through the most recently used workspaces, SuperCtrlAbove_Tab, Cycle through the most recently used, taking the active window with you, SuperCtrlShiftAbove_Tab, Cycle backwards through the most recently used, taking the active window with you, SuperPage_Down/Page_Up, Cycle sequentially through workspaces, SuperCtrlPage_Down/Page_Up, Cycle sequentially through workspaces, taking the active window with you, Monitor Keybindings, ------, -------, SuperShiftArrow_key, Select neighbouring monitor, SuperShiftCtrlArrow_key, Move active window to neighbouring monitor, ### Scratch layer ###

The floating scratch layer, with the alt tab menu open

The scratch layer is an escape hatch to a familiar floating layout. This layer is intended to store windows that are globally useful like chat applications and in general serve as the kitchen sink.
When the scratch layer is active it will float above the tiled windows, when hidden the windows will be minimized.

Opening a window when the scratch layer is active will make it float automatically.

Pressing SuperEscape toggles between showing and hiding the windows in the scratch layer.
Activating windows in the scratch layer is done using SuperTab, the floating windows having priority in the list while active.
When the tiling is active SuperShiftTab selects the most recently used scratch window.

SuperCtrlEscape will move a tiled window into the scratch layer or alternatively tile an already floating window. This functionality can also be accessed through the window context menu (AltSpace)., Keybindings, ------, -------, SuperEscape, Toggle between showing and hiding the most recent scratch window, SuperShiftEscape, Toggle between showing and hiding the scratch windows, SuperCtrlEscape, Toggle between floating and tiling the current window, SuperTab, Cycle through the most recently used scratch windows, SuperH, Minimize the current window, ## Development & user configuration ##

A default user configuration, user.js, is created in ~/.config/paperwm/ with three functions init, enable and disable. init will run only once on startup, enable and disable will be run whenever extensions are being told to disable and enable themselves. Eg. when locking the screen with SuperL.

We also made an emacs package, gnome-shell-mode, to make hacking on the config and writing extensions a more pleasant experience. To support this out of the box we also install a metadata.json so gnome-shell-mode will pick up the correct file context, giving you completion and interactive evaluation ala. looking glass straight in emacs.

Pressing SuperInsert will assign the active window to a global variable metaWindow, its window actor to actor, its workspace to workspace and its PaperWM style workspace to space. This makes it easy to inspect state and test things out.

Using dconf-editor to modify settings

GSETTINGS_SCHEMA_DIR=$HOME/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/schemas dconf-editor /org/gnome/shell/extensions/paperwm/

Winprops

It's possible to create simple rules for placing new windows. Currently most useful when a window should be placed in the scratch layer automatically. An example, best placed in the init part of user.js:

    Tiling.defwinprop({
        wm_class: "Spotify",
        scratch_layer: true,
    });

The wm_class of a window can be found by using looking glass: AltF2 lg Return Go to the "Windows" section at the top right and find the window. X11 users can also use the xprop command line tool.

New Window Handlers

If opening a new application window with SuperReturn isn't doing exactly what you want you can create custom functions to fit your needs. Say you want new emacs windows to open the current buffer by default, or have new terminals inherit the current directory:

    let App = Extension.imports.app;
    App.customHandlers['emacs.desktop'] =
        () => imports.misc.util.spawn(['emacsclient', '--eval', '(make-frame)']);
    App.customHandlers['org.gnome.Terminal.desktop'] =
        (metaWindow, app) => app.action_group.activate_action(
          "win.new-terminal",
          new imports.gi.GLib.Variant("(ss)", ["window", "current"]));

The app id of a window can be looked up like this:

var Shell = imports.gi.Shell;
var Tracker = Shell.WindowTracker.get_default();
var app = Tracker.get_window_app(metaWindow);
app.get_id();

Available application actions can be listed like this:

app.action_group.list_actions();

Keybindings

Due to limitations in the mutter keybinding API we need to steal some built in Gnome Shell actions by default. Eg. the builtin action switch-group with the default SuperAbove_Tab keybinding is overridden to cycle through recently used workspaces. If an overridden action has several keybindings they will unfortunately all activate the override, so for instance because AltAbove_Tab is also bound to switch-group it will be overridden by default. If you want to avoid this, eg. you want AltTab and AltAbove_Tab to use the builtin behavior simply remove the conflicts (ie. SuperTab and SuperAbove_Tab and their Shift variants) from /org/gnome/desktop/wm/keybindings/switch-group (no restarts required).

User defined keybindings

Extension.imports.keybindings.bindkey(keystr, name, handler, options)

Option, Values, Meaning
--------------------, ---------------------, ------------------------------------
activeInNavigator, true, false, The keybinding is active when the minimap/navigator is open
opensMinimap, true, false, The minimap will open when the keybinding is invoked

let Keybindings = Extension.imports.keybindings;
Keybindings.bindkey("<Super>j", "my-favorite-width",
                    (metaWindow) => {
                        let f = metaWindow.get_frame_rect();
                        metaWindow.move_resize_frame(true, f.x, f.y, 500, f.h);
                    },
                    { activeInNavigator: true });

See examples/keybindings.js for more examples.

Fixed Window Size

Currently it is not possible to have a default fixed window size.
Please check the following issues for progress / info:

There's a few Gnome Shell settings which works poorly with PaperWM. Namely

  • workspaces-only-on-primary: Multi monitor support require workspaces
    spanning all monitors
  • edge-tiling: We don't support the native half tiled windows
  • attach-modal-dialogs: Attached modal dialogs can cause visual glitching

To use the recommended settings run
set-recommended-gnome-shell-settings.sh. A "restore previous settings" script is generated so the original settings is not lost.

These extensions are good complements to PaperWM:

Prior work

A similar idea was apparently tried out a while back: http://10gui.com/

Overview

Name With Ownerpaperwm/PaperWM
Primary LanguageJavaScript
Program languageEmacs Lisp (Language Count: 5)
Platform
License:GNU General Public License v3.0
Release Count130
Last Release Namev46.9.0 (Posted on )
First Release Name34.0 (Posted on )
Created At2017-09-17 12:18:35
Pushed At2024-05-10 10:14:06
Last Commit At2021-12-17 14:20:02
Stargazers Count2.7k
Watchers Count34
Fork Count123
Commits Count3.1k
Has Issues Enabled
Issues Count536
Issue Open Count84
Pull Requests Count251
Pull Requests Open Count6
Pull Requests Close Count48
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private
To the top