diff options
author | Archie Hilton <archie.hilton1@gmail.com> | 2019-10-25 12:49:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-25 12:49:27 +0100 |
commit | 2b024b483fc754092829a60e16bfc34913d48ea6 (patch) | |
tree | 696430f19ae1ebb4585a911618a73943c2652861 /bar.sh | |
parent | 7cecb2d92b9aa2aa981dd9b2847f3624189f93e8 (diff) | |
parent | 304d4863d1034ea6fb0d5850fd4a3de6c52693fe (diff) |
Merge pull request #4 from thytom/battery-module-fix
Battery module fix
Diffstat (limited to 'bar.sh')
-rwxr-xr-x | bar.sh | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -15,7 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. - MODULES_DIR="/usr/share/dwmbar/modules/" OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/" @@ -41,8 +40,8 @@ get_bar() { for module in $MODULES; do if [[ $INTERNET -eq 0 ]] || [[ $ONLINE_MODULES != *"$module"* ]];then - module_out=$(cat $OUTPUT_CACHE$module | sed 's/\.$//g') - bar=$bar$module_out + module_out="$(cat $OUTPUT_CACHE$module | sed 's/\.$//g')" + bar="$bar$module_out" fi done # Uncomment to remove last separator @@ -60,15 +59,16 @@ run_module() fi [[ ! "$out" = "" ]] && [[ ! "$module" = "NULL" ]] && out="$out$SEPARATOR." - echo $out > "$OUTPUT_CACHE$module" + echo "$out" > "$OUTPUT_CACHE$module" } run() { get_internet for module in $MODULES; do - if [[ $INTERNET -eq 0 ]]; then - run_module $module + pgrep $module &> /dev/null + if [[ $INTERNET -eq 0 ]] && [[ $? -eq 1 ]]; then + run_module $module & else [[ $ONLINE_MODULES != *"$module"* ]] && run_module $module fi |