Commit Graph

21 Commits

Author SHA1 Message Date
Simon Ser fc640d5f6c Define _POSIX_C_SOURCE globally
See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
2024-02-23 17:43:19 +03:00
Simon Ser 08c1946d71 Use format_str() throughout 2023-04-14 18:34:54 +02:00
Ian Fan 68f53cd509 tray: tidy code
This includes some refactoring and fixing a small memory leak.
2020-03-30 17:31:00 +02:00
Ian Fan 3b894c387d tray: allow themes to inherit from multiple themes 2020-03-30 17:31:00 +02:00
Ian Fan 66f0c91bb8 tray: better errors when parsing index.theme 2020-03-30 17:31:00 +02:00
Till Hofmann 0f5157668d Avoid calling strcmp on nullptr
The function group_handler may get a nullptr as `new_group`. If that's
the case, return true, as if `new_group` was the empty string.

Also make the conversion to bool explicit when calling `strcmp`.
2020-02-10 13:29:07 +01:00
Jason 939c7b2d52 Amend typos 2019-11-23 11:48:31 +01:00
Antonin Décimo 3af52d86f7 Fix memory leaks 2019-08-12 09:42:11 +09:00
Maxime “pep” Buquet 20762ecb3c Validate icon_struct in read_theme_file
The read_theme_file function used to return an invalid icon_struct in
some cases, for example when an empty index.theme file was read.

This makes sure the struct we're returning is always valid as per the
Icon Theme specification.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-04-20 16:41:02 -04:00
Alex Maese 31eeda11b0 Fix a crash in swaybar when an icon dir is not readable 2019-03-30 20:13:34 +02:00
Stephan Hilb d64e8ba946 swaybar: fix loading of malformed icon theme
If the icon index.theme contained a key-value pair without a preceding
group header, entry_handler() would be called with a zero pointer and
lead to a segfault.
Set the error flag and break on such malformed files.
2019-03-13 22:04:04 -06:00
emersion bcde298a71 Fix size_t temporary underflow in log_loaded_themes
`len` will underflow but will overflow right after, so it's not as bad as it
may appear. Still better not to under/overflow at all.

Fixes https://github.com/swaywm/sway/issues/3862
2019-03-11 12:12:46 -04:00
Ian Fan 5c8424c074 stringop.c: remove unused functions
The only use of `join_list` in swaybar/tray/icon.c has been rewritten.
2019-03-11 14:42:58 +01:00
Stefan Schick 0952c9f91d Fix #3445: swaybar tray inerited thems not processed 2019-02-01 21:47:28 -05:00
M Stoeckl 1211a81aad Replace wlr_log with sway_log
This commit mostly duplicates the wlr_log functions, although
with a sway_* prefix. (This is very similar to PR #2009.)
However, the logging function no longer needs to be replaceable,
so sway_log_init's second argument is used to set the exit
callback for sway_abort.

wlr_log_init is still invoked in sway/main.c

This commit makes it easier to remove the wlroots dependency for
the helper programs swaymsg, swaybg, swaybar, and swaynag.
2019-01-21 12:59:42 +01:00
M Stoeckl 695948e689 Fix memory leaks in swaybar 2019-01-19 08:42:52 +01:00
Ian Fan 746600e6ed swaybar: implement icon themes and lookup for tray 2018-12-31 20:40:18 +00:00
Drew DeVault cab1352801 Start port of swaybar to layer shell
This starts up the event loop and wayland display and shims out the
basic top level rendering concepts. Also includes some changes to
incorporate pango into the 1.x codebase properly.
2018-03-29 22:11:08 -04:00
Johannes Lundberg 6a525b23dd Adjust _XOPEN_SOURCE value for build on FreeBSD and fix pointer comparison error. 2017-07-08 08:31:10 +02:00
Mykyta Holubakha ed8f56ba38
Handle getline failure in icon theme parsing 2017-06-23 19:23:44 +03:00
Calvin Lee 843ad38b3c Implement Tray Icons
This commit implements the StatusNotifierItem protocol, and enables
swaybar to show tray icons. It also uses `xembedsniproxy` in order to
communicate with xembed applications.
The tray is completely optional, and can be disabled on compile time
with the `enable-tray` option. Or on runtime with the bar config option
`tray_output none`.

Overview of changes:
In swaybar very little is changed outside the tray subfolder except
that all events are now polled in `event_loop.c`, this creates no
functional difference.

Six bar configuration options were added, these are detailed in
sway-bar(5)

The tray subfolder is where all protocol implementation takes place and
is organised as follows:

tray/sni_watcher.c:
	This file contains the StatusNotifierWatcher. It keeps track of
	items and hosts and reports when they come or go.
tray/tray.c
	This file contains the StatusNotifierHost. It keeps track of
	sway's version of the items and represents the tray itself.
tray/sni.c
	This file contains the StatusNotifierItem struct and all
	communication with individual items.
tray/icon.c
	This file implements the icon theme protocol. It allows for
	finding icons by name, rather than by pixmap.
tray/dbus.c
	This file allows for asynchronous DBus communication.

See #986 #343
2017-06-07 17:49:16 -07:00