Commit graph

249 commits

Author SHA1 Message Date
Alexis Howells
3a7ff0d179
Consider transform when calculating monitor size (#88)
When using a rotated monitor, the width value is incorrect and most of
the widgets are off screen.
When taking the transform into account (swapping width and height when
90/270° rotation is applied) the width is correct.
2024-04-19 22:47:14 +02:00
scorpion-26
b9ab546c4f Add meson option to not link with LibSass 2024-04-14 18:03:34 +02:00
scorpion-26
e58d51d140 Remove WithSys meson option
This was unused anyway
2024-04-14 17:57:46 +02:00
scorpion-26
7948fa073b Add option to disable loading SCSS directly 2024-04-14 17:56:02 +02:00
scorpion-26
ddee5aa1ad Refactor (S)CSS loading 2024-04-14 17:47:55 +02:00
scorpion-26
9cac3ab67a Update icon sizes for NF 3.2.1
NerdFonts v3.2.1 made the FontAwesome icons (compared to both v3.1.1 and v3.2.0)
significantly larger. The icons are now set to a size which roughly
matches that of v3.1.1.
2024-04-14 17:26:30 +02:00
scorpion-26
6dd1ee6783 Process audio slider events asynchronously
This commit avoids piling up events if events are queued quicker, than
gBar can handle, causing severe slowdowns.
Instead, the requests are handled in a worker thread and excess events
are discarded.

Fixes: https://github.com/scorpion-26/gBar/issues/86
2024-04-03 16:34:26 +02:00
scorpion-26
0f943405d3 Update README
- Update the bar screenshot to include some newer features.
- Mention breaking changes to the css.
2024-03-27 18:51:24 +01:00
scorpion-26
82fd62aa20 Respect monitor scale 2024-03-27 18:43:27 +01:00
scorpion-26
c9bc79c956 Toggle audio sink/source on icon click
A click on the mic/speaker icon now mutes/unmutes the sink/source.

Implements https://github.com/scorpion-26/gBar/issues/81
2024-03-26 22:12:02 +01:00
scorpion-26
2974233a5e
Fix CI
For some reason glib2 only optdepends python-packaging, though it is *required* for gdbus-codegen (Part of glib2)
2024-03-26 22:06:49 +01:00
scorpion-26
b35ce3f6b2 Fix source event handling.
A source event has the first bit always set, whereas we only handle
events that equal 0x10 (PA_SUBSCRIPTION_EVENT_CHANGE). Now the bitmask
is correctly handled.

Fixes https://github.com/scorpion-26/gBar/issues/82
2024-03-26 21:35:02 +01:00
scorpion-26
535d02c63c Update README.md 2024-03-18 21:18:06 +01:00
scorpion-26
bc0281ca53 Rewrite large parts of SNI
This is the fix for https://github.com/scorpion-26/gBar/issues/79, but
blown out of proportions, because various things kept breaking

- Original fix: Add/Remove items instead of cleaning everything
  everytime something changes. If the dbus-menu was open, it was
  referencing the old widget causing issues. The new method keeps the
  original GtkDrawingArea and only replace the buffer/tooltip
- Create dbus-menu on widget creation instead of on click. This was
  actually the fix for
  https://github.com/scorpion-26/gBar/pull/12#issuecomment-1529143790.
  The css has also been updated, making the popup finally look good.
- With the new item refreshing theme KeePassXC kept deadlocking when the
  properties changed. To fix it, the dbus properties are now queried
  asynchronously via 'GetAll'
2024-03-18 02:26:09 +01:00
scorpion-26
1cf8f820c2 Add inner left box to hide the padded outer box
Fixes: https://github.com/scorpion-26/gBar/issues/78
2024-03-17 20:43:59 +01:00
scorpion-26
cb160d8608 Add missing protocol 2024-03-17 16:00:23 +01:00
scorpion-26
aab7130e4f Add missing css property to style.css 2024-03-17 15:51:17 +01:00
scorpion-26
70594dae44 Add active window title widget
This widget called "Title" is a simple text with the title of the
currently active window. To prevent clipping the size of the title is capped by the
config variable "MaxTitleLength".

Implements https://github.com/scorpion-26/gBar/issues/77
2024-03-17 15:46:45 +01:00
scorpion-26
3a7fd719a2 Properly center the time
If the time widget is in the center, it wasn't properly centered.
For that to happen, center alignment and expand must be set.
2024-03-17 15:44:12 +01:00
scorpion-26
c5f2dd80c7 Rename TimeSpace and CenterTime
Since you can now customize what widgets go in the center, the names of
these config options are no longer fitting. They are now renamed to
CenterSpace and CenterWidgets respectively.
2024-03-17 15:39:39 +01:00
scorpion-26
91532b952e Refactor out std::find_if for monitors 2024-03-16 17:00:06 +01:00
scorpion-26
c7b80bd045 Fix erroneous error hint 2024-03-16 17:00:06 +01:00
scorpion-26
10fe13048c Document new way of specifying the monitor 2024-03-16 17:00:06 +01:00
scorpion-26
09c533a5e6 Destroy timeouts on Widget deletion.
Timeouts would tick, even after the parent Widget is long gone causing
use-after-free bugs.
2024-03-16 17:00:06 +01:00
scorpion-26
5a2f75dd0d Only allow sequential runs of package checking
If the current monitor would quickly change, GetOutdatedPackagesAsync
would be called while the previous instance is still running, which
caused crashes. Now, GetOutdatedPackagesAsync only uses one
instance/callback a time.
2024-03-16 17:00:06 +01:00
scorpion-26
2c50bed1d8 Fix infinite loop on Window::Close()
Apparently gtk_main_quit doesn't work anymore due to the changes to the
main loop
2024-03-16 17:00:06 +01:00
scorpion-26
95f9b0aadb Handle monitor changes
Since there is no way to map a connector to a Gdk Window ID and window
ID's are not static per monitor, the entire Window and Wayland system
has been rewritten to store a "target monitor" connector name, which is
the name of the monitor we want to be on. Every time a monitor is
removed or added, it is checked against the monitors of our Wayland
backend to match connector to Gdk ID and then the Window is
created/destroyed on the window(The target monitor is preferred, but if
it doesn't exist, other monitors are used too).

This is not perfect, since the matching of connector name to Gdk ID is
only an approximation of the Gdk behaviour (Especially rough
on hyprland with the headless monitor. A hack is needed to handle that).

Additionally the monitor can now be specified by connector name when
starting up (e.g. "gBar bar DP-1").
2024-03-16 17:00:06 +01:00
scorpion-26
f205a26fcc Don't crash on monitor remove
gBar no longer crashes when it's monitor is removed and is instead
evacuated onto another monitor or the next monitor added. We don't
change any monitor indices etc., which results in some glitchy results
2024-03-16 17:00:06 +01:00
scorpion-26
d3f46bc5f0
Update actions/checkout 2024-03-13 01:47:04 +01:00
scorpion-26
097c3d97e7 Remove stb submodule
Since 37b0896 stb_image isn't used anymore and recently the nix CI also
broke because of the hacky way the include directory is determined. This
is now fixed. One side effect of this is, that gBar no longer needs to
be cloned recursively.
2024-03-13 01:44:36 +01:00
scorpion-26
57eb5c5781 Fix missing libsass dep for CI
libsass is now a required package since https://github.com/scorpion-26/gBar/pull/76
2024-03-13 01:24:00 +01:00
Sivecano
74a04abd53
Compile and load .scss directly with libsass (#76)
Even though an scss file is present, it needs to be converted manually and only the
CSS file is parsed. This pull request sets out to fix that.

there is preliminary scss support using libsass now (libsass is technically "deprecated" but there seems to be no other
c/c++ library for converting scss to css)
2024-03-13 01:21:49 +01:00
scorpion-26
fbf25048ff Don't create SNI item, when no icon is found
KeePassXC would call ItemPropertyChanged on exit and simultaneously
vanish its dbus presence. This causes all dbus property queries to fail.
2024-02-16 20:37:04 +01:00
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