From 4f0cba1398690aedfc75b22fa2968b583233db24 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sun, 11 Dec 2016 15:17:59 -0600 Subject: [PATCH] work on bar modules I guess --- env/wm/extras/bar/formatter.bash | 10 ++++++--- env/wm/extras/bar/modules/bl.bash | 27 +++++++++++++++++++++++++ env/wm/extras/bar/modules/clock-bm.bash | 2 +- env/wm/extras/bar/modules/example.bash | 17 ++++++---------- scripts/monitors.sh | 0 variables.bash | 3 +++ 6 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 env/wm/extras/bar/modules/bl.bash mode change 100644 => 100755 scripts/monitors.sh diff --git a/env/wm/extras/bar/formatter.bash b/env/wm/extras/bar/formatter.bash index 18d8b15..2fd1977 100755 --- a/env/wm/extras/bar/formatter.bash +++ b/env/wm/extras/bar/formatter.bash @@ -29,6 +29,10 @@ register_bar_module() { MODULE_DATA[$1]= MODULE_CONTENT[$1]= MODULE_INIT[$1]=$4 + + TYPE_RBM="$(type -t ${MODULE_INIT[$1]})" + TYPE_RBM2="$(type -t ${MODULE_INIT[$3]})" + echo "-----> - $TYPE_RBM - $TYPE_RBM2 -" >> "$BAR_LOG" ${MODULE_INIT[$1]} & PID=$! echo $PID > "$BAR_PATH/modules/$3.pid" @@ -37,19 +41,19 @@ register_bar_module() { export -f register_bar_module for f in "$BAR_PATH/modules/"*-bm.bash; do - # echo -e "$f" >> "$BAR_LOG" for bl in "$BLACKLISTED_BAR_MODULES"; do - if [[ "$f" = "$BAR_PATH/modules/"$bl-bm.bash ]]; then + if [[ "$f" = "$BAR_PATH/modules/""${bl}"-bm.bash ]]; then f="" fi done if [[ -n $f ]]; then + echo -e "$f" >> "$BAR_LOG" source "$f" fi done while read -r line; do - # echo -e "Bar Line: $line" >> "$BAR_LOG" + echo -e "Bar Line: $line" >> "$BAR_LOG" for i in ${!MODULE_MATCH[@]}; do # echo ${!MODULE_MATCH[@]} >> $BAR_LOG if [[ $line == ${MODULE_MATCH[$i]} ]]; then diff --git a/env/wm/extras/bar/modules/bl.bash b/env/wm/extras/bar/modules/bl.bash new file mode 100644 index 0000000..7ec467c --- /dev/null +++ b/env/wm/extras/bar/modules/bl.bash @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +source "$DOTFILES_PATH/variables.bash" +PRIORITY=30505 +MATCH_PREFIX="BM_BL" +MATCH="$MATCH_PREFIX*" + +bar_module_backlight() { + echo -e "%{T-}%{F$COLOR_DARK}lit %{F$COLOR_S5}${1:5}%{F-}" +} +export -f bar_module_backlight + +bar_module_backlight_updater() { + while [ $BAR_RUNNING -eq 1 ]; do + # echo -e "$MATCH_PREFIX""$(xbacklight | sed 's/\.[0-9]*//')" > "$BAR_FIFO" + sleep 5 + done +} +export -f bar_module_backlight_updater + +# Optional: Initialize that module by immediately writing to the FIFO using your +# prefix to show some default information on the bar when it loads. +echo -e "$MATCH_PREFIX"??? > "$BAR_FIFO" + +# Register our module so that it is started once the bar is ready +register_bar_module "$PRIORITY" "$MATCH" "bar_module_backlight" "bar_module_backlight_updater" + diff --git a/env/wm/extras/bar/modules/clock-bm.bash b/env/wm/extras/bar/modules/clock-bm.bash index 3423462..77e4b7e 100644 --- a/env/wm/extras/bar/modules/clock-bm.bash +++ b/env/wm/extras/bar/modules/clock-bm.bash @@ -16,7 +16,7 @@ export -f bar_module_clock bar_module_clock_updater() { while true; do - echo -e "$MATCH_PREFIX""$(date +%H.%M.%S)" > $BAR_FIFO + echo -e "$MATCH_PREFIX""$(date +%H.%M.%S)" > "$BAR_FIFO" sleep 1 done } diff --git a/env/wm/extras/bar/modules/example.bash b/env/wm/extras/bar/modules/example.bash index 0c067c5..3dd73ca 100644 --- a/env/wm/extras/bar/modules/example.bash +++ b/env/wm/extras/bar/modules/example.bash @@ -15,17 +15,12 @@ MATCH="$MATCH_PREFIX*" # should process the first argument (the line from the FIFO) and echo the # desired bar output. bar_module_example() { - # Write the line from the 10th character (cutting off the MATCH_PREFIX) with - # lemonbar's left-align delimiter. - echo -e "%{l}${1:10}" + # Write the line from the 10th character (cutting off the MATCH_PREFIX) + echo -e "${1:10}" } # Export our function so that the formatter script can call it. -export -f bar_module_bspwm - -# Call this handy function for adding the various thing we declared to the -# MODULE_ variables that the formatter script uses. -register_bar_module "$PRIORITY" "$MATCH" "bar_module_example" +export -f bar_module_example # Create a function that will periodically write to the FIFO with the correct # prefix, thereby updating the module. @@ -35,11 +30,11 @@ bar_module_example_updater() { sleep 30 done } - -# Fork that function to a background process. -bar_module_clock_updater & +export -f bar_module_example_updater # Optional: Initialize that module by immediately writing to the FIFO using your # prefix to show some default information on the bar when it loads. echo -e "$MATCH_PREFIX"Loading... > "$BAR_FIFO" +# Register our module so that it is started once the bar is ready +register_bar_module "$PRIORITY" "$MATCH" "bar_module_example" "bar_module_example_updater" diff --git a/scripts/monitors.sh b/scripts/monitors.sh old mode 100644 new mode 100755 diff --git a/variables.bash b/variables.bash index a92bb06..5df73dd 100755 --- a/variables.bash +++ b/variables.bash @@ -41,6 +41,9 @@ source "$DOTFILES_PATH/env/wm/extras/bar/variables.bash" # when we kill bspwm we can export the state to this file export BSPWM_STATE_FILE="$DOTFILES_PATH/bspwm_state.json.tmp" +# disables the clickable launcher buttons for touch or keyboardless devices if 1 +export NO_LAUNCHER_BUTTONS=0 + # this lets our window gap account for the border width # if this is enabled, it is usually so that I can reduce border width on my # desktops with a single chrome window on them so that I can click that tabs at