diff options
author | Archie Hilton <archie.hilton1@gmail.com> | 2019-10-24 18:13:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-24 18:13:16 +0100 |
commit | bc2772b8a27d3e43f9b6b0437650c8aadff2ac9e (patch) | |
tree | 8cee3194f423775d380347c1af010dcde45c9bdb | |
parent | 9969167112f99287ab9011f085bd6c43114a5b2d (diff) | |
parent | 2d2c78a6d7472081fe9af181fd5e75fb7069d9e6 (diff) |
Merge pull request #2 from thytom/sepconfig
Complete Restructure
-rw-r--r-- | TODO.org | 4 | ||||
-rwxr-xr-x | bar.sh (renamed from dwmbarrc) | 16 | ||||
-rw-r--r-- | config | 20 | ||||
-rwxr-xr-x | dwmbar | 27 | ||||
-rwxr-xr-x | install.sh | 10 |
5 files changed, 52 insertions, 25 deletions
@@ -13,6 +13,10 @@ Each module writes to stdout. - Different file for customizable stuff - dwmbar uses /usr/bin/dwmbarrc if no .config/dwmbar/dwmbarrc exists. - Delay in archupdates module (if minutes divisible by 5/4) +- Add dependencies like bc +- Have default modules in /usr/share/dwmbar and all the modules in the + .config/dwmbar/modules override the default ones (no need to have a custom + module dir) Bugs to fix: None @@ -15,20 +15,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. -DELAY=0.05 -MODULES_DIR="/home/$USER/.config/dwmbar/modules/" -CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/" -SEPARATOR=" | " -PADDING="$USER@$HOSTNAME " + +MODULES_DIR="/usr/share/dwmbar/modules/" OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/" OUTPUT="" -# What modules, in what order -MODULES="mpd weather volumebar wifi internet cpuload temperature battery date time" - -# Modules that require an active internet connection -ONLINE_MODULES="weather internet" +CONFIG_FILE="/home/$USER/.config/dwmbar/config" +source $CONFIG_FILE INTERNET=1 #0 being true @@ -53,7 +47,7 @@ get_bar() done # Uncomment to remove last separator # bar=$(echo $bar | sed 's/.$//g') - echo "$bar$PADDING" + echo "$LEFT_PADDING$bar$RIGHT_PADDING" } run_module() @@ -0,0 +1,20 @@ +#!/bin/bash + +# What modules, in what order +MODULES="mpd weather volumebar wifi internet cpuload temperature date time" + +# Modules that require an active internet connection +ONLINE_MODULES="weather internet" + +# Delay between showing the status bar +DELAY="0.05" + +# Where the custom modules are stored +CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/" + +# Separator between modules +SEPARATOR=" | " + +# Padding at the end and beggining of the status bar +RIGHT_PADDING="$USER@$HOSTNAME " +LEFT_PADDING=" " @@ -15,17 +15,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. -VERSION="0.1" +VERSION="0.2" DEFAULT_CONFIG_DIR="/usr/share/dwmbar" DEFAULT_MODULES_DIR="$DEFAULT_CONFIG_DIR/modules" -DEFAULT_RC_LOCATION="$DEFAULT_CONFIG_DIR/dwmbarrc" +DEFAULT_BAR_LOCATION="$DEFAULT_CONFIG_DIR/bar.sh" +DEFAULT_CONFIG_LOCATION="$DEFAULT_CONFIG_DIR/config" -RC_LOCATION="/home/$USER/.config/dwmbar/dwmbarrc" CONFIG_DIR="/home/$USER/.config/dwmbar" -MODULES_DIR="$CONFIG_DIR/modules" -CUSTOM_DIR="$MODULES_DIR/custom" -DWMBARRC="$CONFIG_DIR/dwmbarrc" +CUSTOM_DIR="$CONFIG_DIR/custom" +CONFIG_FILE="$CONFIG_DIR/config" CACHE_DIR="$CONFIG_DIR/.cache" print_help(){ @@ -37,8 +36,7 @@ print_help(){ copy_usr_to_home(){ [[ ! -d $CONFIG_DIR ]] && cp -r /usr/share/dwmbar $CONFIG_DIR - [[ ! -f $DWMBARRC ]] && cp /usr/share/dwmbar/dwmbarrc $DWMBARRC - [[ ! -d $MODULES_DIR ]] && cp /usr/share/dwmbar/modules $MODULES_DIR + [[ ! -f $CONFIG_FILE ]] && cp /usr/share/dwmbar/config $CONFIG_FILE [[ ! -d $CUSTOM_DIR ]] && mkdir $CUSTOM_DIR [[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR } @@ -54,13 +52,18 @@ check_files(){ exit 1 fi - if [[ ! -f $DEFAULT_RC_LOCATION ]]; then - echo "$DEFAULT_RC_LOCATION does not exist." > /dev/stderr + if [[ ! -f $DEFAULT_BAR_LOCATION ]]; then + echo "$DEFAULT_BAR_LOCATION does not exist." > /dev/stderr exit 1 fi + + if [[ ! -f $DEFAULT_CONFIG_LOCATION ]]; then + echo "$DEFAULT_CONFIG_LOCATION does not exist." > /dev/stderr + exit 1 + fi } -while getopts 'v' flag; do +while getopts 'vc' flag; do case "${flag}" in v) print_help exit 0 ;; @@ -72,5 +75,5 @@ done check_files while :; do - xsetroot -name "$(exec $RC_LOCATION)" + xsetroot -name "$(exec $DEFAULT_BAR_LOCATION)" done @@ -28,12 +28,18 @@ if [[ ! -f "dwmbar" ]]; then fi # Create /usr/share/dwmbar -# Containing example dwmbarrc and modules +# Containing example bar.sh and modules mkdir --parents "/usr/share/dwmbar/" +echo "./modules --> /usr/share/dwmbar/modules" cp -r "./modules" "/usr/share/dwmbar/modules" -cp -r "./dwmbarrc" "/usr/share/dwmbar/dwmbarrc" + +echo "./bar.sh --> /usr/share/dwmbar/bar.sh" +cp "./bar.sh" "/usr/share/dwmbar/bar.sh" + +echo "./config --> /usr/share/dwmbar/config" +cp -r "./config" "/usr/share/dwmbar/config" echo "./dwmbar --> /usr/bin/dwmbar" cp "./dwmbar" "/usr/bin/dwmbar" |