Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Allow overriding stylesheet #13

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -174,6 +174,8 @@ When the tiling is active <kbd>Super</kbd><kbd>Shift</kbd><kbd>Tab</kbd> selects

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 <kbd>Super</kbd><kbd>L</kbd>.

You can also supply a custom `stylesheet.css` in `~/.config/paperwm/`, and paperwm will override its own default stylesheet located at the extension installation location, e.g., `~/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/stylesheet.css or `/usr/share/gnome-shell/extensions/paperwm@hedning:matrix.org/stylesheet.css`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can also supply a custom `stylesheet.css` in `~/.config/paperwm/`, and paperwm will override its own default stylesheet located at the extension installation location, e.g., `~/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/stylesheet.css or `/usr/share/gnome-shell/extensions/paperwm@hedning:matrix.org/stylesheet.css`.
You can also supply a custom `user.css` in `~/.config/paperwm/`, and paperwm will override its own default stylesheet located at the extension installation location, e.g., `~/.local/share/gnome-shell/extensions/paperwm@hedning:matrix.org/stylesheet.css or `/usr/share/gnome-shell/extensions/paperwm@hedning:matrix.org/stylesheet.css`.


We also made an emacs package, [gnome-shell-mode](https://github.com/paperwm/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 <kbd>Super</kbd><kbd>Insert</kbd> will assign the active window to a global variable `metaWindow`, its [window actor](https://developer.gnome.org/meta/stable/MetaWindowActor.html) to `actor`, its [workspace](https://developer.gnome.org/meta/stable/MetaWorkspace.html) to `workspace` and its PaperWM style workspace to `space`. This makes it easy to inspect state and test things out.
8 changes: 8 additions & 0 deletions extension.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { St } = imports.gi;

// polyfill workspace_manager that was introduced in 3.30 (must happen before modules are imported)
if (!global.workspace_manager) {
global.workspace_manager = global.screen;
@@ -180,6 +182,12 @@ function initUserConfig() {
if (hasUserConfigFile()) {
Extension.imports.searchPath.push(getConfigDir().get_path());
}

let userStylesheet = getConfigDir().get_child("stylesheet.css");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let userStylesheet = getConfigDir().get_child("stylesheet.css");
let userStylesheet = getConfigDir().get_child("user.css");

if (userStylesheet.query_exists(null)) {
let themeContext = St.ThemeContext.get_for_stage(global.stage);
themeContext.get_theme().load_stylesheet(userStylesheet);
}
}

/**