install: better install + use data and state

Don't complete remove repos, use git pull instead
Use XDG_DATA_HOME and XDG_STATE_HOME
This commit is contained in:
2 * r + 2 * t
2025-02-22 14:25:41 +11:00
parent 9f51b6eeed
commit 669eaa61cb
16 changed files with 113 additions and 103 deletions
+6 -19
View File
@@ -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.'
+3 -4
View File
@@ -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.'
+3 -16
View File
@@ -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.'
+4 -16
View File
@@ -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.'
+14 -7
View File
@@ -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
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 'https://github.com/caelestia-dots/hypr.git' /tmp/caelestia-hypr
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.'
+2 -4
View File
@@ -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.'
+5 -6
View File
@@ -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.'
+3 -3
View File
@@ -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
+44
View File
@@ -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
+4 -5
View File
@@ -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
+3 -3
View File
@@ -34,9 +34,9 @@ end
if test "$argv[1]" = scheme
set -l valid_schemes (path change-extension '' $src/data/schemes/* | sed 's!.*/!!')
if contains -- "$argv[2]" $valid_schemes
mkdir -p $CACHE/scheme
cp $src/data/schemes/$argv[2].txt $CACHE/scheme/current.txt
echo -n $argv[2] > $CACHE/scheme/current-name.txt
mkdir -p $C_STATE/scheme
cp $src/data/schemes/$argv[2].txt $C_STATE/scheme/current.txt
echo -n $argv[2] > $C_STATE/scheme/current-name.txt
else
error "Invalid scheme: $argv[2]"
end
+4 -4
View File
@@ -47,14 +47,14 @@ end
. (dirname (status filename))/util.fish
set storage_dir (xdg-user-dir VIDEOS)/Recordings
set cache_dir $CACHE/record
set state_dir $C_STATE/record
mkdir -p $storage_dir
mkdir -p $cache_dir
mkdir -p $state_dir
set file_ext 'mp4'
set recording_path "$cache_dir/recording.$file_ext"
set notif_id_path "$cache_dir/notifid.txt"
set recording_path "$state_dir/recording.$file_ext"
set notif_id_path "$state_dir/notifid.txt"
if pgrep wf-recorder > /dev/null
pkill wf-recorder
+2 -2
View File
@@ -11,7 +11,7 @@ set -l src (dirname (status filename))
. $src/../util.fish
test -f "$argv[1]" && set -l img "$argv[1]" || set -l img $CACHE/wallpaper/current
test -f "$argv[1]" && set -l img "$argv[1]" || set -l img $C_STATE/wallpaper/current
set -l img (realpath $img)
# Light theme if background lighter than foreground
@@ -24,7 +24,7 @@ else
set colour_scheme dark
end
test "$(cat $CACHE/scheme/current.txt)" = dynamic && gsettings set org.gnome.desktop.interface color-scheme \'prefer-$colour_scheme\'
test "$(cat $C_STATE/scheme/current.txt)" = dynamic && gsettings set org.gnome.desktop.interface color-scheme \'prefer-$colour_scheme\'
# 2nd line except first element is the palette
# The first element in lines 3+ are the layers
+2 -2
View File
@@ -2,8 +2,8 @@
. (dirname (status filename))/util.fish
mkdir -p "$CACHE/screenshots"
set -l tmp_file "$CACHE/screenshots/$(date +'%Y%m%d%H%M%S')"
mkdir -p "$C_CACHE/screenshots"
set -l tmp_file "$C_CACHE/screenshots/$(date +'%Y%m%d%H%M%S')"
grim $argv $tmp_file; and wl-copy < $tmp_file; or exit 1
set -l action (notify-send -i 'image-x-generic-symbolic' -h "STRING:image-path:$tmp_file" \
+5 -3
View File
@@ -1,4 +1,4 @@
function _out -a colour -a level -a text
function _out -a colour level text
set_color $colour
# Pass arguments other than text to echo
echo $argv[4..] -- ":: [$level] $text"
@@ -22,5 +22,7 @@ function input -a text
_out blue INPUT $text $argv[2..]
end
set -q XDG_CONFIG_HOME && set CONFIG $XDG_CONFIG_HOME/caelestia || set CONFIG $HOME/.config/caelestia
set -q XDG_CACHE_HOME && set CACHE $XDG_CACHE_HOME/caelestia || set CACHE $HOME/.cache/caelestia
set -q XDG_DATA_HOME && set -l C_DATA $XDG_DATA_HOME/caelestia || set -l C_DATA $HOME/.local/share/caelestia
set -q XDG_STATE_HOME && set -l C_STATE $XDG_STATE_HOME/caelestia || set -l C_STATE $HOME/.local/state/caelestia
set -q XDG_CACHE_HOME && set -l C_CACHE $XDG_CACHE_HOME/caelestia || set -l C_CACHE $HOME/.cache/caelestia
set -q XDG_CONFIG_HOME && set -l CONFIG $XDG_CONFIG_HOME || set -l CONFIG $HOME/.config
+7 -7
View File
@@ -35,10 +35,10 @@ if set -q _flag_h
echo ' -F, --no-filter Do not filter by size'
echo ' -t, --threshold <threshold> The minimum percentage of the size the image must be greater than to be selected (default '$threshold')'
else
set cache_dir $CACHE/wallpaper
set state_dir $C_STATE/wallpaper
# The path to the last chosen wallpaper
set last_wallpaper_path "$cache_dir/last.txt"
set last_wallpaper_path "$state_dir/last.txt"
# Use wallpaper given as argument else choose random
if set -q _flag_f
@@ -113,13 +113,13 @@ else
# Generate colour scheme for wallpaper
set -l src (dirname (status filename))
$src/scheme/gen-scheme.fish $chosen_wallpaper > $src/data/schemes/dynamic.txt
if test -f $CACHE/scheme/current.txt -a "$(cat $CACHE/scheme/current-name.txt)" = 'dynamic'
cp $src/data/schemes/dynamic.txt $CACHE/scheme/current.txt
if test -f $C_STATE/scheme/current.txt -a "$(cat $C_STATE/scheme/current-name.txt)" = 'dynamic'
cp $src/data/schemes/dynamic.txt $C_STATE/scheme/current.txt
end
# Store the wallpaper chosen
mkdir -p $cache_dir
mkdir -p $state_dir
echo $chosen_wallpaper > $last_wallpaper_path
ln -sf $chosen_wallpaper "$cache_dir/current"
magick $chosen_wallpaper -fill black -colorize 10% -blur 0x10 "$cache_dir/blur" &
ln -sf $chosen_wallpaper "$state_dir/current"
magick $chosen_wallpaper -fill black -colorize 10% -blur 0x10 "$state_dir/blur" &
end