OB Polybar oddities in latest release

#1

Hi guys,
Sorry if I’m dense or if this has been covered in another thread. In my (weak) defense, i have searched, and have read the latest changelog. That said…

  1. I can no longer change the order of the default modules on the right side of my Openbox Polybar. I see them listed in the ~/.config/polybar/config file and in /etc/skel/.config/polybar/config file, but changing the order in either or both of these and restarting polybar, logout/login, or rebooting the system, leaves me with the same polybar although my changes in those files are saved. Is it not “listening” to me, or is there another file i should be changing? To make matters more weird, “battery” is no longer listed at all in those files, but DOES appear as the first (left) right-side module on both my HP laptop (constantly charging at 97% but never finishes while on AC), and on my Dell laptop (100% when on AC, but the left side of the icon is not visible.)

  2. Updates. The OB icon changes to inform me when # updates are available, but clicking on it now does nothing. After i do the updates, whether by pacman in terminal or pamac-aur update in the menu bar, the # updates doesn’t change until i reboot. Not a big deal, but curious.

Thanks for any info as i try to better understand the new config files of polybar!

0 Likes

#2

This I have seen mentioned somewhere in a similar form in regard to the 2018.12 release. I think it is not a bug but a deliberate change that clicking the update icon now has no function (at least I think I remember someone saying that).
I would delete all config files in the /etc/skel, I think nate mentioned that this is recommended (Can't update Archlabs - AL repo configs?, your first issue might be related to that, as well?). Afterwards, check the update-interval of the polybar module in the “new” config file, maybe there is something wrong there.

0 Likes

#3

If you’re keeping the env wrapper around the modules then that environment variable will be used and the listed bit is just a fallback, just looking at the difference between the two sides would be a good hint as to why it’s only happening on the right :stuck_out_tongue_winking_eye:

modules-left   = jgmenu workspaces
modules-right  = ${env:POLYBAR_MODULES:temperature pkg network volume}

The wrapper allows setting modules externally based on whatever, in this case you’re on a laptop so the battery module is added, this is done by al-polybar-session

# if system is a laptop add the battery module and set a few ENV variables
if hash laptop-detect &>/dev/null && laptop-detect; then
    info="$(ls -1 /sys/class/power_supply/)"

    LAPTOP_ADAPTER="$(awk 'NR==1 {print $0}' <<< "$info")"
    LAPTOP_BATTERY="$(awk 'NR==2 {print $0}' <<< "$info")"

    if [[ -z $POLYBAR_MODULES && -n $LAPTOP_ADAPTER && -n $LAPTOP_BATTERY ]]; then
        if [[ $WM == 'openbox' ]]; then
            POLYBAR_MODULES="battery temperature pkg network volume"
        else
            POLYBAR_MODULES="battery coreuse temperature memory pkg network volume"
        fi
        export POLYBAR_MODULES LAPTOP_ADAPTER LAPTOP_BATTERY
    else
        unset POLYBAR_MODULES LAPTOP_ADAPTER LAPTOP_BATTERY
    fi
fi

You can either not use the wrapped modules and set them manually, don’t use al-polybar-session then the variable won’t exist and the fallback will be used, or copy the polybar-session script to ~/bin or somewhere higher on the path than /usr/bin edit it and it will be run instead due to the way path searching works.


Re the battery bit, configure the module to set charged at the percentage it stops at, this is caused by battery wear/tear or the manufacturer limiting it’s charge to reduce wear/tear, that’s why polybar has the setting to change the “full” level. This isn’t messed with by anything and you should just be able to configure it and have it show up when used.

From the polybar wiki’s battery module page

; This is useful in case the battery never reports 100% charge
full-at = 99


As for #2 the change was deliberate however they’re your files now man feel free to change them how you like, want the update script to check more frequently then change the sleep timers in ~/bin/updates.sh, want to click and open a terminal to update then add a click wrapper around the label that opens your terminal with whatever command you like, here’s the old pkg module with click intact

[module/pkg]
type = custom/script
exec = updates.sh
exec-if = "ping -q -w 2 -c 1 176.34.135.167 > /dev/null"
label = %{A1:termite -e "sudo pacman -Syyu" & disown:} %{A3:termite -e "sudo pacman -Syyu" & disown:}%output%%{A} %{A}
tail = true

All of this stuff is well documented already, below is a link to the ‘action’ tag section of the wiki.

Cheers

2 Likes

#4

Oi, i was really dense on this one! Thanks much guys!

0 Likes