summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-14 15:42:20 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-14 15:42:20 +1000
commitb5a91d3ca57d1369d0b7b502112c4b4c9849d26c (patch)
tree8ea45e54e0b0c826f65f54ebf82e41cb68163221
parentfeat: impl pip subcommand (diff)
downloadcaelestia-cli-b5a91d3ca57d1369d0b7b502112c4b4c9849d26c.tar.gz
caelestia-cli-b5a91d3ca57d1369d0b7b502112c4b4c9849d26c.tar.bz2
caelestia-cli-b5a91d3ca57d1369d0b7b502112c4b4c9849d26c.zip
internal: remove all legacy fish scripts
-rw-r--r--.gitignore1
-rw-r--r--README.md33
-rwxr-xr-xclipboard-delete.fish4
-rwxr-xr-xclipboard.fish4
-rwxr-xr-xemoji-picker.fish4
-rwxr-xr-xinstall/btop.fish16
-rwxr-xr-xinstall/discord.fish26
-rwxr-xr-xinstall/firefox.fish36
-rwxr-xr-xinstall/fish.fish24
-rwxr-xr-xinstall/foot.fish14
-rwxr-xr-xinstall/fuzzel.fish15
-rwxr-xr-xinstall/gtk.fish23
-rwxr-xr-xinstall/hypr.fish32
-rwxr-xr-xinstall/qt.fish20
-rwxr-xr-xinstall/safeeyes.fish34
-rwxr-xr-xinstall/scripts.fish21
-rwxr-xr-xinstall/shell.fish42
-rwxr-xr-xinstall/slurp.fish18
-rwxr-xr-xinstall/spicetify.fish24
-rw-r--r--install/util.fish148
-rwxr-xr-xinstall/vscode.fish33
-rwxr-xr-xmain.fish115
-rwxr-xr-xpip.fish61
-rwxr-xr-xrecord.fish99
-rwxr-xr-xscheme/autoadjust.py256
-rwxr-xr-xscheme/gen-print-scheme.fish36
-rwxr-xr-xscheme/gen-scheme.fish33
-rwxr-xr-xscheme/main.fish81
-rwxr-xr-xscheme/score.py134
-rwxr-xr-xscreenshot.fish41
-rwxr-xr-xtoggles/specialws.fish10
-rw-r--r--toggles/util.fish42
-rw-r--r--util.fish51
-rwxr-xr-xwallpaper.fish122
-rwxr-xr-xworkspace-action.sh11
35 files changed, 8 insertions, 1656 deletions
diff --git a/.gitignore b/.gitignore
index 19faf38..9d018c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,2 @@
-/data/schemes/dynamic/
__pycache__/
/dist/
diff --git a/README.md b/README.md
index 3dfd494..607331d 100644
--- a/README.md
+++ b/README.md
@@ -1,34 +1,17 @@
-# caelestia-scripts
+# caelestia-cli
-A collection of scripts for my caelestia dotfiles.
+The main control script for the Caelestia dotfiles.
## Installation
-Clone this repo.
+### Package manager
-Run `install/scripts.fish`.
-`~/.local/bin` must be in your path.
+TODO
-## Usage
+### Manual installation
-```
-> caelestia help
-Usage: caelestia COMMAND [ ...args ]
+TODO
-COMMAND := help | install | shell | toggle | workspace-action | scheme | screenshot | record | clipboard | clipboard-delete | emoji-picker | wallpaper | pip
+## Usage
- help: show this help message
- install: install a module
- shell: start the shell or message it
- toggle: toggle a special workspace
- workspace-action: execute a Hyprland workspace dispatcher in the current group
- scheme: change the current colour scheme
- variant: change the current scheme variant
- screenshot: take a screenshot
- record: take a screen recording
- clipboard: open clipboard history
- clipboard-delete: delete an item from clipboard history
- emoji-picker: open the emoji picker
- wallpaper: change the wallpaper
- pip: move the focused window into picture in picture mode or start the pip daemon
-```
+TODO
diff --git a/clipboard-delete.fish b/clipboard-delete.fish
deleted file mode 100755
index b0212bb..0000000
--- a/clipboard-delete.fish
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env fish
-
-set -l chosen_item (cliphist list | fuzzel --dmenu --prompt='del > ' --placeholder='Delete from clipboard')
-test -n "$chosen_item" && echo "$chosen_item" | cliphist delete
diff --git a/clipboard.fish b/clipboard.fish
deleted file mode 100755
index 579071d..0000000
--- a/clipboard.fish
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env fish
-
-set -l chosen_item (cliphist list | fuzzel --dmenu --placeholder='Type to search clipboard')
-test -n "$chosen_item" && echo "$chosen_item" | cliphist decode | wl-copy
diff --git a/emoji-picker.fish b/emoji-picker.fish
deleted file mode 100755
index 4f2283c..0000000
--- a/emoji-picker.fish
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env fish
-
-set -l chosen_item (cat (dirname (status filename))/data/emojis.txt | fuzzel --dmenu --placeholder='Type to search emojis')
-test -n "$chosen_item" && echo "$chosen_item" | cut -d ' ' -f 1 | tr -d '\n' | wl-copy
diff --git a/install/btop.fish b/install/btop.fish
deleted file mode 100755
index 3b3bcb4..0000000
--- a/install/btop.fish
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git btop
-
-set -l dist $CONFIG/btop
-
-# Update/Clone repo
-update-repo btop $dist
-sed -i 's|$SRC|'$dist'|g' $dist/btop.conf
-
-# Install systemd service
-setup-systemd-monitor btop $dist
-
-log 'Done.'
diff --git a/install/discord.fish b/install/discord.fish
deleted file mode 100755
index a01538f..0000000
--- a/install/discord.fish
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git discord equicord-installer-bin
-sudo Equilotl -install -location /opt/discord
-sudo Equilotl -install-openasar -location /opt/discord
-
-set -l dist $C_DATA/discord
-
-# Update/Clone repo
-update-repo discord $dist
-
-# Install systemd service
-setup-systemd-monitor discord $dist
-
-# Link themes to client configs
-set -l clients Vencord Equicord discord vesktop equibop legcord $argv
-for client in $clients
- if test -d $CONFIG/$client
- log "Linking themes for $client"
- install-link $dist/themes $CONFIG/$client/themes
- end
-end
-
-log 'Done.'
diff --git a/install/firefox.fish b/install/firefox.fish
deleted file mode 100755
index 5458fdd..0000000
--- a/install/firefox.fish
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git inotify-tools
-
-set -l dist $C_DATA/firefox
-
-# Update/Clone repo
-update-repo firefox $dist
-
-# Install native app manifest
-for dev in mozilla zen
- if test -d $HOME/.$dev
- mkdir -p $HOME/.$dev/native-messaging-hosts
- cp $dist/native_app/manifest.json $HOME/.$dev/native-messaging-hosts/caelestiafox.json
- sed -i "s|\$SRC|$dist|g" $HOME/.$dev/native-messaging-hosts/caelestiafox.json
- end
-end
-
-# Install zen css
-if test -d $HOME/.zen
- for profile in $HOME/.zen/*/chrome
- for file in userChrome userContent
- if test -f $profile/$file.css
- set -l imp "@import url('$dist/zen/$file.css');"
- grep -qFx $imp $profile/$file.css || printf '%s\n%s' $imp "$(cat $profile/$file.css)" > $profile/$file.css
- else
- echo "@import url('$dist/zen/$file.css');" > $profile/$file.css
- end
- end
- end
-end
-
-log 'Done.'
-log 'Please install the extension manually from https://addons.mozilla.org/en-US/firefox/addon/caelestiafox'
diff --git a/install/fish.fish b/install/fish.fish
deleted file mode 100755
index 2bcc292..0000000
--- a/install/fish.fish
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git starship fastfetch
-
-set -l dist $C_DATA/fish
-
-# Update/Clone repo
-update-repo fish $dist
-
-# Install fish config
-install-link $dist/config.fish $CONFIG/fish/config.fish
-
-# Install fish greeting
-install-link $dist/fish_greeting.fish $CONFIG/fish/functions/fish_greeting.fish
-
-# Install starship config
-install-link $dist/starship.toml $CONFIG/starship.toml
-
-# Install fastfetch config
-install-link $dist/fastfetch.jsonc $CONFIG/fastfetch/config.jsonc
-
-log 'Done.'
diff --git a/install/foot.fish b/install/foot.fish
deleted file mode 100755
index 67e682b..0000000
--- a/install/foot.fish
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git foot inotify-tools
-
-set -l dist $CONFIG/foot
-
-update-repo foot $dist
-sed -i 's|$SRC|'$dist'|g' $dist/foot.ini
-
-install-link $dist/foot.fish ~/.local/bin/foot
-
-log 'Done.'
diff --git a/install/fuzzel.fish b/install/fuzzel.fish
deleted file mode 100755
index 915e46b..0000000
--- a/install/fuzzel.fish
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git fuzzel-git
-
-set -l dist $CONFIG/fuzzel
-
-# Clone repo
-update-repo fuzzel $dist
-
-# Install systemd service
-setup-systemd-monitor fuzzel $dist
-
-log 'Done.'
diff --git a/install/gtk.fish b/install/gtk.fish
deleted file mode 100755
index d1c999f..0000000
--- a/install/gtk.fish
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git adw-gtk-theme
-install-optional-deps 'papirus-icon-theme (icon theme)'
-
-set -l dist $C_DATA/gtk
-
-# Update/Clone repo
-update-repo gtk $dist
-
-# Install systemd service
-setup-systemd-monitor gtk $dist
-
-# Set theme
-gsettings set org.gnome.desktop.interface gtk-theme \'adw-gtk3-dark\'
-if pacman -Q papirus-icon-theme &> /dev/null && test "$(gsettings get org.gnome.desktop.interface icon-theme | cut -d - -f 1 | string sub -s 2)" != Papirus
- read -l -p "input 'Set icon theme to Papirus? [Y/n] ' -n" confirm
- test "$confirm" = 'n' -o "$confirm" = 'N' || gsettings set org.gnome.desktop.interface icon-theme \'Papirus-Dark\'
-end
-
-log 'Done.'
diff --git a/install/hypr.fish b/install/hypr.fish
deleted file mode 100755
index 44d2f5a..0000000
--- a/install/hypr.fish
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env 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 app2unit-git
-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
-
-# 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 $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
-install-link $hypr/uwsm $CONFIG/uwsm
-
-# Enable ydotool if installed
-pacman -Q ydotool &> /dev/null && systemctl --user enable --now ydotool.service
-
-log 'Done.'
diff --git a/install/qt.fish b/install/qt.fish
deleted file mode 100755
index 08ed1a0..0000000
--- a/install/qt.fish
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git darkly-bin
-install-optional-deps 'papirus-icon-theme (icon theme)'
-
-set -l dist $C_DATA/qt
-
-# Update/Clone repo
-update-repo qt $dist
-
-# Install systemd service
-setup-systemd-monitor qt $dist
-
-# Change settings
-confirm-copy $dist/qtct.conf $CONFIG/qt5ct/qt5ct.conf
-confirm-copy $dist/qtct.conf $CONFIG/qt6ct/qt6ct.conf
-
-log 'Done.'
diff --git a/install/safeeyes.fish b/install/safeeyes.fish
deleted file mode 100755
index bbea62b..0000000
--- a/install/safeeyes.fish
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git dart-sass aylurs-gtk-shell-git alsa-utils libappindicator-gtk3
-
-# Update/Clone repo
-update-repo safeeyes $C_DATA/safeeyes
-
-if which systemctl &> /dev/null
- log 'Installing systemd service...'
-
- set -l systemd $CONFIG/systemd/user
- mkdir -p $systemd
- echo -n "
-[Unit]
-Description=Protect your eyes from eye strain using this simple and beautiful, yet extensible break reminder.
-After=graphical-session.target
-
-[Service]
-Type=exec
-ExecStart=/usr/bin/ags run -d $C_DATA/safeeyes
-Restart=on-failure
-Slice=app-graphical.slice
-
-[Install]
-WantedBy=graphical-session.target
-" > $systemd/caelestia-safeeyes.service
-
- systemctl --user daemon-reload
- systemctl --user enable --now caelestia-safeeyes.service
-end
-
-log 'Done.'
diff --git a/install/scripts.fish b/install/scripts.fish
deleted file mode 100755
index 4afa66b..0000000
--- a/install/scripts.fish
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git hyprland-git hyprpaper-git imagemagick wl-clipboard fuzzel-git socat foot jq python xdg-user-dirs python-materialyoucolor-git app2unit-git grim wayfreeze-git wl-screenrec
-install-optional-deps 'discord (messaging app)' 'btop (system monitor)' 'zen-browser (web browser)'
-
-set -l dist $C_DATA/scripts
-
-# Update/Clone repo
-update-repo scripts $dist
-
-# Install to path
-install-link $dist/main.fish ~/.local/bin/caelestia
-
-# Install completions
-test -e $CONFIG/fish/completions/caelestia.fish && rm $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
deleted file mode 100755
index e857c18..0000000
--- a/install/shell.fish
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-if ! pacman -Q lm_sensors > /dev/null
- sudo pacman -S --noconfirm lm_sensors
- sudo sensors-detect --auto
-end
-
-install-deps git quickshell curl jq ttf-material-symbols-variable-git ttf-jetbrains-mono-nerd ttf-ibm-plex app2unit-git fd fish python-aubio python-pyaudio python-numpy cava networkmanager bluez-utils ddcutil brightnessctl imagemagick
-install-optional-deps 'uwsm (for systems using uwsm)'
-
-set -l shell $C_DATA/shell
-
-# Update/Clone repo
-update-repo shell $shell
-
-if which systemctl &> /dev/null
- log 'Installing systemd service...'
-
- set -l systemd $CONFIG/systemd/user
- mkdir -p $systemd
- echo -n "
-[Unit]
-Description=A very segsy desktop shell.
-After=graphical-session.target
-
-[Service]
-Type=exec
-ExecStart=$shell/run.fish
-Restart=on-failure
-Slice=app-graphical.slice
-
-[Install]
-WantedBy=graphical-session.target
-" > $systemd/caelestia-shell.service
-
- systemctl --user daemon-reload
- systemctl --user enable --now caelestia-shell.service
-end
-
-log 'Done.'
diff --git a/install/slurp.fish b/install/slurp.fish
deleted file mode 100755
index 56be19e..0000000
--- a/install/slurp.fish
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git slurp
-
-set -l dist $C_DATA/slurp
-
-# Clone repo
-update-repo slurp $dist
-
-# Install systemd service
-setup-systemd-monitor slurp $dist
-
-# Install to path
-install-link $dist/slurp ~/.local/bin/slurp
-
-log 'Done.'
diff --git a/install/spicetify.fish b/install/spicetify.fish
deleted file mode 100755
index 912371b..0000000
--- a/install/spicetify.fish
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git spicetify-cli spicetify-marketplace-bin
-
-set -l dist $C_DATA/spicetify
-
-# Clone repo
-update-repo spicetify $dist
-
-# Install systemd service
-setup-systemd-monitor spicetify $dist
-
-# Install theme files
-mkdir -p $CONFIG/spicetify/Themes/caelestia
-cp $dist/color.ini $CONFIG/spicetify/Themes/caelestia/color.ini
-cp $dist/user.css $CONFIG/spicetify/Themes/caelestia/user.css
-
-# Set spicetify theme
-spicetify config current_theme caelestia color_scheme caelestia
-
-# Setup marketplace
-spicetify config custom_apps marketplace
diff --git a/install/util.fish b/install/util.fish
deleted file mode 100644
index 9b258e0..0000000
--- a/install/util.fish
+++ /dev/null
@@ -1,148 +0,0 @@
-. (dirname (status filename))/../util.fish
-
-function confirm-overwrite -a path
- if test -e $path -o -L $path
- read -l -p "input '$(realpath $path 2> /dev/null || echo $path) already exists. Overwrite? [y/N] ' -n" confirm
- if test "$confirm" = 'y' -o "$confirm" = 'Y'
- log 'Continuing.'
- test -z "$argv[2]" && rm -rf $path # If a second arg is provided, don't delete
- else
- log 'Exiting.'
- exit
- end
- end
-end
-
-function install-deps
- # All dependencies already installed
- pacman -Q $argv &> /dev/null && return
-
- for dep in $argv
- # Skip if already installed
- if ! pacman -Q $dep &> /dev/null
- # If pacman can install it, use it, otherwise use an AUR helper
- if pacman -Si $dep &> /dev/null
- log "Installing dependency '$dep'"
- sudo pacman -S --noconfirm $dep
- else
- # Get AUR helper or install if none
- which yay &> /dev/null && set -l helper yay || set -l helper paru
- if ! which $helper &> /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
-
- log "Installing dependency '$dep'"
- $helper -S --noconfirm $dep
- end
- end
- end
-end
-
-function install-optional-deps
- for dep in $argv
- set -l dep_name (string split -f 1 ' ' $dep)
- if ! pacman -Q $dep_name &> /dev/null
- read -l -p "input 'Install $dep? [Y/n] ' -n" confirm
- test "$confirm" != 'n' -a "$confirm" != 'N' && install-deps $dep_name
- 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
-
- # Delete and clone if it's a different git repo
- if test "$(git config --get remote.origin.url)" != $remote
- cd .. || exit
- confirm-overwrite $dir
- git clone $remote $dir
- else
- # Check for uncommitted changes
- if test -n "$(git status --porcelain)"
- read -l -p "input 'You have uncommitted changes in $dir. Stash, reset or exit? [S/r/e] ' -n" confirm
-
- if test "$confirm" = 'e' -o "$confirm" = 'E'
- log 'Exiting...'
- exit
- end
-
- if test "$confirm" = 'r' -o "$confirm" = 'R'
- log 'Resetting to HEAD...'
- git reset --hard
- else
- log 'Stashing changes...'
- git stash
- end
- end
-
- 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
-
-function install-link -a from to
- if ! test -L $to -a "$(realpath $to 2> /dev/null)" = $from
- mkdir -p (dirname $to)
- confirm-overwrite $to
- ln -s $from $to
- end
-end
-
-function confirm-copy -a from to
- test -L $to -a "$(realpath $to 2> /dev/null)" = (realpath $from) && return # Return if symlink
- cmp $from $to &> /dev/null && return # Return if files are the same
- if test -e $to
- read -l -p "input '$(realpath $to) already exists. Overwrite? [y/N] ' -n" confirm
- test "$confirm" = 'y' -o "$confirm" = 'Y' && log 'Continuing.' || return
- end
- cp $from $to
-end
diff --git a/install/vscode.fish b/install/vscode.fish
deleted file mode 100755
index 32b9fcb..0000000
--- a/install/vscode.fish
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-install-deps git
-
-set -l dist $C_DATA/vscode
-
-# Update/Clone repo
-update-repo vscode $dist
-
-# Install settings
-for prog in 'Code' 'Code - OSS' 'VSCodium'
- 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
- end
-end
-
-# Install extension
-for prog in code code-insiders codium
- if which $prog &> /dev/null
- log "Installing extensions for '$prog'"
- if ! contains 'catppuccin.catppuccin-vsc-icons' ($prog --list-extensions)
- read -l -p "input 'Install catppuccin icons (for light/dark integration)? [Y/n] ' -n" confirm
- test "$confirm" = 'n' -o "$confirm" = 'N' || $prog --install-extension catppuccin.catppuccin-vsc-icons
- end
- $prog --install-extension $dist/caelestia-vscode-integration/caelestia-vscode-integration-*.vsix
- end
-end
-
-log 'Done.'
diff --git a/main.fish b/main.fish
deleted file mode 100755
index 7522540..0000000
--- a/main.fish
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/env fish
-
-set -l src (dirname (realpath (status filename)))
-
-. $src/util.fish
-
-if test "$argv[1]" = shell
- # Start shell if no args
- if test -z "$argv[2..]"
- if qs list --all | grep "Config path: $C_DATA/shell/shell.qml" &> /dev/null
- warn 'Shell already running'
- else
- $C_DATA/shell/run.fish
- end
- else
- if test "$argv[2]" = help
- qs -p $C_DATA/shell ipc show
- exit
- end
-
- if qs list --all | grep "Config path: $C_DATA/shell/shell.qml" &> /dev/null
- qs -p $C_DATA/shell ipc call $argv[2..]
- else
- warn 'Shell unavailable'
- end
- end
- exit
-end
-
-if test "$argv[1]" = toggle
- set -l valid_toggles communication music sysmon specialws todo
- if contains -- "$argv[2]" $valid_toggles
- if test $argv[2] = specialws
- $src/toggles/specialws.fish
- else
- . $src/toggles/util.fish
- toggle-workspace $argv[2]
- end
- else
- error "Invalid toggle: $argv[2]"
- end
-
- exit
-end
-
-if test "$argv[1]" = workspace-action
- $src/workspace-action.sh $argv[2..]
- exit
-end
-
-if test "$argv[1]" = scheme
- if test "$argv[2]" = print
- $src/scheme/gen-print-scheme.fish $argv[3..]
- else
- $src/scheme/main.fish $argv[2..]
- end
- exit
-end
-
-if test "$argv[1]" = variant
- set -l variants vibrant tonalspot expressive fidelity fruitsalad rainbow neutral content monochrome
- if contains -- "$argv[2]" $variants
- echo -n $argv[2] > $C_STATE/scheme/current-variant.txt
- $src/scheme/gen-scheme.fish
- else
- error "Invalid variant: $argv[2]"
- end
-
- exit
-end
-
-if test "$argv[1]" = install
- set -l valid_modules scripts btop discord firefox fish foot fuzzel hypr safeeyes shell slurp spicetify gtk qt vscode
- if test "$argv[2]" = all
- for module in $valid_modules
- $src/install/$module.fish $argv[3..]
- end
- else
- contains -- "$argv[2]" $valid_modules && $src/install/$argv[2].fish $argv[3..] || error "Invalid module: $argv[2]"
- end
- test -f $C_STATE/scheme/current.txt || $src/scheme/main.fish onedark # Init scheme after install or update
- exit
-end
-
-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
-
-test "$argv[1]" != help && error "Unknown command: $argv[1]"
-
-echo 'Usage: caelestia COMMAND [ ...args ]'
-echo
-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'
-echo ' scheme: change the current colour scheme'
-echo ' variant: change the current scheme variant'
-echo ' screenshot: take a screenshot'
-echo ' record: take a screen recording'
-echo ' clipboard: open clipboard history'
-echo ' clipboard-delete: delete an item from clipboard history'
-echo ' emoji-picker: open the emoji picker'
-echo ' wallpaper: change the wallpaper'
-echo ' pip: move the focused window into picture in picture mode or start the pip daemon'
-
-# Set exit status
-test "$argv[1]" = help
-exit
diff --git a/pip.fish b/pip.fish
deleted file mode 100755
index 08fda6d..0000000
--- a/pip.fish
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env fish
-
-argparse -n 'caelestia-pip' -X 0 \
- 'h/help' \
- 'd/daemon' \
- -- $argv
-or exit
-
-if set -q _flag_h
- echo 'Usage:'
- echo ' caelestia pip ( -h | --help )'
- echo ' caelestia pip [ -d | --daemon ]'
- echo
- echo 'Options:'
- echo ' -h, --help Print this help message and exit'
- echo ' -d, --daemon Run this script in daemon mode'
- echo
- echo 'Normal mode (no args):'
- echo ' Move and resize the active window to picture in picture default geometry.'
- echo
- echo 'Daemon mode:'
- echo ' Set all picture in picture window initial geometry to default.'
-
- exit
-end
-
-. (dirname (status filename))/util.fish
-
-function handle-window -a address workspace
- set -l monitor_id (hyprctl workspaces -j | jq '.[] | select(.name == "'$workspace'").monitorID')
- set -l monitor_size (hyprctl monitors -j | jq -r '.[] | select(.id == '$monitor_id') | "\(.width)\n\(.height)"')
- set -l window_size (hyprctl clients -j | jq '.[] | select(.address == "'$address'").size[]')
- set -l scale_factor (math $monitor_size[2] / 4 / $window_size[2])
- set -l scaled_window_size (math -s 0 $window_size[1] x $scale_factor) (math -s 0 $window_size[2] x $scale_factor)
-
- hyprctl dispatch "resizewindowpixel exact $scaled_window_size,address:$address" > /dev/null
- hyprctl dispatch "movewindowpixel exact $(math -s 0 $monitor_size[1] x 0.98 - $scaled_window_size[1]) $(math -s 0 $monitor_size[2] x 0.97 - $scaled_window_size[2]),address:$address" > /dev/null
- log "Handled window at address $address"
-end
-
-if set -q _flag_d
- log 'Daemon started'
- socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read line
- switch $line
- case 'openwindow*'
- set -l window (string sub -s 13 $line | string split ',')
- if string match -qr '^(Picture(-| )in(-| )[Pp]icture)$' $window[4]
- handle-window 0x$window[1] $window[2]
- end
- end
- end
-
- exit
-end
-
-set -l active_window (hyprctl activewindow -j | jq -r '"\(.address)\n\(.workspace.name)\n\(.floating)"')
-if test $active_window[3] = true
- handle-window $active_window
-else
- warn 'Focused window is not floating, ignoring'
-end
diff --git a/record.fish b/record.fish
deleted file mode 100755
index d7c292d..0000000
--- a/record.fish
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/usr/bin/env fish
-
-function get-audio-source
- pactl list short sources | grep '\.monitor.*RUNNING' | cut -f 2 | head -1
-end
-
-function get-region
- slurp || exit 0
-end
-
-function get-active-monitor
- hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name'
-end
-
-argparse -n 'caelestia-record' -X 0 \
- 'h/help' \
- 's/sound' \
- 'r/region=?' \
- 'n/no-hwaccel' \
- -- $argv
-or exit
-
-if set -q _flag_h
- echo 'Usage:'
- echo ' caelestia record ( -h | --help )'
- echo ' caelestia record [ -s | --sound ] [ -r | --region ] [ -c | --compression ] [ -H | --hwaccel ]'
- echo
- echo 'Options:'
- echo ' -h, --help Print this help message and exit'
- echo ' -s, --sound Enable audio capturing'
- echo ' -r, --region [ <region> ] The region to capture, current monitor if option not given, default region slurp'
- echo ' -N, --no-hwaccel Do not use the GPU encoder'
-
- exit
-end
-
-. (dirname (status filename))/util.fish
-
-set -l storage_dir (xdg-user-dir VIDEOS)/Recordings
-set -l state_dir $C_STATE/record
-
-mkdir -p $storage_dir
-mkdir -p $state_dir
-
-set -l file_ext 'mp4'
-set -l recording_path "$state_dir/recording.$file_ext"
-set -l notif_id_path "$state_dir/notifid.txt"
-
-if pgrep wl-screenrec > /dev/null
- pkill wl-screenrec
-
- # Move to recordings folder
- set -l new_recording_path "$storage_dir/recording_$(date '+%Y%m%d_%H-%M-%S').$file_ext"
- mv $recording_path $new_recording_path
-
- # Close start notification
- if test -f $notif_id_path
- gdbus call --session \
- --dest org.freedesktop.Notifications \
- --object-path /org/freedesktop/Notifications \
- --method org.freedesktop.Notifications.CloseNotification \
- (cat $notif_id_path)
- end
-
- # Notification with actions
- set -l action (notify-send 'Recording stopped' "Stopped recording $new_recording_path" -i 'video-x-generic' -a 'caelestia-record' \
- --action='watch=Watch' --action='open=Open' --action='save=Save As' --action='delete=Delete')
-
- switch $action
- case 'watch'
- app2unit -O $new_recording_path
- case 'open'
- dbus-send --session --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:"file://$new_recording_path" string:'' \
- || app2unit -O (dirname $new_recording_path)
- case 'save'
- set -l save_file (app2unit -- zenity --file-selection --save --title='Save As')
- test -n "$save_file" && mv $new_recording_path $save_file || warn 'No file selected'
- case 'delete'
- rm $new_recording_path
- end
-else
- # Set region if flag given otherwise active monitor
- if set -q _flag_r
- # Use given region if value otherwise slurp
- set region -g (test -n "$_flag_r" && echo $_flag_r || get-region)
- else
- set region -o (get-active-monitor)
- end
-
- # Sound if enabled
- set -q _flag_s && set -l audio --audio --audio-device (get-audio-source)
-
- # No hardware accel
- set -q _flag_n && set -l hwaccel --no-hw
-
- wl-screenrec $region $audio $hwaccel --codec hevc -f $recording_path & disown
-
- notify-send 'Recording started' 'Recording...' -i 'video-x-generic' -a 'caelestia-record' -p > $notif_id_path
-end
diff --git a/scheme/autoadjust.py b/scheme/autoadjust.py
deleted file mode 100755
index 1c6dc2c..0000000
--- a/scheme/autoadjust.py
+++ /dev/null
@@ -1,256 +0,0 @@
-#!/usr/bin/env python3
-
-import sys
-from colorsys import hls_to_rgb, rgb_to_hls
-from pathlib import Path
-
-from materialyoucolor.blend import Blend
-from materialyoucolor.dynamiccolor.material_dynamic_colors import (
- DynamicScheme,
- MaterialDynamicColors,
-)
-from materialyoucolor.hct import Hct
-from materialyoucolor.scheme.scheme_content import SchemeContent
-from materialyoucolor.scheme.scheme_expressive import SchemeExpressive
-from materialyoucolor.scheme.scheme_fidelity import SchemeFidelity
-from materialyoucolor.scheme.scheme_fruit_salad import SchemeFruitSalad
-from materialyoucolor.scheme.scheme_monochrome import SchemeMonochrome
-from materialyoucolor.scheme.scheme_neutral import SchemeNeutral
-from materialyoucolor.scheme.scheme_rainbow import SchemeRainbow
-from materialyoucolor.scheme.scheme_tonal_spot import SchemeTonalSpot
-from materialyoucolor.scheme.scheme_vibrant import SchemeVibrant
-
-light_colours = [
- "dc8a78",
- "dd7878",
- "ea76cb",
- "8839ef",
- "d20f39",
- "e64553",
- "fe640b",
- "df8e1d",
- "40a02b",
- "179299",
- "04a5e5",
- "209fb5",
- "1e66f5",
- "7287fd",
-]
-
-dark_colours = [
- "f5e0dc",
- "f2cdcd",
- "f5c2e7",
- "cba6f7",
- "f38ba8",
- "eba0ac",
- "fab387",
- "f9e2af",
- "a6e3a1",
- "94e2d5",
- "89dceb",
- "74c7ec",
- "89b4fa",
- "b4befe",
-]
-
-colour_names = [
- "rosewater",
- "flamingo",
- "pink",
- "mauve",
- "red",
- "maroon",
- "peach",
- "yellow",
- "green",
- "teal",
- "sky",
- "sapphire",
- "blue",
- "lavender",
- "success",
- "error",
-]
-
-HLS = tuple[float, float, float]
-
-
-def hex_to_rgb(hex: str) -> tuple[float, float, float]:
- """Convert a hex string to an RGB tuple in the range [0, 1]."""
- return tuple(int(hex[i : i + 2], 16) / 255 for i in (0, 2, 4))
-
-
-def rgb_to_hex(rgb: tuple[float, float, float]) -> str:
- """Convert an RGB tuple in the range [0, 1] to a hex string."""
- return "".join(f"{round(i * 255):02X}" for i in rgb)
-
-
-def hex_to_hls(hex: str) -> tuple[float, float, float]:
- return rgb_to_hls(*hex_to_rgb(hex))
-
-
-def hls_to_hex(h: str, l: str, s: str) -> str:
- return rgb_to_hex(hls_to_rgb(h, l, s))
-
-
-def hex_to_argb(hex: str) -> int:
- return int(f"0xFF{hex}", 16)
-
-
-def argb_to_hls(argb: int) -> HLS:
- return hex_to_hls(f"{argb:08X}"[2:])
-
-
-def grayscale(hls: HLS, light: bool) -> HLS:
- h, l, s = hls
- return h, 0.5 - l / 2 if light else l / 2 + 0.5, 0
-
-
-def mix(a: HLS, b: HLS, w: float) -> HLS:
- r1, g1, b1 = hls_to_rgb(*a)
- r2, g2, b2 = hls_to_rgb(*b)
- return rgb_to_hls(
- r1 * (1 - w) + r2 * w, g1 * (1 - w) + g2 * w, b1 * (1 - w) + b2 * w
- )
-
-
-def harmonize(a: str, b: int) -> HLS:
- return argb_to_hls(Blend.harmonize(hex_to_argb(a), b))
-
-
-def darken(colour: HLS, amount: float) -> HLS:
- h, l, s = colour
- return h, max(0, l - amount), s
-
-
-def distance(colour: HLS, base: str) -> float:
- h1, l1, s1 = colour
- h2, l2, s2 = hex_to_hls(base)
- return abs(h1 - h2) * 0.4 + abs(l1 - l2) * 0.3 + abs(s1 - s2) * 0.3
-
-
-def smart_sort(colours: list[HLS], base: list[str]) -> dict[str, HLS]:
- sorted_colours = [None] * len(colours)
- distances = {}
-
- for colour in colours:
- dist = [(i, distance(colour, b)) for i, b in enumerate(base)]
- dist.sort(key=lambda x: x[1])
- distances[colour] = dist
-
- for colour in colours:
- while len(distances[colour]) > 0:
- i, dist = distances[colour][0]
-
- if sorted_colours[i] is None:
- sorted_colours[i] = colour, dist
- break
- elif sorted_colours[i][1] > dist:
- old = sorted_colours[i][0]
- sorted_colours[i] = colour, dist
- colour = old
-
- distances[colour].pop(0)
-
- return {colour_names[i]: c[0] for i, c in enumerate(sorted_colours)}
-
-
-def get_scheme(scheme: str) -> DynamicScheme:
- if scheme == "content":
- return SchemeContent
- if scheme == "expressive":
- return SchemeExpressive
- if scheme == "fidelity":
- return SchemeFidelity
- if scheme == "fruitsalad":
- return SchemeFruitSalad
- if scheme == "monochrome":
- return SchemeMonochrome
- if scheme == "neutral":
- return SchemeNeutral
- if scheme == "rainbow":
- return SchemeRainbow
- if scheme == "tonalspot":
- return SchemeTonalSpot
- return SchemeVibrant
-
-
-def get_alt(i: int) -> str:
- names = ["default", "alt1", "alt2"]
- return names[i]
-
-
-if __name__ == "__main__":
- light = sys.argv[1] == "light"
- scheme = sys.argv[2]
- primaries = sys.argv[3].split(" ")
- colours_in = sys.argv[4].split(" ")
- out_path = sys.argv[5]
-
- base = light_colours if light else dark_colours
-
- # Convert to HLS
- base_colours = [hex_to_hls(c) for c in colours_in]
-
- # Sort colours and turn into dict
- base_colours = smart_sort(base_colours, base)
-
- # Adjust colours
- MatScheme = get_scheme(scheme)
- for name, hls in base_colours.items():
- if scheme == "monochrome":
- base_colours[name] = grayscale(hls, light)
- else:
- argb = hex_to_argb(hls_to_hex(*hls))
- mat_scheme = MatScheme(Hct.from_int(argb), not light, 0)
-
- colour = MaterialDynamicColors.primary.get_hct(mat_scheme)
-
- # Boost neutral scheme colours
- if scheme == "neutral":
- colour.chroma += 10
-
- base_colours[name] = hex_to_hls(
- "{:02X}{:02X}{:02X}".format(*colour.to_rgba()[:3])
- )
-
- # Layers and accents
- for i, primary in enumerate(primaries):
- material = {}
-
- primary_argb = hex_to_argb(primary)
- primary_scheme = MatScheme(Hct.from_int(primary_argb), not light, 0)
- for colour in vars(MaterialDynamicColors).keys():
- colour_name = getattr(MaterialDynamicColors, colour)
- if hasattr(colour_name, "get_hct"):
- rgb = colour_name.get_hct(primary_scheme).to_rgba()[:3]
- material[colour] = hex_to_hls("{:02X}{:02X}{:02X}".format(*rgb))
-
- # TODO: eventually migrate to material for layers
- colours = {
- **material,
- "text": material["onBackground"],
- "subtext1": material["onSurfaceVariant"],
- "subtext0": material["outline"],
- "overlay2": mix(material["surface"], material["outline"], 0.86),
- "overlay1": mix(material["surface"], material["outline"], 0.71),
- "overlay0": mix(material["surface"], material["outline"], 0.57),
- "surface2": mix(material["surface"], material["outline"], 0.43),
- "surface1": mix(material["surface"], material["outline"], 0.29),
- "surface0": mix(material["surface"], material["outline"], 0.14),
- "base": material["surface"],
- "mantle": darken(material["surface"], 0.03),
- "crust": darken(material["surface"], 0.05),
- "success": harmonize(base[8], primary_argb),
- }
-
- for name, hls in base_colours.items():
- colours[name] = harmonize(hls_to_hex(*hls), primary_argb)
-
- out_file = Path(f"{out_path}/{scheme}/{get_alt(i)}/{sys.argv[1]}.txt")
- out_file.parent.mkdir(parents=True, exist_ok=True)
- colour_arr = [
- f"{name} {hls_to_hex(*colour)}" for name, colour in colours.items()
- ]
- out_file.write_text("\n".join(colour_arr))
diff --git a/scheme/gen-print-scheme.fish b/scheme/gen-print-scheme.fish
deleted file mode 100755
index 6dfa482..0000000
--- a/scheme/gen-print-scheme.fish
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env fish
-
-set -l src (dirname (status filename))
-
-. $src/../util.fish
-
-test -f "$argv[1]" && set -l img (realpath "$argv[1]") || set -l img $C_STATE/wallpaper/thumbnail.jpg
-
-# Thumbnail image if not already thumbnail
-if test $img != $C_STATE/wallpaper/thumbnail.jpg
- set -l thumb_path $C_CACHE/thumbnails/(sha1sum $img | cut -d ' ' -f 1).jpg
- if ! test -f $thumb_path
- magick -define jpeg:size=256x256 $img -thumbnail 128x128\> $thumb_path
- end
- set img $thumb_path
-end
-
-set -l variants vibrant tonalspot expressive fidelity fruitsalad rainbow neutral content monochrome
-contains -- "$argv[2]" $variants && set -l variant $argv[2] || set -l variant (cat $C_STATE/scheme/current-variant.txt 2> /dev/null)
-contains -- "$variant" $variants || set -l variant tonalspot
-
-set -l hash (sha1sum $img | cut -d ' ' -f 1)
-
-# Cache scheme
-if ! test -d $C_CACHE/schemes/$hash/$variant
- set -l colours ($src/score.py $img)
- $src/autoadjust.py dark $variant $colours $C_CACHE/schemes/$hash
- $src/autoadjust.py light $variant $colours $C_CACHE/schemes/$hash
-end
-
-# Get mode from image
-set -l lightness (magick $img -format '%[fx:int(mean*100)]' info:)
-test $lightness -ge 60 && set -l mode light || set -l mode dark
-
-# Print scheme
-cat $C_CACHE/schemes/$hash/$variant/default/$mode.txt
diff --git a/scheme/gen-scheme.fish b/scheme/gen-scheme.fish
deleted file mode 100755
index 35e0bc5..0000000
--- a/scheme/gen-scheme.fish
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env fish
-
-set -l src (dirname (status filename))
-
-. $src/../util.fish
-
-test -f "$argv[1]" && set -l img (realpath "$argv[1]") || set -l img $C_STATE/wallpaper/thumbnail.jpg
-
-set -l variants vibrant tonalspot expressive fidelity fruitsalad rainbow neutral content monochrome
-contains -- "$argv[2]" $variants && set -l variant $argv[2] || set -l variant (cat $C_STATE/scheme/current-variant.txt 2> /dev/null)
-contains -- "$variant" $variants || set -l variant tonalspot
-
-set -l hash (sha1sum $img | cut -d ' ' -f 1)
-
-# Cache scheme
-if ! test -d $C_CACHE/schemes/$hash/$variant
- set -l colours ($src/score.py $img)
- $src/autoadjust.py dark $variant $colours $C_CACHE/schemes/$hash
- $src/autoadjust.py light $variant $colours $C_CACHE/schemes/$hash
-end
-
-# Copy scheme from cache
-rm -rf $src/../data/schemes/dynamic
-cp -r $C_CACHE/schemes/$hash/$variant $src/../data/schemes/dynamic
-
-# Update if current
-set -l variant (string match -gr 'dynamic-(.*)' (cat $C_STATE/scheme/current-name.txt 2> /dev/null))
-if test -n "$variant"
- # If variant doesn't exist, use default
- test -d $src/../data/schemes/dynamic/$variant || set -l variant default
- # Apply scheme
- $src/main.fish dynamic $variant $MODE > /dev/null
-end
diff --git a/scheme/main.fish b/scheme/main.fish
deleted file mode 100755
index 5e6ad03..0000000
--- a/scheme/main.fish
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env fish
-
-# Usage:
-# caelestia scheme <scheme> <flavour> [mode]
-# caelestia scheme <scheme> [flavour]
-# caelestia scheme [scheme]
-
-function set-scheme -a path name mode
- mkdir -p $C_STATE/scheme
-
- # Update scheme colours
- cp $path $C_STATE/scheme/current.txt
-
- # Update scheme name
- echo -n $name > $C_STATE/scheme/current-name.txt
-
- # Update scheme mode
- echo -n $mode > $C_STATE/scheme/current-mode.txt
-
- log "Changed scheme to $name ($mode)"
-end
-
-set -l src (dirname (status filename))/..
-set -l schemes $src/data/schemes
-
-. $src/util.fish
-
-set -l scheme $argv[1]
-set -l flavour $argv[2]
-set -l mode $argv[3]
-
-set -l valid_schemes (basename -a $schemes/*)
-
-test -z "$scheme" && set -l scheme (random choice $valid_schemes)
-
-if contains -- "$scheme" $valid_schemes
- set -l flavours (basename -a (find $schemes/$scheme/ -mindepth 1 -maxdepth 1 -type d) 2> /dev/null)
- set -l modes (basename -s .txt (find $schemes/$scheme/ -mindepth 1 -maxdepth 1 -type f) 2> /dev/null)
-
- if test -n "$modes"
- # Scheme only has one flavour, so second arg is mode
- set -l mode $flavour
- if test -z "$mode"
- # Try to use current mode if not provided and current mode exists for flavour, otherwise random mode
- set mode (cat $C_STATE/scheme/current-mode.txt 2> /dev/null)
- contains -- "$mode" $modes || set mode (random choice $modes)
- end
-
- if contains -- "$mode" $modes
- # Provided valid mode
- set-scheme $schemes/$scheme/$mode.txt $scheme $mode
- else
- error "Invalid mode for $scheme: $mode"
- end
- else
- # Scheme has multiple flavours, so second arg is flavour
- test -z "$flavour" && set -l flavour (random choice $flavours)
-
- if contains -- "$flavour" $flavours
- # Provided valid flavour
- set -l modes (basename -s .txt $schemes/$scheme/$flavour/*.txt)
- if test -z "$mode"
- # Try to use current mode if not provided and current mode exists for flavour, otherwise random mode
- set mode (cat $C_STATE/scheme/current-mode.txt 2> /dev/null)
- contains -- "$mode" $modes || set mode (random choice $modes)
- end
-
- if contains -- "$mode" $modes
- # Provided valid mode
- set-scheme $schemes/$scheme/$flavour/$mode.txt $scheme-$flavour $mode
- else
- error "Invalid mode for $scheme $flavour: $mode"
- end
- else
- # Invalid flavour
- error "Invalid flavour for $scheme: $flavour"
- end
- end
-else
- error "Invalid scheme: $scheme"
-end
diff --git a/scheme/score.py b/scheme/score.py
deleted file mode 100755
index 18ddc21..0000000
--- a/scheme/score.py
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-
-from materialyoucolor.dislike.dislike_analyzer import DislikeAnalyzer
-from materialyoucolor.hct import Hct
-from materialyoucolor.quantize import ImageQuantizeCelebi
-from materialyoucolor.utils.math_utils import difference_degrees, sanitize_degrees_int
-
-
-class Score:
- TARGET_CHROMA = 48.0
- WEIGHT_PROPORTION = 0.7
- WEIGHT_CHROMA_ABOVE = 0.3
- WEIGHT_CHROMA_BELOW = 0.1
- CUTOFF_CHROMA = 5.0
- CUTOFF_EXCITED_PROPORTION = 0.01
-
- def __init__(self):
- pass
-
- @staticmethod
- def score(colors_to_population: dict) -> tuple[list[Hct], list[Hct]]:
- desired = 14
- filter_enabled = False
- dislike_filter = True
-
- colors_hct = []
- hue_population = [0] * 360
- population_sum = 0
-
- for rgb, population in colors_to_population.items():
- hct = Hct.from_int(rgb)
- colors_hct.append(hct)
- hue = int(hct.hue)
- hue_population[hue] += population
- population_sum += population
-
- hue_excited_proportions = [0.0] * 360
-
- for hue in range(360):
- proportion = hue_population[hue] / population_sum
- for i in range(hue - 14, hue + 16):
- neighbor_hue = int(sanitize_degrees_int(i))
- hue_excited_proportions[neighbor_hue] += proportion
-
- # Score colours
- scored_hct = []
- for hct in colors_hct:
- hue = int(sanitize_degrees_int(round(hct.hue)))
- proportion = hue_excited_proportions[hue]
-
- if filter_enabled and (
- hct.chroma < Score.CUTOFF_CHROMA
- or proportion <= Score.CUTOFF_EXCITED_PROPORTION
- ):
- continue
-
- proportion_score = proportion * 100.0 * Score.WEIGHT_PROPORTION
- chroma_weight = (
- Score.WEIGHT_CHROMA_BELOW
- if hct.chroma < Score.TARGET_CHROMA
- else Score.WEIGHT_CHROMA_ABOVE
- )
- chroma_score = (hct.chroma - Score.TARGET_CHROMA) * chroma_weight
- score = proportion_score + chroma_score
- scored_hct.append({"hct": hct, "score": score})
-
- scored_hct.sort(key=lambda x: x["score"], reverse=True)
-
- # Choose distinct colours
- chosen_colors = []
- for difference_degrees_ in range(90, 0, -1):
- chosen_colors.clear()
- for item in scored_hct:
- hct = item["hct"]
- duplicate_hue = any(
- difference_degrees(hct.hue, chosen_hct.hue) < difference_degrees_
- for chosen_hct in chosen_colors
- )
- if not duplicate_hue:
- chosen_colors.append(hct)
- if len(chosen_colors) >= desired:
- break
- if len(chosen_colors) >= desired:
- break
-
- # Get primary colour
- primary = None
- for cutoff in range(20, 0, -1):
- for item in scored_hct:
- if item["hct"].chroma > cutoff and item["hct"].tone > cutoff * 3:
- primary = item["hct"]
- break
- if primary:
- break
-
- # Choose distinct primaries
- chosen_primaries = [primary]
- for difference_degrees_ in range(90, 14, -1):
- chosen_primaries = [primary]
- for item in scored_hct:
- hct = item["hct"]
- duplicate_hue = any(
- difference_degrees(hct.hue, chosen_hct.hue) < difference_degrees_
- for chosen_hct in chosen_primaries
- )
- if not duplicate_hue:
- chosen_primaries.append(hct)
- if len(chosen_primaries) >= 3:
- break
- if len(chosen_primaries) >= 3:
- break
-
- # Fix disliked colours
- if dislike_filter:
- for i, chosen_hct in enumerate(chosen_primaries):
- chosen_primaries[i] = DislikeAnalyzer.fix_if_disliked(chosen_hct)
- for i, chosen_hct in enumerate(chosen_colors):
- chosen_colors[i] = DislikeAnalyzer.fix_if_disliked(chosen_hct)
-
- return chosen_primaries, chosen_colors
-
-
-if __name__ == "__main__":
- img = sys.argv[1]
- mode = sys.argv[2] if len(sys.argv) > 2 else "hex"
-
- colours = Score.score(ImageQuantizeCelebi(img, 1, 128))
- for l in colours:
- if mode != "hex":
- print("".join(["\x1b[48;2;{};{};{}m \x1b[0m".format(*c.to_rgba()[:3]) for c in l]))
- if mode != "swatch":
- print(" ".join(["{:02X}{:02X}{:02X}".format(*c.to_rgba()[:3]) for c in l]))
diff --git a/screenshot.fish b/screenshot.fish
deleted file mode 100755
index 122ad3e..0000000
--- a/screenshot.fish
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env fish
-
-. (dirname (status filename))/util.fish
-
-mkdir -p "$C_CACHE/screenshots"
-set -l tmp_file "$C_CACHE/screenshots/$(date +'%Y%m%d%H%M%S')"
-
-if test "$argv[1]" = 'region'
- if test "$argv[2]" = 'freeze'
- wayfreeze --hide-cursor & set PID $last_pid
- sleep .1
- end
-
- set -l ws (hyprctl -j activeworkspace | jq -r '.id')
- set -l region (hyprctl -j clients | jq -r --argjson activeWsId $ws '.[] | select(.workspace.id == $activeWsId) | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | slurp)
- if test -n "$region"
- grim -l 0 -g $region - | swappy -f - &
- end
-
- set -q PID && kill $PID
-
- exit
-end
-
-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" \
- -a 'caelestia-screenshot' --action='open=Open' --action='save=Save' \
- 'Screenshot taken' "Screenshot stored in $tmp_file and copied to clipboard")
-switch $action
- case 'open'
- app2unit -- swappy -f $tmp_file & disown
- case 'save'
- set -l save_file (app2unit -- zenity --file-selection --save --title='Save As')
- test -z $save_file && exit 0
- if test -f $save_file
- app2unit -- yad --image='abrt' --title='Warning!' --text-align='center' --buttons-layout='center' --borders=20 \
- --text='<span size="x-large">Are you sure you want to overwrite this file?</span>' || exit 0
- end
- cp $tmp_file $save_file
-end
diff --git a/toggles/specialws.fish b/toggles/specialws.fish
deleted file mode 100755
index 01fcfd7..0000000
--- a/toggles/specialws.fish
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env fish
-
-if ! hyprctl workspaces -j | jq -e 'first(.[] | select(.name == "special:special"))'
- set activews (hyprctl activewindow -j | jq -r '.workspace.name')
- string match -r -- '^special:' $activews && set togglews (string sub -s 9 $activews) || set togglews special
-else
- set togglews special
-end
-
-hyprctl dispatch togglespecialworkspace $togglews
diff --git a/toggles/util.fish b/toggles/util.fish
deleted file mode 100644
index 3cffc15..0000000
--- a/toggles/util.fish
+++ /dev/null
@@ -1,42 +0,0 @@
-. (dirname (status filename))/../util.fish
-
-function move-client -a selector workspace
- if hyprctl -j clients | jq -e 'first(.[] | select('$selector')).workspace.name != "special:'$workspace'"' > /dev/null
- # Window not in correct workspace
- set -l window_addr (hyprctl -j clients | jq -r 'first(.[] | select('$selector')).address')
- hyprctl dispatch movetoworkspacesilent "special:$workspace,address:$window_addr"
- end
-end
-
-function spawn-client -a selector spawn
- # Spawn if doesn't exist
- hyprctl -j clients | jq -e "first(.[] | select($selector))" > /dev/null
- set -l stat $status
- if test $stat != 0
- eval "app2unit -- $spawn & disown"
- end
- test $stat != 0 # Exit 1 if already exists
-end
-
-function jq-var -a op json
- jq -rn --argjson json "$json" "\$json | $op"
-end
-
-function toggle-workspace -a workspace
- set -l apps (get-config "toggles.$workspace.apps")
-
- for i in (seq 0 (math (jq-var 'length' "$apps") - 1))
- set -l app (jq-var ".[$i]" "$apps")
- set -l action (jq-var '.action' "$app")
- set -l selector (jq-var '.selector' "$app")
- set -l extra_cond (jq-var '.extraCond' "$app")
-
- test $extra_cond = null && set -l extra_cond true
- if eval $extra_cond
- string match -qe -- 'spawn' $action && spawn-client $selector (jq-var '.spawn' "$app")
- string match -qe -- 'move' $action && move-client $selector $workspace
- end
- end
-
- hyprctl dispatch togglespecialworkspace $workspace
-end
diff --git a/util.fish b/util.fish
deleted file mode 100644
index 5718628..0000000
--- a/util.fish
+++ /dev/null
@@ -1,51 +0,0 @@
-function _out -a colour level text
- set_color $colour
- # Pass arguments other than text to echo
- echo $argv[4..] -- ":: [$level] $text"
- set_color normal
-end
-
-function log -a text
- _out cyan LOG $text $argv[2..]
-end
-
-function warn -a text
- _out yellow WARN $text $argv[2..]
-end
-
-function error -a text
- _out red ERROR $text $argv[2..]
- return 1
-end
-
-function input -a text
- _out blue INPUT $text $argv[2..]
-end
-
-function get-config -a key
- test -f $C_CONFIG_FILE && set -l value (jq -r ".$key" $C_CONFIG_FILE)
- test -n "$value" -a "$value" != null && echo $value || jq -r ".$key" (dirname (status filename))/data/config.json
-end
-
-function set-config -a key value
- if test -f $C_CONFIG_FILE
- set -l tmp (mktemp)
- cp $C_CONFIG_FILE $tmp
- jq -e ".$key = $value" $tmp > $C_CONFIG_FILE || cp $tmp $C_CONFIG_FILE
- rm $tmp
- else
- jq -en ".$key = $value" > $C_CONFIG_FILE || rm $C_CONFIG_FILE
- end
-end
-
-set -q XDG_DATA_HOME && set C_DATA $XDG_DATA_HOME/caelestia || set C_DATA $HOME/.local/share/caelestia
-set -q XDG_STATE_HOME && set C_STATE $XDG_STATE_HOME/caelestia || set C_STATE $HOME/.local/state/caelestia
-set -q XDG_CACHE_HOME && set C_CACHE $XDG_CACHE_HOME/caelestia || set C_CACHE $HOME/.cache/caelestia
-set -q XDG_CONFIG_HOME && set CONFIG $XDG_CONFIG_HOME || set CONFIG $HOME/.config
-set C_CONFIG $CONFIG/caelestia
-set C_CONFIG_FILE $C_CONFIG/scripts.json
-
-mkdir -p $C_DATA
-mkdir -p $C_STATE
-mkdir -p $C_CACHE
-mkdir -p $C_CONFIG
diff --git a/wallpaper.fish b/wallpaper.fish
deleted file mode 100755
index e8cfdd8..0000000
--- a/wallpaper.fish
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/usr/bin/env fish
-
-function get-valid-wallpapers
- identify -ping -format '%i\n' $wallpapers_dir/** 2> /dev/null
-end
-
-set script_name (basename (status filename))
-set wallpapers_dir (xdg-user-dir PICTURES)/Wallpapers
-set threshold 80
-
-# Max 0 non-option args | h, f and d are exclusive | F and t are also exclusive
-argparse -n 'caelestia-wallpaper' -X 0 -x 'h,f,d' -x 'F,t' \
- 'h/help' \
- 'f/file=' \
- 'd/directory=' \
- 'F/no-filter' \
- 't/threshold=!_validate_int --min 0' \
- 'T/theme=!test $_flag_value = light -o $_flag_value = dark' \
- -- $argv
-or exit
-
-. (dirname (status filename))/util.fish
-
-if set -q _flag_h
- echo 'Usage:'
- echo ' caelestia wallpaper'
- echo ' caelestia wallpaper [ -h | --help ]'
- echo ' caelestia wallpaper [ -f | --file ] [ -T | --theme ]'
- echo ' caelestia wallpaper [ -d | --directory ] [ -F | --no-filter ] [ -T | --theme ]'
- echo ' caelestia wallpaper [ -d | --directory ] [ -t | --threshold ] [ -T | --theme ]'
- echo
- echo 'Options:'
- echo ' -h, --help Print this help message and exit'
- echo ' -f, --file <file> The file to change wallpaper to'
- echo ' -d, --directory <directory> The folder to select a random wallpaper from (default '$wallpapers_dir')'
- 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')'
- echo ' -T, --theme <"light" | "dark"> Set light/dark theme for dynamic scheme'
-else
- set state_dir $C_STATE/wallpaper
-
- # The path to the last chosen wallpaper
- set last_wallpaper_path "$state_dir/last.txt"
-
- # Use wallpaper given as argument else choose random
- if set -q _flag_f
- set chosen_wallpaper (realpath $_flag_f)
-
- if ! identify -ping $chosen_wallpaper &> /dev/null
- error "$chosen_wallpaper is not a valid image"
- exit 1
- end
- else
- # The path to the directory containing the selection of wallpapers
- set -q _flag_d && set wallpapers_dir (realpath $_flag_d)
-
- if ! test -d $wallpapers_dir
- error "$wallpapers_dir does not exist"
- exit 1
- end
-
- # Get all files in $wallpapers_dir and exclude the last wallpaper (if it exists)
- if test -f "$last_wallpaper_path"
- set last_wallpaper (cat $last_wallpaper_path)
- test -n "$last_wallpaper" && set unfiltered_wallpapers (get-valid-wallpapers | grep -v $last_wallpaper)
- end
- set -q unfiltered_wallpapers || set unfiltered_wallpapers (get-valid-wallpapers)
-
- # Filter by resolution if no filter option is not given
- if set -q _flag_F
- set wallpapers $unfiltered_wallpapers
- else
- set -l screen_size (hyprctl monitors -j | jq -r 'max_by(.width * .height) | "\(.width)\n\(.height)"')
- set -l wall_sizes (identify -ping -format '%w %h\n' $unfiltered_wallpapers)
-
- # Apply threshold
- set -q _flag_t && set threshold $_flag_t
- set screen_size[1] (math $screen_size[1] x $threshold / 100)
- set screen_size[2] (math $screen_size[2] x $threshold / 100)
-
- # Add wallpapers that are larger than the screen size * threshold to list to choose from ($wallpapers)
- for i in (seq 1 (count $wall_sizes))
- set -l wall_size (string split ' ' $wall_sizes[$i])
- if test $wall_size[1] -ge $screen_size[1] -a $wall_size[2] -ge $screen_size[2]
- set -a wallpapers $unfiltered_wallpapers[$i]
- end
- end
- end
-
- # Check if the $wallpapers list is unset or empty
- if ! set -q wallpapers || test -z "$wallpapers"
- error "No valid images found in $wallpapers_dir"
- exit 1
- end
-
- # Choose a random wallpaper from the $wallpapers list
- set chosen_wallpaper (random choice $wallpapers)
- end
-
- # Thumbnail wallpaper for colour gen
- mkdir -p $C_CACHE/thumbnails
- set -l thumb_path $C_CACHE/thumbnails/(sha1sum $chosen_wallpaper | cut -d ' ' -f 1).jpg
- if ! test -f $thumb_path
- magick -define jpeg:size=256x256 $chosen_wallpaper -thumbnail 128x128 $thumb_path
- end
- cp $thumb_path $state_dir/thumbnail.jpg
-
- # Light/dark mode detection if not specified
- if ! set -q _flag_T
- set -l lightness (magick $state_dir/thumbnail.jpg -format '%[fx:int(mean*100)]' info:)
- test $lightness -ge 60 && set _flag_T light || set _flag_T dark
- end
-
- # Generate colour scheme for wallpaper
- set -l src (dirname (status filename))
- MODE=$_flag_T $src/scheme/gen-scheme.fish &
-
- # Store the wallpaper chosen
- mkdir -p $state_dir
- echo $chosen_wallpaper > $last_wallpaper_path
- ln -sf $chosen_wallpaper "$state_dir/current"
-end
diff --git a/workspace-action.sh b/workspace-action.sh
deleted file mode 100755
index 76d0950..0000000
--- a/workspace-action.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env bash
-
-active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
-
-if [[ "$1" == *"group" ]]; then
- # Move to group
- hyprctl dispatch "${1::-5}" $((($2 - 1) * 10 + ${active_ws:0-1}))
-else
- # Move to ws in group
- hyprctl dispatch "$1" $((((active_ws - 1) / 10) * 10 + $2))
-fi