Open CaptaiNiveau opened 9 months ago
The things you need to add are pretty similar across the different bar components and you can pretty much copy-paste and then adapt them accordingly. Since I'm guessing you want a slider, you can probably look for the implementation(s) of the audio widget. Quick explanation of the parts that need to be modified for new widgets (and some design quirks):
style/style.scss
: That's where the default css lives (Beware that gBar never reads the style/*
files, so you need to copy them inside /usr/share
or ~/.local/share/
for testing. And don't forget to generate the css file with sass)src/Bar.cpp
: The definition of the bar. The methods for updating the bar live inside the Bar::DynCtx namespace and the definition of the gtk layout (which is immutable!) are inside the methods called Widget***
(e.g. WidgetAudio for the Audio widget)src/System.[h,cpp]
: The methods for polling and modifying system state(e.g. reading and writing screen brightness). For reading GetBatteryPercentage
is a good starting point. For writing I don't have a good starting point, but I'd imagine you can just write to the brightness control file (Beware permissions!)src/Config.[h,cpp]
: Where the config variables live and are parsed (The AddConfigVar
block is the interesting part for you). RuntimeConfig controls the widgets which are available (e.g. if the BlueZ module fails inside System::InitBluetooth
, the bluetooth widget is disabled and not shown). You probably want something similar if permissions fail (Or no backlight is detected at the user-specified location).data/config
: Default config, not much to say (Like css/style.*
, This is also never read by gBar). If you also want to add a flyin similar to the audio one (gBar audio 0
), you need to modify src/gBar.cpp
and add files similar to src/AudioFlyin.[h,cpp]
brightness on my laptops' integrated screen and my LG TV
Beware, that gbar currently only allows one instance of a widget, due to the way gbar is designed.
Regarding discord, can you send me an email with your handle?
Sent the E-Mail.
Yeah I already checked out the repository a bit to fix an issue with the battery widget, which I wanted to PR but you were too fast and fixed it yourself :D
I don't need multiple brightness widgets rn, I was talking about my laptop and desktop separately. For my TV I need to call a CLI to remotely control the TV over LAN, so I have to include an option to call a script with the brightness value and also a script to retrieve it.
I'm a bit annoyed with the way the sliders work, as they shift all the other items around and using my laptops' trackpad it's sometimes a bit annoying to hit the volume slider and get it to 0 (on desktop I can just scroll on it with my mouse). After this I might try to maybe add another style where you open a drop down, probably similar to a lot of other bars. There's also some other ideas I'd like to implement which I'll talk to you on Discord, if you want to.
Any update on that?
Hi!
I've been using this bar for a few months now and been quite happy. Recently I've noticed myself setting the screen brightness manually in the terminal quite often and thought that it'd be nice to integrate it into the bar.
I'd like to contribute to this project and do this myself (I want to learn C++ with that, too). Can you guide me a tad on what I should look out for? I know how to change the brightness on my laptops' integrated screen and my LG TV and would like to abstract that somehow in the config to a reasonable degree.
Do you have discord by chance? Thanks.