Allow user to change applets + make startup an applet

This commit is contained in:
Fierelier 2023-11-18 14:47:26 +01:00
parent 25003e6c87
commit c426f2e9ae
5 changed files with 26 additions and 21 deletions

28
app
View File

@ -1,30 +1,22 @@
#!/usr/bin/env bash
set -e
de_path="$(dirname "$(realpath "$BASH_SOURCE")")"
de_distro="${de_distro:="me.fier.de"}"
de_conf_global="${de_conf_global:="$de_path/user"}"
de_conf_local="${de_conf_local:="$HOME/.config/$de_distro"}"
if ! [ "$1" = "" ]; then
source "$de_path/applets/$1"
if [ "$1" = "source" ]; then
return 0
fi
if [ "$1" = "source" ]; then
return 0
fi
if ! [ -d "$de_conf_local" ]; then
cp -r "$de_conf_global" "$de_conf_local"
fi
while IFS="" read -r de_module || [ -n "$de_module" ]; do
if [ -f "$de_conf_local/modules.d/$de_module/source" ]; then
source "$de_conf_local/modules.d/$de_module/source"
fi
if [ -x "$de_conf_local/modules.d/$de_module/run" ]; then
"$de_conf_local/modules.d/$de_module/run" "$de_conf_local" "$de_module"
fi
if [ -x "$de_conf_local/modules.d/$de_module/exec" ]; then
exec "$de_conf_local/modules.d/$de_module/exec" "$de_conf_local" "$de_module"
fi
done < "$de_conf_local/modules"
if ! [ "$1" = "" ]; then
source "$de_conf_local/applets.d/$1" "${@}"
exit 0
fi
echo "Syntax: \"$0\" <applet> [arg 1] [arg 2] ..."
exit 1

View File

@ -8,7 +8,7 @@ User data is copied from "/opt/me.fier.de/user" to "~/.config/me.fier.de", if it
sudo apt install feh autorandr openbox lxpanel lxrandr pcmanfm lxterminal
sudo ./install
cp -n "~/.xinitrc" "~/.xinitrc.bak"
echo "me.fier.de" >"~/.xinitrc"
echo "me.fier.de start" >"~/.xinitrc"
* Start:
startx

1
applets/logoff → user/applets.d/logoff Normal file → Executable file
View File

@ -4,4 +4,3 @@ while IFS="" read -r de_module || [ -n "$de_module" ]; do
"$de_conf_local/modules.d/$de_module/logoff" "$de_conf_local" "$de_module"
fi
done < "$de_conf_local/modules"
exit 0

1
applets/source → user/applets.d/null Normal file → Executable file
View File

@ -1,2 +1 @@
#!/usr/bin/env bash
return 0

15
user/applets.d/start Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set +e
while IFS="" read -r de_module || [ -n "$de_module" ]; do
if [ -f "$de_conf_local/modules.d/$de_module/source" ]; then
source "$de_conf_local/modules.d/$de_module/source"
fi
if [ -x "$de_conf_local/modules.d/$de_module/run" ]; then
"$de_conf_local/modules.d/$de_module/run" "$de_conf_local" "$de_module"
fi
if [ -x "$de_conf_local/modules.d/$de_module/exec" ]; then
exec "$de_conf_local/modules.d/$de_module/exec" "$de_conf_local" "$de_module"
fi
done < "$de_conf_local/modules"