Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
98 changes: 98 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
ifdef $$XDG_DATA_HOME
XDG_DATA_HOME := $$XDG_DATA_HOME
else
XDG_DATA_HOME := ${HOME}/.local/share
endif

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

CONFIG_FILES = config/user.js config/user.css
GSCHEMA_FILES = schemas/org.gnome.shell.extensions.paperwm.gschema.xml
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 \
LICENSE

ZIP := zip

ifneq (,$(shell command -v gnome-extensions))
GNOME_EXT_DISABLE := gnome-extensions disable
else
GNOME_EXT_DISABLE := gnome-shell-extension-tool --disable
endif

## Update compiled files
all: $(RELEASE_FILES)

## Install PaperWM on this system
install: schemas/gschemas.compiled
@if [[ ! -L "$(TARGET)" && -d "$(TARGET)" ]]; \
then \
echo; \
echo "INSTALL FAILED:"; \
echo; \
echo "A previous (non-symlinked) installation of PaperWM already exists at:"; \
echo "'$(TARGET)'."; \
echo; \
echo "Please remove the installed version from that path and re-run this install script."; \
echo; \
exit 1; \
fi
@$(call rich_echo,"MKDIR","$(EXT_DIR)")
@mkdir -p $(EXT_DIR)
@$(call rich_echo,"LINK","$(EXT_ID)")
@ln -snf $(SOURCE) $(TARGET)
@echo
@echo "INSTALL SUCCESSFUL:"
@echo
@echo "If this is the first time installing PaperWM, then please logout/login"
@echo "and enable the PaperWM extension, either with the GNOME Extensions application,"
@echo "or manually by executing the following command from a terminal:"
@echo
@echo "gnome-extensions enable $(EXT_ID)"
@echo

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


## Generate a release zip for review on GNOME Extensions
release: $(EXT_ID).zip


$(EXT_ID).zip: $(RELEASE_FILES)
@$(call rich_echo,"ZIP","$@")
@$(ZIP) -r $@ $^

schemas/gschemas.compiled: $(GSCHEMA_FILES)
@$(call rich_echo,"MAKE","$@")
@$(MAKE) -C schemas gschemas.compiled

.PHONY: install uninstall release

include lib.mk
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ 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 [`install.sh`](https://github.com/paperwm/PaperWM/blob/release/install.sh) script
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
`~/.local/share/gnome-shell/extensions`. It will then ask if you want to enable PaperWM.
```bash
./install.sh # install, load and enable paperwm
make install # install, load and enable paperwm
```

Running the extension will automatically install a user config file as described in [User configuration & development](#user-configuration--development).

> #### ➡️ You'll need to restart Gnome shell after installing PaperWM, e.g. logout then login, or restart in place with an `alt-F2` and entering `r` (X11 only).
>
> After logging back in, you can then enable PaperWM via the `Extensions` application, or by running the following command from the command-line:
Expand All @@ -44,10 +47,7 @@ from the repository. The installer will create a link to the repo in

#### Uninstall PaperWM (if installed via source)

To uninstall simply run `./uninstall.sh`.

Running the extension will automatically install a user config file as described in [User configuration & development](#user-configuration--development).

To uninstall simply run `make uninstall`.

### Try without installing

Expand Down
10 changes: 2 additions & 8 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@ stdenv.mkDerivation {
version = "unstable";
src = ./.;

makeFlags = [ "SOURCE=$(src)" "EXT_DIR=$(out)/share/gnome-shell/extensions" ];

nativeBuildInputs = with pkgs;
[ glib
];
buildPhase = ''
make -C schemas gschemas.compiled
'';

installPhase = ''
mkdir -p $out/share/gnome-shell/extensions
cp -r -T . $out/share/gnome-shell/extensions/${uuid}
'';

passthru = {
extensionPortalSlug = "paperwm";
Expand Down
15 changes: 0 additions & 15 deletions generate-extension-zip.sh

This file was deleted.

36 changes: 0 additions & 36 deletions install.sh

This file was deleted.

28 changes: 28 additions & 0 deletions lib.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# COLORS
GREEN := $(shell tput setaf 2 2>/dev/null)
YELLOW := $(shell tput setaf 3 2>/dev/null)
BOLD := $(shell tput bold 2>/dev/null)
RESET := $(shell tput sgr0 2>/dev/null)

define rich_echo
printf "${BOLD}$(1)${RESET}\t$(2)\n"
endef


TARGET_MAX_CHAR_NUM=20
## Show this message
help:
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
30 changes: 0 additions & 30 deletions uninstall.sh

This file was deleted.