Commit graph

216 commits

Author SHA1 Message Date
scorpion-26
a868f3e8e5 Fix crash when dbusmenu was double freed
Apparently gtk_menu_detach unrefs the menu
2024-02-16 20:36:15 +01:00
scorpion-26
4ed6c06449 Fix dbusmenu leak
The menu that was created for the sni context menu was never destroyed.
Instead of creating a new menu each time, the existing menu is recycled
and destroyed when the item is.
2024-02-16 20:03:34 +01:00
scorpion-26
da4634770d Add error message for battery not found 2024-02-12 21:12:55 +01:00
scorpion-26
12d1c59ef0 Add a warning color when battery is low
The threshold is controlled via BatteryWarnThreshold and the color via
battery-warning
2024-02-12 21:05:24 +01:00
scorpion-26
e717e0e7ad Add a CLI option to override the config dir
The CLI option -c/--config overrides the search path, and appends itself
to the front of the CSS search path.

Partially implements https://github.com/scorpion-26/gBar/issues/75
2024-01-21 17:13:45 +01:00
scorpion-26
2eeea75c1b Improve CLI interface
A CLI help option has been added, as well as a more clear error message
when a plugin was not found.
2024-01-21 16:55:53 +01:00
Kilian Mio
8c49270677
Honor the XDG specification when locating the CSS (#67)
According to XDG specifications paths like /usr/share etc. are usually
in XDG_DATA_DIRS. Since this variable may be set differently for other
linux distributions we prefer those environment variables to hard-coded
paths. As such hard-coded paths have been removed

This solves issue #66
2024-01-21 16:55:03 +01:00
scorpion-26
438024c626 Fix use-after-free in SNI
gtk_icon_theme_load_icon returns a pixbuf which is not owned by us, and
therefore g_free shouldn't be called. When reloading an icon, this pixbuf
was reused by the icon theme even though we just free'd it.

Fixes: https://github.com/scorpion-26/gBar/issues/74
2023-12-14 23:54:07 +01:00
scorpion-26
0e8634a227 Implement ability to disable certain SNI icons
Implements https://github.com/scorpion-26/gBar/issues/69 (nice)
2023-12-03 22:52:37 +01:00
scorpion-26
37b0896d6d Allow overriding of SNI icons
This adds a config option to override the name of the icons displayed.
This also removes the frankenstein monster of the icon location
querying, which was a giant mess and not even remotely close to being
compliant with the XDG spec. Instead we use the much simpler Gtk API
which has the added benefit of properly supporting themes.

The SNI filter also now work for items without a set tooltip (e.g. steam).
For these items the object name is matched instead.

Implements https://github.com/scorpion-26/gBar/issues/63
2023-12-03 22:52:37 +01:00
scorpion-26
cbc36239d1 Strip whitespaces for second pair element 2023-12-03 22:52:37 +01:00
scorpion-26
dcd554b69f Fix regression caused by #72
The slider texts had a background of inactive, instead of background.
So only set the background of the actual sensors
2023-11-30 13:15:33 +01:00
Christoph
56c53c49cd
Add more css classes(#72)
This PR adds classes to every widget. 

Introduces a breaking change for the lock-button, which needs to be
added to the style.css manually if you're using a custom one.

Every widget gets a "widget" class as well as a specific one like an id.
In the future, names/ids should be used for that.
Also cleaned up the sensors a little as well as the related CSS.

Fixes #70.
2023-11-30 12:53:30 +01:00
scorpion-26
952f020fb5 Allow AddClass before widget creation
This is necessary for multiple layout classes.
2023-11-29 23:27:41 +01:00
scorpion-26
1279d3e2fb Add config for modifying sensor size
This wasn't possible with css, as I hardcoded 24 for the size

For ping: https://github.com/scorpion-26/gBar/issues/64
2023-11-23 23:42:31 +01:00
scorpion-26
9c0dcb7385 Update the font variable
For some reason GTK doesn't recognise CaskaydiaCove Nerd Font anymore
2023-11-23 23:42:31 +01:00
scorpion-26
584c74467f
Fix SleepIcon config var 2023-11-22 02:22:35 +01:00
scorpion-26
964b12ed36 Add support for custom icons
Not *everything* is implemented, two icons from the BluetoothDevices
widgets are still missing.

Implements https://github.com/scorpion-26/gBar/issues/56
2023-11-22 00:54:41 +01:00
scorpion-26
7d8a792d60 Fix compilation warning 2023-11-22 00:54:18 +01:00
scorpion-26
1f4f84093a Add support for string escaping
This is needed for spaces at the end of variables
2023-11-22 00:53:44 +01:00
scorpion-26
8b8ce501d4 Add nullptr check for batteryText
If SensorTooltips: true, then batteryText would be nullptr, but the
class would still be updated, causing the crash

Fixes https://github.com/scorpion-26/gBar/issues/58
2023-11-06 20:17:56 +01:00
scorpion-26
4b3679b550 Cleanup commented out g_variant_unref calls
They were bogus and the added comment explains why they're not needed
in this case
2023-11-05 22:10:02 +01:00
scorpion-26
2420574c70 SNI: Allow svgs as icons
To facilitate that, Texture now accepts GdkPixbuf instead of raw
uint8_t[], because we can't convert svgs into uint8_t[] easily without
the use of GdkPixbuf.
2023-11-05 22:03:50 +01:00
scorpion-26
dc7c7b7902 Add checks for null GtkWidget
Gtk complained about invalid widgets, because they were null.
2023-11-05 22:02:58 +01:00
scorpion-26
eb8e0bc2b5 Fix gtk_widget_destroy warnings
gtk_remove_widget unrefs the widget and destroys it and all its children.
Since we also do that in the destructor, we do a double free.
To fix this, a ref is added to prevent destroying by gtk_remove_widget.
2023-11-05 22:01:09 +01:00
scorpion-26
f0d3c6c0e4 Include package widget in hardcoded config 2023-11-05 14:51:54 +01:00
scorpion-26
9b551fe848 Add DrmAmdCard config option
Some AMD cards are under card1, so make the hardcoded path at least a
bit configurable.
2023-11-02 23:04:37 +01:00
scorpion-26
48c0f4814d
Update bug_report.md 2023-11-01 17:40:15 +01:00
scorpion-26
1f6ad2aab7 Don't destroy unused Widget for SensorTooltips
We would create the Revealer and then destroy it when SensorTooltips is
true
2023-11-01 17:08:13 +01:00
scorpion-26
6c8f57238a Add option to have right-side up icons and text
The margins are still not perfect, but it at least acceptable.
SensorTooltips is required, as the sensor texts break due to being
right-side up.

Implements https://github.com/scorpion-26/gBar/issues/48
2023-11-01 00:34:33 +01:00
scorpion-26
a2117475da Allow escaping strings in config
\n \\ and \t now will be translated to their escaped counterpart
2023-11-01 00:24:02 +01:00
scorpion-26
6e71e8a4f3 Add battery charging indication 2023-10-28 23:48:22 +02:00
scorpion-26
74f8df49f3 Add missing RAM to hardcoded config 2023-10-28 23:47:53 +02:00
scorpion-26
ffe2d07bec Fix wrong Widget name in hardcoded config
Sound != Audio
2023-10-28 23:05:06 +02:00
scorpion-26
996a6611ad Add options for reordering widget layout.
Partially implements https://github.com/scorpion-26/gBar/issues/48 and https://github.com/scorpion-26/gBar/issues/20
2023-10-21 18:32:51 +02:00
scorpion-26
b19b091c92 Layer audioflyin on top of fullscreen windows
LAYER_TOP (The previously hardcoded layer) draws below fullscreen
windows (at least on Hyprland). For the flyin we want it to be always on
top, so LAYER_OVERLAY is used instead now.
2023-10-21 16:40:41 +02:00
scorpion-26
3a0b0e0699 Add support for vector configs
This is the first step for arbitrary widget position
2023-10-18 18:32:56 +02:00
Edvin Källström
f5e4638297
Nix: NumWorkspaces, removed nulls, default HyrplandIPC (#54)
No option for NumWorkspaces and some options could be null while they
shouldn't. Also set UseHyprlandIPC to true by default as that is now
required by Hyprland 0.30.
2023-10-11 17:37:10 +09:00
scorpion-26
96485f408e
Check nvidia gpu features on init
When a required feature is not supported, gBar would crash inside the
query functions without a way to manually bypass NvidiaGPU. Now
NvidiaGPU checks whether all features are supported and disables the
module if any throw an error.

Fixes https://github.com/scorpion-26/gBar/issues/52
2023-09-21 19:30:42 +08:00
Sebastian Zerbe
471bc6e719
Make the partition monitored by disk sensor configurable (#50)
Allows to stat partitions other than the root partition

---------

Co-authored-by: Sebastian Zerbe <zerbe@phil.hhu.de>
2023-09-08 16:34:17 +02:00
scorpion-26
9afbfe3c1d Unify data/config formatting 2023-09-08 01:01:02 +02:00
scorpion-26
b215dfb145 Don't crash for empty string config
Fixes https://github.com/scorpion-26/gBar/issues/49
2023-09-07 18:49:25 +02:00
scorpion-26
0812c3680f Add option for sensor tooltips instead of sliders
Partially implements https://github.com/scorpion-26/gBar/issues/48
2023-09-07 17:24:41 +02:00
scorpion-26
d811b14767 Move WorkspaceSymbol parsing to other map configs 2023-09-02 00:15:04 +02:00
scorpion-26
df46c58244 Add config for number of workspaces
Adds NumWorkspaces config, https://github.com/scorpion-26/gBar/issues/45

The WorkspaceSymbols syntax was also upgraded to use maps, since the -n
was hardcoded to query for numbers from 1-9, which is now no longer
correct.
The old syntax for WorkspaceSymbols still works, but only for ws 1-9
2023-09-02 00:05:08 +02:00
scorpion-26
5c2ac6fa08 Generalize map config parsing
Maps like the one used by SNIIconSize and SNIPaddingTop are now
generalized, without requiring the awkward std::pair<_,_> buf and hasntFoundProperty helpers
2023-09-01 23:42:45 +02:00
scorpion-26
71278a3529 Use Hyprland IPC by default.
Hyprland will remove ext-workspace-unstable-v1 support in
v0.30.0 and Workspaces with UseHyprlandIPC: false will no longer work.
2023-09-01 17:55:22 +02:00
scorpion-26
7a7c6b5ce8 Nix: Add DateTimeLocale to module.nix 2023-09-01 03:24:01 +02:00
scorpion-26
6f9da7f7c9 Add PID to logfile
This avoid log corruption when multiple gBar instances are open at the same, as the logfile was the same
2023-09-01 03:19:07 +02:00
scorpion-26
9ecba84be5 Fix compilation without USE_LOGFILE 2023-09-01 03:19:07 +02:00