Commit graph

133 commits

Author SHA1 Message Date
scorpion-26
7567465454 Refactor Wayland code out 2023-06-15 13:25:19 +02:00
scorpion-26
f2dc5a806c Log workspace dispatching 2023-06-15 00:23:02 +02:00
scorpion-26
1f56e6ba15 Greatly reduce clipping when CenterTime is set
Giving each main box element (left, center, right) caused the window to
resize and clip out of the monitor when
e.g. the right part was larger than the 1/3 of the window.

Now we have a size for the center widget and try to manually center a box with
that size by setting the left widget's size accordingly. This allows the
right widget to have more room, so it can go right up to the center widget without issues.
2023-06-10 23:50:09 +02:00
scorpion-26
a34ffd8334 Add Window::GetWidth() 2023-06-10 23:49:13 +02:00
scorpion-26
6815d8e017 Initialise GTK early 2023-06-10 23:49:13 +02:00
scorpion-26
2a66f1d64c Format BluetoothDevices.cpp 2023-06-10 23:49:13 +02:00
faulTTY
9aa310fd07
Make datetime format configurable (#18)
Co-authored-by: Sciu-Crak <sciu-crak@crak-tower.ironyworld>
Co-authored-by: FaulTTY <faultty@localhost>
2023-05-26 08:57:02 +02:00
scorpion-26
77924b5097 Add confirmation to power PowerWidget
For it to actually do something, we need to click twice within 2s. The
clicked button also changes color for visual indication on what was
pressed

See https://github.com/scorpion-26/gBar/issues/17
2023-05-23 22:40:03 +02:00
scorpion-26
c51fadbc79 Consider capacity for battery sensor 2023-05-10 13:08:17 +02:00
scorpion-26
80ade2b06e Fix inconsistent whitespace 2023-05-05 23:13:35 +02:00
scorpion-26
259083a904 Fix off by one error in default update script 2023-05-05 12:47:40 +02:00
scorpion-26
1c6cd3bd2b Update more icons
Seems like I missed some in the first round
2023-05-04 23:26:30 +02:00
scorpion-26
e9c9d3abb1 SNI: Add Icon positioning config options 2023-05-04 16:14:18 +02:00
scorpion-26
79e78826e0 SNI: Only add to clientsToQuery once 2023-05-04 15:04:06 +02:00
scorpion-26
31e070a3da SNI: Add config 2023-05-04 13:57:50 +02:00
scorpion-26
b7a92e50d9 SNI: Add context menu
Since it uses a 13 year old library, it is broken. The popup size is
hard-fixed at 200x200, with looks really ugly with non-transparent
background.
2023-05-04 13:57:50 +02:00
scorpion-26
40115befdd SNI: Improve logging 2023-05-04 13:57:50 +02:00
scorpion-26
25912c7e35 SNI: Add tooltip 2023-05-04 13:57:50 +02:00
scorpion-26
6bd5a450b1 SNI: Implement changing properties 2023-05-04 13:57:50 +02:00
scorpion-26
b50ecb0f6c SNI: Fix freeze when connecting to Qt SNI apps
Qt waits until the callback to RegisterItem is done. Thus, we can't
query the item and need to defer it
2023-05-04 13:57:50 +02:00
scorpion-26
a02bce9b91 SNI: Remove items on bus name vanish 2023-05-04 13:57:50 +02:00
scorpion-26
d4ffac395b SNI: Proper alignment for the icons 2023-05-04 13:57:50 +02:00
scorpion-26
1241d7c87c SNI: Initial proof of concept
Implements a rough outline of the SNI (StatusNotifierItem) d-bus
protocol for tray icons.

Note: This is currently *very* WIP

Full implementation will close https://github.com/scorpion-26/gBar/issues/5
2023-05-04 13:57:50 +02:00
scorpion-26
05e7635c80 Fix CI 2023-05-04 13:53:15 +02:00
scorpion-26
ecc52a81a5 Update all deprecated Material Design icons
All Material Design icons should now use their new code points.
This unbreaks gBar with Nerd Fonts v3.0.0
2023-05-03 23:21:21 +02:00
scorpion-26
be47a62880 Properly escape the default package command
/bin/sh would remove any newlines without ""
2023-05-03 23:20:29 +02:00
scorpion-26
c101449ba6 Allow Package widget to be anywhere 2023-05-03 19:02:26 +02:00
scorpion-26
aa08206e4b Fix default packages command 2023-05-03 19:00:39 +02:00
scorpion-26
299b497748 Add package widget
Polling is done via user script and a pipe. Since it is only run every
5 minutes by default, this should be fine

Partially implements https://github.com/scorpion-26/gBar/issues/14
2023-05-03 18:40:45 +02:00
scorpion-26
3517fa5de8 Widget: Fix delayed "SetText" 2023-03-25 21:15:35 +01:00
scorpion-26
507cf222fb Audio: Add Min/Max volume
AudioMinVolume/AudioMaxVolume remap the range 0%-100% to
AudioMinVolume-AudioMaxVolume

https://github.com/scorpion-26/gBar/issues/13
2023-03-21 22:09:56 +01:00
scorpion-26
d6610f2594 Config: Support double values 2023-03-21 22:08:59 +01:00
scorpion-26
2fa23a2d54 Audio: Log SetVolume*** events 2023-03-21 17:49:30 +01:00
scorpion-26
c2c38dcae7 Workspaces: Add config option for Hyprland IPC
ext_workspace wasn't as perfect of a replacement as I thought it was...
2023-03-11 00:24:50 +01:00
scorpion-26
78107f16fa Always activate first x monitors
The workspace of a second monitor would not be activated, so
lastActiveWorkspace of that would be nullptr. This would also happen for
the first monitor (First and second swapped)
after Hyprland boot.

Now the WS of the first monitor is fully activated by default and every
other monitor has at least lastActiveWorkspace set (Assumes, that WS
with MonID + 1 is on that monitor).
2023-03-05 20:30:43 +01:00
scorpion-26
f2bc8e00c8 Fix late update SetText 2023-03-04 22:07:25 +01:00
scorpion-26
ad92b7c12a Workspaces: Implement ext_workspace protocol
Even though it isn't faster than Hyprland IPC, it still is more flexible
and more future proof.

Closes https://github.com/scorpion-26/gBar/issues/8
2023-03-03 20:46:37 +01:00
scorpion-26
660e690195 Cache SetText
Apparently, gtk_button_set_label is very expensive to do. Now it is
only called when necessary.

This is the culprit for the mysterious high CPU usage and not the Hyprland
IPC as said in https://github.com/scorpion-26/gBar/issues/7 and https://github.com/scorpion-26/gBar/issues/8.
2023-03-03 17:02:59 +01:00
scorpion-26
d8eae96e50 Widgets: Avoid redraws by reducing gtk calls 2023-02-24 22:34:30 +01:00
scorpion-26
e1cf8f2475 PulseAudio: Optimizations
Instead of always polling audio volume, gBar subscribes to events,
causing the update to only happen on demand.
Plus we can block poll updates when there is audio change through gBar,
which results in a much smoother slider.

This change reduces (at least on my end) CPU times from 4-6% per core
to 2-4% per core.
2023-02-24 14:34:11 +01:00
scorpion-26
38116636ae Workspaces: Optimize GetStatus
We previously called DispatchIPC 18 times every 100ms
Now it is only 2 times per 100ms
2023-02-24 13:28:09 +01:00
scorpion-26
35a6670868 Fix issue with audio slider
Due to the fact, that we needed to manually propagate hover events from
the slider, two hover events are sent when coming from the side of the
slider. This we need to await BOTH close events until we can call the
leave function.
2023-02-22 17:23:47 +01:00
scorpion-26
3c8c93d774 Add Microphone support
This commit adds a new widget for the bar: A Microphone widget. It is
disabled by default and can can
be enabled with AudioInput: true.
Implements a flyin as well.

https://github.com/scorpion-26/gBar/issues/5 for the ping
2023-02-22 17:13:14 +01:00
scorpion-26
f5adfebfe9 PulseAudio: Improve iterator loop
We now store sthe pa_operation and check if they were done'd, cancelled or still running.
2023-02-21 22:47:30 +01:00
scorpion-26
16933c24ff Add log file
Plus refactoring out the logging.
2023-02-21 22:20:02 +01:00
scorpion-26
0e4b877654 PulseAudio: Make FlushLoop more robust
When PA_CONTEXT_READY is called multiple times, PulseAudio::FlusLoop() would get stuck to to integer underflow.
Now there are multiple things preventing that.

Possible fix for https://github.com/scorpion-26/gBar/issues/7
2023-02-21 21:19:22 +01:00
scorpion-26
60b9355e88 System: Don't crash when dbus isn't installed. 2023-02-21 11:39:39 +01:00
scorpion-26
a12cb9af5d AudioSlider: Add option for scroll speed
There seems to be a floating point error somewhere though, since
sometimes it goes up by AudioScrollSpeed - 1 instead of
AudioScrollSpeed...

For the ping https://github.com/scorpion-26/gBar/issues/5
2023-02-20 23:04:37 +01:00
scorpion-26
906a1259c3 Add Net sanity checking
This disables network if the tx_bytes file is not found on Init()
2023-02-12 20:45:05 +01:00
scorpion-26
35b7065879 Implement Workspace scroll
Scrolling the workspace widgets now scroll through the workspaces. The
exact behaviour is governed by
'WorkspaceScrollOnMonitor'(either 'm[+/-]1' or 'e[+/-]1'). The direction
can be inverted with 'WorkspaceScrollInvert'.

For the ping: https://github.com/scorpion-26/gBar/issues/5
2023-02-12 14:57:32 +01:00
scorpion-26
c29d752cb8 EventBox: Fix fault callback parameter. 2023-02-12 14:56:59 +01:00
scorpion-26
b4dfaa62b1 EventBox: Add scroll event 2023-02-12 14:28:46 +01:00
scorpion-26
3134c82245 Add a Network Widget
This new widget visualizes the up and download speeds for a
specified network adapter. It is on by default, but can be disabled.
2023-02-10 17:20:26 +01:00
scorpion-26
c901b59ab4 Add missing files
I accidently forgot to add them when commiting 883037029f
2023-02-10 17:14:57 +01:00
scorpion-26
f916b00de7 Fix bogus comment removal
The previous substr call would remove everything but the comment, which
    is not what we want.
2023-02-10 17:10:35 +01:00
scorpion-26
883037029f Refactor CSS out of Window.cpp
It has nothing to do with *windows* and obviously doesn't belong there.
Plus I don't know whether I may need static access to the provider.
2023-02-09 16:16:18 +01:00
scorpion-26
9e48830dc8 Abstract out quad calculation from Sensor
The calculation of the bounding quad is now in CairoArea, as it is quite
useful
2023-02-09 16:16:18 +01:00
scorpion-26
902f445757 Abstract out the cairo drawing area
And rename CairoSensor to Sensor
2023-02-04 16:09:08 +01:00
scorpion-26
c0038d83b8 Add audio revealer
This adds an option to hide the audio slider behind a revealer, which
works similar to the sensors.
For the ping: https://github.com/scorpion-26/gBar/issues/5
2023-02-04 15:48:06 +01:00
scorpion-26
df1e62f501 Revealer + slider combi now works as intended 2023-02-04 15:43:51 +01:00
scorpion-26
78f3119544 Fix issues with opening the bluetooth widget
On my system, the bluetooth widget wouldn't execute the first time the
button is clicked. This probably due to the fact I forgot a NULL at the
end of the execl call. Now I just call system and "call" it a day
2023-02-04 15:33:06 +01:00
scorpion-26
7f867aa0fb Initial impl for audio revealer
System events are now propagated to the slider. Problems: Rest of the
revealers don't work...
2023-02-04 15:07:05 +01:00
scorpion-26
4373ab7654 AMD GPU: Add temperature
That should be it for the AMD GPU part of https://github.com/scorpion-26/gBar/issues/5
2023-01-30 20:43:24 +01:00
scorpion-26
27bb118d9a Initial AMD GPU implementation
Partially implements https://github.com/scorpion-26/gBar/issues/5
The spammy logs will remain, until it is confirmed, that it works.
2023-01-30 17:23:28 +01:00
scorpion-26
812e689c77 Disable opt. dependencies dynamically
This lifts the requirement of needing to disable the dependencies by
hand if you don't have them installed.
It also enables us to have a single package, that works for all.
2023-01-30 16:58:38 +01:00
scorpion-26
dce92a63f8 Add option to not center the time
Setting this will make https://github.com/scorpion-26/gBar/issues/4 less
likely.
2023-01-29 21:31:00 +01:00
scorpion-26
e38f27b784 Improve the configuration language
Plus it is now much easier to add new config variables
2023-01-29 17:42:32 +01:00
scorpion-26
7cc929f773 Refactored out config 2023-01-29 16:47:50 +01:00
scorpion-26
dfae74e169 Switch audio loop to late dispatch 2023-01-29 12:43:05 +01:00
scorpion-26
3c6850b530 Fix regressions caused by immediate dispatch 2023-01-29 12:36:29 +01:00
scorpion-26
3473da36f4 Widget: Add immediate timer dispatch
gLib will not immediately run the callback after the timeout has been
added.
This caused everything to be a few ms late.
Now the timeout will trigger early by default.
2023-01-29 12:23:44 +01:00
Moss
7c7c58f384
Add workspace symbol configuration (#2)
Also added an example line to the config at data/config.
Config syntax is: "WorkspaceSymbol-[workspace_number]: [symbol]".
If no default is provided it will default to the circle with dot.
2023-01-29 12:07:24 +01:00
Moss
2c64d6da79
Add Battery Widget (#1)
Added a battery widget which only shows if the battery folder is set in the config and exists.
2023-01-28 23:47:55 +01:00
scorpion-26
6621e3abc2 Add configuration system
The config file format could still be improved though...
2023-01-28 18:06:41 +01:00
scorpion-26
d1b062bad9 Install styling automatically. 2023-01-28 17:31:18 +01:00
scorpion-26
c27912c8a5 Add Plugin system
Plugins are used to extend the functionality, without needing to poke around in
the original source code.
2023-01-28 15:08:12 +01:00
scorpion-26
8b20500b3e
Switch ExitWM error to LOG
Why was it system in the first place?
2023-01-27 20:42:07 +01:00
scorpion-26
07b2d5e35d Add icons to bluetooth widget
And add one more icon type
2023-01-15 11:10:42 +01:00
scorpion-26
7eb364aa6a Add missing files
Otherwise, there will be a lot of nasty, and unavoidable errors
2023-01-14 23:23:00 +01:00
scorpion-26
ed32d70916 Added a bluetooth widget
I think it looks really slick. Probably still many bugs
2023-01-14 23:18:34 +01:00
scorpion-26
7b91486441 Add Bluetooth tooltips 2023-01-14 23:14:53 +01:00
scorpion-26
1bc74fa840 Add Hyprland check for logout. 2023-01-13 16:24:22 +01:00
scorpion-26
b0ed0d17e5 Initial commit! 2023-01-13 16:19:21 +01:00