Skip to content
Open
Show file tree
Hide file tree
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
41 changes: 25 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ endif

SOURCE := $$PWD
EXT_ID := [email protected]
EXT_DIR := $(XDG_DATA_HOME)/gnome-shell/extensions
EXT_DIR := $(if $(DESTDIR),$(DESTDIR)/usr/share,$(XDG_DATA_HOME))/gnome-shell/extensions
TARGET := $(EXT_DIR)/$(EXT_ID)

CONFIG_FILES = config/user.js config/user.css
Expand All @@ -15,11 +15,12 @@ JS_FILES = $(wildcard *.js)
UI_FILES = $(wildcard *.ui)
RESOURCE_FILES = $(wildcard resources/*)

RELEASE_FILES = $(JS_FILES) $(UI_FILES) $(RESOURCE_FILES) \
$(CONFIG_FILES) $(GSCHEMA_FILES) \
schemas/gschemas.compiled \
metadata.json \
stylesheet.css \
EXT_FILES = $(JS_FILES) $(UI_FILES) $(RESOURCE_FILES) \
$(CONFIG_FILES) \
metadata.json \
stylesheet.css
RELEASE_FILES = $(EXT_FILES) \
$(GSCHEMA_FILES) schemas/gschemas.compiled \
LICENSE

ZIP := zip
Expand All @@ -33,7 +34,7 @@ endif
## Update compiled files
all: $(RELEASE_FILES)

## Install PaperWM on this system
## Install PaperWM for this user
install: schemas/gschemas.compiled
@if [[ ! -L "$(TARGET)" && -d "$(TARGET)" ]]; \
then \
Expand Down Expand Up @@ -61,25 +62,33 @@ install: schemas/gschemas.compiled
@echo "gnome-extensions enable $(EXT_ID)"
@echo

## Uninstall PaperWM from this system
## Uninstall PaperWM for this user
uninstall:
@$(call rich_echo,"GNOME_EXT_DISABLE", "$(EXT_ID)")
@$(GNOME_EXT_DISABLE) $(EXT_ID)
@if [[ `readlink -f $(TARGET)` != `readlink -f $$PWD` ]]; \
@if [ -z "$(DESTDIR)" ] && [ ! `readlink -f $(TARGET)` = `readlink -f $$PWD` ]; \
then \
echo "'$(TARGET)' does not link to '$$PWD', refusing to remove."; \
exit 1 \
echo "'$(TARGET)' does not link to '$$PWD' and '$(DESTDIR)' undefined,"; \
echo "refusing to remove."; \
exit 1; \
fi
@if [ -L $(TARGET) ]; \
then \
$(call rich_echo,"RM", "$(TARGET)") \
$(call rich_echo,"RM", "$(TARGET)"); \
rm $(EXT); \
else \
read -p "Remove $(TARGET)? (y/N): " -n 1 -r \
echo \
[[ $$REPLY =~ ^[Yy]$ ]] && rm -rf $(TARGET) \
echo "Remove $(TARGET)? (y/N): "; \
read REPLY; \
[ "$$REPLY" = "Y" ] || [ "$$REPLY" = "y" ] && rm -rf $(TARGET); \
fi

## Install in system-wide location
install-system:
for f in $(EXT_FILES); do \
install -D -p -m 0644 $$f "$(TARGET)/$$f"; \
done
install -d "$(DESTDIR)/usr/share/glib-2.0/schemas"
install -p -m 0644 $(GSCHEMA_FILES) "$(DESTDIR)/usr/share/glib-2.0/schemas/"

## Generate a release zip for review on GNOME Extensions
release: $(EXT_ID).zip
Expand All @@ -93,6 +102,6 @@ schemas/gschemas.compiled: $(GSCHEMA_FILES)
@$(call rich_echo,"MAKE","$@")
@$(MAKE) -C schemas gschemas.compiled

.PHONY: install uninstall release
.PHONY: install install-system uninstall release

include lib.mk
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ Clone the repo and check out the branch for the GNOME Shell version you're runni
- 40-41 ([EOL](https://release.gnome.org/calendar/#releases)): https://github.com/paperwm/PaperWM/tree/gnome-40
- 3.28-3.38 ([EOL](https://release.gnome.org/calendar/#releases)): https://github.com/paperwm/PaperWM/tree/gnome-3.38

then run the [`make install`](https://github.com/paperwm/PaperWM/blob/release/install.sh)
from the repository. The installer will create a link to the repo in
then run [`make install`] from the repository. The installer will create a link to the repo in
`~/.local/share/gnome-shell/extensions`. It will then ask if you want to enable PaperWM.
```bash
make install # install, load and enable paperwm
Expand Down
4 changes: 1 addition & 3 deletions schemas/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
gschemas.compiled: phony
gschemas.compiled: *.gschema.xml
glib-compile-schemas .

.PHONY: phony
21 changes: 16 additions & 5 deletions workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@ const WORKSPACE_KEY = 'org.gnome.shell.extensions.paperwm.workspace';
export class WorkspaceSettings {
constructor(extension) {
this.workspaceSettingsCache = {};
this.schemaSource = Gio.SettingsSchemaSource.new_from_directory(
GLib.build_filenamev([extension.path, "schemas"]),
Gio.SettingsSchemaSource.get_default(),
false
);

console.debug("Extension path " + extension.dir.get_parent().get_path());
console.debug("XDG_DATA_DIR=" + GLib.get_user_data_dir());
if (extension.dir.get_parent().get_parent().get_parent().get_path() == GLib.get_user_data_dir()) {
console.debug("We are installed in $XDG_DATA_HOME");
this.schemaSource = Gio.SettingsSchemaSource.new_from_directory(
GLib.build_filenamev([extension.path, "schemas"]),
Gio.SettingsSchemaSource.get_default(),
false
);
} else {
// assume we are installed system-wide and our schema source is in
// the default schema.
console.debug("We are installed in system $PREFIX.");
this.schemaSource = Gio.SettingsSchemaSource.get_default();
}

this.workspaceList = new Gio.Settings({
settings_schema: this.getSchemaSource().lookup(WORKSPACE_LIST_KEY, true),
Expand Down