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 - Mail
- CPU Usage - CPU Usage
- Volume Bar (archie) - Volume Bar (archie)
- Backlight
- Memory Usage - Memory Usage
Finished Modules: Finished Modules:
- Backlight
- Network - Network
- Volume - Volume
- Battery - Battery
@ -31,6 +31,6 @@ Finished Modules:
- Time - Time
- Date - Date
Scripts Scripts:
- Individual module delays. - 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 DELAY=5
MODULES_DIR="modules/" MODULES_DIR="modules/"
CUSTOM_DIR="modules/custom/"
SEPARATOR=" | " SEPARATOR=" | "
MODULES="wifi internet bluetooth volume temperature date time battery" MODULES="wifi internet bluetooth volume temperature date time battery"
@ -11,7 +12,11 @@ MODULES="wifi internet bluetooth volume temperature date time battery"
run_modules(){ run_modules(){
for module in $MODULES; do for module in $MODULES; do
[[ ! "$OUTPUT" = "" ]] && OUTPUT="$OUTPUT$SEPARATOR" [[ ! "$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 done
} }

View file

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