by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Goosewood
@goosewood
Because the tray behaves as "detached" and is unaffected by the bar when it's not on the same side. But having the tray on the right with an offset also doesn't work because it always spawns on the top right corner. This works fine when everything is on the left of the screen though
Illia Denysenko
@juliancoffee
I've seen one of the Project about Module state machine. What kind of work needs to be done, to implement this? If I understand it correctly, it somewhat blocks implementing format-warn for all modules like CPU, memory, filesystem, etc.
There is some PR, whish stay unmerged since April 20 for the battery module. It is because of this https://github.com/polybar/polybar/projects/7 ?
Patrick Ziegler
@patrick96

@juliancoffee The module state machines are still kind of a vague idea. I toyed around with it a bit polybar/polybar#1963, but I realized that it's better to separate the state of the module itself (running, stopped, etc) from the state of the thing the module is observing (cpu load, temperature, etc), let's call this the data state.

Right now what I'm envisioning is that the module state is managed externally (for example by the controller) and modules are started, stopped, restarted as needed.
The data state is managed by the module base class, each module implementation only needs to declare which states exist, signal events, and define which transitions happen for which event. The base class then determines which format should be used.
This ties in a bit with my polybar/polybar#1752 about custom label names since removing the restriction of which label names are allowed makes it easier for the base class to manage the labels, ramps, etc. in each format.

I think the two ideas can be implemented completely independently. I also think that adding only the data state machines (without arbitrary label names) is already a huge task, so it's probably a good idea to migrate modules one by one to a new system. We could do this for example by subclassing the module class and using that new class as the base for all modules in the new system. Once all modules are migrated, we can merge this subclass back into the module class.
So the first step would be to create this new base class and migrate a single module, a simple one like the cpu module.

@goosewood I could have sworn I answered you already, but the message isn't in the chat. Do you want the tray to be pushed outside of the bar? In general polybar builds from left to right, so everything is pushed to the right. However, the tray on the right will never move, so if there is too much stuff on the bar, the modules on the right will be pushed under the tray instead of the tray moving off the bar.
@ericdallo The network module can't do that. It is either connected or not, nothing in between
Eric Dallo
@ericdallo
Thank you @patrick96 , do you know if that is possible via custom script?
Illia Denysenko
@juliancoffee
@patrick96 How module state machine is connected to get_format() function? We'll add things like warn and critical state to the state machine and update() will change it, and get_format() will choose format depend on state?
Patrick Ziegler
@patrick96
@ericdallo If you can figure out how to tell when a network adapter is connecting, then yes. Though I don't know how to get that information.
Eric Dallo
@ericdallo

@ericdallo If you can figure out how to tell when a network adapter is connecting, then yes. Though I don't know how to get that information.

I see, thank you, I'll take a look

Patrick Ziegler
@patrick96

@juliancoffee That is the way it is currently done, yes. However, each module implementation has to manage its own state, the base class does not help here. Looking at the code again, it may not be feasible to actually move more of the state managing to the base class because right now each format has a different set of labels, ramps and progressbars associated with it. Maybe it would make more sense to first implement the custom label names and only afterwards generalize the state machine.

The reason we want to move the state machine to the base class, is because adding a new format-warn or format-critical to each module adds more or less the same code to every module. This much code duplication is just bloat and will only make it harder to refactor a module. That's why we want to make it easier to just add a new format without having to add too much code. Having no restriction on what labels, ramps, etc. can be in a specific format make this a lot easier.

Illia Denysenko
@juliancoffee
For custom labels, we probably need rework config parser, yes?
Patrick Ziegler
@patrick96
We don't. The config parser doesn't know about what labels or formats are, it just associates keys with string values (and sometimes converts those to other data types). Parsing the labels in a format is done in base.inl in the get_output function. That's probably where this effort needs to start.
Illia Denysenko
@juliancoffee
Thanks, I'll try to look to it.
Patrick Ziegler
@patrick96
I appreciate you looking into this. Let us know if you need anything
Goosewood
@goosewood
@patrick96 https://imgur.com/a/SxfJpcL
idk I if bugged it to get the text to append on the left side but it works. I want to have the tray attached left instead of floating off a little.
Daniel
@kingDaniel2004

guys, I have 2 polybar running on a same device... how i I just hide one of them by calling it?

this command hides both of them, i just want to hide just one

"polybar-msg cmd hide"

