aboutsummaryrefslogtreecommitdiffstats
path: root/modules/by-name/lf
diff options
context:
space:
mode:
Diffstat (limited to 'modules/by-name/lf')
-rw-r--r--modules/by-name/lf/lf/colors7
-rw-r--r--modules/by-name/lf/lf/colors.license9
-rwxr-xr-xmodules/by-name/lf/lf/commands/base.sh92
-rw-r--r--modules/by-name/lf/lf/commands/default.nix290
-rwxr-xr-xmodules/by-name/lf/lf/commands/run.sh40
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/archive.sh77
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/archive_compress.sh73
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/archive_decompress.sh36
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/broot_jump.sh25
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/cd_lf_make_map.sh27
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/cd_project_root.sh29
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/chmod.sh24
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/clear_trash.sh8
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/cow_cp.sh10
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/dl_file.sh43
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/dragon.sh17
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/dragon_individual.sh17
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/dragon_stay.sh17
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/execute.sh13
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/follow_link.sh21
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/fzf_jump.sh24
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/go_project_root.sh22
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/mk_directory.sh (renamed from modules/by-name/lf/lf/commands/scripts/mk_dir.sh)15
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/mk_file.sh15
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/mk_file_and_edit.sh33
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/mk_link.sh (renamed from modules/by-name/lf/lf/commands/scripts/mk_ln.sh)24
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/mk_scr_default.sh38
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/mk_script.sh (renamed from modules/by-name/lf/lf/commands/scripts/mk_scr_temp.sh)27
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/restore_trash.sh16
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh17
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/set_wall_paper.sh19
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/set_wallpaper.sh29
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/stripspace.sh44
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/trash.sh34
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/trash_clear.sh19
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/trash_restore.sh27
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/unarchive.sh36
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/view_file.sh15
-rw-r--r--modules/by-name/lf/lf/ctpv/default.nix50
-rw-r--r--modules/by-name/lf/lf/ctpv/helpers.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/any.sh21
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix20
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix9
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh17
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix20
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh17
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix9
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix9
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix9
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix22
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh18
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/audio/audio.sh15
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/audio/default.nix13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/default.nix18
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/font/default.nix12
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/font/font.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/image/default.nix10
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/image/image.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix10
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix9
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/default.nix16
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/directory/default.nix19
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/directory/ls.sh20
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/fifo/default.nix19
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/fifo/fifo.sh16
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/ls.sh15
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh14
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/symlink/default.nix19
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/symlink/symlink.sh19
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/x-empty/default.nix19
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/inode/x-empty/empty.sh16
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/libreoffice.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/message/rfc822/default.nix26
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/message/rfc822/rfc822.sh22
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix9
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/text/bat.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/text/default.nix17
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix9
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/text/glow.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/text/html/default.nix13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/text/html/elinks.sh18
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/text/json/default.nix9
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh13
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/video/default.nix10
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/video/video.sh13
-rw-r--r--modules/by-name/lf/lf/icons.license9
-rw-r--r--modules/by-name/lf/lf/keybindings/default.nix135
-rw-r--r--modules/by-name/lf/lf/module.nix49
-rw-r--r--modules/by-name/lf/lf/wrappers/default.nix4
-rw-r--r--modules/by-name/lf/lf/wrappers/ll/default.nix18
-rwxr-xr-xmodules/by-name/lf/lf/wrappers/ll/ll.sh23
-rw-r--r--modules/by-name/lf/lf/wrappers/lm/default.nix18
-rwxr-xr-xmodules/by-name/lf/lf/wrappers/lm/lm.sh28
102 files changed, 1560 insertions, 907 deletions
diff --git a/modules/by-name/lf/lf/colors b/modules/by-name/lf/lf/colors
index 1c2853ec..ed211581 100644
--- a/modules/by-name/lf/lf/colors
+++ b/modules/by-name/lf/lf/colors
@@ -58,13 +58,8 @@ ex 03;01;95 # EXEC
fi 00 # FILE
# links to hide
-~/.mozilla 01;08;30
+~/.pki 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/colors.license b/modules/by-name/lf/lf/colors.license
new file mode 100644
index 00000000..eae6a84c
--- /dev/null
+++ b/modules/by-name/lf/lf/colors.license
@@ -0,0 +1,9 @@
+nixos-config - My current NixOS configuration
+
+Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+SPDX-License-Identifier: GPL-3.0-or-later
+
+This file is part of my nixos-config.
+
+You should have received a copy of the License along with this program.
+If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
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..e0b6216c
--- /dev/null
+++ b/modules/by-name/lf/lf/commands/base.sh
@@ -0,0 +1,92 @@
+#!/usr/bin/env bash
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# 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 -t --tmpdir="$__base_tmp_temporary_directory" lf_commands_tmp_fun_XXXXXXXX)"
+ cat >"$__base_tmp_temporary_file"
+ echo "$__base_tmp_temporary_file"
+}
+__base_tmp_temporary_directory="$(mktemp -t --directory lf_commands_tmp_fun_XXXXXXXXXXXX)"
+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.
+#
+# # Type
+# lf_cmd :: [String]
+#
+# # Arguments
+# $1..$@
+# : The arguments composing the command to run.
+lf_cmd() {
+ arguments=""
+ for arg in "$@"; do
+ # We _can_ use the fancy bash syntax, but it's really hard to correctly quote the
+ # single quote in bash, and I don't really feel like it's worth it.
+ # shellcheck disable=SC2001
+ arg="$(echo "$arg" | sed "s/'/\\\'/g")"
+
+ 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..42dc548e 100644
--- a/modules/by-name/lf/lf/commands/default.nix
+++ b/modules/by-name/lf/lf/commands/default.nix
@@ -1,231 +1,183 @@
-{
- pkgs,
- sysLib,
- shell_library,
- system,
- ...
-}: let
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{pkgs, ...}: let
functionCall = {
name,
dependencies,
- replacementStrings,
- ...
+ keepPath ? false,
}:
- 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 =
+ [
+ pkgs.lf
+ pkgs.mktemp
+ pkgs.coreutils
+ pkgs.gnused
+ ]
+ ++ dependencies;
+ inheritPath = keepPath;
}
+ "/bin/${name}";
- shell = {
- name,
- dependencies,
- replacementStrings ? null,
- ...
- }: ''
+ # closes the lf tui
+ shell = args: ''
''${{
- ${functionCall {inherit name dependencies replacementStrings;}}
+ ${functionCall args}
}}
- ''; # closes the lf tui
- pipe = {
- name,
- dependencies,
- replacementStrings ? null,
- ...
- }: ''
+ '';
+ # runs the command in the ui/term bar
+ pipe = args: ''
%{{
- ${functionCall {inherit name dependencies replacementStrings;}}
+ ${functionCall args}
}}
- ''; # runs the command in the ui/term bar
- async = {
- name,
- dependencies,
- replacementStrings ? null,
- ...
- }: ''
+ '';
+ # runs the command in the background
+ async = args: ''
&{{
- ${functionCall {inherit name dependencies replacementStrings;}}
+ ${functionCall args}
}}
- ''; # runs the command in the background
- wait = {
- name,
- dependencies,
- replacementStrings ? null,
- ...
- }: ''
+ '';
+ # adds a prompt after the command has run
+ wait = args: ''
!{{
- ${functionCall {inherit name dependencies replacementStrings;}}
+ ${functionCall args}
}}
- ''; # adds a prompt after the command has run
+ '';
in {
- archive = shell {
- name = "archive";
- dependencies = builtins.attrValues {
- inherit
- (pkgs)
- fzf
- gnutar
- xz
- p7zip
- zip
- ;
- };
+ archive_compress = shell {
+ name = "archive_compress";
+ dependencies = [
+ pkgs.fzf
+ pkgs.gnutar
+ pkgs.xz
+ pkgs.p7zip
+ pkgs.zip
+ pkgs.gzip
+ ];
};
- broot_jump = shell {
- name = "broot_jump";
- dependencies = builtins.attrValues {
- inherit (pkgs) broot;
- };
+ archive_decompress = pipe {
+ name = "archive_decompress";
+ dependencies = [
+ pkgs.gnutar
+ pkgs.openjdk_headless
+ pkgs.p7zip
+ pkgs.xz
+ pkgs.gzip
+ ];
+ };
+
+ cd_project_root = async {
+ name = "cd_project_root";
+ dependencies = [pkgs.git];
};
+ cd_lf_make_map = shell {
+ name = "cd_lf_make_map";
+ dependencies = [
+ pkgs.lf-make-map
+ ];
+ };
+
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.dragon-drop];
};
dragon_individual = pipe {
name = "dragon_individual";
- dependencies = builtins.attrValues {
- inherit
- (pkgs)
- xdragon
- ;
- };
+ dependencies = [pkgs.dragon-drop];
};
dragon_stay = pipe {
name = "dragon_stay";
- dependencies = builtins.attrValues {
- inherit
- (pkgs)
- xdragon
- ;
- };
+ dependencies = [pkgs.dragon-drop];
};
+
execute = shell {
name = "execute";
dependencies = [];
+ keepPath = true;
};
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 = [];
+ keepPath = true;
};
- 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 = [
+ pkgs.river-classic # for `riverctl`
+ pkgs.swaybg
+ pkgs.procps
+ ];
};
+
stripspace = pipe {
name = "stripspace";
- dependencies = [];
+ dependencies = [pkgs.gnused];
};
+
trash = pipe {
name = "trash";
- dependencies = builtins.attrValues {
- inherit
- (pkgs)
- trashy
- trash-cli
- findutils
- ;
- };
+ dependencies = [pkgs.trash-cli];
+ };
+ trash_clear = shell {
+ name = "trash_clear";
+ dependencies = [
+ pkgs.conceal
+ pkgs.fzf
+ pkgs.gawk
+ pkgs.trashy
+ pkgs.gnused
+ ];
};
- unarchive = pipe {
- name = "unarchive";
- dependencies = builtins.attrValues {
- inherit
- (pkgs)
- gnutar
- unzip
- p7zip
- ;
- };
+ trash_restore = shell {
+ name = "trash_restore";
+ dependencies = [
+ pkgs.conceal
+ pkgs.fzf
+ pkgs.gawk
+ pkgs.trashy
+ pkgs.gnused
+ ];
+ };
+
+ view_file = async {
+ name = "view_file";
+ dependencies = [pkgs.file];
+ keepPath = true;
};
}
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..06106aed
--- /dev/null
+++ b/modules/by-name/lf/lf/commands/run.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env sh
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# 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..b42688bf
--- /dev/null
+++ b/modules/by-name/lf/lf/commands/scripts/archive_compress.sh
@@ -0,0 +1,73 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# 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..10eb0bc5
--- /dev/null
+++ b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh
@@ -0,0 +1,36 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# 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) jar --verbose --extract --file "$file" ;;
+ *.7z) 7z x "$file" ;;
+ *) die "'$file' is not a supported file for unarchiving." ;;
+ esac
+
+ lf_cmd echo "decompression of '$file' done."
+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_lf_make_map.sh b/modules/by-name/lf/lf/commands/scripts/cd_lf_make_map.sh
new file mode 100755
index 00000000..00befd3f
--- /dev/null
+++ b/modules/by-name/lf/lf/commands/scripts/cd_lf_make_map.sh
@@ -0,0 +1,27 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# shellcheck shell=sh
+
+# shellcheck disable=SC2269
+f="$f"
+# shellcheck disable=SC2269
+fx="$fx"
+# shellcheck disable=SC2269
+fs="$fs"
+# shellcheck disable=SC2269
+id="$id"
+
+root="$(lf-make-map --depth 4 interactive ~/media ~/repos ~/documents ~/.config ~/.local)"
+if [ "$root" ]; then
+ lf_cmd cd "$root" || die "Bug: Failed to cd to selected path at '$root'"
+fi
+
+# 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..c2de61e6
--- /dev/null
+++ b/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh
@@ -0,0 +1,29 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# 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..757f3c9c 100755
--- a/modules/by-name/lf/lf/commands/scripts/chmod.sh
+++ b/modules/by-name/lf/lf/commands/scripts/chmod.sh
@@ -1,7 +1,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -12,13 +19,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/cow_cp.sh b/modules/by-name/lf/lf/commands/scripts/cow_cp.sh
index 98675b9e..dbe00654 100755
--- a/modules/by-name/lf/lf/commands/scripts/cow_cp.sh
+++ b/modules/by-name/lf/lf/commands/scripts/cow_cp.sh
@@ -1,5 +1,15 @@
#!/usr/bin/env bash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
# shellcheck source=/dev/null
SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
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..a4a52c72 100755
--- a/modules/by-name/lf/lf/commands/scripts/dragon.sh
+++ b/modules/by-name/lf/lf/commands/scripts/dragon.sh
@@ -1,7 +1,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -14,7 +21,7 @@ id="$id"
while read -r file; do
set -- "$@" "$file"
-done <"$(tmp echo "$fx")"
+done <"$(echo "$fx" | tmp)"
-dragon -a -x "$@"
+dragon-drop --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..370e9753 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,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -14,7 +21,7 @@ id="$id"
while read -r file; do
set -- "$@" "$file"
-done <"$(tmp echo "$fx")"
+done <"$(echo "$fx" | tmp)"
-dragon "$@"
+dragon-drop "$@"
# 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..86a19370 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,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -14,7 +21,7 @@ id="$id"
while read -r file; do
set -- "$@" "$file"
-done <"$(tmp echo "$fx")"
+done <"$(echo "$fx" | tmp)"
-dragon -a "$@"
+dragon-drop --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..ce62dfa0 100755
--- a/modules/by-name/lf/lf/commands/scripts/execute.sh
+++ b/modules/by-name/lf/lf/commands/scripts/execute.sh
@@ -1,7 +1,14 @@
-#!/usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# 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..71fa6825 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,14 @@
-#!/usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -14,6 +21,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..f3bd6d29 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,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -23,7 +30,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..78271aaa 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,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -23,7 +30,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..35f49c38 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,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -14,20 +21,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 +42,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_default.sh b/modules/by-name/lf/lf/commands/scripts/mk_scr_default.sh
deleted file mode 100755
index 47d05080..00000000
--- a/modules/by-name/lf/lf/commands/scripts/mk_scr_default.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_base
- name="$name_base.sh"
- 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"
-
-cat "%SHELL_LIBRARY_TEMPLATE" >"$script"
-chmod +x "$script"
-"$VISUAL" "$script"
-
-# 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_script.sh
index 512b5d0b..a708825d 100755
--- a/modules/by-name/lf/lf/commands/scripts/mk_scr_temp.sh
+++ b/modules/by-name/lf/lf/commands/scripts/mk_script.sh
@@ -1,7 +1,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -23,15 +30,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
-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"
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..f4cb5115 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,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -17,10 +24,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..6311031e
--- /dev/null
+++ b/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh
@@ -0,0 +1,29 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# shellcheck shell=sh
+
+# shellcheck disable=SC2269
+f="$f"
+# shellcheck disable=SC2269
+fx="$fx"
+# shellcheck disable=SC2269
+fs="$fs"
+# shellcheck disable=SC2269
+id="$id"
+
+# Kill all previous instances
+pkill swaybg
+
+# 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..9253b6de 100755
--- a/modules/by-name/lf/lf/commands/scripts/stripspace.sh
+++ b/modules/by-name/lf/lf/commands/scripts/stripspace.sh
@@ -1,7 +1,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -12,29 +19,14 @@ fs="$fs"
# shellcheck disable=SC2269
id="$id"
-files=$(mktmp)
-echo "$fx" >"$files"
+echo "$fx" | while read -r file; do
+ dirty_name=$(basename "$file")
+ clean_name=$(echo "$dirty_name" | sed 's/[[:blank:]]\+/_/g' | sed 's/\(.*\)/\L\1/')
-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
+ [ -e "$clean_name" ] && die "file '$clean_name' already exists!"
+ mv "$dirty_name" "$clean_name" || die "Move failed"
-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 "$(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..68b36774 100755
--- a/modules/by-name/lf/lf/commands/scripts/trash.sh
+++ b/modules/by-name/lf/lf/commands/scripts/trash.sh
@@ -1,7 +1,14 @@
-#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -12,26 +19,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"
-error: 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..597995f9
--- /dev/null
+++ b/modules/by-name/lf/lf/commands/scripts/trash_clear.sh
@@ -0,0 +1,19 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# shellcheck shell=sh
+
+while IFS="$(printf '\n')" read -r file; do
+ set -- "$@" "$(pwd)/$file"
+done <"$(conceal list | fzf --multi --ansi | awk '{$1="";$2=""; print $0}' | sed 's/^\s*//' | 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..7b078c26
--- /dev/null
+++ b/modules/by-name/lf/lf/commands/scripts/trash_restore.sh
@@ -0,0 +1,27 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# shellcheck shell=sh
+
+# shellcheck disable=SC2269
+f="$f"
+# shellcheck disable=SC2269
+fx="$fx"
+# shellcheck disable=SC2269
+fs="$fs"
+# shellcheck disable=SC2269
+id="$id"
+
+while IFS="$(printf '\n')" read -r file; do
+ set -- "$@" "$(pwd)/$file"
+done <"$(conceal list | fzf --multi --ansi | awk '{$1="";$2=""; print $0}' | sed 's/^\s*//' | 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..48cdd85e 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,14 @@
-#!/usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=sh
# shellcheck disable=SC2269
f="$f"
@@ -12,7 +19,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/default.nix b/modules/by-name/lf/lf/ctpv/default.nix
index 3748eca4..6f9988b9 100644
--- a/modules/by-name/lf/lf/ctpv/default.nix
+++ b/modules/by-name/lf/lf/ctpv/default.nix
@@ -1,5 +1,13 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
- sysLib,
lib,
config,
pkgs,
@@ -8,15 +16,15 @@
functionCall = {
name,
dependencies,
- replacementStrings,
scriptPath,
- ...
+ environment,
}:
- sysLib.writeShellScript {
+ pkgs.writeShellApplication {
inherit name;
- src = scriptPath;
- keepPath = false;
- inherit replacementStrings dependencies;
+ text = builtins.readFile ./helpers.sh + builtins.readFile scriptPath;
+ inheritPath = false;
+ runtimeInputs = dependencies;
+ runtimeEnv = environment;
}
+ "/bin/${name}";
@@ -24,8 +32,8 @@
matches,
priority,
dependencies,
- replacementStrings,
previewer,
+ environment,
}: let
mkMimePath = val: let
split = lib.strings.splitString "/" val;
@@ -49,7 +57,7 @@
inherit
name
dependencies
- replacementStrings
+ environment
;
scriptPath = previewer;
};
@@ -93,6 +101,12 @@
};
};
+ environment = lib.mkOption {
+ type = lib.types.attrsOf lib.types.str;
+ default = {};
+ description = "Environment variables to set for the script";
+ };
+
previewer = lib.mkOption {
type = lib.types.pathInStore;
description = "The path to the preview script or binary";
@@ -104,13 +118,6 @@
default = 0;
description = "The priority to use this previewer.";
};
- replacementStrings = lib.mkOption {
- type = lib.types.attrsOf (lib.types.either lib.types.str lib.types.pathInStore);
- default = {
- HELPERS = ./helpers.sh;
- };
- description = "Arbitrary strings to replace in the shell script.";
- };
dependencies = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [];
@@ -153,17 +160,6 @@ in {
package = lib.mkPackageOption pkgs "ctpv-64-types" {};
- # TODO: This is necessary, as the `./prev` dir is imported separately and as such
- # cannot access the `./helpers.sh` file in it's parent directory.
- # This separate import should ideally be removed. <2024-12-15>
- helpers = lib.mkOption {
- default = ./helpers.sh;
- type = lib.types.pathInStore;
-
- internal = true;
- readOnly = true;
- };
-
previewers = lib.mkOption {
description = ''
The previewers to add to the config file.
diff --git a/modules/by-name/lf/lf/ctpv/helpers.sh b/modules/by-name/lf/lf/ctpv/helpers.sh
index 6dc7fee6..d0bba315 100644
--- a/modules/by-name/lf/lf/ctpv/helpers.sh
+++ b/modules/by-name/lf/lf/ctpv/helpers.sh
@@ -1,5 +1,15 @@
#! /usr/bin/env dash
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
# shellcheck disable=SC2269
cache_f="$cache_f"
# shellcheck disable=SC2269
@@ -21,6 +31,7 @@ chafa_run() {
# TODO: Animation support would be nice, but it would need to be supported in chafa by
# allowing us to make a call to ctpvclear after each image is displayed. <2024-11-25>
chafa --size "${w}x${h}" --animate=off "$1" | sed 's/#/\n#/g'
+ exiftool "$1"
}
send_image() {
@@ -59,7 +70,7 @@ preview_xxd() {
# This has been derived mathematically.
octet_columns=$(((2 * w - 22) / 7))
- if [ -n "$CTPV_LESS_PREVIEWER" ]; then
+ if [ "${CTPV_LESS_PREVIEWER:-unset}" != "-unset" ]; then
__base_xxd_preview "$1"
else
__base_xxd_preview "$1" -len "$((h * octet_columns))"
diff --git a/modules/by-name/lf/lf/ctpv/prev/any.sh b/modules/by-name/lf/lf/ctpv/prev/any.sh
index 38dfd538..01c31e2b 100644
--- a/modules/by-name/lf/lf/ctpv/prev/any.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/any.sh
@@ -1,16 +1,23 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
w="$w"
# shellcheck disable=SC2269
-e="$e"
+e="${e:-[missing extension]}"
# shellcheck disable=SC2269
-m="$m"
+m="${m:-[missing mime type]}"
# shellcheck disable=SC2269
h="$h"
@@ -19,8 +26,6 @@ extension="$e"
# shellcheck disable=SC2269
mime="$m"
-. %HELPERS
-
is_not_printable() {
grep --text --quiet '[^[:print:]]' "$1"
}
@@ -33,8 +38,8 @@ case "$mime" in
*)
echo "(ctpv did not recognize this file, with extension: '$extension' and mime: '$mime')"
- directory_storage="%STORAGE_DIRECTORY/$mime"
- mkdir --parents "$(dirname "%STORAGE_DIRECTORY/$mime")"
+ directory_storage="$STORAGE_DIRECTORY/$mime"
+ mkdir --parents "$(dirname "$STORAGE_DIRECTORY/$mime")"
printf "%s -- %s\n" "$f" "$extension" >>"$directory_storage"
;;
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh b/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh
index 5f4baac7..2bf8a89f 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh
@@ -1,11 +1,16 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
-. %HELPERS
-
atool --list -- "$f"
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..a5fc2c50 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
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
atool = {
@@ -5,14 +14,19 @@
matches.mime = [
"application/gzip"
"application/java-archive"
+ "application/vnd.android.package-archive"
"application/vnd.debian.binary-package"
"application/x-7z-compressed"
+ "application/x-archive"
"application/x-bzip2"
+ "application/x-cpio"
+ "application/x-lz4"
"application/x-rar"
"application/x-tar"
"application/x-xz"
"application/zip"
"application/zlib"
+ "application/zstd"
];
matches.extension = [
@@ -64,7 +78,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
@@ -80,6 +94,10 @@
pkgs.xz
pkgs.zip
+ pkgs.cabextract
+
+ pkgs.coreutils
+
# Unfree stuff
# pkgs.lha
# pkgs.rar
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix
index 00c7e389..121f419d 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
dll = {
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh b/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh
index 678506eb..6ec68d55 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh
@@ -1,19 +1,24 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
w="$w"
# shellcheck disable=SC2269
-e="$e"
+e="${e:-[missing extension]}"
# shellcheck disable=SC2269
-m="$m"
+m="${m:-[missing mime type]}"
# shellcheck disable=SC2269
h="$h"
-. %HELPERS
-
preview_xxd "$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix
index 40510a78..43e683a9 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
epub = {
@@ -5,11 +14,12 @@
matches.mime = ["application/epub+zip"];
matches.extension = ["epub"];
priority = 1;
- dependencies = with pkgs; [
- bk
- epub-thumbnailer
- chafa
- gnused
+ dependencies = [
+ pkgs.bk
+ pkgs.epub-thumbnailer
+ pkgs.chafa
+ pkgs.exiftool
+ pkgs.gnused
];
};
};
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh b/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh
index 703e7dad..87c33dff 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh
@@ -1,23 +1,28 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
w="$w"
# shellcheck disable=SC2269
-e="$e"
+e="${e:-[missing extension]}"
# shellcheck disable=SC2269
-m="$m"
+m="${m:-[missing mime type]}"
# shellcheck disable=SC2269
h="$h"
# shellcheck disable=SC2269
cache_f="$cache_f"
-. %HELPERS
-
epub() {
epub-thumbnailer "$f" "$cache_f" 20000
}
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix
index d3061ea8..cb96d7a9 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
pdf = {
@@ -5,9 +14,11 @@
matches.mime = ["application/pdf"];
priority = 1;
dependencies = [
- pkgs.poppler_utils # for `pdftoppm`
+ pkgs.poppler-utils # for `pdftoppm`
pkgs.chafa
+ pkgs.exiftool
pkgs.gnused
+ pkgs.coreutils
];
};
};
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh b/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh
index 2f807b1a..2c2e5ff9 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh
@@ -1,15 +1,20 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
cache_f="$cache_f"
-. %HELPERS
-
pdf() {
pdftoppm -f 1 -l 1 \
-scale-to-x 1920 \
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix
index 32f42783..c9001176 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
pgp = {
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh b/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh
index a4eefd96..cfe359ea 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh
@@ -1,13 +1,18 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
w="$w"
-. %HELPERS
-
hide_script_env sq inspect --certifications -- "$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix
index 54b8c29e..ab200dd9 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
sqlite = {
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh
index 07e77a93..2d3a45fe 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh
@@ -1,15 +1,20 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
w="$w"
-. %HELPERS
-
echo "SQLite database. Schema:"
echo
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix
index 504623a0..dfd6911b 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
torrent = {
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh
index 16cfcbcd..38838d2e 100644
--- a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh
@@ -1,13 +1,18 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
cache_f="$cache_f"
-. %HELPERS
-
transmission-show -- "$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix
new file mode 100644
index 00000000..28b69890
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix
@@ -0,0 +1,22 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{pkgs, ...}: {
+ soispha.programs.lf.ctpv.previewers = {
+ pem = {
+ previewer = ./pem.sh;
+ matches.mime = [
+ "application/x-pem-file"
+ ];
+ dependencies = [
+ pkgs.openssl
+ ];
+ };
+ };
+}
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh
new file mode 100644
index 00000000..2948e25a
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh
@@ -0,0 +1,18 @@
+#! /usr/bin/env dash
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# shellcheck disable=SC2269
+f="$f"
+# shellcheck disable=SC2269
+cache_f="$cache_f"
+
+openssl x509 -in "$f" -text -noout
diff --git a/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh b/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh
index c5abc646..22894ca2 100644
--- a/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh
@@ -1,20 +1,25 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
cache_f="$cache_f"
-. %HELPERS
-
audio() {
ffmpegthumbnailer -i "$f" -s 0 -q 5 -t 10 -o "$cache_f" 2>/dev/null
}
-x="$(ffmpeg -hide_banner -i "$f" 2>&1)"
+x="$(ffprobe -hide_banner "$f" 2>&1)"
printf '%s\n' "$x"
y=$((y + $(printf '%s\n' "$x" | wc -l)))
diff --git a/modules/by-name/lf/lf/ctpv/prev/audio/default.nix b/modules/by-name/lf/lf/ctpv/prev/audio/default.nix
index 0c60e9d5..b9d4ff0d 100644
--- a/modules/by-name/lf/lf/ctpv/prev/audio/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/audio/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
audio = {
@@ -5,10 +14,12 @@
matches.mime = ["audio/*"];
dependencies = [
pkgs.ffmpegthumbnailer
- pkgs.ffmpeg
+ pkgs.ffmpeg-headless
pkgs.chafa
+ pkgs.exiftool
pkgs.gnused
+ pkgs.coreutils
];
};
};
diff --git a/modules/by-name/lf/lf/ctpv/prev/default.nix b/modules/by-name/lf/lf/ctpv/prev/default.nix
index b59430f8..d7e420d0 100644
--- a/modules/by-name/lf/lf/ctpv/prev/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
pkgs,
config,
@@ -10,18 +19,15 @@ in {
previewer = ./any.sh;
priority = -1;
matches.mime = ["*/*"];
- replacementStrings = {
- # FIXME: This declaration replaces the default (although it should be merged with
- # the default value.) There must be a way, so that repeating the default values is
- # not needed. <2024-12-15>
- HELPERS = cfg.ctpv.helpers;
-
+ environment = {
STORAGE_DIRECTORY = "${cfg.ctpv.xdgDataHome}/ctpv/missing_previews";
};
dependencies = [
pkgs.tinyxxd # For xxd
pkgs.bat
+ pkgs.gnugrep
+ pkgs.coreutils
];
};
};
diff --git a/modules/by-name/lf/lf/ctpv/prev/font/default.nix b/modules/by-name/lf/lf/ctpv/prev/font/default.nix
index 306e7892..e2ce2cc2 100644
--- a/modules/by-name/lf/lf/ctpv/prev/font/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/font/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
font = {
@@ -5,6 +14,7 @@
matches.mime = [
"font/*"
"application/vnd.ms-opentype"
+ "application/x-font-pf2"
# TODO: This should be added (ext: 'eot') <2024-12-04>
# "application/vnd.ms-fontobject"
@@ -12,7 +22,9 @@
dependencies = [
pkgs.fontforge # for `fontimage`
pkgs.chafa
+ pkgs.exiftool
pkgs.gnused
+ pkgs.coreutils
];
};
};
diff --git a/modules/by-name/lf/lf/ctpv/prev/font/font.sh b/modules/by-name/lf/lf/ctpv/prev/font/font.sh
index 4065557e..49e12ec7 100644
--- a/modules/by-name/lf/lf/ctpv/prev/font/font.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/font/font.sh
@@ -1,15 +1,20 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
cache_f="$cache_f"
-. %HELPERS
-
font() {
fontimage -o "$cache_f.png" "$f" 2>/dev/null &&
mv -- "$cache_f.png" "$cache_f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/image/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/default.nix
index 87fba00c..765c7c83 100644
--- a/modules/by-name/lf/lf/ctpv/prev/image/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/image/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
image = {
@@ -5,6 +14,7 @@
matches.mime = ["image/*"];
dependencies = [
pkgs.chafa
+ pkgs.exiftool
pkgs.gnused
];
};
diff --git a/modules/by-name/lf/lf/ctpv/prev/image/image.sh b/modules/by-name/lf/lf/ctpv/prev/image/image.sh
index b5b97668..d021cbf6 100644
--- a/modules/by-name/lf/lf/ctpv/prev/image/image.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/image/image.sh
@@ -1,11 +1,16 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
-. %HELPERS
-
send_image "$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix
index 90915c84..12e65337 100644
--- a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
svg = {
@@ -7,6 +16,7 @@
dependencies = [
pkgs.imagemagick
pkgs.chafa
+ pkgs.exiftool
pkgs.gnused
];
};
diff --git a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh
index 04a06f56..b16e4fc5 100644
--- a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh
@@ -1,15 +1,20 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
cache_f="$cache_f"
-. %HELPERS
-
svg() {
magick "$f" "jpg:$cache_f"
}
diff --git a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix
index a3394ef4..5af6c501 100644
--- a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
xcf = {
diff --git a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh
index 1603e337..4ad4b34b 100644
--- a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh
@@ -1,15 +1,20 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
cache_f="$cache_f"
-. %HELPERS
-
xcf() {
# TODO: Add this (currently it fails, as gimp lacks the `python-fu` evaluator) <2024-11-25>
true
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/default.nix
deleted file mode 100644
index eaade0f1..00000000
--- a/modules/by-name/lf/lf/ctpv/prev/inode/default.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{pkgs, ...}: {
- soispha.programs.lf.ctpv.previewers = {
- ls = {
- previewer = ./ls.sh;
- priority = 1;
- matches.mime = ["inode/directory"];
- dependencies = [pkgs.coreutils];
- };
- symlink = {
- previewer = ./symlink.sh;
- priority = 1;
- matches.mime = ["inode/symlink"];
- dependencies = [];
- };
- };
-}
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/directory/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/directory/default.nix
new file mode 100644
index 00000000..baf0314f
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/inode/directory/default.nix
@@ -0,0 +1,19 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{pkgs, ...}: {
+ soispha.programs.lf.ctpv.previewers = {
+ ls = {
+ previewer = ./ls.sh;
+ priority = 1;
+ matches.mime = ["inode/directory"];
+ dependencies = [pkgs.coreutils];
+ };
+ };
+}
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/directory/ls.sh b/modules/by-name/lf/lf/ctpv/prev/inode/directory/ls.sh
new file mode 100644
index 00000000..73e036eb
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/inode/directory/ls.sh
@@ -0,0 +1,20 @@
+#! /usr/bin/env dash
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# shellcheck disable=SC2269
+f="$f"
+# shellcheck disable=SC2269
+cache_d="$cache_d"
+# shellcheck disable=SC2269
+cache_f="$cache_f"
+
+ls --color --group-directories-first -- "$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/fifo/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/fifo/default.nix
new file mode 100644
index 00000000..70cb9132
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/inode/fifo/default.nix
@@ -0,0 +1,19 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{...}: {
+ soispha.programs.lf.ctpv.previewers = {
+ fifo = {
+ previewer = ./fifo.sh;
+ priority = 1;
+ matches.mime = ["inode/fifo"];
+ dependencies = [];
+ };
+ };
+}
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/fifo/fifo.sh b/modules/by-name/lf/lf/ctpv/prev/inode/fifo/fifo.sh
new file mode 100644
index 00000000..594d40db
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/inode/fifo/fifo.sh
@@ -0,0 +1,16 @@
+#! /usr/bin/env dash
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# shellcheck disable=SC2269
+f="$f"
+
+printf "<fifo no preview>\n"
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh b/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh
deleted file mode 100644
index f73bd1c2..00000000
--- a/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh
+++ /dev/null
@@ -1,15 +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
-cache_d="$cache_d"
-# shellcheck disable=SC2269
-cache_f="$cache_f"
-
-. %HELPERS
-
-ls --color --group-directories-first -- "$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh b/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh
deleted file mode 100644
index b30957d0..00000000
--- a/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /usr/bin/env dash
-
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
-
-# shellcheck disable=SC2269
-f="$f"
-
-. %HELPERS
-
-#
-# do nothing because in src/ctpv.c some kind of a "preview"
-# is already printed
-#
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/symlink/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/symlink/default.nix
new file mode 100644
index 00000000..0c1cb286
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/inode/symlink/default.nix
@@ -0,0 +1,19 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{...}: {
+ soispha.programs.lf.ctpv.previewers = {
+ symlink = {
+ previewer = ./symlink.sh;
+ priority = 1;
+ matches.mime = ["inode/symlink"];
+ dependencies = [];
+ };
+ };
+}
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/symlink/symlink.sh b/modules/by-name/lf/lf/ctpv/prev/inode/symlink/symlink.sh
new file mode 100644
index 00000000..2629f62a
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/inode/symlink/symlink.sh
@@ -0,0 +1,19 @@
+#! /usr/bin/env dash
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# shellcheck disable=SC2269
+f="$f"
+
+#
+# do nothing because in src/ctpv.c some kind of a "preview"
+# is already printed
+#
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/default.nix
new file mode 100644
index 00000000..670ad38b
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/default.nix
@@ -0,0 +1,19 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{...}: {
+ soispha.programs.lf.ctpv.previewers = {
+ empty = {
+ previewer = ./empty.sh;
+ priority = 1;
+ matches.mime = ["inode/x-empty"];
+ dependencies = [];
+ };
+ };
+}
diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/empty.sh b/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/empty.sh
new file mode 100644
index 00000000..da2cd9a9
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/empty.sh
@@ -0,0 +1,16 @@
+#! /usr/bin/env dash
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# shellcheck disable=SC2269
+f="$f"
+
+printf "<empty file no preview>\n"
diff --git a/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh b/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh
index ec57da0b..ade1038e 100644
--- a/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh
@@ -1,7 +1,14 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
@@ -10,8 +17,6 @@ cache_d="$cache_d"
# shellcheck disable=SC2269
cache_f="$cache_f"
-. %HELPERS
-
doc() {
# File produced by libreoffice
jpg="$(printf '%s\n' "$f" | sed 's|^.*/||; s|\..*$||')"
diff --git a/modules/by-name/lf/lf/ctpv/prev/message/rfc822/default.nix b/modules/by-name/lf/lf/ctpv/prev/message/rfc822/default.nix
new file mode 100644
index 00000000..3cb0fcf5
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/message/rfc822/default.nix
@@ -0,0 +1,26 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{pkgs, ...}: {
+ soispha.programs.lf.ctpv.previewers = {
+ rfc822 = {
+ previewer = ./rfc822.sh;
+ priority = 1;
+ matches.mime = [
+ "message/rfc822"
+ "application/mbox"
+ ];
+ dependencies = [
+ pkgs.coreutils
+ # pkgs.meli
+ # pkgs.util-linux
+ ];
+ };
+ };
+}
diff --git a/modules/by-name/lf/lf/ctpv/prev/message/rfc822/rfc822.sh b/modules/by-name/lf/lf/ctpv/prev/message/rfc822/rfc822.sh
new file mode 100644
index 00000000..228e01b7
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/message/rfc822/rfc822.sh
@@ -0,0 +1,22 @@
+#! /usr/bin/env dash
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# shellcheck disable=SC2269
+f="$f"
+# shellcheck disable=SC2269
+cache_f="$cache_f"
+
+# TODO: Actually use `meli`, currently it will just not produce output, because the script
+# never stops <2026-02-19>
+# hide_script_env meli --config /dev/null view "$f"
+
+cat "$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix b/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix
index 1407386b..6614fa8d 100644
--- a/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{...}: {
soispha.programs.lf.ctpv.extraConfigPre = ''
remove any
diff --git a/modules/by-name/lf/lf/ctpv/prev/text/bat.sh b/modules/by-name/lf/lf/ctpv/prev/text/bat.sh
index be952aea..b20e9cea 100644
--- a/modules/by-name/lf/lf/ctpv/prev/text/bat.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/text/bat.sh
@@ -1,13 +1,18 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
w="$w"
-. %HELPERS
-
preview_bat "$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/text/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/default.nix
index 14e74a4d..868a7460 100644
--- a/modules/by-name/lf/lf/ctpv/prev/text/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/text/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
glow = {
@@ -12,7 +21,13 @@
bat = {
priority = 0;
previewer = ./bat.sh;
- matches.mime = ["text/*"];
+ matches.mime = [
+ "text/*"
+ "application/postscript"
+ "application/javascript"
+ "application/x-setupscript"
+ "application/x-wine-extension-ini"
+ ];
dependencies = [
pkgs.bat
];
diff --git a/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix
index e0fa15bb..f21acd5e 100644
--- a/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
delta = {
diff --git a/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh b/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh
index 6a4e9a4e..d30565df 100644
--- a/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh
@@ -1,11 +1,16 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
-. %HELPERS
-
delta <"$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/text/glow.sh b/modules/by-name/lf/lf/ctpv/prev/text/glow.sh
index 301fe675..2e8d9f58 100644
--- a/modules/by-name/lf/lf/ctpv/prev/text/glow.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/text/glow.sh
@@ -1,15 +1,20 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
w="$w"
-. %HELPERS
-
# Specify the style, to force `glow` to output colors.
# tracking issue: https://github.com/charmbracelet/glow/issues/654
# We can't use `hide_script_env` because of some bespoke reason. (It just forces glow to
diff --git a/modules/by-name/lf/lf/ctpv/prev/text/html/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/html/default.nix
deleted file mode 100644
index 2a7a9a9f..00000000
--- a/modules/by-name/lf/lf/ctpv/prev/text/html/default.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-{pkgs, ...}: {
- # TODO: I might want to use lynx/w3m instead <2024-11-24>
- soispha.programs.lf.ctpv.previewers = {
- elinks = {
- previewer = ./elinks.sh;
- priority = 1;
- matches.mime = ["text/html"];
- dependencies = [
- pkgs.elinks
- ];
- };
- };
-}
diff --git a/modules/by-name/lf/lf/ctpv/prev/text/html/elinks.sh b/modules/by-name/lf/lf/ctpv/prev/text/html/elinks.sh
deleted file mode 100644
index ca0de22e..00000000
--- a/modules/by-name/lf/lf/ctpv/prev/text/html/elinks.sh
+++ /dev/null
@@ -1,18 +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
-w="$w"
-
-. %HELPERS
-
-elinks \
- -dump 1 -dump-width "$w" \
- -no-references -no-numbering <"$f"
-
-# lynx -dump -nonumbers -nolist -width="$w" -- "$f"
-# w3m -dump "$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix
index 7e2ef090..9538c365 100644
--- a/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
jq = {
diff --git a/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh b/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh
index bf807d1d..fa7c47b6 100644
--- a/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh
@@ -1,11 +1,16 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
-. %HELPERS
-
jq --color-output . <"$f"
diff --git a/modules/by-name/lf/lf/ctpv/prev/video/default.nix b/modules/by-name/lf/lf/ctpv/prev/video/default.nix
index f38f61c7..dc51dbdf 100644
--- a/modules/by-name/lf/lf/ctpv/prev/video/default.nix
+++ b/modules/by-name/lf/lf/ctpv/prev/video/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{pkgs, ...}: {
soispha.programs.lf.ctpv.previewers = {
video = {
@@ -6,6 +15,7 @@
dependencies = [
pkgs.ffmpegthumbnailer
pkgs.chafa
+ pkgs.exiftool
pkgs.gnused
];
};
diff --git a/modules/by-name/lf/lf/ctpv/prev/video/video.sh b/modules/by-name/lf/lf/ctpv/prev/video/video.sh
index e42e3612..dac75205 100644
--- a/modules/by-name/lf/lf/ctpv/prev/video/video.sh
+++ b/modules/by-name/lf/lf/ctpv/prev/video/video.sh
@@ -1,15 +1,20 @@
#! /usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
cache_f="$cache_f"
-. %HELPERS
-
video() {
ffmpegthumbnailer -i "$f" -o "$cache_f" -s 0 -t 50% 2>/dev/null
}
diff --git a/modules/by-name/lf/lf/icons.license b/modules/by-name/lf/lf/icons.license
new file mode 100644
index 00000000..eae6a84c
--- /dev/null
+++ b/modules/by-name/lf/lf/icons.license
@@ -0,0 +1,9 @@
+nixos-config - My current NixOS configuration
+
+Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+SPDX-License-Identifier: GPL-3.0-or-later
+
+This file is part of my nixos-config.
+
+You should have received a copy of the License along with this program.
+If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
diff --git a/modules/by-name/lf/lf/keybindings/default.nix b/modules/by-name/lf/lf/keybindings/default.nix
index f624719f..d7f8eb95 100644
--- a/modules/by-name/lf/lf/keybindings/default.nix
+++ b/modules/by-name/lf/lf/keybindings/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
uid,
downloadDir,
@@ -6,53 +15,69 @@
"'\"'" = null;
";" = null;
"\"'\"" = null;
- c = null;
- d = null;
- e = null;
- j = null;
- k = null;
- m = null;
- f = null;
# Sorting
- kn = ":set sortby natural; set info";
- ks = ":set sortby size; set info size";
- kt = ":set sortby time; set info time";
- ka = ":set sortby atime; set info atime";
- kc = ":set sortby ctime; set info ctime";
- ke = ":set sortby ext; set info";
+ # k = null;
+ k = {
+ n = ":set sortby natural; set info";
+ s = ":set sortby size; set info size";
+ t = ":set sortby time; set info time";
+ a = ":set sortby atime; set info atime";
+ c = ":set sortby ctime; set info ctime";
+ e = ":set sortby ext; set info";
+ };
# Searching
l = "search-next";
L = "search-prev";
- # File Openers
- ee = "\$\$EDITOR \"$f\"";
- es = "\$ nvim -S \"$f\"";
+ # File edit
+ # e = null;
+ e = {
+ e = "\$\$EDITOR \"$f\"";
+ s = "\$ nvim -S \"$f\"";
+ };
+
u = "view_file";
- cc = "\$sudo -e \"$f\"";
- fe = "execute";
- fl = "follow_link";
- cp = "set_clipboard_path";
+
+ # f = null;
+ f = {
+ e = "execute";
+ l = "follow_link";
+ };
+
+ # c = null;
+ c = {
+ p = "set_clipboard_path";
+ s = "stripspace";
+ h = "chmod";
+ };
# Archive Mappings
- au = "unarchive";
- aa = "archive";
+ a = {
+ u = "archive_decompress";
+ a = "archive_compress";
+ };
- # Trash Mappings
- dd = "trash";
- jc = "clear_trash";
- jr = "restore_trash";
+ D = {
+ D = "delete";
+ };
+ # d = null;
+ d = {
+ # Trash Mappings
+ d = "trash";
- # Dragon Mapping
- dr = "dragon";
- ds = "dragon-stay";
- di = "dragon-individual";
- #dm = "mvdragon";
- #dc = "cpdragon";
- dl = "dlfile";
+ # Dragon Mapping
+ r = "dragon";
+ s = "dragon_stay";
+ i = "dragon_individual";
+ };
- cs = "stripspace";
+ # j = null;
+ j = {
+ c = "trash_clear";
+ r = "trash_restore";
+ };
# Vim keys
h = "updir";
@@ -62,38 +87,36 @@
# Basic Functions
"." = "set hidden!";
- DD = "delete";
p = "paste";
x = "cut";
y = "copy";
"<enter>" = "open";
- mk = "mk_ln";
- mf = "mk_file";
- me = "mk_file_and_edit";
- md = "mk_dir";
- ms = "mk_scr_default";
- mt = "mk_scr_temp";
+ # m = null;
+ m = {
+ k = "mk_link";
+ f = "mk_file";
+ d = "mk_directory";
+ s = "mk_script";
+ };
+
+ b = {
+ g = "set_wallpaper";
+ };
- ch = "chmod";
- bg = "set_wall_paper";
r = ":rename; cmd-end";
- H = "go_project_base_directory";
R = "reload";
C = "clear";
U = "unselect";
- # Movement
- gjr = "cd ~/.local/share/Trash/files";
- gus = "cd /run/user/${builtins.toString uid}";
-
- gc = "cd ~/.config";
- gl = "cd ~/.local";
- gE = "cd /etc";
- gd = "cd ${downloadDir}";
-
- "gU." = "cd /usr";
- gUs = " cd /usr/share";
+ # (walking) Movement
+ w = {
+ u = "cd /run/user/${builtins.toString uid}";
+ e = "cd /etc";
+ d = "cd ${downloadDir}";
+ t = "cd /tmp";
+ h = "cd_project_root";
+ };
- gt = "cd /tmp";
+ g = "cd_lf_make_map";
}
diff --git a/modules/by-name/lf/lf/module.nix b/modules/by-name/lf/lf/module.nix
index 6dc8e919..0a0e193f 100644
--- a/modules/by-name/lf/lf/module.nix
+++ b/modules/by-name/lf/lf/module.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
pkgs,
config,
@@ -8,7 +17,21 @@
...
}: let
commands = import ./commands {inherit pkgs sysLib shell_library system;};
- keybindings = import ./keybindings {inherit (cfg.keymaps) uid downloadDir;};
+ keybindings_raw = import ./keybindings {inherit (cfg.keymaps) uid downloadDir;};
+
+ process = prefix: attrs:
+ lib.mapAttrsToList (name: value:
+ if (builtins.isAttrs value)
+ then
+ (process name value)
+ ++ [(lib.nameValuePair name null)]
+ else if prefix == null
+ then (lib.nameValuePair name value)
+ else (lib.nameValuePair (prefix + name) value))
+ attrs;
+ keybindings = builtins.listToAttrs (lib.lists.flatten (process null keybindings_raw));
+
+ packages = import ./wrappers {inherit pkgs;};
cfg = config.soispha.programs.lf;
in {
@@ -49,6 +72,11 @@ in {
"lf/colors".source = ./colors;
};
+ programs.zsh.shellAliases = {
+ ll = ". ${lib.getExe packages.ll}";
+ lm = ". ${lib.getExe packages.lm}";
+ };
+
programs.lf = {
enable = true;
@@ -69,31 +97,14 @@ in {
drawbox = true;
- # errorfmt = "\\033[1;91m==> ERROR:\\033[0m\\033[1;93m%s\\033[0m";
errorfmt = "\\033[1;91m%s\\033[0m";
hidden = true; # show hidden files
icons = true;
ifs = "\\n"; # internal field separator for shell commands
#info = "size"; # show the size of a directory
- shell = "sh";
+ shell = "${lib.getExe pkgs.dash}";
shellopts = "-eu"; # e: exit on error; u: error for unset variables
};
- extraConfig = ''
- # Dynamically generate the cd mappings.
- # This code dependends on the fact, that the lf server was started previously
- # and keep running through `autoquit = false`.
- # (Otherwise, the remote command is silently dropped: https://github.com/gokcehan/lf/issues/495)
- &{{
- tmp="$(mktemp)"
- ${lib.getExe pkgs.lf-make-map} --depth 4 generate ~/media ~/repos ~/school >"$tmp"
-
- lf -remote "send $id source $tmp"
- sleep 1
- lf -remote "send $id source $tmp"
-
- rm "$tmp"
- }}
- '';
};
};
};
diff --git a/modules/by-name/lf/lf/wrappers/default.nix b/modules/by-name/lf/lf/wrappers/default.nix
new file mode 100644
index 00000000..7257a66e
--- /dev/null
+++ b/modules/by-name/lf/lf/wrappers/default.nix
@@ -0,0 +1,4 @@
+{pkgs}: {
+ ll = pkgs.callPackage ./ll {};
+ lm = pkgs.callPackage ./lm {};
+}
diff --git a/modules/by-name/lf/lf/wrappers/ll/default.nix b/modules/by-name/lf/lf/wrappers/ll/default.nix
new file mode 100644
index 00000000..6e4ee336
--- /dev/null
+++ b/modules/by-name/lf/lf/wrappers/ll/default.nix
@@ -0,0 +1,18 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{writeShellApplication}:
+writeShellApplication {
+ name = "ll";
+ text = builtins.readFile ./ll.sh;
+
+ # This is sourced in the shell
+ inheritPath = true;
+ bashOptions = [];
+}
diff --git a/modules/by-name/lf/lf/wrappers/ll/ll.sh b/modules/by-name/lf/lf/wrappers/ll/ll.sh
new file mode 100755
index 00000000..9bb314c6
--- /dev/null
+++ b/modules/by-name/lf/lf/wrappers/ll/ll.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env dash
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+[ -d "$XDG_RUNTIME_DIR/ll" ] || mkdir "$XDG_RUNTIME_DIR/ll"
+last_directory="$XDG_RUNTIME_DIR/ll/last_directory"
+
+command lf -last-dir-path="$last_directory" "$@"
+
+dir="$(cat "$last_directory")"
+if ! cd "$dir"; then
+ die "ll: Failed to cd to '$dir'. Does it exist?"
+fi
+
+# vim: ft=sh
diff --git a/modules/by-name/lf/lf/wrappers/lm/default.nix b/modules/by-name/lf/lf/wrappers/lm/default.nix
new file mode 100644
index 00000000..42bdc687
--- /dev/null
+++ b/modules/by-name/lf/lf/wrappers/lm/default.nix
@@ -0,0 +1,18 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{writeShellApplication}:
+writeShellApplication {
+ name = "lm";
+ text = builtins.readFile ./lm.sh;
+
+ # This is sourced in the shell
+ inheritPath = true;
+ bashOptions = [];
+}
diff --git a/modules/by-name/lf/lf/wrappers/lm/lm.sh b/modules/by-name/lf/lf/wrappers/lm/lm.sh
new file mode 100755
index 00000000..71213721
--- /dev/null
+++ b/modules/by-name/lf/lf/wrappers/lm/lm.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env dash
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+die() {
+ echo "ERROR: $1"
+ exit 1
+}
+
+msg() {
+ echo "$1"
+}
+
+if [ -f "$XDG_RUNTIME_DIR/ll/last_directory" ]; then
+ last_dir="$(cat "$XDG_RUNTIME_DIR/ll/last_directory")"
+ cd "$last_dir" || die "$last_dir does not exist!"
+else
+ msg "No last directory saved (try using ll instead)."
+fi
+# vim: ft=sh