Dwmbar changes for install to work out of the box

This commit is contained in:
Archie Hilton (thytom) 2019-11-06 14:50:04 +00:00
parent fe6553a134
commit 8b9fb9a9f4
2 changed files with 17 additions and 6 deletions

10
bar.sh
View file

@ -14,19 +14,17 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
if [[ -z $CACHE_DIR ]]; then
MODULES_DIR="/usr/share/dwmbar/modules/"
if [[ -d $CACHE_DIR ]]; then
OUTPUT_CACHE="$CACHE_DIR" OUTPUT_CACHE="$CACHE_DIR"
else else
OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/" OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/"
fi fi
OUTPUT=""
CONFIG_FILE="/home/$USER/.config/dwmbar/config" CONFIG_FILE="/home/$USER/.config/dwmbar/config"
source $CONFIG_FILE source $CONFIG_FILE
OUTPUT=""
get_bar() get_bar()
{ {
for module in $MODULES; do for module in $MODULES; do
@ -46,7 +44,7 @@ run_module()
then then
out="$($CUSTOM_DIR$1)" out="$($CUSTOM_DIR$1)"
else else
out="$($MODULES_DIR$1)" out="$($DEFAULT_MODULES_DIR$1)"
fi fi
if [[ ! "$out" = "" ]]; then if [[ ! "$out" = "" ]]; then

13
dwmbar
View file

@ -16,13 +16,26 @@
VERSION="0.2" VERSION="0.2"
DEFAULT_CONFIG_DIR="/usr/share/dwmbar" DEFAULT_CONFIG_DIR="/usr/share/dwmbar"
export DEFAULT_CONFIG_DIR
DEFAULT_MODULES_DIR="$DEFAULT_CONFIG_DIR/modules" DEFAULT_MODULES_DIR="$DEFAULT_CONFIG_DIR/modules"
export DEFAULT_MODULES_DIR
DEFAULT_BAR_LOCATION="$DEFAULT_CONFIG_DIR/bar.sh" DEFAULT_BAR_LOCATION="$DEFAULT_CONFIG_DIR/bar.sh"
export DEFAULT_BAR_LOCATION
DEFAULT_CONFIG_LOCATION="$DEFAULT_CONFIG_DIR/config" DEFAULT_CONFIG_LOCATION="$DEFAULT_CONFIG_DIR/config"
export DEFAULT_CONFIG_LOCATION
CONFIG_DIR="/home/$USER/.config/dwmbar" CONFIG_DIR="/home/$USER/.config/dwmbar"
export CONFIG_DIR
CUSTOM_DIR="$CONFIG_DIR/custom" CUSTOM_DIR="$CONFIG_DIR/custom"
export CUSTOM_DIR
CONFIG_FILE="$CONFIG_DIR/config" CONFIG_FILE="$CONFIG_DIR/config"
if [[ ! -f "$CONFIG_FILE" ]]; then
CONFIG_FILE=$DEFAULT_CONFIG_LOCATION
fi
export CONFIG_FILE
CACHE_DIR="$HOME/.cache/dwmbar/" CACHE_DIR="$HOME/.cache/dwmbar/"
export CACHE_DIR export CACHE_DIR