aboutsummaryrefslogtreecommitdiffstats
path: root/hm/soispha/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'hm/soispha/pkgs')
-rw-r--r--hm/soispha/pkgs/default.nix164
-rw-r--r--hm/soispha/pkgs/scripts.nix97
-rwxr-xr-xhm/soispha/pkgs/scripts/apps/aumo54
-rwxr-xr-xhm/soispha/pkgs/scripts/apps/con2pdf152
-rwxr-xr-xhm/soispha/pkgs/scripts/small_functions/dldragon28
-rwxr-xr-xhm/soispha/pkgs/scripts/small_functions/gtk-themes21
-rwxr-xr-xhm/soispha/pkgs/scripts/small_functions/mocs15
-rwxr-xr-xhm/soispha/pkgs/scripts/small_functions/screen_shot10
-rwxr-xr-xhm/soispha/pkgs/scripts/small_functions/update-sys78
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/backsnap3
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/ll14
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/llp19
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/spodi45
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/virsh-del10
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/yti36
15 files changed, 746 insertions, 0 deletions
diff --git a/hm/soispha/pkgs/default.nix b/hm/soispha/pkgs/default.nix
new file mode 100644
index 00000000..c8135d21
--- /dev/null
+++ b/hm/soispha/pkgs/default.nix
@@ -0,0 +1,164 @@
+{
+ pkgs,
+ sysLib,
+ grades,
+ snap-sync,
+ system,
+ flake_update,
+ ...
+}:
+with pkgs; let
+ snap-sync-pkgs = pkgs.writeShellScriptBin "snap-sync" (builtins.readFile "${snap-sync}/bin/snap-sync");
+ shell-scripts = (import ./scripts.nix) {inherit pkgs sysLib;};
+
+ Gui = {
+ Terminals = [
+ # foot # wayland native terminal
+ alacritty # default terminal
+ ];
+ Browsers = [
+ #ungoogled-chromium # web browser (only for web programming)
+ #brave
+ ];
+
+ ImageManipulation = [
+ #krita # new, and better (KDE)
+ #gimp # conservative, and old (GNOME)
+ ];
+
+ Social = [
+ mumble # voice chat software (client)
+ lutris # multiple game store clients
+
+ # nheko # best matrix client (as of today)
+ # element-desktop # nheko didn't work
+ signal-desktop # to avoid encryption problems with signal-bridge
+ ];
+
+ Misc = [
+ #kalzium # Periodic Table of Elements (`element` is [sort of] better)
+ keepassxc # password manager
+ #onlykey # OnlyKey Chrome Desktop App
+ anki-bin # spaced repetition
+ ];
+ };
+
+ TuiCli = {
+ EyeCandy = [
+ #banner # Print large banners to ASCII terminals
+ cmatrix # A curses-based scrolling 'Matrix'-like screen
+ hyfetch # Neofetch with LGBTQ pride flags.
+ ];
+
+ Social = [
+ iamb # best tui matrix client (as of today)
+ ];
+
+ Misc = [
+ android-file-transfer # Android MTP client with minimalistic UI
+ #xdg-ninja # A shell script which checks your $HOME for unwanted files and directories.
+ xdg-utils # open urls and such things
+ yokadi # Command line oriented, sqlite powered, todo list
+ killall # kill a application by name
+ ];
+
+ WM = {
+ river = [river]; # A dynamic tiling wayland compositor
+
+ CLITools = [
+ lswt # List Wayland toplevels
+ wl-clipboard # Command-line copy/paste utilities
+ swaylock # lockscreen
+ ];
+
+ Media = [
+ wf-recorder # Screen recorder
+ ];
+ };
+
+ Media = {
+ View = [
+ imv # Image viewer
+ ];
+
+ Listen = [
+ pulseaudio # set the volume with pactl
+ ncmpc # mpd player client
+ mpc-cli # a cli mpd client
+ ];
+ };
+
+ Hardware = {
+ Storage = [
+ #compsize # Calculate compression ratio of a set of files on Btrfs
+ # TODO: smartmontools # Control and monitor S.M.A.R.T. enabled ATA and SCSI Hard Drives
+ ];
+
+ Input = [
+ #piper # GTK application to configure gaming mice
+ ];
+
+ Printer = [
+ # TODO: sane-airscan # SANE - SANE backend for AirScan (eSCL) and WSD document scanners
+ ];
+ };
+
+ FileListers = [
+ tree # A directory listing program displaying a depth indented list of files
+ fd # Simple, fast and user-friendly alternative to find
+ ripgrep # A search tool that combines the usability of ag with the raw speed of grep
+ fzf # used to quickly move around with its keybindings
+ ];
+
+ Editors = [
+ ed # A POSIX-compliant line-oriented text editor
+ #sed # GNU stream editor
+ vim # The original ex/vi text editor (this is `vim` and not `vi`, as `vi` is unfree)
+ #neovim # Fork of Vim aiming to improve user experience, plugins, and GUIs
+ ];
+
+ Programming = {
+ GeneralTools = [
+ git # the fast distributed version control system
+ git-crypt # mostly here to avoid problems in repositories, where the flake can't be loaded
+ glow # Command-line markdown renderer
+ ];
+ };
+ };
+ # TODO: unmaintained, find sth else:
+ # handlr # Powerful alternative to xdg-utils written in Rust
+ mapFun = x:
+ if builtins.isAttrs x
+ then
+ if lib.isDerivation x
+ then [x]
+ else builtins.attrValues x
+ else [x];
+in {
+ home.packages =
+ [
+ snap-sync-pkgs
+ flake_update.outputs.packages.${system}.default
+ grades.outputs.packages.${system}.default
+ ]
+ ++ shell-scripts
+ ++ (with builtins;
+ concatLists
+ (concatLists [
+ (concatMap mapFun
+ (concatMap mapFun
+ (concatMap mapFun
+ (concatMap mapFun
+ (concatMap mapFun
+ (concatMap mapFun
+ (attrValues Gui)))))))
+
+ (concatMap mapFun
+ (concatMap mapFun
+ (concatMap mapFun
+ (concatMap mapFun
+ (concatMap mapFun
+ (concatMap mapFun
+ (attrValues TuiCli)))))))
+ ]));
+}
diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix
new file mode 100644
index 00000000..544975c5
--- /dev/null
+++ b/hm/soispha/pkgs/scripts.nix
@@ -0,0 +1,97 @@
+{
+ pkgs,
+ sysLib,
+ ...
+}: let
+ write_script = {
+ name,
+ path,
+ dependencies,
+ }:
+ sysLib.writeShellScriptWithLibrary {
+ inherit name;
+ src = ./scripts/${path}/${name};
+ dependencies = dependencies ++ [pkgs.dash];
+ };
+ aumo-scr = write_script {
+ name = "aumo";
+ path = "apps";
+ dependencies = builtins.attrValues {inherit (pkgs) udisks gawk gnused gnugrep sudo;};
+ };
+ con2pdf-scr = write_script {
+ name = "con2pdf";
+ path = "apps";
+ dependencies = builtins.attrValues {inherit (pkgs) sane-backends imagemagick coreutils fd;};
+ };
+
+ dldragon-scr = write_script {
+ name = "dldragon";
+ path = "small_functions";
+ dependencies = builtins.attrValues {inherit (pkgs) curl xdragon;};
+ };
+ gtk-themes-scr = write_script {
+ name = "gtk-themes";
+ path = "small_functions";
+ dependencies = builtins.attrValues {inherit (pkgs) glib;};
+ };
+ screen_shot-scr = write_script {
+ name = "screen_shot";
+ path = "small_functions";
+ dependencies = builtins.attrValues {inherit (pkgs) grim slurp alacritty;}; # TODO: add llp
+ };
+ mocs-scr = write_script {
+ name = "mocs";
+ path = "small_functions";
+ dependencies = builtins.attrValues {inherit (pkgs) ncmpc procps;}; # TODO: add mymocp
+ };
+ update-sys-scr = write_script {
+ name = "update-sys";
+ path = "small_functions";
+ dependencies = builtins.attrValues {inherit (pkgs) git git-crypt nixos-rebuild sudo openssh coreutils mktemp gnugrep gnused;};
+ };
+
+ backsnap-scr = write_script {
+ name = "backsnap";
+ path = "wrappers";
+ dependencies = builtins.attrValues {}; # TODO: add snap-sync
+ };
+ ll-scr = sysLib.writeShellScriptWithLibraryUnwrapped {
+ name = "ll";
+ src = ./scripts/wrappers/ll;
+ };
+ # TODO: this need to be replaced with a wayland alternative
+ # llp-scr = write_script {
+ # name = "llp";
+ # path = "wrappers";
+ # dependencies = builtins.attrValues {inherit (pkgs) lf ueberzug;};
+ # };
+ spodi-scr = write_script {
+ name = "spodi";
+ path = "wrappers";
+ dependencies = builtins.attrValues {inherit (pkgs) gawk expect spotdl fd coreutils;};
+ };
+ virsh-del-scr = write_script {
+ name = "virsh-del";
+ path = "wrappers";
+ dependencies = builtins.attrValues {inherit (pkgs) libvirt;};
+ };
+ yti-scr = write_script {
+ name = "yti";
+ path = "wrappers";
+ dependencies = builtins.attrValues {inherit (pkgs) gawk expect yt-dlp;};
+ };
+in [
+ aumo-scr
+ con2pdf-scr
+ dldragon-scr
+ gtk-themes-scr
+ screen_shot-scr
+ mocs-scr
+ update-sys-scr
+ backsnap-scr
+ ll-scr
+ # llp-scr # TODO: see above
+ spodi-scr
+ virsh-del-scr
+ yti-scr
+]
diff --git a/hm/soispha/pkgs/scripts/apps/aumo b/hm/soispha/pkgs/scripts/apps/aumo
new file mode 100755
index 00000000..e49ac82d
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/apps/aumo
@@ -0,0 +1,54 @@
+#! /usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
+
+# TODO: rewrite this
+
+if [ "$1" = "-u" ];then udisksctl unmount -b "$(cat "$HOME/.cache/aumo/mnt_disk")"; exit 0; fi
+all_available_disks=$(mktemp)
+awk '{print $4}' /proc/partitions | sed '1 s|.*||' > "$all_available_disks"
+
+mounted_disk=$(mktemp)
+awk '{print $1}' /proc/mounts > "$mounted_disk"
+
+unmounted_disks=$(mktemp)
+
+for i in $(cat $all_available_disks);do
+ if ! grep -qw "/dev/$i" $mounted_disk && ! ls /sys/block/$i/*/partition > /dev/null 2> /dev/null;then echo $i >> $unmounted_disks;fi
+done
+
+
+u=1
+disk=-1
+while [ $disk -lt 0 ] || [ $disk -gt $(wc -l $unmounted_disks | awk '{print $1}') ];do
+
+ [ "$1" = "-v" ] && for i in $(cat $unmounted_disks);do
+ sudo fdisk -l "/dev/$i"
+ done
+
+ for i in $(cat $unmounted_disks);do
+ printf "%4s) %s\n" "$u" "$i"
+ u=$(( u + 1 ))
+ done
+
+ printf "%4s) Exit\n" "0"
+ printf "Input number: "
+ read -r disk
+
+ [ $disk -lt 0 ] || [ $disk -gt $(wc -l $unmounted_disks | awk '{print $1}') ] && printf "Wrong number. Please retry\n"
+ [ $disk -eq 0 ] && exit 0
+done
+
+mnt_disk="/dev/$(awk -v n=$disk 'NR==n' $unmounted_disks)"
+
+if ! [ "$1" = "-v" ] && [ -n "$1" ];then sudo mount "$mnt_disk" "$1" && exit 0;fi
+[ -n "$2" ] && sudo mount "$mnt_disk" "$1" && exit 0
+if mount | grep -q ~/mnt ;then dien "Something is mounted at ~/mnt";else udisksctl mount -b "$mnt_disk";fi
+
+[ -e $HOME/.cache/aumo/mnt_disk ] || mkdir -p $HOME/.cache/aumo
+echo $mnt_disk >> $HOME/.cache/aumo/mnt_disk
+rm $all_available_disks
+rm $mounted_disk
+rm $unmounted_disks
+[ -d /tmp/LIB_FILE_TEMP_DIR/ ] && rm -r /tmp/LIB_FILE_TEMP_DIR/
diff --git a/hm/soispha/pkgs/scripts/apps/con2pdf b/hm/soispha/pkgs/scripts/apps/con2pdf
new file mode 100755
index 00000000..9cadc376
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/apps/con2pdf
@@ -0,0 +1,152 @@
+#! /usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
+
+
+# needed for help() and version
+# shellcheck disable=2034
+AUTHORS="Soispha";
+# shellcheck disable=2034
+YEARS="2023";
+# shellcheck disable=2034
+VERSION="1.0.0";
+
+help() {
+cat << EOF
+Scan images and turn them into a pdf.
+
+Usage:
+ $NAME [--help|--version|--out-dir|--num-pages|--method] --name --device
+
+Options:
+ --out-dir | -o
+ Path to place the generated pdf files (default: ./pdf).
+ --name | -n
+ Name for the pdf files (e.g. "\$name"_1.pdf).
+ --num-pages | -p
+ Number of pages to merge into one pdf (default: 1).
+ --device | -d
+ Device used for scanning.
+ --method | -m
+ Method to use for scanning (default: ADF).
+ --help | -h
+ Display this help and exit.
+ --version | -v
+ Display version and copyright information and exit.
+EOF
+}
+
+scan() {
+ number_of_pages="$1";
+ device="$2";
+ output_directory="$3";
+ name="$4";
+ method="$5";
+
+ [ -z "$number_of_pages" ] && die "Parameter 'number_of_pages' is not set!"
+ [ -z "$device" ] && die "Parameter 'device' is not set!"
+ [ -z "$output_directory" ] && die "Parameter 'output_directory' is not set!"
+ [ -z "$name" ] && die "Parameter 'name' is not set!"
+ [ -z "$method" ] && die "Parameter 'method' is not set!"
+
+ tiff_temp_path="$(mktmp -d)";
+ cd "$tiff_temp_path" || die "Bug"
+
+ msg "Started scanning...";
+ if [ "$method" = "Flatbed" ]; then
+ do_until_success \
+ "scanimage --format=tiff --progress --source='$method' --device='$device' --output-file=1.tiff" \
+ "warn 'Retrying scan, as we assume a network error!'"
+ else
+ for i in $(seq "$number_of_pages");do
+ do_until_success \
+ "scanimage --format=tiff --progress --source='$method' --device='$device' --batch=%d.tif --batch-increment='$number_of_pages' --batch-start='$i'" \
+ "warn 'Retrying scan, as we assume a network error!'"
+
+
+ if [ "$number_of_pages" -ne 1 ];then
+ msg "Finished turn, please change side!";
+ readp "Press enter to continue" noop
+ fi
+ done
+ fi
+
+ msg "Creating output directory...";
+ mkdir "$output_directory";
+ cd "$output_directory" || die "Bug"
+
+ counter=0;
+ msg "Converting images to pdfs...";
+ while read -r scanned_image_a;do
+ if [ "$number_of_pages" -ne 1 ];then
+ scanned_image_b_set=false;
+ if [ -z "$scanned_image_b" ];then
+ scanned_image_b="$i"
+ scanned_image_b_set=true;
+ : $((counter += 1))
+ fi
+
+ if [ -n "$scanned_image_a" ] && [ "$scanned_image_b_set" = false ];then
+ convert "$scanned_image_b" "$scanned_image_a" -compress jpeg -quality 100 "$name"_"$counter".pdf
+ fi
+ else
+ : $((counter += 1))
+ convert "$scanned_image_a" -compress jpeg -quality 100 "$name"_"$counter".pdf
+ fi
+
+ done < "$(tmp "fd . '$tiff_temp_path' | sort -n")"
+}
+
+for input in "$@"; do
+ case "$input" in
+ "--help" | "-h")
+ help;
+ exit 0;
+ ;;
+ "--version" | "-v")
+ version;
+ exit 0;
+ ;;
+ esac
+done
+
+number_of_pages="1";
+unset device;
+output_directory="$(pwd)/pdf";
+unset name;
+method="ADF";
+
+while [ "$#" -ne 0 ]; do
+ case "$1" in
+ "--help" | "-h")
+ ;;
+ "--version" | "-v")
+ ;;
+ "--out-dir" | "-o")
+ shift 1;
+ output_directory="$1";
+ ;;
+ "--name" | "-n")
+ shift 1;
+ name="$1";
+ ;;
+ "--num-pages" | "-p")
+ shift 1;
+ number_of_pages="$1";
+ ;;
+ "--device" | "-d")
+ shift 1;
+ device="$1";
+ ;;
+ "--method" | "-m")
+ shift 1;
+ method="$1";
+ ;;
+ *)
+ die "Command line arg $1 does not exist. See --help for a list.";
+ ;;
+ esac
+ shift 1;
+done
+scan "$number_of_pages" "$device" "$output_directory" "$name" "$method";
diff --git a/hm/soispha/pkgs/scripts/small_functions/dldragon b/hm/soispha/pkgs/scripts/small_functions/dldragon
new file mode 100755
index 00000000..ea75c362
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/small_functions/dldragon
@@ -0,0 +1,28 @@
+#! /usr/bin/env dash
+# Provides the ability to download a file by dropping it into a window
+
+url=$(dragon -t -x)
+
+if [ -n "$url" ]; then
+ printf "File Name: "
+ name=""
+ while [ -z $name ] || [ -e $name ]
+ do
+ read -r name
+ if [ -e "$name" ]; then
+ printf "File already exists, overwrite (y|n): "
+ read -r ans
+
+ if [ "$ans" = "y" ]; then
+ break
+ else
+ printf "File Name: "
+ fi
+ fi
+ done
+
+ # Download the file with curl
+ [ -n "$name" ] && curl -o "$name" "$url" || exit 1
+else
+ exit 1
+fi
diff --git a/hm/soispha/pkgs/scripts/small_functions/gtk-themes b/hm/soispha/pkgs/scripts/small_functions/gtk-themes
new file mode 100755
index 00000000..457bc35a
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/small_functions/gtk-themes
@@ -0,0 +1,21 @@
+#! /usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
+
+
+# TODO: document, what this does
+
+# usage: import-gsettings
+config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
+if [ ! -f "$config" ]; then exit 1; fi
+
+gnome_schema="org.gnome.desktop.interface"
+gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')"
+icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')"
+cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')"
+font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')"
+gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
+gsettings set "$gnome_schema" icon-theme "$icon_theme"
+gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
+gsettings set "$gnome_schema" font-name "$font_name"
diff --git a/hm/soispha/pkgs/scripts/small_functions/mocs b/hm/soispha/pkgs/scripts/small_functions/mocs
new file mode 100755
index 00000000..e14a84c8
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/small_functions/mocs
@@ -0,0 +1,15 @@
+#! /bin/bash
+if [[ "$(pgrep mocp)" -eq 0 ]];
+then
+ mocp -M "${XDG_CONFIG_HOME}"/moc -S
+ if [[ $1 -eq 0 ]];
+ then
+ mocp -M "${XDG_CONFIG_HOME}"/moc -v 12
+ else
+ mocp -M "${XDG_CONFIG_HOME}"/moc -v "$1"
+ fi
+ mocp -M "${XDG_CONFIG_HOME}"/moc -p
+ mymocp&
+else
+ mocp -M "${XDG_CONFIG_HOME}"/moc -G
+fi
diff --git a/hm/soispha/pkgs/scripts/small_functions/screen_shot b/hm/soispha/pkgs/scripts/small_functions/screen_shot
new file mode 100755
index 00000000..73eb2ee4
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/small_functions/screen_shot
@@ -0,0 +1,10 @@
+#! /usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
+
+date="$(date +%s)"
+grim -g "$(slurp)" "$HOME/media/pictures/screenshots/$date.png" &&
+ alacritty -e ll -command ":{{ set sortby atime; set reverse!; }}" "$HOME/media/pictures/screenshots/$date.png"
+
+# vim: ft=sh
diff --git a/hm/soispha/pkgs/scripts/small_functions/update-sys b/hm/soispha/pkgs/scripts/small_functions/update-sys
new file mode 100755
index 00000000..355682d1
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/small_functions/update-sys
@@ -0,0 +1,78 @@
+#!/usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
+
+help() {
+ cat << EOF
+This is a NixOS System flake update manager.
+
+Usage:
+ $NAME [--branch <branchname>] [--help]
+
+Options:
+ --branch | -b BRANCHNAME
+ select a branch to update from.
+ --mode | -m MODE
+ select a mode to update with
+ --help | -h
+ output this help.
+EOF
+ exit "$1";
+}
+default_branch=$(mktmp);
+BRANCH="";
+
+while [ "$#" -gt 0 ];do
+ case "$1" in
+ "--help" | "-h")
+ help 0;
+ ;;
+ "--branch" | "-b")
+ if [ -n "$2" ];then
+ BRANCH="$2";
+ else
+ error "$1 requires an argument";
+ help 1;
+ fi
+ shift 2;
+ ;;
+ "--mode" | "-m")
+ if [ -n "$2" ];then
+ MODE="$2";
+ else
+ error "$1 requires an argument";
+ help 1;
+ fi
+ shift 2;
+ ;;
+ *)
+ error "the option $1 does not exist!";
+ help 1;
+ ;;
+ esac
+done
+
+
+cd /etc/nixos || die "No /etc/nixos";
+msg "Starting system update...";
+git remote update origin --prune > /dev/null 2>&1;
+if ! [ "$BRANCH" = "" ];then
+ git switch "$BRANCH" > /dev/null 2>&1 && msg2 "Switched to branch '$BRANCH'";
+fi
+msg2 "Updating git repository...";
+git pull --rebase;
+
+git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' > "$default_branch" &
+
+msg2 "Updating system...";
+if [ -n "$MODE" ]; then
+ nixos-rebuild "$MODE";
+else
+ nixos-rebuild switch;
+fi
+
+git switch "$(cat "$default_branch")" > /dev/null 2>&1 && msg2 "Switched to branch '$(cat "$default_branch")'";
+msg "Finished Update!";
+
+# vim: ft=sh
diff --git a/hm/soispha/pkgs/scripts/wrappers/backsnap b/hm/soispha/pkgs/scripts/wrappers/backsnap
new file mode 100755
index 00000000..cd08045d
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/wrappers/backsnap
@@ -0,0 +1,3 @@
+#! /usr/bin/env dash
+snap-sync --noconfirm -u d1c6e0f6-1837-40fd-bb29-251d5ea0ddb0
+umount /run/dt/d1c6e0f6-1837-40fd-bb29-251d5ea0ddb0
diff --git a/hm/soispha/pkgs/scripts/wrappers/ll b/hm/soispha/pkgs/scripts/wrappers/ll
new file mode 100755
index 00000000..cb1fc0ea
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/wrappers/ll
@@ -0,0 +1,14 @@
+#!/usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
+
+last_directory="$(mktemp)"
+
+command lf -last-dir-path="$last_directory" "$@"
+
+dir="$(cat "$last_directory")"
+cd "$dir" || die "$dir does not exist!"
+rm "$last_directory"
+
+# vim: ft=sh
diff --git a/hm/soispha/pkgs/scripts/wrappers/llp b/hm/soispha/pkgs/scripts/wrappers/llp
new file mode 100755
index 00000000..2a21450c
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/wrappers/llp
@@ -0,0 +1,19 @@
+#! /bin/bash
+
+export LLP=1
+cleanup() {
+ exec 3>&-
+ rm "$FIFO_UEBERZUG"
+}
+
+if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
+ lf "$@"
+else
+ [ ! -d "$HOME/.cache/lf" ] && mkdir --parents "$HOME/.cache/lf"
+ export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
+ mkfifo "$FIFO_UEBERZUG"
+ ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
+ exec 3>"$FIFO_UEBERZUG"
+ trap cleanup EXIT
+ lf "$@" 3>&-
+fi
diff --git a/hm/soispha/pkgs/scripts/wrappers/spodi b/hm/soispha/pkgs/scripts/wrappers/spodi
new file mode 100755
index 00000000..4ff53bff
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/wrappers/spodi
@@ -0,0 +1,45 @@
+#!/usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
+
+DOWN_DIR="/home/soispha/media/music/down";
+
+download_url="$1";
+
+
+
+already_downloaded_files="$(mktmp)"
+fd . "$DOWN_DIR" --exclude spotdl.log > "$already_downloaded_files";
+
+config="$(mktmp)"
+cat << EO > "$config"
+--log-level INFO
+--cache-path /home/soispha/.local/share/spotdl/.spotipy
+--audio youtube-music youtube
+--lyrics genius musixmatch azlyrics
+--ffmpeg ffmpeg
+--format mp3
+--output {artists}_-_{title}
+--overwrite skip
+--client-id 5f573c9620494bae87890c0f08a60293
+--client-secret 212476d9b0f3472eaa762d90b19b0ba8
+--threads 16
+--print-errors
+--preload
+EO
+
+if [ -z "$NO_CHECK" ] && [ "$(wc -l < "$already_downloaded_files" )" -ne 0 ];then
+ die "something is already downloaded"
+fi
+
+rm "$DOWN_DIR/spotdl.log"
+cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR"
+
+
+# The sub shell needs to be unquoted, as the arguments may not be treated as one.
+# shellcheck disable=2046
+unbuffer spotdl $(cat "$config") download "$download_url" | tee "$DOWN_DIR/spotdl.log"
+
+[ -d ~/.spotdl ] && rm -r ~/.spotdl
+# vim: ft=sh
diff --git a/hm/soispha/pkgs/scripts/wrappers/virsh-del b/hm/soispha/pkgs/scripts/wrappers/virsh-del
new file mode 100755
index 00000000..afcd87c1
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/wrappers/virsh-del
@@ -0,0 +1,10 @@
+#! /usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
+
+virsh destroy "$1"
+virsh undefine "$1" --nvram
+virsh vol-delete --pool default "$1".qcow2
+
+# vim: ft=sh
diff --git a/hm/soispha/pkgs/scripts/wrappers/yti b/hm/soispha/pkgs/scripts/wrappers/yti
new file mode 100755
index 00000000..0b737b30
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/wrappers/yti
@@ -0,0 +1,36 @@
+#! /usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
+
+die "Use spodi instead!" # TODO: fix this script
+DOWN_DIR=/home/soispha/media/playlist/down/
+
+
+tmp=$(mktmp)
+config=$(mktmp)
+
+for e in "$DOWN_DIR"/*.mp3;do echo "$e" >> "$tmp";done
+[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded"
+
+cat << EO > "$config"
+--paths home:"$DOWN_DIR"
+#--output %(fulltitle)
+--restrict-filenames
+--no-overwrites
+--no-write-info-json
+--clean-info-json
+--prefer-free-formats
+#--format mp3
+--extract-audio
+--audio-quality 0
+--audio-format best
+EO
+
+
+rm ${DOWN_DIR}yt-dlp.log
+cd $DOWN_DIR || die "BUG: no $DOWN_DIR"
+
+unbuffer yt-dlp --config-location "$config" "$1" | tee $DOWN_DIR/yt-dlp.log
+
+# vim: ft=sh