summaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-02-22 14:25:41 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-02-22 14:25:41 +1100
commit669eaa61cbead28957c0b541212e05a8ca8c7a7f (patch)
tree064b476d7757cd8abb19faddff67defba0c538bf /install
parentreadme: update help message (diff)
downloadcaelestia-cli-669eaa61cbead28957c0b541212e05a8ca8c7a7f.tar.gz
caelestia-cli-669eaa61cbead28957c0b541212e05a8ca8c7a7f.tar.bz2
caelestia-cli-669eaa61cbead28957c0b541212e05a8ca8c7a7f.zip
install: better install + use data and state
Don't complete remove repos, use git pull instead Use XDG_DATA_HOME and XDG_STATE_HOME
Diffstat (limited to 'install')
-rwxr-xr-xinstall/discord.fish25
-rwxr-xr-xinstall/foot.fish7
-rwxr-xr-xinstall/fuzzel.fish19
-rwxr-xr-xinstall/gtk.fish20
-rwxr-xr-xinstall/hypr.fish25
-rwxr-xr-xinstall/safeeyes.fish6
-rwxr-xr-xinstall/scripts.fish11
-rwxr-xr-xinstall/shell.fish6
-rw-r--r--install/util.fish44
-rwxr-xr-xinstall/vscode.fish9
10 files changed, 90 insertions, 82 deletions
diff --git a/install/discord.fish b/install/discord.fish
index 98d7fad..2eff70a 100755
--- a/install/discord.fish
+++ b/install/discord.fish
@@ -10,30 +10,17 @@ end
install-deps git
install-optional-deps 'arrpc (rich presence)'
-set -l systemd $CONFIG/../systemd/user
-set -l client $CONFIG/../$argv[1]
-set -l discord $CONFIG/discord
+set -l client $CONFIG/$argv[1]
+set -l dist $C_DATA/discord
-# Clone repo
-confirm-overwrite $discord
-git clone https://github.com/caelestia-dots/discord.git $discord
+# Update/Clone repo
+update-repo discord $dist
# Install systemd service
-if test -d $systemd
- log 'Installing systemd service...'
-
- echo "[Service]
-Type=oneshot
-ExecStart=$discord/monitor/update.fish" > $systemd/discord-monitor-scheme.service
- cp $discord/monitor/discord-monitor-scheme.path $systemd/discord-monitor-scheme.path
-
- systemctl --user daemon-reload
- systemctl --user enable --now discord-monitor-scheme.path
- systemctl --user start discord-monitor-scheme.service
-end
+setup-systemd-monitor discord $dist
# Link themes to client config
confirm-overwrite $client/themes
-ln -s $discord/themes $client/themes
+ln -s $dist/themes $client/themes
log 'Done.'
diff --git a/install/foot.fish b/install/foot.fish
index 8e9c51e..941630f 100755
--- a/install/foot.fish
+++ b/install/foot.fish
@@ -4,10 +4,9 @@
install-deps git foot inotify-tools
-set -l foot $CONFIG/../foot
+set -l dist $CONFIG/foot
-confirm-overwrite $foot
-git clone 'https://github.com/caelestia-dots/foot.git' $foot
-sed -i 's|$SRC|'$foot'|g' $foot/foot.ini
+update-repo foot $dist
+sed -i 's|$SRC|'$dist'|g' $dist/foot.ini
log 'Done.'
diff --git a/install/fuzzel.fish b/install/fuzzel.fish
index eb3bf3b..3f22fee 100755
--- a/install/fuzzel.fish
+++ b/install/fuzzel.fish
@@ -4,25 +4,12 @@
install-deps git fuzzel-git
-set -l systemd $CONFIG/../systemd/user
-set -l fuzzel $CONFIG/../fuzzel
+set -l dist $CONFIG/fuzzel
# Clone repo
-confirm-overwrite $fuzzel
-git clone 'https://github.com/caelestia-dots/fuzzel.git' $fuzzel
+update-repo fuzzel $dist
# Install systemd service
-if test -d $systemd
- log 'Installing systemd service...'
-
- echo "[Service]
-Type=oneshot
-ExecStart=$fuzzel/monitor/update.fish" > $systemd/fuzzel-monitor-scheme.service
- cp $fuzzel/monitor/fuzzel-monitor-scheme.path $systemd/fuzzel-monitor-scheme.path
-
- systemctl --user daemon-reload
- systemctl --user enable --now fuzzel-monitor-scheme.path
- systemctl --user start fuzzel-monitor-scheme.service
-end
+setup-systemd-monitor fuzzel $dist
log 'Done.'
diff --git a/install/gtk.fish b/install/gtk.fish
index 10e41e4..c3cca61 100755
--- a/install/gtk.fish
+++ b/install/gtk.fish
@@ -4,24 +4,12 @@
install-deps git adw-gtk-theme
-set -l gtk $CONFIG/gtk
-set -l systemd $CONFIG/../systemd/user
+set -l dist $C_DATA/gtk
-confirm-overwrite $gtk
-git clone 'https://github.com/caelestia-dots/gtk.git' $gtk
+# Update/Clone repo
+update-repo gtk $dist
# Install systemd service
-if test -d $systemd
- log 'Installing systemd service...'
-
- echo "[Service]
-Type=oneshot
-ExecStart=$gtk/monitor/update.fish" > $systemd/gtk-monitor-scheme.service
- cp $gtk/monitor/gtk-monitor-scheme.path $systemd/gtk-monitor-scheme.path
-
- systemctl --user daemon-reload
- systemctl --user enable --now gtk-monitor-scheme.path
- systemctl --user start gtk-monitor-scheme.service
-end
+setup-systemd-monitor gtk $dist
log 'Done.'
diff --git a/install/hypr.fish b/install/hypr.fish
index e93c0ba..e7761cf 100755
--- a/install/hypr.fish
+++ b/install/hypr.fish
@@ -5,13 +5,24 @@
install-deps git uwsm hyprland-git hyprpaper-git hyprlock-git hypridle-git polkit-gnome gnome-keyring wl-clipboard wireplumber
install-optional-deps 'gammastep (night light)' 'wlogout (secondary session menu)' 'grimblast-git (screenshot freeze)' 'hyprpicker-git (colour picker)' 'foot (terminal emulator)' 'firefox (web browser)' 'vscodium-bin (IDE)' 'thunar (file manager)' 'nemo (secondary file manager)' 'fuzzel (secondary app launcher)' 'ydotool (alternate paste)' 'trash-cli (auto trash)'
-set -l hypr $CONFIG/../hypr
-set -l uwsm $CONFIG/../uwsm
+set -l hypr $CONFIG/hypr
+set -l uwsm $CONFIG/uwsm
# Cause hyprland autogenerates a config file when it is removed
-confirm-overwrite $hypr dummy
-git clone 'https://github.com/caelestia-dots/hypr.git' /tmp/caelestia-hypr
-rm -rf $hypr && mv /tmp/caelestia-hypr $hypr
+set -l remote https://github.com/caelestia-dots/hypr.git
+if test -d $hypr
+ cd $hypr || exit
+ if test "$(git config --get remote.origin.url)" != $remote
+ cd .. || exit
+ confirm-overwrite $hypr dummy
+ git clone $remote /tmp/caelestia-hypr
+ rm -rf $hypr && mv /tmp/caelestia-hypr $hypr
+ else
+ git pull
+ end
+else
+ git clone $remote $dir
+end
# Install uwsm envs
confirm-overwrite $uwsm
@@ -20,8 +31,4 @@ mv $hypr/uwsm $uwsm
# Enable ydotool if installed
pacman -Q ydotool &> /dev/null && systemctl --user enable --now ydotool.service
-# Reload hyprland config to get rid of error messages
-sleep .1
-hyprctl reload
-
log 'Done.'
diff --git a/install/safeeyes.fish b/install/safeeyes.fish
index 93da2d2..05582fa 100755
--- a/install/safeeyes.fish
+++ b/install/safeeyes.fish
@@ -4,9 +4,7 @@
install-deps git dart-sass aylurs-gtk-shell-git alsa-utils libappindicator-gtk3
-set -l safeeyes $CONFIG/safeeyes
-
-confirm-overwrite $safeeyes
-git clone 'https://github.com/caelestia-dots/safeeyes.git' $safeeyes
+# Update/Clone repo
+update-repo safeeyes $C_DATA/safeeyes
log 'Done.'
diff --git a/install/scripts.fish b/install/scripts.fish
index 3cca775..bc5770b 100755
--- a/install/scripts.fish
+++ b/install/scripts.fish
@@ -5,18 +5,17 @@
install-deps git hyprland-git hyprpaper-git okolors-git imagemagick wl-clipboard fuzzel-git socat foot jq python
install-optional-deps 'equibop-bin (discord client)' 'btop (system monitor)' 'wf-recorder (screen recorder)' 'grim (screenshot tool)' 'firefox (web browser)' 'spotify-adblock (music player)'
-set -l dist $CONFIG/scripts
+set -l dist $C_DATA/scripts
-# Clone repo
-confirm-overwrite $dist
-git clone 'https://github.com/caelestia-dots/scripts.git' $dist
+# Update/Clone repo
+update-repo scripts $dist
# Install to path
mkdir -p ~/.local/bin
ln -s $dist/main.fish ~/.local/bin/caelestia
# Install completions
-mkdir -p $CONFIG/../fish/completions
-cp $dist/completions/caelestia.fish $CONFIG/../fish/completions/caelestia.fish
+mkdir -p $CONFIG/fish/completions
+cp $dist/completions/caelestia.fish $CONFIG/fish/completions/caelestia.fish
log 'Done.'
diff --git a/install/shell.fish b/install/shell.fish
index c48b817..2e9d117 100755
--- a/install/shell.fish
+++ b/install/shell.fish
@@ -5,10 +5,10 @@
install-deps git dart-sass libastal-gjs-git libastal-meta npm curl libnotify ttf-material-symbols-variable-git ttf-jetbrains-mono-nerd ttf-rubik-vf pacman-contrib
install-optional-deps 'uwsm (for systems using uwsm)' 'yay (AUR package management)' 'fd (launcher file search)' 'wl-clipboard (clipboard support)' 'foot (opening stuff in terminal)'
-set -l shell $CONFIG/shell
+set -l shell $C_DATA/shell
-confirm-overwrite $shell
-git clone 'https://github.com/caelestia-dots/shell.git' $shell
+# Update/Clone repo
+update-repo shell $shell
cd $shell || exit
npm install
diff --git a/install/util.fish b/install/util.fish
index 6fca2f9..ad62230 100644
--- a/install/util.fish
+++ b/install/util.fish
@@ -64,3 +64,47 @@ function install-optional-deps
end
end
end
+
+function update-repo -a module dir
+ set -l remote https://github.com/caelestia-dots/$module.git
+ if test -d $dir
+ cd $dir || exit
+ if test "$(git config --get remote.origin.url)" != $remote
+ cd .. || exit
+ confirm-overwrite $dir
+ git clone $remote $dir
+ else
+ git pull
+ end
+ else
+ git clone $remote $dir
+ end
+end
+
+function setup-systemd-monitor -a module dir
+ set -l systemd $CONFIG/systemd/user
+ if which systemctl &> /dev/null
+ log 'Installing systemd service...'
+
+ mkdir -p $systemd
+ echo "[Unit]
+Description=Sync $module and caelestia schemes
+
+[Service]
+Type=oneshot
+ExecStart=$dir/monitor/update.fish" > $systemd/$module-monitor-scheme.service
+ echo "[Unit]
+Description=Sync $module and caelestia schemes (monitor)
+
+[Path]
+PathModified=%S/caelestia/scheme/current.txt
+Unit=$module-monitor-scheme.service
+
+[Install]
+WantedBy=default.target" > $systemd/$module-monitor-scheme.path
+
+ systemctl --user daemon-reload
+ systemctl --user enable --now $module-monitor-scheme.path
+ systemctl --user start $module-monitor-scheme.service
+ end
+end
diff --git a/install/vscode.fish b/install/vscode.fish
index e74163a..1f4b6b1 100755
--- a/install/vscode.fish
+++ b/install/vscode.fish
@@ -12,15 +12,14 @@ end
install-deps git
-set -l dist $CONFIG/vscode
+set -l dist $C_DATA/vscode
-# Clone repo
-confirm-overwrite $dist
-git clone 'https://github.com/caelestia-dots/vscode.git' $dist
+# Update/Clone repo
+update-repo vscode $dist
# Install settings
for prog in 'Code' 'Code - OSS' 'VSCodium'
- set -l conf $CONFIG/../$prog
+ set -l conf $CONFIG/$prog
if test -d $conf
confirm-copy $dist/settings.json $conf/User/settings.json
confirm-copy $dist/keybindings.json $conf/User/keybindings.json