From 9bf27a7919504d1f0da8d3f124a3c58ec2a12985 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 23 Mar 2025 23:38:17 +0100
Subject: [PATCH] Reorganize.

---
 testing/home/all/.bashrc                                    | 3 ++-
 .../.nonpath_bins/{plomlib.sh => plomlib.file_dot_variants} | 4 +---
 testing/home/all/.profile                                   | 6 ++----
 testing/home/desktop/.local/bin/borgplom                    | 3 +--
 testing/home/desktop/.local/bin/vol                         | 3 +--
 .../home/desktop/.nonpath_bins/plomlib.audio_dev_is_mute    | 3 +++
 .../{plomlib.sh.desktop => plomlib.get_passphrase}          | 4 ----
 testing/home/t490s/.nonpath_bins/status.sh                  | 3 +--
 testing/scripts/setup_secrets.sh                            | 3 +--
 9 files changed, 12 insertions(+), 20 deletions(-)
 rename testing/home/all/.nonpath_bins/{plomlib.sh => plomlib.file_dot_variants} (54%)
 create mode 100644 testing/home/desktop/.nonpath_bins/plomlib.audio_dev_is_mute
 rename testing/home/desktop/.nonpath_bins/{plomlib.sh.desktop => plomlib.get_passphrase} (56%)

diff --git a/testing/home/all/.bashrc b/testing/home/all/.bashrc
index 851118b..115837e 100644
--- a/testing/home/all/.bashrc
+++ b/testing/home/all/.bashrc
@@ -25,4 +25,5 @@ PS3="${tput_color}select: ${tput_reset}"
 PS4="${tput_color}+ ${tput_reset}"
 
 # include others
-dot_shell_file_variants "${HOME}/\.bashrc"
+. "${HOME}/.nonpath_bins/plomlib.file_dot_variants"
+file_dot_variants "${HOME}/\.bashrc"
diff --git a/testing/home/all/.nonpath_bins/plomlib.sh b/testing/home/all/.nonpath_bins/plomlib.file_dot_variants
similarity index 54%
rename from testing/home/all/.nonpath_bins/plomlib.sh
rename to testing/home/all/.nonpath_bins/plomlib.file_dot_variants
index a5b1cb0..1c1bf69 100644
--- a/testing/home/all/.nonpath_bins/plomlib.sh
+++ b/testing/home/all/.nonpath_bins/plomlib.file_dot_variants
@@ -1,9 +1,7 @@
-dot_shell_file_variants () {
+file_dot_variants() {
     for FILE in ${1}\.*; do
         if [ -f "${FILE}" ]; then
             . "${FILE}"
         fi
     done
 }
-
-dot_shell_file_variants "${HOME}/.nonpath_bins/plomlib.sh"
diff --git a/testing/home/all/.profile b/testing/home/all/.profile
index fb0e2a4..d4f1e09 100644
--- a/testing/home/all/.profile
+++ b/testing/home/all/.profile
@@ -7,9 +7,6 @@
 # useful for providing environment variables to non-shell applications started
 # within a login session.
 
-# for: dot_shell_file_variants
-. "${HOME}"/.nonpath_bins/plomlib.sh
-
 eval $(ssh-agent) && ssh-add
 
 PATH_BASHRC="${HOME}/.bashrc"
@@ -22,4 +19,5 @@ PATH_LOCAL_BIN="${HOME}/.local/bin"
 export PATH
 
 # include others
-dot_shell_file_variants "${HOME}/\.profile"
+. "${HOME}/.nonpath_bins/plomlib.file_dot_variants"
+file_dot_variants "${HOME}/\.profile"
diff --git a/testing/home/desktop/.local/bin/borgplom b/testing/home/desktop/.local/bin/borgplom
index 8a9eead..d9511b4 100755
--- a/testing/home/desktop/.local/bin/borgplom
+++ b/testing/home/desktop/.local/bin/borgplom
@@ -1,8 +1,7 @@
 #!/bin/sh
 set -e
 
-. "${HOME}/.nonpath_bins/plomlib.sh"
-# for: get_passphrase
+. "${HOME}/.nonpath_bins/plomlib.get_passphrase"
 
 PATH_BORGKEYS="${HOME}/.config/borg/keys"
 NAME_REPO=borg
diff --git a/testing/home/desktop/.local/bin/vol b/testing/home/desktop/.local/bin/vol
index 0ae8077..cf49262 100755
--- a/testing/home/desktop/.local/bin/vol
+++ b/testing/home/desktop/.local/bin/vol
@@ -1,8 +1,7 @@
 #!/bin/sh
 set -e
 
-. "${HOME}/.nonpath_bins/plomlib.sh"
-# for: audio_dev_is_mute
+. "${HOME}/.nonpath_bins/plomlib.audio_dev_is_mute"
 
 MAX_LOUDNESS=150
 
diff --git a/testing/home/desktop/.nonpath_bins/plomlib.audio_dev_is_mute b/testing/home/desktop/.nonpath_bins/plomlib.audio_dev_is_mute
new file mode 100644
index 0000000..e28da40
--- /dev/null
+++ b/testing/home/desktop/.nonpath_bins/plomlib.audio_dev_is_mute
@@ -0,0 +1,3 @@
+audio_dev_is_mute() {
+    [ "$(pactl get-sink-mute 0)" = "Mute: yes" ]
+}
diff --git a/testing/home/desktop/.nonpath_bins/plomlib.sh.desktop b/testing/home/desktop/.nonpath_bins/plomlib.get_passphrase
similarity index 56%
rename from testing/home/desktop/.nonpath_bins/plomlib.sh.desktop
rename to testing/home/desktop/.nonpath_bins/plomlib.get_passphrase
index e50a77b..6e3f0ff 100644
--- a/testing/home/desktop/.nonpath_bins/plomlib.sh.desktop
+++ b/testing/home/desktop/.nonpath_bins/plomlib.get_passphrase
@@ -4,7 +4,3 @@ get_passphrase() {
     stty echo
     printf "${PASSPHRASE}"
 }
-
-audio_dev_is_mute() {
-    [ "$(pactl get-sink-mute 0)" = "Mute: yes" ]
-}
diff --git a/testing/home/t490s/.nonpath_bins/status.sh b/testing/home/t490s/.nonpath_bins/status.sh
index e353f69..9794d2e 100755
--- a/testing/home/t490s/.nonpath_bins/status.sh
+++ b/testing/home/t490s/.nonpath_bins/status.sh
@@ -2,8 +2,7 @@
 # see sway-bar(5) and swaybar-protocol(7)
 set -e
 
-. "${HOME}/.nonpath_bins/plomlib.sh"
-# for: audio_dev_is_mute
+. "${HOME}/.nonpath_bins/plomlib.audio_dev_is_mute"
 
 SYSCLASS_DIR=/sys/class
 
diff --git a/testing/scripts/setup_secrets.sh b/testing/scripts/setup_secrets.sh
index ea80501..6135927 100755
--- a/testing/scripts/setup_secrets.sh
+++ b/testing/scripts/setup_secrets.sh
@@ -14,8 +14,7 @@ cd $(dirname "$0")
 # - PATH_USER_HOME
 # - USERNAME
 
-. "${PATH_USER_HOME}/.nonpath_bins/plomlib.sh.desktop"
-# for: get_passphrase
+. "${PATH_USER_HOME}/.nonpath_bins/plomlib.get_passphrase"
 
 PATH_REL_SECRETS=to_usb
 export PATH_SECRETS="${PATH_USER_HOME}/${PATH_REL_SECRETS}"
-- 
2.30.2