diff options
Diffstat (limited to '')
54 files changed, 1106 insertions, 750 deletions
diff --git a/modules/by-name/di/direnv/module.nix b/modules/by-name/di/direnv/module.nix new file mode 100644 index 00000000..1ddf3d5d --- /dev/null +++ b/modules/by-name/di/direnv/module.nix @@ -0,0 +1,21 @@ +{ + config, + lib, + ... +}: let + cfg = config.soispha.programs.direnv; +in { + options.soispha.programs.direnv = { + enable = lib.mkEnableOption "direnv"; + }; + + config.home-manager.users.soispha.programs.direnv = lib.mkIf cfg.enable { + enable = true; + nix-direnv.enable = true; + config = { + warn_timeout = 0; + # strict_env = true; + # disable_stdin = true; + }; + }; +} diff --git a/modules/by-name/im/impermanence/module.nix b/modules/by-name/im/impermanence/module.nix index 9c289346..94789755 100644 --- a/modules/by-name/im/impermanence/module.nix +++ b/modules/by-name/im/impermanence/module.nix @@ -43,7 +43,7 @@ in { ".config/iamb/profiles" ".cache" - ".mozilla" + ".mozilla/firefox" "media" "repos" diff --git a/modules/by-name/lf/lf/colors b/modules/by-name/lf/lf/colors index 1c2853ec..17201e64 100644 --- a/modules/by-name/lf/lf/colors +++ b/modules/by-name/lf/lf/colors @@ -60,11 +60,6 @@ fi 00 # FILE # links to hide ~/.mozilla 01;08;30 ~/.ssh 01;08;30 -~/.zshenv 01;08;30 - -~/.steampid 01;08;30 -~/.steam 01;08;30 -~/.steampath 01;08;30 # archives or compressed (dircolors defaults) *.tar 01;31 diff --git a/modules/by-name/lf/lf/commands/base.sh b/modules/by-name/lf/lf/commands/base.sh new file mode 100755 index 00000000..61b59a7b --- /dev/null +++ b/modules/by-name/lf/lf/commands/base.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env sh + +# shellcheck disable=SC2269 +id="$id" + +# Prompt the user for input. +# This will just _print_ the prompt, you still need to `read -r` the user's answer. +# +# # Type +# prompt :: String +# +# # Arguments +# $1 +# : The prompt to print for the user. +prompt() { + printf "=> %s" "$1" +} + +# Reads its Stdin into a temporary file and returns the path of the temporary file. +# This is only really useful, if you want to pipe something into an while read loop that +# should modify global variables. Piping directly into it will not work, because the shell +# would just run it in a subshell, so you need this workaround. +# +# # Type +# tmp :: <stdin> -> Path +# +# # Arguments +# +# # Examples +# while read -r file; do +# set -- "$@" "$file" +# done < "$(echo "$fx" | tmp)" +tmp() { + __base_tmp_temporary_file="$(mktemp --tmpdir="$__base_tmp_temporary_directory")" + cat >"$__base_tmp_temporary_file" + echo "$__base_tmp_temporary_file" +} +__base_tmp_temporary_directory="$(mktemp --directory)" +trap 'rm --recursive "$__base_tmp_temporary_directory"' EXIT + +# Run a lf command on the current lf client +# All arguments will run in like they were typed directly into lf. +# # TODO(@bpeetz): Escape the single quotes in the input arguments. <2025-02-02> +# +# # Type +# lf_cmd :: [String] +# +# # Arguments +# $1..$@ +# : The arguments composing the command to run. +lf_cmd() { + arguments="" + for arg in "$@"; do + if [ -z "$arguments" ]; then + arguments="'$arg'" + else + arguments="$arguments '$arg'" + fi + done + + lf -remote "send $id $arguments" +} + +# Print an error message and exit with error code 1. +# The error message will be printed to lf. +# +# # Type +# die :: String +# +# # Arguments +# $1 +# : The error message +die() { + lf_cmd echo "Error: $1" + exit 1 +} + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/default.nix b/modules/by-name/lf/lf/commands/default.nix index b3c9acab..9a709168 100644 --- a/modules/by-name/lf/lf/commands/default.nix +++ b/modules/by-name/lf/lf/commands/default.nix @@ -1,231 +1,157 @@ -{ - pkgs, - sysLib, - shell_library, - system, - ... -}: let +{pkgs, ...}: let functionCall = { name, dependencies, - replacementStrings, ... }: - sysLib.writeShellScript { + pkgs.writeShellApplication { inherit name; - src = ./scripts/${name}.sh; - keepPath = true; - dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash coreutils;}); - inherit replacementStrings; + text = builtins.readFile ./base.sh + builtins.readFile ./scripts/${name}.sh; + runtimeInputs = dependencies; } + "/bin/${name}"; + # closes the lf tui shell = { name, dependencies, - replacementStrings ? null, ... }: '' ''${{ - ${functionCall {inherit name dependencies replacementStrings;}} + ${functionCall {inherit name dependencies;}} }} - ''; # closes the lf tui + ''; + # runs the command in the ui/term bar pipe = { name, dependencies, - replacementStrings ? null, ... }: '' %{{ - ${functionCall {inherit name dependencies replacementStrings;}} + ${functionCall {inherit name dependencies;}} }} - ''; # runs the command in the ui/term bar + ''; + # runs the command in the background async = { name, dependencies, - replacementStrings ? null, ... }: '' &{{ - ${functionCall {inherit name dependencies replacementStrings;}} + ${functionCall {inherit name dependencies;}} }} - ''; # runs the command in the background + ''; + # adds a prompt after the command has run wait = { name, dependencies, - replacementStrings ? null, ... }: '' !{{ - ${functionCall {inherit name dependencies replacementStrings;}} + ${functionCall {inherit name dependencies;}} }} - ''; # adds a prompt after the command has run + ''; in { - archive = shell { - name = "archive"; - dependencies = builtins.attrValues { - inherit - (pkgs) - fzf - gnutar - xz - p7zip - zip - ; - }; - }; - broot_jump = shell { - name = "broot_jump"; - dependencies = builtins.attrValues { - inherit (pkgs) broot; - }; + archive_compress = shell { + name = "archive_compress"; + dependencies = with pkgs; [ + fzf + gnutar + xz + p7zip + zip + ]; + }; + archive_decompress = pipe { + name = "archive_decompress"; + dependencies = with pkgs; [ + gnutar + unzip + p7zip + ]; }; + + cd_project_root = async { + name = "cd_project_root"; + dependencies = [pkgs.git]; + }; + chmod = pipe { name = "chmod"; dependencies = []; }; - clear_trash = shell { - name = "clear_trash"; - dependencies = builtins.attrValues { - inherit - (pkgs) - fzf - trashy - ; - }; - }; - dl_file = pipe { - name = "dl_file"; - dependencies = builtins.attrValues { - inherit - (pkgs) - xdragon - curl - ; - }; - }; + dragon = pipe { name = "dragon"; - dependencies = builtins.attrValues { - inherit - (pkgs) - xdragon - ; - }; + dependencies = [pkgs.xdragon]; }; dragon_individual = pipe { name = "dragon_individual"; - dependencies = builtins.attrValues { - inherit - (pkgs) - xdragon - ; - }; + dependencies = [pkgs.xdragon]; }; dragon_stay = pipe { name = "dragon_stay"; - dependencies = builtins.attrValues { - inherit - (pkgs) - xdragon - ; - }; + dependencies = [pkgs.xdragon]; }; + execute = shell { name = "execute"; dependencies = []; }; follow_link = pipe { name = "follow_link"; - dependencies = with pkgs; [lf]; - }; - fzf_jump = shell { - name = "fzf_jump"; - dependencies = builtins.attrValues { - inherit (pkgs) fzf lf gnused; - }; + dependencies = []; }; - mk_dir = pipe { - name = "mk_dir"; + + mk_directory = pipe { + name = "mk_directory"; dependencies = []; }; mk_file = shell { name = "mk_file"; dependencies = []; }; - mk_file_and_edit = shell { - name = "mk_file_and_edit"; + mk_link = pipe { + name = "mk_link"; dependencies = []; }; - mk_ln = pipe { - name = "mk_ln"; + mk_script = shell { + name = "mk_script"; dependencies = []; }; - mk_scr_default = shell { - name = "mk_scr_default"; - dependencies = builtins.attrValues {}; - replacementStrings = { - SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; - }; - }; - mk_scr_temp = shell { - name = "mk_scr_temp"; - dependencies = builtins.attrValues {}; - replacementStrings = { - SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; - TO_BE_SHELL_LIBRARY_PATH = "%SHELL_LIBRARY_PATH"; # replacement is not recursive - }; - }; - view_file = async { - name = "view_file"; - dependencies = builtins.attrValues {inherit (pkgs) file;}; - }; - go_project_base_directory = async { - name = "go_project_root"; - dependencies = []; - }; - restore_trash = shell { - name = "restore_trash"; - dependencies = builtins.attrValues { - inherit - (pkgs) - fzf - trashy - ; - }; - }; + set_clipboard_path = async { name = "set_clipboard_path"; dependencies = [pkgs.wl-clipboard]; }; - set_wall_paper = pipe { - name = "set_wall_paper"; - dependencies = []; + set_wallpaper = pipe { + name = "set_wallpaper"; + dependencies = with pkgs; [ + river # for `riverctl` + swaybg + ]; }; + stripspace = pipe { name = "stripspace"; - dependencies = []; + dependencies = [pkgs.gnused]; }; + trash = pipe { name = "trash"; - dependencies = builtins.attrValues { - inherit - (pkgs) - trashy - trash-cli - findutils - ; - }; - }; - unarchive = pipe { - name = "unarchive"; - dependencies = builtins.attrValues { - inherit - (pkgs) - gnutar - unzip - p7zip - ; - }; + dependencies = [pkgs.trash-cli]; + }; + trash_clear = shell { + name = "trash_clear"; + dependencies = with pkgs; [conceal fzf gawk trashy]; + }; + trash_restore = shell { + name = "trash_restore"; + dependencies = with pkgs; [conceal fzf gawk trashy]; + }; + + view_file = async { + name = "view_file"; + dependencies = with pkgs; [file]; }; } diff --git a/modules/by-name/lf/lf/commands/run.sh b/modules/by-name/lf/lf/commands/run.sh new file mode 100755 index 00000000..6a9b8cab --- /dev/null +++ b/modules/by-name/lf/lf/commands/run.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env sh + +# Run one of the commands for debugging purposes. + +[ "$#" -gt 1 ] || { + echo "Usage: $0 <script_name> <input_files>.." + exit 2 +} + +script_name="./scripts/$1" +shift 1 + +fx="" +for arg in "$@"; do + if [ -z "$fx" ]; then + fx="$arg" + else + fx="$(printf "%s\n%s" "$fx" "$arg")" + fi +done + +export f="$1" +set -- + +# shellcheck source=/dev/null +. ./base.sh +# shellcheck source=/dev/null +. "$script_name" + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/archive.sh b/modules/by-name/lf/lf/commands/scripts/archive.sh deleted file mode 100755 index 25f40534..00000000 --- a/modules/by-name/lf/lf/commands/scripts/archive.sh +++ /dev/null @@ -1,77 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# Option '-f' disables pathname expansion which can be useful when $f, $fs, and -# $fx variables contain names with '*' or '?' characters. However, this option -# is used selectively within individual commands as it can be limiting at -# times. -set -f - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" - -archivers="$(tmp echo gzip xz 7z zip)" -archiver="$(awk '{for (i=1; i<=NF; i++) print $i}' "$archivers" | fzf)" - -case "$archiver" in -"gzip") - ext=tar.gz - ;; -"xz") - ext=tar.xz - ;; -"7z") - ext=7z - ;; -"zip") - ext=zip - ;; -esac - -prompt "Archive name: " -name="" -while [ -z "$name" ] || [ -e "$name" ]; do - read -r name_base - name="$name_base.$ext" - if [ -e "$name" ]; then - prompt "Archive already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Archive name: " - fi - fi -done - -root="$(if [ "$(pwd)" = "/" ]; then pwd; else echo "$(pwd)/"; fi)" - -# fx contains all selected file name separated by a newline -while read -r raw_file; do - file="$(echo "$raw_file" | sed "s|$root||")" - set -- "$@" "$file" -done <"$(tmp echo "$fx")" - -case "$archiver" in -"gzip") - tar --create --gzip -file="$name" "$@" - ;; -"xz") - tar --create --file="$name" "$@" - xz --compress -9 --extreme --threads=0 "$name" - ;; -"7z") - 7z a "$name" "$@" - ;; -"zip") - zip --symlinks -9 -r "$name" "$@" - ;; -esac -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/archive_compress.sh b/modules/by-name/lf/lf/commands/scripts/archive_compress.sh new file mode 100755 index 00000000..c3776a80 --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/archive_compress.sh @@ -0,0 +1,63 @@ +# shellcheck shell=sh + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" + +archiver="$(printf "%s\n" gzip xz 7z zip | fzf)" + +case "$archiver" in +"gzip") + ext=tar.gz + ;; +"xz") + ext=tar.xz + ;; +"7z") + ext=7z + ;; +"zip") + ext=zip + ;; +esac + +prompt "Archive name: " +name="" +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name_base + name="$name_base.$ext" + if [ -e "$name" ]; then + prompt "Archive already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "New Archive name: " + fi + fi +done + +# fx contains all selected file name separated by a newline +while read -r file; do + set -- "$@" "$(realpath --relative-to="$(pwd)" "$file")" +done <"$(echo "$fx" | tmp)" + +case "$archiver" in +"gzip") + tar --create --gzip --file="$name" "$@" + ;; +"xz") + tar --create "$@" | xz --compress -9 --format=xz --extreme --threads=0 --stdout >"$name" + ;; +"7z") + 7z a "$name" "$@" + ;; +"zip") + zip --symlinks -9 --recurse-paths "$name" "$@" + ;; +esac +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh new file mode 100755 index 00000000..08374176 --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh @@ -0,0 +1,23 @@ +# shellcheck shell=sh + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +echo "$fx" | while read -r file; do + case "$file" in + *.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar --extract --bzip2 --verbose --file="$file" ;; + *.tar.gz | *.tgz) tar --extract --gzip --verbose --file="$file" ;; + *.tar.xz | *.txz) tar --extract --xz --verbose --file="$file" ;; + *.tar*) tar --extract --verbose --file="$file" ;; + *.zip) unzip "$file" ;; + *.7z) 7z x "$file" ;; + *) die "'$file' is not a supported file for unarchiving." ;; + esac +done +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/broot_jump.sh b/modules/by-name/lf/lf/commands/scripts/broot_jump.sh deleted file mode 100755 index 8f40ba01..00000000 --- a/modules/by-name/lf/lf/commands/scripts/broot_jump.sh +++ /dev/null @@ -1,25 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -tmp=$(mktmp) -res="$(broot --outcmd "$tmp" && sed 's/cd //' "$tmp")" - -if [ -f "$res" ]; then - cmd="select" -elif [ -d "$res" ]; then - cmd="cd" -fi - -lf -remote "send '$id' '$cmd' '$res'" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh b/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh new file mode 100755 index 00000000..19100947 --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh @@ -0,0 +1,19 @@ +# shellcheck shell=sh + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +root="$(git rev-parse --show-toplevel)" +if [ "$root" ]; then + lf_cmd cd "$root" || die "Bug: Failed to cd to project root at '$root'" +else + die "Unable to locate base dir" +fi + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/chmod.sh b/modules/by-name/lf/lf/commands/scripts/chmod.sh index 9859127b..3dc5f19c 100755 --- a/modules/by-name/lf/lf/commands/scripts/chmod.sh +++ b/modules/by-name/lf/lf/commands/scripts/chmod.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -12,13 +9,12 @@ fs="$fs" # shellcheck disable=SC2269 id="$id" -readp "Mode bits: " bits -# shellcheck disable=SC2269 -bits="$bits" +prompt "Mode bits: " +read -r bits -while read -r file; do +echo "$fx" | while read -r file; do chmod "$bits" "$file" -done <"$(tmp echo "$fx")" +done -lf -remote 'send reload' +lf_cmd reload # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/clear_trash.sh b/modules/by-name/lf/lf/commands/scripts/clear_trash.sh deleted file mode 100755 index 9052bb5f..00000000 --- a/modules/by-name/lf/lf/commands/scripts/clear_trash.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# could also use --force, for instand removal -trash list | fzf --multi | awk '{print $NF}' | xargs trash empty --match=exact -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/dl_file.sh b/modules/by-name/lf/lf/commands/scripts/dl_file.sh deleted file mode 100755 index c7e3d8b2..00000000 --- a/modules/by-name/lf/lf/commands/scripts/dl_file.sh +++ /dev/null @@ -1,43 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -# Provides the ability to download a file by dropping it into a window - -url="$(dragon -t -x)" - -if [ -n "$url" ]; then - prompt "File Name: " - name="" - while [ -z "$name" ] || [ -e "$name" ]; do - read -r name - if [ -e "$name" ]; then - prompt "File already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "File Name: " - fi - fi - done - - # Download the file with curl - if [ -n "$name" ]; then - curl -o "$name" "$url" || die "curl failed" - fi -else - die "URL is null!" -fi -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/dragon.sh b/modules/by-name/lf/lf/commands/scripts/dragon.sh index cf3c3176..299d7bbe 100755 --- a/modules/by-name/lf/lf/commands/scripts/dragon.sh +++ b/modules/by-name/lf/lf/commands/scripts/dragon.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -14,7 +11,7 @@ id="$id" while read -r file; do set -- "$@" "$file" -done <"$(tmp echo "$fx")" +done <"$(echo "$fx" | tmp)" -dragon -a -x "$@" +dragon --all --and-exit "$@" # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh b/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh index 2465cdfa..1cb603d9 100755 --- a/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh +++ b/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -14,7 +11,7 @@ id="$id" while read -r file; do set -- "$@" "$file" -done <"$(tmp echo "$fx")" +done <"$(echo "$fx" | tmp)" dragon "$@" # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh b/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh index 066b4c75..4a16e802 100755 --- a/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh +++ b/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -14,7 +11,7 @@ id="$id" while read -r file; do set -- "$@" "$file" -done <"$(tmp echo "$fx")" +done <"$(echo "$fx" | tmp)" -dragon -a "$@" +dragon --all "$@" # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/execute.sh b/modules/by-name/lf/lf/commands/scripts/execute.sh index aa97fd7f..1d5dc87f 100755 --- a/modules/by-name/lf/lf/commands/scripts/execute.sh +++ b/modules/by-name/lf/lf/commands/scripts/execute.sh @@ -1,7 +1,4 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" diff --git a/modules/by-name/lf/lf/commands/scripts/follow_link.sh b/modules/by-name/lf/lf/commands/scripts/follow_link.sh index 80413990..509fc2e0 100755 --- a/modules/by-name/lf/lf/commands/scripts/follow_link.sh +++ b/modules/by-name/lf/lf/commands/scripts/follow_link.sh @@ -1,7 +1,4 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -14,6 +11,12 @@ id="$id" dir="$(realpath "$f")" -lf -remote "send $id cd \"$dir\"" +if [ -f "$dir" ]; then + cmd="select" +elif [ -d "$dir" ]; then + cmd="cd" +fi + +lf_cmd "$cmd" "$dir" # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/fzf_jump.sh b/modules/by-name/lf/lf/commands/scripts/fzf_jump.sh deleted file mode 100755 index ad1633fb..00000000 --- a/modules/by-name/lf/lf/commands/scripts/fzf_jump.sh +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -res="$(fd . --maxdepth 3 | fzf --header='Jump to location')" - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -if [ -f "$res" ]; then - cmd="select" -elif [ -d "$res" ]; then - cmd="cd" -fi - -lf -remote "send $id $cmd \"$res\"" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/go_project_root.sh b/modules/by-name/lf/lf/commands/scripts/go_project_root.sh deleted file mode 100755 index 5f7746d3..00000000 --- a/modules/by-name/lf/lf/commands/scripts/go_project_root.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -flake_base_dir="$(search_flake_base_dir)" -if [ "$flake_base_dir" ]; then - lf -remote "send $id cd $flake_base_dir" || die "Bug: No base dir ($flake_base_dir)" -else - die "Unable to locate base dir" -fi - -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/mk_dir.sh b/modules/by-name/lf/lf/commands/scripts/mk_directory.sh index 150f7eed..58921ccd 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_dir.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_directory.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -23,7 +20,7 @@ while [ -z "$name" ] || [ -e "$name" ]; do if [ "$ans" = "y" ]; then break else - prompt "Directory Name: " + prompt "New Directory Name: " fi fi done diff --git a/modules/by-name/lf/lf/commands/scripts/mk_file.sh b/modules/by-name/lf/lf/commands/scripts/mk_file.sh index 41d5cf1a..5dafe30d 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_file.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_file.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -23,7 +20,7 @@ while [ -z "$name" ] || [ -e "$name" ]; do if [ "$ans" = "y" ]; then break else - prompt "File name: " + prompt "New File name: " fi fi done diff --git a/modules/by-name/lf/lf/commands/scripts/mk_file_and_edit.sh b/modules/by-name/lf/lf/commands/scripts/mk_file_and_edit.sh deleted file mode 100755 index 19fc51db..00000000 --- a/modules/by-name/lf/lf/commands/scripts/mk_file_and_edit.sh +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -prompt "File name: " -name="" -while [ -z "$name" ] || [ -e "$name" ]; do - read -r name - if [ -e "$name" ]; then - prompt "File already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "File name: " - fi - fi -done - -touch "$name" -"$EDITOR" "$name" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/mk_ln.sh b/modules/by-name/lf/lf/commands/scripts/mk_link.sh index 7fab8e22..40b2099d 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_ln.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_link.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -14,20 +11,19 @@ id="$id" while IFS= read -r i; do set -- "$@" "$i" -done <"$HOME"/.local/share/lf/files +done <"$HOME/.local/share/lf/files" mode="$1" shift if [ "$#" -eq 0 ]; then - msg "no files to link" + lf_cmd echo "No files to link." exit 0 fi case "$mode" in copy) - while [ "$#" -gt 0 ]; do - file="$1" + for file in "$@"; do ans="$(basename "$file")" while [ -e "$ans" ]; do @@ -36,10 +32,10 @@ copy) done ln --symbolic --relative "$file" "$(pwd)/$ans" - shift done ;; esac -rm ~/.local/share/lf/files +rm "$HOME/.local/share/lf/files" # lf -remote "send clear" + # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/mk_scr_temp.sh b/modules/by-name/lf/lf/commands/scripts/mk_scr_temp.sh deleted file mode 100755 index 512b5d0b..00000000 --- a/modules/by-name/lf/lf/commands/scripts/mk_scr_temp.sh +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -prompt "Script name: " -name="" -while [ -z "$name" ] || [ -e "$name" ]; do - read -r name - if [ -e "$name" ]; then - prompt "Script already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Script Name: " - fi - fi -done - -script="$(pwd)"/"$name" - -sed 's|%TO_BE_SHELL_LIBRARY_PATH|%SHELL_LIBRARY_PATH|' "%SHELL_LIBRARY_TEMPLATE" >"$script" -sed -i 's|dash|sh|' "$script" -chmod +x "$script" -"$VISUAL" "$script" - -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/mk_scr_default.sh b/modules/by-name/lf/lf/commands/scripts/mk_script.sh index 47d05080..bbdf6d39 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_scr_default.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_script.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -15,8 +12,7 @@ id="$id" prompt "Script name: " name="" while [ -z "$name" ] || [ -e "$name" ]; do - read -r name_base - name="$name_base.sh" + read -r name if [ -e "$name" ]; then prompt "Script already exists, overwrite [y|N]: " read -r ans @@ -24,14 +20,21 @@ while [ -z "$name" ] || [ -e "$name" ]; do if [ "$ans" = "y" ]; then break else - prompt "Script Name: " + prompt "New Script Name: " fi fi done -script="$(pwd)"/"$name" +script="$(pwd)/$name" + +cat <<SCRIPT >"$script" +#! /usr/bin/env sh + + + +# vim: ft=sh +SCRIPT -cat "%SHELL_LIBRARY_TEMPLATE" >"$script" chmod +x "$script" "$VISUAL" "$script" diff --git a/modules/by-name/lf/lf/commands/scripts/restore_trash.sh b/modules/by-name/lf/lf/commands/scripts/restore_trash.sh deleted file mode 100755 index b4ef492f..00000000 --- a/modules/by-name/lf/lf/commands/scripts/restore_trash.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -trash list | fzf --multi | awk '{print $NF}' | xargs trash restore --match=exact -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh b/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh index ff5f3c01..893452e1 100755 --- a/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh +++ b/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -17,10 +14,10 @@ if [ -n "$fx" ]; then elif [ -n "$f" ]; then echo "$f" | wl-copy --trim-newline else - lf -remote "send $id echo 'No file selected.'" + lf_cmd echo "No file selected." exit 1 fi -lf -remote "send $id echo 'Path copied'" +lf_cmd echo "Path copied to clipboard." # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/set_wall_paper.sh b/modules/by-name/lf/lf/commands/scripts/set_wall_paper.sh deleted file mode 100755 index 2e607d33..00000000 --- a/modules/by-name/lf/lf/commands/scripts/set_wall_paper.sh +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -die "No yet implemented" # TODO: do what the 'die' says -#sed -i "s,export AWMWALLPAPER='.*',export AWMWALLPAPER='${f}'," ${ZDOTDIR}/.zshenv -#nohub swaybg -i "$f" -#feh --bg-max --no-fehbg "$f" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh b/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh new file mode 100755 index 00000000..4387cd9a --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh @@ -0,0 +1,19 @@ +# shellcheck shell=sh + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +pid="$(pgrep swaybg)" +[ -n "$pid" ] && kill "$pid" + +# We cannot control the available commands for river. +# Thus we ensure that it can correctly start `swaybg` +swaybg="$(command -v swaybg)" +riverctl spawn "$swaybg --image \"$f\"" && lf_cmd echo "Temporary background image set." +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/stripspace.sh b/modules/by-name/lf/lf/commands/scripts/stripspace.sh index 33b1cbcf..95f8f742 100755 --- a/modules/by-name/lf/lf/commands/scripts/stripspace.sh +++ b/modules/by-name/lf/lf/commands/scripts/stripspace.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -12,29 +9,14 @@ fs="$fs" # shellcheck disable=SC2269 id="$id" -files=$(mktmp) -echo "$fx" >"$files" - -awk_source=$(mktmp) -cat <<OFT >"$awk_source" -BEGIN {FS=" "} -{for (i=1; i != NF + 1; i++) - if (i == NF) { - parts[i]=tolower(\$i); - } else { - parts[i]=tolower(\$i"_"); - } -} -END {for (i in parts) printf parts[i]} -OFT +echo "$fx" | while read -r file; do + dirty_name=$(basename "$file") + clean_name=$(echo "$dirty_name" | sed 's/[[:blank:]]\+/_/g' | sed 's/\(.*\)/\L\1/') -while read -r file; do - dirty_name=$(mktmp) - basename "$file" >"$dirty_name" - clean_name=$(awk -f "$awk_source" "$dirty_name") + [ -e "$clean_name" ] && die "file '$clean_name' already exists!" + mv "$dirty_name" "$clean_name" || die "Move failed" - [ -e "$clean_name" ] && die "file \"$clean_name\" already exists!" - mv "$(cat "$dirty_name")" "$clean_name" || die "Move failed" - lf -remote 'send reload' -done <"$files" + lf_cmd reload + lf_cmd select "$clean_name" +done # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/trash.sh b/modules/by-name/lf/lf/commands/scripts/trash.sh index f4878c49..958bc3f9 100755 --- a/modules/by-name/lf/lf/commands/scripts/trash.sh +++ b/modules/by-name/lf/lf/commands/scripts/trash.sh @@ -1,7 +1,4 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -12,26 +9,9 @@ fs="$fs" # shellcheck disable=SC2269 id="$id" -trash_output=$(mktmp) -expected_error_output=$(mktmp) - while read -r file; do set -- "$@" "$file" -done <"$(tmp echo "$fx")" - -# TODO: why are we using trashy at all, when trash-cli can do everything? -# -# try trashy first, through nix because both trashy and trash-cli provide a trash command, which conflicts -nix run nixpkgs#trashy -- put "$@" 2>"$trash_output" - -# FIXME: Find a way, that does not depend on parsing an error message <2023-08-29> -cat <<EOF >"$expected_error_output" -[1;31merror:[0m Error during a \`trash\` operation: Unknown { description: "Path: '\"/.Trash-1000\"'. Message: Permission denied (os error 13)" } -EOF +done <"$(echo "$fx" | tmp)" -if [ "$(cat "$expected_error_output")" = "$(cat "$trash_output")" ]; then - warning "Deleting with trash-cli to the /.Trash folder" - # this file could not be trashed because it is on the tempfs volume, trash-cli can do this this - trash-put "$@" -fi +trash-put -- "$@" # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/trash_clear.sh b/modules/by-name/lf/lf/commands/scripts/trash_clear.sh new file mode 100755 index 00000000..faa3c553 --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/trash_clear.sh @@ -0,0 +1,9 @@ +# shellcheck shell=sh + +while read -r file; do + set -- "$@" "$(pwd)/$file" +done <"$(conceal list | fzf --multi --ansi | awk '{for(i=3; i<=NF; i++) {print $i}}' | tmp)" + +[ "$#" -ne 0 ] && trash empty --match=exact "$@" + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/trash_restore.sh b/modules/by-name/lf/lf/commands/scripts/trash_restore.sh new file mode 100755 index 00000000..f685345f --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/trash_restore.sh @@ -0,0 +1,17 @@ +# shellcheck shell=sh + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +while read -r file; do + set -- "$@" "$(pwd)/$file" +done <"$(conceal list | fzf --multi --ansi | awk '{for(i=3; i<=NF; i++) {print $i}}' | tmp)" + +[ "$#" -ne 0 ] && trash restore --match=exact "$@" +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/unarchive.sh b/modules/by-name/lf/lf/commands/scripts/unarchive.sh deleted file mode 100755 index d4835f6b..00000000 --- a/modules/by-name/lf/lf/commands/scripts/unarchive.sh +++ /dev/null @@ -1,36 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -# extract the current file with the right command -# (xkcd link: https://xkcd.com/1168/) -set -f - -unarchive() { - case "$1" in - *.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar xjvf "$1" ;; - *.tar.gz | *.tgz) tar xzvf "$1" ;; - *.tar.xz | *.txz) tar xJvf "$1" ;; - *.zip) unzip "$1" ;; - *.rar) - die "rar is a unfree format!" - ;; - *.7z) 7z x "$1" ;; - *) die "Unsupported format" ;; - esac -} - -while read -r file; do - unarchive "$file" -done <"$fx" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/view_file.sh b/modules/by-name/lf/lf/commands/scripts/view_file.sh index 6258d755..38e6b778 100755 --- a/modules/by-name/lf/lf/commands/scripts/view_file.sh +++ b/modules/by-name/lf/lf/commands/scripts/view_file.sh @@ -1,7 +1,4 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -12,7 +9,7 @@ fs="$fs" mime_type="$(file --mime-type --brief --dereference "$f")" case "$mime_type" in -application/pdf) +application/pdf | application/epub*) "$READER" "$f" ;; image/*) diff --git a/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix index 9370bf14..febacb7d 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix @@ -64,7 +64,7 @@ pkgs.atool # archive tools - pkgs.archiver # for arc + # pkgs.archiver # for arc # Unmaintained and insecure # pkgs.arj # NOTE: Fails to build since: 2024-12-28 pkgs.cpio pkgs.dpkg diff --git a/modules/by-name/lf/lf/keybindings/default.nix b/modules/by-name/lf/lf/keybindings/default.nix index f624719f..c5d6427d 100644 --- a/modules/by-name/lf/lf/keybindings/default.nix +++ b/modules/by-name/lf/lf/keybindings/default.nix @@ -36,21 +36,18 @@ cp = "set_clipboard_path"; # Archive Mappings - au = "unarchive"; - aa = "archive"; + au = "archive_decompress"; + aa = "archive_compress"; # Trash Mappings dd = "trash"; - jc = "clear_trash"; - jr = "restore_trash"; + jc = "trash_clear"; + jr = "trash_restore"; # Dragon Mapping dr = "dragon"; - ds = "dragon-stay"; - di = "dragon-individual"; - #dm = "mvdragon"; - #dc = "cpdragon"; - dl = "dlfile"; + ds = "dragon_stay"; + di = "dragon_individual"; cs = "stripspace"; @@ -68,17 +65,15 @@ y = "copy"; "<enter>" = "open"; - mk = "mk_ln"; + mk = "mk_link"; mf = "mk_file"; - me = "mk_file_and_edit"; - md = "mk_dir"; - ms = "mk_scr_default"; - mt = "mk_scr_temp"; + md = "mk_directory"; + ms = "mk_script"; ch = "chmod"; - bg = "set_wall_paper"; + bg = "set_wallpaper"; r = ":rename; cmd-end"; - H = "go_project_base_directory"; + H = "cd_project_root"; R = "reload"; C = "clear"; U = "unselect"; diff --git a/modules/by-name/lo/locale/keymaps/us_modified.xkb b/modules/by-name/lo/locale/keymaps/us_modified.xkb deleted file mode 100644 index 6299a5e9..00000000 --- a/modules/by-name/lo/locale/keymaps/us_modified.xkb +++ /dev/null @@ -1,9 +0,0 @@ -partial alphanumeric_keys -xkb_symbols "us-modified" { - name[Group1]= "US English with caps lock key as compose key"; - - - include "us(basic)" - include "compose(caps)" -}; -// vim: ft=xkb diff --git a/modules/by-name/lo/locale/module.nix b/modules/by-name/lo/locale/module.nix index 10569216..eda707af 100644 --- a/modules/by-name/lo/locale/module.nix +++ b/modules/by-name/lo/locale/module.nix @@ -42,11 +42,6 @@ in { }; services.xserver.xkb.extraLayouts = { - "us-modified" = { - description = "standard us with caps as compose key."; - languages = ["eng" "swe" "deu"]; - symbolsFile = ./keymaps/us_modified.xkb; - }; "dvorak-modified" = { description = "standard dvorak english with german and swedish extra chars."; languages = ["eng" "swe" "deu"]; diff --git a/modules/by-name/mp/mpv/module.nix b/modules/by-name/mp/mpv/module.nix new file mode 100644 index 00000000..49a97c3c --- /dev/null +++ b/modules/by-name/mp/mpv/module.nix @@ -0,0 +1,315 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.programs.mpv; +in { + options.soispha.programs.mpv = { + enable = lib.mkEnableOption "mpv"; + }; + + config.home-manager.users.soispha = lib.mkIf cfg.enable { + programs.mpv = { + enable = true; + + bindings = { + q = "quit 0"; + "Ctrl+c" = "quit 1"; + "Shift+q" = "quit-watch-later 1"; + }; + config = { + # uosc provides seeking & volume indicators (via flash-timeline and flash-volume commands) + # if you decide to use them, you don't need osd-bar + osd-bar = false; + + # uosc will draw its own window controls and border if you disable window border + border = false; + }; + scriptOpts = { + osc = { + scalewindowed = 0.8; + hidetimeout = 300; + }; + uosc = { + # Display style of current position. available: line, bar + timeline_style = "line"; + + # Line display style config + timeline_line_width = 2; + + # Timeline size when fully expanded, in pixels, 0 to disable + timeline_size = 40; + + # Comma separated states when element should always be fully visible. + # Available: paused, audio, image, video, idle, windowed, fullscreen + timeline_persistency = ""; + + # Top border of background color to help visually separate timeline from video + timeline_border = 1; + + # When scrolling above timeline, wheel will seek by this amount of seconds. + # Default uses fast seeking. Add `!` suffix to enable exact seeks. Example: `5!` + timeline_step = 5; + + # Render cache indicators for streaming content + timeline_cache = true; + + # When to display an always visible progress bar (minimized timeline). Can be: windowed, fullscreen, always, never + # Can also be toggled on demand with `toggle-progress` command. + progress = "windowed"; + progress_size = 2; + progress_line_width = 20; + + # A comma delimited list of controls above the timeline. Set to `never` to disable. + # Parameter spec: enclosed in `{}` means value, enclosed in `[]` means optional + # Full item syntax: `[<[!]{disposition1}[,[!]{dispositionN}]>]{element}[:{paramN}][#{badge}[>{limit}]][?{tooltip}]` + # Common properties: + # `{icon}` - parameter used to specify an icon name (example: `face`) + # - pick here: https://fonts.google.com/icons?icon.platform=web&icon.set=Material+Icons&icon.style=Rounded + # `{element}`s and their parameters: + # `{shorthand}` - preconfigured shorthands: + # `play-pause`, `menu`, `subtitles`, `audio`, `video`, `playlist`, + # `chapters`, `editions`, `stream-quality`, `open-file`, `items`, + # `next`, `prev`, `first`, `last`, `audio-device`, `fullscreen`, + # `loop-playlist`, `loop-file`, `shuffle`, `autoload` + # `speed[:{scale}]` - display speed slider, [{scale}] - factor of controls_size, default: 1.3 + # `command:{icon}:{command}` - button that executes a {command} when pressed + # `toggle:{icon}:{prop}[@{owner}]` - button that toggles mpv property. shorthand for yes/no cycle below + # `cycle:{default_icon}:{prop}[@{owner}]:{value1}[={icon1}][!]/{valueN}[={iconN}][!]` + # - button that cycles mpv property between values, each optionally having different icon and active flag + # - presence of `!` at the end will style the button as active + # - `{owner}` is the name of a script that manages this property if any. Set to `uosc` to tap into uosc options. + # `gap[:{scale}]` - display an empty gap + # {scale} - factor of controls_size, default: 0.3 + # `space` - fills all available space between previous and next item, useful to align items to the right + # - multiple spaces divide the available space among themselves, which can be used for centering + # `button:{name}` - button whose state, look, and click action are managed by external script + # Item visibility control: + # `<[!]{disposition1}[,[!]{dispositionN}]>` - optional prefix to control element's visibility + # - `{disposition}` can be one of: + # - `idle` - true if mpv is in idle mode (no file loaded) + # - `image` - true if current file is a single image + # - `audio` - true for audio only files + # - `video` - true for files with a video track + # - `has_many_video` - true for files with more than one video track + # - `has_image` - true for files with a cover or other image track + # - `has_audio` - true for files with an audio track + # - `has_many_audio` - true for files with more than one audio track + # - `has_sub` - true for files with an subtitle track + # - `has_many_sub` - true for files with more than one subtitle track + # - `has_many_edition` - true for files with more than one edition + # - `has_chapter` - true for files with chapter list + # - `stream` - true if current file is read from a stream + # - `has_playlist` - true if current playlist has 2 or more items in it + # - prefix with `!` to negate the required disposition + # Examples: + # - `<stream>stream-quality` - show stream quality button only for streams + # - `<has_audio,!audio>audio` - show audio tracks button for all files that have + # an audio track, but are not exclusively audio only files + # Place `#{badge}[>{limit}]` after the element params to give it a badge. Available badges: + # `sub`, `audio`, `video` - track type counters + # `{mpv_prop}` - any mpv prop that makes sense to you: https://mpv.io/manual/master/#property-list + # - if prop value is an array it'll display its size + # `>{limit}` will display the badge only if it's numerical value is above this threshold. + # Example: `#audio>1` + # Place `?{tooltip}` after the element config to give it a tooltip. + # Example implementations: + # menu = command:menu:script-binding uosc/menu-blurred?Menu + # subtitles = command:subtitles:script-binding uosc/subtitles#sub?Subtitles + # fullscreen = cycle:crop_free:fullscreen:no/yes=fullscreen_exit!?Fullscreen + # loop-playlist = cycle:repeat:loop-playlist:no/inf!?Loop playlist + # toggle:{icon}:{prop} = cycle:{icon}:{prop}:no/yes! + controls = "menu,gap,subtitles,<has_many_audio>audio,<has_many_video>video,<has_many_edition>editions,<stream>stream-quality,gap,space,speed,space,shuffle,loop-playlist,loop-file,gap,prev,items,next,gap,fullscreen"; + controls_size = 32; + controls_margin = 8; + controls_spacing = 2; + controls_persistency = ""; + + # Where to display volume controls: none, left, right + volume = "right"; + volume_size = 40; + volume_border = 1; + volume_step = 1; + volume_persistency = ""; + + # Playback speed widget: mouse drag or wheel to change, click to reset + speed_step = 0.1; + speed_step_is_factor = false; + speed_persistency = ""; + + # Controls all menus, such as context menu, subtitle loader/selector, etc + menu_item_height = 36; + menu_min_width = 260; + menu_padding = 4; + + # Determines if `/` or `ctrl+f` is required to activate the search, or if typing + # any text is sufficient. + # When enabled, you can no longer toggle a menu off with the same key that opened it, if the key is a unicode character. + menu_type_to_search = true; + + # Top bar with window controls and media title + # Can be: never, no-border, always + top_bar = "never"; + top_bar_size = 40; + # Can be: `no` (hide), left or right + top_bar_controls = false; + # Can be: `no` (hide), `yes` (inherit title from mpv.conf), or a custom template string + top_bar_title = false; + # Template string to enable alternative top bar title. If alt title matches main title, + # it'll be hidden. Tip: use `${media-title}` for main, and `${filename}` for alt title. + top_bar_alt_title = ""; + # Can be: + # `below` => display alt title below the main one + # `toggle` => toggle the top bar title text between main and alt by clicking + # the top bar, or calling `toggle-title` binding + top_bar_alt_title_place = "below"; + # Flash top bar when any of these file types is loaded. Available: audio,video,image,chapter + top_bar_flash_on = "video,audio"; + top_bar_persistency = ""; + + # Window border drawn in no-border mode + window_border_size = 1; + + # If there's no playlist and file ends, load next file in directory + # Uses `load_types` config below to determine what type of file to load next. + # When enabled, usoc will set mpv config `keep-open` to `yes`, and `keep-open-pause` to `no`. + autoload = false; + # Enable uosc's playlist/directory shuffle mode + # This simply makes the next selected playlist or directory item be random, just + # like any other player in the world. It also has an easily togglable control button. + shuffle = false; + + # Scale the interface by this factor + scale = 1; + # Scale in fullscreen + scale_fullscreen = 1.3; + # Adjust the text scaling to fit your font + font_scale = 1; + # Border of text and icons when drawn directly on top of video + text_border = 1.2; + # Border radius of buttons, menus, and all other rectangles + border_radius = 4; + # A comma delimited list of color overrides in RGB HEX format. Defaults: + # foreground=ffffff,foreground_text=000000,background=000000,background_text=ffffff,curtain=111111,success=a5e075,error=ff616e + color = ""; + # A comma delimited list of opacity overrides for various UI element backgrounds and shapes. + # This does not affect any text, which is always rendered fully opaque. Defaults: + # timeline=0.9,position=1,chapters=0.8,slider=0.9,slider_gauge=1,controls=0,speed=0.6,menu=1,submenu=0.4,border=1,title=1,tooltip=1,thumbnail=1,curtain=0.8,idle_indicator=0.8,audio_indicator=0.5,buffering_indicator=0.3,playlist_position=0.8 + opacity = ""; + + # A comma delimited list of features to refine at a cost of some performance impact. + # text_width - Use a more accurate text width measurement that measures each text string individually + # instead of just measuring the width of known letters once and adding them up. + # sorting - Use filename sorting that handles non-english languages better, especially asian ones. + # At the moment, this is only available on windows, and has no effect on other platforms. + refine = ""; + + # Duration of animations in milliseconds + animation_duration = 100; + + # Execute command for background clicks shorter than this number of milliseconds, 0 to disable + # Execution always waits for `input-doubleclick-time` to filter out double-clicks + click_threshold = 0; + click_command = "cycle pause; script-binding uosc/flash-pause-indicator"; + + # Flash duration in milliseconds used by `flash-{element}` commands + flash_duration = 1000; + + # Distances in pixels below which elements are fully faded in/out + proximity_in = 40; + proximity_out = 120; + + # Use only bold font weight throughout the whole UI + font_bold = false; + + # One of `total`, `playtime-remaining` (scaled by the current speed), `time-remaining` (remaining length of file) + destination_time = "playtime-remaining"; + + # Display sub second fraction in timestamps up to this precision + time_precision = 0; + + # Display stream's buffered time in timeline if it's lower than this amount of seconds, 0 to disable + buffered_time_threshold = 60; + + # Hide UI when mpv autohides the cursor. Timing is controlled by `cursor-autohide` in `mpv.conf` (in milliseconds). + autohide = true; + + # Can be: flash, static, manual (controlled by flash-pause-indicator and decide-pause-indicator commands) + pause_indicator = "static"; + + # Sizes to list in stream quality menu + stream_quality_options = "4320,2160,1440,1080,720,480,360,240,144"; + + # Types to identify media files + video_types = "3g2,3gp,asf,avi,f4v,flv,h264,h265,m2ts,m4v,mkv,mov,mp4,mp4v,mpeg,mpg,ogm,ogv,rm,rmvb,ts,vob,webm,wmv,y4m"; + audio_types = "aac,ac3,aiff,ape,au,cue,dsf,dts,flac,m4a,mid,midi,mka,mp3,mp4a,oga,ogg,opus,spx,tak,tta,wav,weba,wma,wv"; + image_types = "apng,avif,bmp,gif,j2k,jp2,jfif,jpeg,jpg,jxl,mj2,png,svg,tga,tif,tiff,webp"; + subtitle_types = "aqt,ass,gsub,idx,jss,lrc,mks,pgs,pjs,psb,rt,sbv,slt,smi,sub,sup,srt,ssa,ssf,ttxt,txt,usf,vt,vtt"; + playlist_types = "m3u,m3u8,pls,url,cue"; + + # Type pools used by file navigation and `autoload` to determine what type of file to load next + # Available: video,audio,image,playlist,same. `same` means the same type pool (not just extension) as currently open file. + load_types = "video,audio,image"; + + # Default open-file menu directory. Use `{drives}` to open drives menu on windows (defaults to `/` on unix). + default_directory = "~/"; + + # List hidden files when reading directories. Due to environment limitations, this currently only hides + # files starting with a dot. Doesn't hide hidden files on windows (we have no way to tell they're hidden). + show_hidden_files = false; + + # Move files to trash (recycle bin) when deleting files. Dependencies: + # - Linux: `sudo apt install trash-cli` + # - MacOS: `brew install trash` + use_trash = false; + + # Adjusted osd margins based on the visibility of UI elements + adjust_osd_margins = true; + + # Adds chapter range indicators to some common chapter types. + # Additionally to displaying the start of the chapter as a diamond icon on top of the timeline, + # the portion of the timeline of that chapter range is also colored based on the config below. + # + # The syntax is a comma-delimited list of `{type}:{color}` pairs, where: + # `{type}` => range type. Currently supported ones are: + # - `openings`, `endings` => anime openings/endings + # - `intros`, `outros` => video intros/outros + # - `ads` => segments created by sponsor-block software like https://github.com/po5/mpv_sponsorblock + # `{color}` => an RGB(A) HEX color code (`rrggbb`, or `rrggbbaa`) + # + # To exclude marking any of the range types, simply remove them from the list. + chapter_ranges = "openings:30abf964,endings:30abf964,ads:c54e4e80"; + + # Add alternative lua patterns to identify beginnings of simple chapter ranges (except for `ads`) + # Syntax: `{type}:{pattern}[,{patternN}][;{type}:{pattern}[,{patternN}]]` + chapter_range_patterns = "openings:オープニング;endings:エンディング"; + + # Localization language priority from highest to lowest. + # Also controls what languages are fetched by `download-subtitles` menu. + # Built in languages can be found in `uosc/intl`. + # `slang` is a keyword to inherit values from `--slang` mpv config. + # Supports paths to custom json files: `languages=~~/custom.json,slang,en` + languages = "slang,en"; + + # A comma separated list of element IDs to disable. Available IDs: + # window_border, top_bar, timeline, controls, volume, + # idle_indicator, audio_indicator, buffering_indicator, pause_indicator + disable_elements = ""; + }; + thumbfast = { + hwdec = true; + network = false; + spawn_first = false; + max_height = 250; + max_width = 250; + }; + }; + scripts = with pkgs.mpvScripts; [ + uosc + thumbfast + ]; + }; + }; +} diff --git a/modules/by-name/nv/nvim/module.nix b/modules/by-name/nv/nvim/module.nix index 69e417bb..0eb416f6 100644 --- a/modules/by-name/nv/nvim/module.nix +++ b/modules/by-name/nv/nvim/module.nix @@ -32,6 +32,9 @@ in { programs.nixvim = { enable = true; + # Use my global nixpkgs set, instead of constructing a separate one. + nixpkgs.useGlobalPackages = true; + # source: https://www.patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=Neovim extraConfigLuaPre = lib.mkBefore '' --------------------------------------------------------------------------- diff --git a/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix b/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix index c1ace4ac..48fcd8a6 100644 --- a/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix @@ -6,7 +6,8 @@ }: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + # TODO: Get this plugin working again <2025-01-29> + home-manager.users.soispha.programs.nixvim = lib.mkIf false { # TODO: package flatten-nvim though a module extraConfigLuaPre = '' diff --git a/modules/by-name/ol/ollama/module.nix b/modules/by-name/ol/ollama/module.nix index bd0baaa6..7a4e8038 100644 --- a/modules/by-name/ol/ollama/module.nix +++ b/modules/by-name/ol/ollama/module.nix @@ -28,6 +28,16 @@ in { services.ollama = { enable = true; acceleration = false; + + # TODO: This could work for GPU acceleration. <2024-12-20> + # acceleration = "rocm"; + # host = "127.0.0.1"; + # port = 11434; + # environmentVariables = { + # HCC_AMDGPU_TARGET = "gfx1032"; # used to be necessary, but doesn't seem to anymore + # }; + # + # rocmOverrideGfx = "10.3.2"; }; }; } diff --git a/modules/by-name/ri/river/init_base.sh b/modules/by-name/ri/river/init_base.sh new file mode 100755 index 00000000..938b46b1 --- /dev/null +++ b/modules/by-name/ri/river/init_base.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +# NOTE: Keep this in sync with the file from `river-start` <2025-02-03> +RIVER_LOG_FILE="$HOME/.local/share/river/log" + +err_fail() { + if ! "$@"; then + output="" + for arg in "$@"; do + if [ -z "$output" ]; then + output="'$arg'" + else + output="$output '$arg'" + fi + done + printf "%s failed!\n" "$output" >>"$RIVER_LOG_FILE" + fi +} +exec 1>>"$RIVER_LOG_FILE" +exec 2>>"$RIVER_LOG_FILE" + +# Start of the generated stuff. diff --git a/modules/by-name/ri/river/module.nix b/modules/by-name/ri/river/module.nix index a059da4d..c8fb973c 100644 --- a/modules/by-name/ri/river/module.nix +++ b/modules/by-name/ri/river/module.nix @@ -3,19 +3,216 @@ lib, qmk_firmware, system, + pkgs, ... }: let cfg = config.soispha.programs.river; + esa = lib.strings.escapeShellArg; + riverctl = lib.getExe' pkgs.river "riverctl"; + + mkOutputFlags = output: flags: let + expandedFlags = builtins.concatStringsSep " " (lib.attrsets.mapAttrsToList (flag: value: "--${esa flag} ${esa value}") flags); + in '' + err_fail ${lib.getExe pkgs.wlr-randr} --output ${esa output} ${expandedFlags} + ''; + screenSetupCode = builtins.concatStringsSep "" (lib.attrsets.mapAttrsToList mkOutputFlags cfg.init.screenSetupCode); + + mkLrProgram = input: let + program = builtins.concatStringsSep " " ( + if lib.isDerivation input + then [(lib.getExe input)] + else builtins.map esa input + ); + in "err_fail ${program} &"; + longRunningPrograms = builtins.concatStringsSep "\n" (builtins.map mkLrProgram cfg.init.backgroundStart); + + keymapFormat = pkgs.formats.json {}; + + keymappings = '' + err_fail ${riverctl} keyboard-layout ${esa cfg.init.mappings.layout} + err_fail ${lib.getExe pkgs.river-mk-keymap} ${keymapFormat.generate "keys.json" cfg.init.mappings.keymap} + ''; + + mkRule = { + app-id, + title, + action, + }: '' + err_fail ${riverctl} rule-add -app-id ${esa app-id} -title ${esa title} ${esa action} + ''; + ruleSetup = builtins.concatStringsSep "" (builtins.map mkRule cfg.init.rules); + + mkSetting = name: maybe_values: let + rawValues = + if builtins.isString maybe_values + then [maybe_values] + else maybe_values; + values = builtins.concatStringsSep " " (builtins.map esa rawValues); + in '' + err_fail ${riverctl} ${esa name} ${values} + ''; + generalSettings = + builtins.concatStringsSep "" (lib.attrsets.mapAttrsToList mkSetting + cfg.init.generalSettings); + + mkInput = name: arguments: + builtins.concatStringsSep "" (builtins.map (argumentLine: mkSetting "input" ([name] ++ argumentLine)) arguments); + inputs = + builtins.concatStringsSep "" (lib.attrsets.mapAttrsToList mkInput cfg.init.inputs); in { options.soispha.programs.river = { enable = lib.mkEnableOption "river"; + unicodeInput = { enable = lib.mkEnableOption "udev rules for rawhid based unicode input"; }; + + init = { + mappings = { + layout = lib.mkOption { + type = lib.types.str; + description = "The keymap to use"; + default = "dvorak-modified"; + }; + + keymap = lib.mkOption { + type = lib.types.submodule { + freeformType = keymapFormat.type; + + options = {}; + }; + default = {}; + + description = '' + Configuration for river-mk-keymap via `keys.json`. + ''; + }; + }; + + rules = lib.mkOption { + type = lib.types.listOf (lib.types.attrsOf lib.types.str); + default = []; + + example = '' + [ + { + app-id = "*"; + title = "floating please"; + action = "float"; + } + { + app-id = "*"; + title = "*"; + action = "ssd"; + } + ] + ''; + + description = '' + Configuration for river_init_lesser via `keys.json`. + ''; + }; + + generalSettings = lib.mkOption { + type = lib.types.attrsOf (lib.types.either (lib.types.listOf lib.types.str) lib.types.str); + description = "Simple key value settings."; + default = {}; + example = '' + { + background-color = "0x002b36"; + set-repeat = ["50" "300"]; + hide-cursor = ["when-typing" "enabled"]; + } + ''; + }; + + inputs = lib.mkOption { + type = lib.types.attrsOf (lib.types.listOf (lib.types.listOf lib.types.str)); + description = "Options to set per input device"; + default = {}; + example = '' + { + pointer-1133-49970-Logitech_Gaming_Mouse_G502 = [["pointer-accel" "0"] ["accel-profile" "none"]]; + pointer-12951-6505-ZSA_Technology_Labs_Moonlander_Mark_I = [["pointer-accel" "0"] ["accel-profile" "none"]]; + } + ''; + }; + + backgroundStart = lib.mkOption { + type = lib.types.listOf (lib.types.either lib.types.package (lib.types.listOf lib.types.str)); + description = "List of programs to start in the background"; + example = '' + [ + pkgs.gammastep + ] + ''; + }; + + screenSetupCode = lib.mkOption { + type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); + default = {}; + description = '' + `wlr-randr` flags to set up outputs. The attribute names are the `--output` keys + and the attrs are flag value pairs to setup. + ''; + example = '' + { + "Virtual-1" = {mode = "1920x1080";}; + "DP-2" = {pos = "2560,0";}; + "DP-1" = {scale = "1.5"; pos = "0,0";}; + } + ''; + }; + }; }; config = lib.mkIf cfg.enable { - # TODO: Migrate the complete river module <2024-12-30> services.udev.packages = lib.mkIf cfg.unicodeInput.enable [qmk_firmware.packages.${system}.qmk_unicode_type]; + + home-manager.users.soispha = { + home.sessionVariables = { + WM = "river"; + XDG_CURRENT_DESKTOP = "river"; + DESKTOP_SESSION = "river"; + + # Export Wayland env Vars {{{ + QT_QPA_PLATFORM = "wayland"; + QT_QPA_PLATFORMTHEME = "qt5ct"; # needs qt5ct + CLUTTER_BACKEND = "wayland"; + SDL_VIDEODRIVER = "wayland"; # might brake some things + # }}} + }; + + home.packages = [ + pkgs.river-start + ]; + + xdg.configFile."river/init" = { + executable = true; + text = let + mkHeading = text: other_stuff: '' + # ${text} + ${other_stuff} + ''; + in + builtins.readFile ./init_base.sh + + + # bash + mkHeading "Environment variables" '' + err_fail ${riverctl} spawn "${lib.getExe' pkgs.dbus "dbus-update-activation-environment"} --verbose --systemd SEATD_SOCK DISPLAY WAYLAND_DISPLAY DESKTOP_SESSION=river XDG_CURRENT_DESKTOP=river" + export XDG_CURRENT_DESKTOP=river DESKTOP_SESSION=river; + '' + + mkHeading "Key Mappings" keymappings + + mkHeading "Rules" ruleSetup + + mkHeading "General Settings" generalSettings + + mkHeading "Input Section" inputs + + mkHeading "Screen setup code" screenSetupCode + + mkHeading "Background services" longRunningPrograms + + mkHeading "Layout Setup" '' + err_fail ${riverctl} default-layout rivertile + ${lib.getExe' pkgs.river "rivertile"} -main-ratio 0.5 -view-padding 1 -outer-padding 0 + ''; + }; + }; }; } diff --git a/modules/by-name/so/sound/module.nix b/modules/by-name/so/sound/module.nix index f3120a67..8b519f09 100644 --- a/modules/by-name/so/sound/module.nix +++ b/modules/by-name/so/sound/module.nix @@ -10,7 +10,7 @@ in { }; config = lib.mkIf cfg.enable { - hardware.pulseaudio.enable = false; + services.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { diff --git a/modules/home.legacy/conf/swaylock/GTDcanonical.png b/modules/by-name/sw/swaylock/images/GTDcanonical.png index ef41d79d..ef41d79d 100644 --- a/modules/home.legacy/conf/swaylock/GTDcanonical.png +++ b/modules/by-name/sw/swaylock/images/GTDcanonical.png Binary files differdiff --git a/modules/home.legacy/conf/swaylock/commands.jpg b/modules/by-name/sw/swaylock/images/commands.jpg index 54016503..54016503 100644 --- a/modules/home.legacy/conf/swaylock/commands.jpg +++ b/modules/by-name/sw/swaylock/images/commands.jpg Binary files differdiff --git a/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg b/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg new file mode 100644 index 00000000..d72f32d1 --- /dev/null +++ b/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg Binary files differdiff --git a/modules/home.legacy/conf/swaylock/gnu.png b/modules/by-name/sw/swaylock/images/gnu.png index d07dee3e..d07dee3e 100644 --- a/modules/home.legacy/conf/swaylock/gnu.png +++ b/modules/by-name/sw/swaylock/images/gnu.png Binary files differdiff --git a/modules/by-name/sw/swaylock/module.nix b/modules/by-name/sw/swaylock/module.nix index 6cbcef28..fc296de7 100644 --- a/modules/by-name/sw/swaylock/module.nix +++ b/modules/by-name/sw/swaylock/module.nix @@ -1,4 +1,25 @@ -{...}: { - # otherwise swaylock can't access the user password. - security.pam.services.swaylock = {}; +{ + config, + lib, + ... +}: let + cfg = config.soispha.programs.swaylock; +in { + options.soispha.programs.swaylock = { + enable = lib.mkEnableOption "swaylock"; + }; + + config = lib.mkIf cfg.enable { + # otherwise swaylock can't access the user password. + security.pam.services.swaylock = {}; + + home-manager.users.soispha.programs.swaylock = { + enable = true; + settings = { + image = "${./images/duwon-lee-tempano-port.jpg}"; + scaling = "stretch"; + color = "000000"; + }; + }; + }; } diff --git a/modules/by-name/zs/zsh/module.nix b/modules/by-name/zs/zsh/module.nix index 833da126..cb1bb086 100644 --- a/modules/by-name/zs/zsh/module.nix +++ b/modules/by-name/zs/zsh/module.nix @@ -6,7 +6,8 @@ ... }: let cfg = config.soispha.programs.zsh; - homeConfig = config.home-manager.users.soispha; + + zDotDir = ".config/zsh"; sourceFile = path: "source ${path}\n"; in { @@ -14,98 +15,108 @@ in { enable = lib.mkEnableOption "zsh"; }; - config.home-manager.users.soispha = lib.mkIf cfg.enable { - home.sessionPath = []; - - programs.zsh = { - enable = true; - enableCompletion = true; - autosuggestion = { - enable = true; - strategy = []; - }; - syntaxHighlighting.enable = true; - - autocd = true; + config = lib.mkIf cfg.enable { + environment.variables = { + ZDOTDIR = "${config.home-manager.users.soispha.home.homeDirectory}/${zDotDir}"; + }; - # Must be relative to the users home directory (for whatever reason) - # Thus no `${homeConfig.xdg.configHome}` - dotDir = ".config/zsh"; + home-manager.users.soispha = { + home.sessionPath = lib.mkForce []; - # TODO: Remove the whole history and replace it completely with `atuin` <2024-10-21> - history = { - path = "/dev/null"; - # save = 0; # number of lines to save - # size = 0; # number of lines to keep - # share = false; # share between sessions - }; + # This just includes a `source ~/.config/zsh/.zshenv`, because home-manger by-default + # can't access the root `/etc/zshenv`. We can and thus, we can remove this file. + home.file.".zshenv".enable = false; - loginExtra = - # bash - '' - setopt AUTO_CD - setopt AUTO_PUSHD - setopt CHASE_DOTS - - setopt ALWAYS_TO_END - - setopt EXTENDED_HISTORY - setopt HIST_ALLOW_CLOBBER - setopt HIST_VERIFY - setopt HIST_FCNTL_LOCK - setopt APPEND_HISTORY - - setopt DVORAK - setopt CORRECT - - setopt PROMPT_SUBST - setopt TRANSIENT_RPROMPT # maybe? - - setopt COMBINING_CHARS - setopt VI - ''; - - initExtraFirst = - sourceFile ./config/zsh-init.zsh - + '' - SHELL_LIBRARY_VERSION="2.1.2" source ${shell_library.rawLib.${system}} - ''; - - initExtra = let - start = lib.modules.mkBefore ( - # NOTE: This must be before the insult, as we otherwise override the previous handler <2024-02-28> - sourceFile ./config/command_not_found/command_not_found.sh - + sourceFile ./config/command_not_found/command_not_found_insult.sh - + sourceFile ./config/custom_cursor.zsh - + sourceFile ./config/edit_command_line.zsh - + sourceFile ./plugins/zsh-history-substring-search.zsh - ); - end = lib.modules.mkAfter ( - sourceFile ./config/keymaps_start.zsh - + sourceFile ./config/keymaps/command.zsh - + sourceFile ./config/keymaps/emacs.zsh - + sourceFile ./config/keymaps/isearch.zsh - + sourceFile ./config/keymaps/vicmd.zsh - + sourceFile ./config/keymaps/viins.zsh - + sourceFile ./config/keymaps/viopp.zsh - + sourceFile ./config/keymaps/visual.zsh - + sourceFile ./config/keymaps_end.zsh - ); - in - lib.modules.mkMerge - [ - start - end - ]; - - localVariables = { - HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND = "bg=cyan,fg=white"; - HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND = "fg=red,underline,standout,bold"; - }; - - shellAliases = { - ll = ". ll"; - lm = ". lm"; + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion = { + enable = true; + strategy = []; + }; + syntaxHighlighting.enable = true; + + autocd = true; + + # Must be relative to the users home directory (for whatever reason) + # Thus no `${homeConfig.xdg.configHome}` + dotDir = zDotDir; + + # TODO: Remove the whole history and replace it completely with `atuin` <2024-10-21> + history = { + path = "/dev/null"; + # save = 0; # number of lines to save + # size = 0; # number of lines to keep + # share = false; # share between sessions + }; + + loginExtra = + # bash + '' + setopt AUTO_CD + setopt AUTO_PUSHD + setopt CHASE_DOTS + + setopt ALWAYS_TO_END + + setopt EXTENDED_HISTORY + setopt HIST_ALLOW_CLOBBER + setopt HIST_VERIFY + setopt HIST_FCNTL_LOCK + setopt APPEND_HISTORY + + setopt DVORAK + setopt CORRECT + + setopt PROMPT_SUBST + setopt TRANSIENT_RPROMPT # maybe? + + setopt COMBINING_CHARS + setopt VI + ''; + + initExtraFirst = + sourceFile ./config/zsh-init.zsh + + '' + SHELL_LIBRARY_VERSION="2.1.2" source ${shell_library.rawLib.${system}} + ''; + + initExtra = let + start = lib.modules.mkBefore ( + # NOTE: This must be before the insult, as we otherwise override the previous handler <2024-02-28> + sourceFile ./config/command_not_found/command_not_found.sh + + sourceFile ./config/command_not_found/command_not_found_insult.sh + + sourceFile ./config/custom_cursor.zsh + + sourceFile ./config/edit_command_line.zsh + + sourceFile ./plugins/zsh-history-substring-search.zsh + ); + end = lib.modules.mkAfter ( + sourceFile ./config/keymaps_start.zsh + + sourceFile ./config/keymaps/command.zsh + + sourceFile ./config/keymaps/emacs.zsh + + sourceFile ./config/keymaps/isearch.zsh + + sourceFile ./config/keymaps/vicmd.zsh + + sourceFile ./config/keymaps/viins.zsh + + sourceFile ./config/keymaps/viopp.zsh + + sourceFile ./config/keymaps/visual.zsh + + sourceFile ./config/keymaps_end.zsh + ); + in + lib.modules.mkMerge + [ + start + end + ]; + + localVariables = { + HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND = "bg=cyan,fg=white"; + HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND = "fg=red,underline,standout,bold"; + }; + + shellAliases = { + ll = ". ll"; + lm = ". lm"; + }; }; }; }; |