Created a uniform interface accross all session scripts

This commit is contained in:
Sasha Koshka 2024-02-01 00:46:39 -05:00
parent 794f7216cd
commit 463be06955
5 changed files with 56 additions and 8 deletions

View File

@ -1,5 +1,14 @@
#!/bin/sh
name=`basename "$0"`
usage() {
echo "Usage: $name" >&2
exit 2
}
[ "$#" -gt 0 ] && usage
# basic Xmd environment variables
export XMD_SESSION_PID="$$"
export XMD_USERDIR="${HOME}/.Xmd"
@ -23,7 +32,7 @@ appDefaults="${XMD_USERDIR}/app-defaults"
if [ -d "$appDefaults" ]; then
export XAPPLRESDIR="$appDefaults"
else
echo "!!! cant find $appDefaults"
echo "$name cant find $appDefaults" >&2
fi
xmd-load-wallpaper
@ -33,7 +42,7 @@ if [ -d "$startupDir" ]; then
export XMD_STARTUPDIR="$startupDir"
xmd-run-startup-items
else
echo "!!! cant find $startupDir"
echo "$name cant find $startupDir" >&2
fi
sleep infinity

View File

@ -1,7 +1,16 @@
#!/bin/sh
name=`basename "$0"`
usage() {
echo "Usage: $name" >&2
exit 2
}
[ "$#" -gt 0 ] && usage
if [ -z "$XMD_SESSION_PID" ]; then
echo "ERR session is not running (\$XMD_SESSION_PID not set)"
echo "$name: session is not running (\$XMD_SESSION_PID not set)" >&2
exit 1
fi

View File

@ -21,6 +21,7 @@ usage() {
[ "$#" -gt 0 ] && usage
echo $configFilePath
if type "$configFilePath" > /dev/null; then
color="black"

View File

@ -1,10 +1,30 @@
#!/bin/sh
xrdb -remove
name=`basename "$0"`
xResources="${XMD_USERDIR}/Xresources"
isInstalled() {
type "$1" > /dev/null
}
mustHaveInstalled() {
if ! isInstalled "$1"; then
echo "$name: $1 is not installed" >&2
exit 1
fi
}
usage() {
echo "Usage: $name" >&2
exit 2
}
[ "$#" -gt 0 ] && usage
cd ~
if [ -r "$xResources" ]; then
mustHaveInstalled xrdb
xrdb -cpp /usr/bin/cpp < "$xResources"
else
echo "!!! can't find $xResources"
echo "$name: can't find $xResources" >&2
fi

View File

@ -1,10 +1,19 @@
#!/bin/sh
name=`basename "$0"`
usage() {
echo "Usage: $name" >&2
exit 2
}
[ "$#" -gt 0 ] && usage
if [ -z "$XMD_STARTUPDIR" ]; then
echo "!!! \$XMD_STARTUPDIR not set"
echo "$name \$XMD_STARTUPDIR not set" >&2
exit 1
fi
for item in $XMD_STARTUPDIR/*; do
for item in "$XMD_STARTUPDIR"/*; do
if [ -x "$item" ]; then
"$item" &
fi