Added custom modules directory.

Scripts in here override the system ones, and won't get written over
during updates.
This commit is contained in:
Archie Hilton (thytom) 2019-10-21 22:57:45 +01:00
parent a37c7b0f4e
commit 63399b3319
3 changed files with 17 additions and 12 deletions

View file

@ -17,10 +17,10 @@ Modules:
- Mail
- CPU Usage
- Volume Bar (archie)
- Backlight
- Memory Usage
Finished Modules:
- Backlight
- Network
- Volume
- Battery
@ -31,6 +31,6 @@ Finished Modules:
- Time
- Date
Scripts
Scripts:
- Individual module delays.
- Modules that don't output anything shouldn't get a separator.
- Make install script install locally and not for root.

View file

@ -4,6 +4,7 @@
DELAY=5
MODULES_DIR="modules/"
CUSTOM_DIR="modules/custom/"
SEPARATOR=" | "
MODULES="wifi internet bluetooth volume temperature date time battery"
@ -11,7 +12,11 @@ MODULES="wifi internet bluetooth volume temperature date time battery"
run_modules(){
for module in $MODULES; do
[[ ! "$OUTPUT" = "" ]] && OUTPUT="$OUTPUT$SEPARATOR"
OUTPUT="$OUTPUT$(exec $MODULES_DIR$module)"
if [[ -f "$CUSTOM_DIR$module" ]]; then
OUTPUT="$OUTPUT$(exec $CUSTOM_DIR$module)"
elif
OUTPUT="$OUTPUT$(exec $MODULES_DIR$module)"
fi
done
}

View file

@ -2,6 +2,7 @@
CONFIG_DIR="/home/$USER/.config/dwmbar"
MODULES_DIR="$CONFIG_DIR/modules"
CUSTOM_DIR="$MODULES_DIR/custom"
DWMBARRC="$CONFIG_DIR/dwmbarrc"
DWMBAR="/usr/bin/dwmbar"
@ -9,14 +10,13 @@ if [[ ! -f "dwmbar" ]]; then
echo "dwmbar executable not found."
fi
install()
{
cp "./dwmbar" "/usr/bin/dwmbar"
cp "./dwmbar" "/usr/bin/dwmbar"
mkdir -p "$CONFIG_DIR"
mkdir -p "$CUSTOM_DIR"
[[ ! -f "$MODULES_DIR" ]] && cp -r "./modules" "$CONFIG_DIR/modules"
[[ ! -f "$DWMBARRC" ]] && cp "./dwmbarrc" "$DWMBARRC"
}
for script in $(ls modules); do
echo "modules/$script -> $MODULES_DIR/$script"
cp "modules/$script" "$MODULES_DIR/$script"
done
install
[[ ! -f "$DWMBARRC" ]] && cp "./dwmbarrc" "$DWMBARRC"