install scripts for all modules

This commit is contained in:
2 * r + 2 * t
2025-01-28 16:45:16 +11:00
parent 1f9044c5db
commit 587e29efe4
14 changed files with 250 additions and 19 deletions
+3 -1
View File
@@ -4,7 +4,9 @@ A collection of scripts for my caelestia dotfiles.
## Installation
Run the `install.fish` script in the base of the repo.
Clone this repo.
Run `install/scripts.fish`.
`~/.local/bin` must be in your path.
## Usage
+6 -1
View File
@@ -1,6 +1,6 @@
set -l seen '__fish_seen_subcommand_from'
set -l has_opt '__fish_contains_opt'
set -l commands help shell toggle workspace-action scheme screenshot record clipboard clipboard-delete emoji-picker wallpaper pip
set -l commands help install shell toggle workspace-action scheme screenshot record clipboard clipboard-delete emoji-picker wallpaper pip
set -l not_seen "not $seen $commands"
# Disable file completions
@@ -8,6 +8,7 @@ complete -c caelestia -f
# Subcommands
complete -c caelestia -n $not_seen -a 'help' -d 'Show help'
complete -c caelestia -n $not_seen -a 'install' -d 'Install a module'
complete -c caelestia -n $not_seen -a 'shell' -d 'Start the shell or message it'
complete -c caelestia -n $not_seen -a 'toggle' -d 'Toggle a special workspace'
complete -c caelestia -n $not_seen -a 'workspace-action' -d 'Exec a dispatcher in the current group'
@@ -20,6 +21,10 @@ complete -c caelestia -n $not_seen -a 'emoji-picker' -d 'Open the emoji picker'
complete -c caelestia -n $not_seen -a 'wallpaper' -d 'Change the wallpaper'
complete -c caelestia -n $not_seen -a 'pip' -d 'Picture in picture utilities'
# Install
set -l commands discord foot fuzzel hypr safeeyes scripts shell
complete -c caelestia -n "$seen install && not $seen $commands" -a "$commands"
# Shell
set -l commands quit reload-css show brightness media
set -l not_seen "$seen shell && not $seen $commands"
-8
View File
@@ -1,8 +0,0 @@
#!/bin/fish
set -q XDG_CONFIG_HOME && set -l config $XDG_CONFIG_HOME/caelestia || set -l config ~/.config/caelestia
set -l dist $config/scripts
git clone https://github.com/caelestia-dots/scripts.git $dist
mkdir -p ~/.local/bin
ln -s $dist/main.fish ~/.local/bin/caelestia
+67
View File
@@ -0,0 +1,67 @@
#!/bin/fish
if test -z "$argv[1]"
echo 'Usage: caelestia install discord <client_config_folder_name>'
exit 1
end
. (dirname (status filename))/util.fish
install-deps git
set -l systemd $CONFIG/../systemd/user
set -l client $CONFIG/../$argv[1]
set -l discord $CONFIG/discord
# Clone repo
confirm-overwrite $discord
git clone https://github.com/caelestia-dots/discord.git $discord
# 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
# Optionally install arRPC
read -l -p "input 'Install arRPC? [Y/n] ' -n" confirm
if test "$confirm" = 'n' -o "$confirm" = 'N'
log 'Skipping.'
else
log 'Installing arRPC...'
install-deps npm
git clone 'https://github.com/OpenAsar/arrpc.git' $discord/arrpc
cd $discord/arrpc || exit
npm install
echo "[Unit]
Description=arRPC Discord RPC daemon
After=network.target
[Service]
Type=simple
ExecStart=node $discord/arrpc/src
Restart=on-failure
WorkingDirectory=$discord/arrpc
[Install]
WantedBy=default.target" > $systemd/arrpc.service
systemctl --user daemon-reload
systemctl --user enable --now arrpc.service
end
# Link themes to client config
confirm-overwrite $client/themes
ln -s $discord/themes $client/themes
log 'Done.'
+13
View File
@@ -0,0 +1,13 @@
#!/bin/fish
. (dirname (status filename))/util.fish
install-deps git foot inotify-tools
set -l foot $CONFIG/../foot
confirm-overwrite $foot
git clone 'https://github.com/caelestia-dots/foot.git' $foot
sed -i 's|$SRC|'$foot'|g' $foot/foot.ini
log 'Done.'
+28
View File
@@ -0,0 +1,28 @@
#!/bin/fish
. (dirname (status filename))/util.fish
install-deps git fuzzel-git
set -l systemd $CONFIG/../systemd/user
set -l fuzzel $CONFIG/../fuzzel
# Clone repo
confirm-overwrite $fuzzel
git clone 'https://github.com/caelestia-dots/fuzzel.git' $fuzzel
# 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
log 'Done.'
+16
View File
@@ -0,0 +1,16 @@
#!/bin/fish
. (dirname (status filename))/util.fish
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)' 'hypricker-git (colour picker)' 'foot (terminal emulator)' 'firefox (web browser)' 'vscodium-bin (IDE)' 'thunar (file manager)' 'nemo (secondary file manager)' 'fuzzel (secondary app launcher)'
set -l hypr $CONFIG/../hypr
confirm-overwrite $hypr
git clone 'https://github.com/caelestia-dots/hypr.git' $hypr
sudo pacman -S --needed --noconfirm ydotool
systemctl --user enable --now ydotool.service
log 'Done.'
+12
View File
@@ -0,0 +1,12 @@
#!/bin/fish
. (dirname (status filename))/util.fish
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
log 'Done.'
+17
View File
@@ -0,0 +1,17 @@
#!/bin/fish
. (dirname (status filename))/util.fish
install-deps git hyprland-git hyprpaper-git okolors-git imagemagick wl-clipboard fuzzel-git socat foot jq
install-optional-deps 'vesktop-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
confirm-overwrite $dist
git clone 'https://github.com/caelestia-dots/scripts.git' $dist
mkdir -p ~/.local/bin
ln -s $dist/main.fish ~/.local/bin/caelestia
log 'Done.'
+13
View File
@@ -0,0 +1,13 @@
#!/bin/fish
. (dirname (status filename))/util.fish
install-deps git dart-sass 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
confirm-overwrite $shell
git clone 'https://github.com/caelestia-dots/shell.git' $shell
log 'Done.'
+55
View File
@@ -0,0 +1,55 @@
. (dirname (status filename))/../util.fish
function confirm-overwrite -a path
if test -e $path
read -l -p "input '$(realpath $path) already exists. Overwrite? [y/N] ' -n" confirm
if test "$confirm" = 'y' -o "$confirm" = 'Y'
log 'Continuing.'
rm -rf $path
else
log 'Exiting.'
exit
end
end
end
function install-deps
# All dependencies already installed
pacman -Q $argv &> /dev/null && return
# Get AUR helper or install if none
which yay > /dev/null && set -l helper yay || set -l helper paru
if ! which paru > /dev/null
warn 'No AUR helper found'
read -l -p "input 'Install yay? [Y/n] ' -n" confirm
if test "$confirm" = 'n' -o "$confirm" = 'N'
warn "Manually install yay or paru and try again."
warn "Alternatively, install the dependencies '$argv' manually and try again."
exit
else
sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd ..
rm -rf yay
# First use, see https://github.com/Jguer/yay?tab=readme-ov-file#first-use
yay -Y --gendb
yay -Y --devel --save
end
end
# Install
log "Installing dependencies '$argv'"
$helper -S --needed --noconfirm $argv
end
function install-optional-deps
for dep in $argv
if ! pacman -Q $dep &> /dev/null
read -l -p "input 'Install $dep? [Y/n] ' -n" confirm
test "$confirm" != 'n' -a "$confirm" != 'N' && install-deps (cut -f 1 -d ' ' $dep)
end
end
end
+14 -7
View File
@@ -7,10 +7,10 @@ set -l src (dirname (realpath (status filename)))
if test "$argv[1]" = shell
# Start shell if no args
if test -z "$argv[2..]"
set -q CAELESTIA_SHELL_DIR && set shell_dir $CAELESTIA_SHELL_DIR || set shell_dir $CONFIG/shell
set -q CAELESTIA_SHELL_DIR && set -l shell_dir $CAELESTIA_SHELL_DIR || set -l shell_dir $CONFIG/shell
$shell_dir/run.fish
else
if contains 'caelestia' (astal -l)
if contains -- 'caelestia' (astal -l)
log "Sent command '$argv[2..]' to shell"
astal -i caelestia $argv[2..]
else
@@ -22,7 +22,7 @@ end
if test "$argv[1]" = toggle
set -l valid_toggles communication music sysmon specialws
contains "$argv[2]" $valid_toggles && $src/toggles/$argv[2].fish || error "Invalid toggle: $argv[2]"
contains -- "$argv[2]" $valid_toggles && $src/toggles/$argv[2].fish || error "Invalid toggle: $argv[2]"
exit
end
@@ -33,16 +33,22 @@ end
if test "$argv[1]" = scheme
set -l valid_schemes dynamic mocha macchiato frappe latte
if contains "$argv[2]" $valid_schemes
if contains -- "$argv[2]" $valid_schemes
echo -n $argv[2] > $CACHE/scheme/current.txt || error "Invalid scheme: $argv[2]"
test -f $CONFIG/gtk/update-scheme.fish && $CONFIG/gtk/update-scheme.fish
end
exit
end
set valid_subcommands screenshot record clipboard clipboard-delete emoji-picker wallpaper pip
if test "$argv[1]" = install
set -l valid_modules discord foot fuzzel hypr safeeyes scripts shell
contains -- "$argv[2]" $valid_modules && $src/install/$argv[2].fish || error "Invalid module: $argv[2]"
exit
end
if contains "$argv[1]" $valid_subcommands
set -l valid_subcommands screenshot record clipboard clipboard-delete emoji-picker wallpaper pip
if contains -- "$argv[1]" $valid_subcommands
$src/$argv[1].fish $argv[2..]
exit
end
@@ -51,9 +57,10 @@ test "$argv[1]" != help && error "Unknown command: $argv[1]"
echo 'Usage: caelestia COMMAND [ ...args ]'
echo
echo 'COMMAND := help | shell | toggle | workspace-action | scheme | screenshot | record | clipboard | clipboard-delete | emoji-picker | wallpaper | pip'
echo 'COMMAND := help | install | shell | toggle | workspace-action | scheme | screenshot | record | clipboard | clipboard-delete | emoji-picker | wallpaper | pip'
echo
echo ' help: show this help message'
echo ' install: install a module'
echo ' shell: start the shell or message it'
echo ' toggle: toggle a special workspace'
echo ' workspace-action: execute a Hyprland workspace dispatcher in the current group'
+2 -2
View File
@@ -44,9 +44,9 @@ end
set -l src (dirname (status filename))
set -l colours ($src/gen-scheme.fish $argv[1])
if test -d $CONFIG/hypr
if test -d $CONFIG/../hypr/scheme
log 'Generating hypr scheme'
gen-hypr $colours > $CONFIG/hypr/scheme/dynamic.conf
gen-hypr $colours > $CONFIG/../hypr/scheme/dynamic.conf
end
if test -d $CONFIG/shell
+4
View File
@@ -18,5 +18,9 @@ function error -a text
return 1
end
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