Patrick Ziegler
@patrick96
@kingDaniel2004 The polybar-msg command can be called with the -p flag to which you pass the process id of the polybar you want to target: polybar-msg -p <PUT PID HERE> cmd hide
@goosewood I need to see your config for this. This could be caused by a number of things
@goosewood Do you have padding-left set in your bar section?
Goosewood
@goosewood
@patrick96 http://dpaste.com/0CQMW6Z
nope
Daniel
@kingDaniel2004
@patrick96 that worked thanks!
Patrick Ziegler
@patrick96
@goosewood You have set the bar width to 17%, all the modules are on the right and the tray is on the left. That empty space between is the empty part of the bar. If you want the tray to be flush to the left of your modules, you need to put your modules in modules-left
(And also remove tray-offset-x)
boojum
@b00jum_gitlab
Howdy! I'm being driven bonkers trying to set up two polybars on two monitors, with hot-plugging. Here is my hot-plug script and here is bspwmrc. Polybar config is trimmed down defaults - here, and polybar start script is here. When I plug in the second monitory, polybar is being created on it but with desktops 6-0 instead of 1-5, and windows are overlapping it. On the primary monitor, polybar vanishes completely leaving a odd margin in its stead. When I unplug the monitor I get one polybar but again, desktops are arranged 6-0 following by 1-5. Any idea what am I missing here? I just want two separate polybars when I got two monitory plugged in, and one otherwise.
sebastn
@sebastn
Did anyone ever face issues running python script modules for polybar? My python script runs fine in the terminal but shows a traceback error when called within polybar.
Goosewood
@goosewood
@patrick96 ahh okay so there's no way to have a bar on the right side of the screen and have it work though. I suppose having an x offset is a hacky way to get it to render on the right anyways. I'll just see if I can put the tray elsewhere, thanks for taking a look at it!
Patrick Ziegler
@patrick96
@goosewood Yeah, if you want the bar on the right but the tray on the right side of the bar, you would need a bar that automatically resizes from right to left, and polybar can't do that.
@sebastn What's the error? Maybe it's some environment variable that's only set in your terminal but not when polybar starts
Patrick Ziegler
@patrick96
@b00jum_gitlab Are you sure that the right desktops get assigned to HDMI-0? Can you also post the first line in the output of bspc subscribe report when both monitors are connected and polybar shows the wrong thing.
boojum
@b00jum_gitlab
@patrick96 here is the output of bspc subscribe report. HDMI-1 is getting desktops assigned alright - I can switch 1 to 5 but the polybar shows 6 - 0. Desktops on the eDP-1, are created fine as well - I am able to use desktops 6-0. But with eDP-1, there's only weird margin where polybar should be.
Patrick Ziegler
@patrick96
@b00jum_gitlab Can you add label-monitor = %name% and format = <label-state> <label-monitor> to the bspwm module and try again. I suspect that the bar that displays 6-0 is actually the bar that was started on eDP-1. Once polybar is started it stays where it is, in your case the bar on eDP-1 is at 0x0 when you connect the HDMI monitor, the bar started for eDP-1 stays at 0x0, but now 0x0 is the top-left corner of your HDMI monitor.
The solution would be to restart all bars whenever your screen setup changes
Or you could add screenchange-reload = true into the [settings] section. This way, polybar restarts for you
boojum
@b00jum_gitlab
@patrick96 Thanks for your suggestions! I am setting screenchange-reload already, didn't help. I will see about label-monitor and format in few days, I'm traveling right now.
sebastn
@sebastn
@patrick96 - The main problem is that I can't see what the entire traceback error is. It only displays till "Traceback (most recent call last:". I checked the system python env variables and they were returning python3 (as expected). Is it possible to see the entire error (from the python script) or see the python env variable being used by polybar? TIA
Daisy Jornlin
@daisyj_gitlab
I was wondering if there is a way to change my polybar's colors depending on time of day
Patrick Ziegler
@patrick96
@sebastn You can redirect the output of your script to a log file and when you get the error you can check the log file for the entire message
@daisyj_gitlab Polybar can't really dynamically change its colors (unless you use a script to generate all the polybar output). But you could use something like pywal to generate a set of color palettes and restart polybar with different configs throughout the day
Daisy Jornlin
@daisyj_gitlab
gotcha, thanks for answering my question
sebastn
@sebastn
@patrick96 When i run "polybar -l info example" from the terminal, there is no traceback error and the module works as expected. And no errors are shown in the log file either.
Qwerty-Space
@Qwerty-Space
Hi, I'm struggling to get two identical bars working with herbstluftwm. How would I go about doing that?
Patrick Ziegler
@patrick96
@sebastn I meant redirecting the output of your python script. For example exec = script.py >/tmp/log 2>&1
sebastn
@sebastn
@patrick96 Thank you so much for that awesome tip. I redirected the python output and the error was that python module was not found. And when I printed sys.version from the script, it showed GCC 10.1 whereas I expected it to be anaconda. The script was running fine from the terminal as it was always being run by the conda python and all the required modules were installed by default to anaconda. I could not change the environment being used by the script, but I managed to install the missing modules using the "python3.8 -m pip install pandas" command. :) So everything works well now :)
Patrick Ziegler
@patrick96
@sebastn That probably means that polybar doesn't have the same environment variables set when you run it in your startup routine than when you run it in the terminal. In particular, the PATH variable (and probably others) are different. So whatever sets those variable to include conda, probably runs after the wm startup.
ask6155
@ask6155
hello
polybar broke on arch today
libjsoncpp got updated and now polybar doesn't work
x70b1
@x70b1
ask you have to rebuild it
ask6155: ^