aboutsummaryrefslogtreecommitdiff
path: root/swaynag
AgeCommit message (Collapse)AuthorLines
2025-04-17swaymsg, swaynag: drop sway_terminate() definitionsFurkan Sahin-5/+0
These are unused.
2024-11-08swaynag: fix null dereference on scale changeFurkan Sahin-1/+3
If cursor-shape-v1 is available, the old wl_cursor_theme path should not be used.
2024-02-16Define _POSIX_C_SOURCE globallyFurkan Sahin-4/+0
See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
2023-11-03swaynag/config.c: fix build against gcc-14 (-Walloc-size)Furkan Sahin-1/+1
`gcc-14` added a new `-Walloc-size` warning that makes sure that size of an individual element matches size of a pointed type: https://gcc.gnu.org/PR71219 `sway` triggers it on `calloc()` calls where member size is used as `1` (instead of member count): swaynag/config.c:169:65: error: allocation of insufficient size '1' for type 'struct swaynag_button' with size '48' [-Werror=alloc-size] 169 | struct swaynag_button *button = calloc(sizeof(struct swaynag_button), 1);
2023-07-29swaynag: Implement wp_cursor_shape_v1Furkan Sahin-5/+20
2023-07-13swaynag: handle wayland-cursor failuresFurkan Sahin-0/+8
Same as 6bd6491af691 ("swaybar: handle wayland-cursor failures") but for swaynag. Closes: https://github.com/swaywm/sway/issues/7671
2023-06-23Use "default" XCursor instead of "left_ptr"Furkan Sahin-1/+1
"left_ptr" is the legacy XCursor name. "default" is the cursor spec name.
2023-01-08swaynag: call swaynag_destroy on clean exitFurkan Sahin-17/+17
And fix the fallout of the swaynag_destroy having evolved without being tested: * wl_display_disconnect was called too early * `button_close` and `swaynag.details.button_details` needed to be heap allocated, since they are added to swaynag.buttons, and all entries of swaynag.buttons are freed in swaynag_destroy * To keep things simpler, disconnect the lifetime of the 'Toggle details' button text config setting from the button itself.
2022-12-21swaynag: drop swaynag_type.fontFurkan Sahin-11/+5
It's too easy to have this go out of sync with font_description.
2022-12-21swaynag: fix NULL font descriptionFurkan Sahin-0/+7
The font description was only set if provided on the CLI. It was left NULL for the defaults and when reading from the config file. Closes: https://github.com/swaywm/sway/issues/7186
2022-11-27Fix build on Debian StableFurkan Sahin-0/+1
2022-11-25build: drop intermediate libraries for protocolsFurkan Sahin-1/+1
2022-07-01Reuse parsed PangoFontDescriptionFurkan Sahin-9/+11
Avoids parsing the configured font each time text is rendered.
2022-06-05swaynag: move close_button up to fix SIGSEGVFurkan Sahin-5/+5
When swaynag_parse_options encounters '--dismiss-button' (or its shorthand '-s'), it sets the text of the first button in the swaynag.buttons list, which is expected to exist and to be the dismiss button, to the one passed by the user. Commit 38288c3916d3d9f33771c220ae307d32e8a208e8 ("swaynag: statically allocate button_close, and move declaration") moved the list initialization to after swaynag_parse_options is called which made that code fail. For example, the command 'swaynag --dismiss-button Dismiss' crashes and 'swaynag --message Message --button Yes "" --dismiss-button Dismiss' shows the wrong buttons. Move it back to before swaynag_parse_options is called.
2022-03-20swaynag: combine consecutive declaration/assignmentsFurkan Sahin-4/+2
2022-03-18swaynag: improve robustness when loading configFurkan Sahin-12/+5
2022-03-17swaynag: do error checking and rename read_from_stdinFurkan Sahin-11/+23
read_from_stdin not only read from stdin, but trimming trailing newlines, so rename it to reflect this.
2022-03-01remove unnecessary strlen callFurkan Sahin-2/+2
2022-02-28swaynag: remove redundant status variables in mainFurkan Sahin-14/+10
Instead, we just use `status` for all failures.
2022-02-28swaynag: remove unnecessary zero of swaynag structFurkan Sahin-1/+0
Global variables are initialized to 0.
2022-02-28swaynag: statically allocate button_close, and move declarationFurkan Sahin-10/+5
Every swaynag has a close button, so it doesn't make sense to allocate it dynamically. The declaration is moved later to when it is actually needed.
2022-02-28swaynag: allocate button_details with detailsFurkan Sahin-17/+7
They are used together, so it doesn't make sense to allocate them separately.
2022-02-25swaynag: die on all allocation failuresFurkan Sahin-0/+36
2022-02-08Remove all sprintf callsFurkan Sahin-4/+5
Replace them with snprintf, which ensures buffer overflows won't happen.
2022-01-23swaynag: remove buffer destruction conditionFurkan Sahin-7/+2
An address of a variable can never be NULL, so checking it doesn't make sense; and `destroy_buffer()` can operate on already destroyed buffers anyway. Fixes #6780
2021-12-13swaynag: remove xdg-output logicFurkan Sahin-40/+19
We can just get the output name from wl_output directly, now that wl_output version 4 exists.
2021-09-13swaynag: fix pointer button events on scaled outputsFurkan Sahin-2/+2
sway#6504 simplified rendering code by setting scaling at cairo, but that also changed button position records into ones without scale multiplication, breaking button events. This fixes it by not multiplying scale on events handling as well.
2021-09-13Rename pango_printf to render_textFurkan Sahin-3/+3
This avoids using the pango_ prefix, reserved for functions coming from the Pango library.
2021-09-09Simplify swaybar/swaynag scaling codeFurkan Sahin-29/+29
Use `cairo_scale` to set the scale factor, removing redundant multiplications by `output->scale`.
2021-03-17swaynag: adds option to set wayland shell layerFurkan Sahin-2/+36
Uses --layer/-y set to overlay|top|bottom|background
2021-05-28details-gackground typo fixFurkan Sahin-1/+1
2021-05-07cairo: Replace <cairo/cairo.h> by <cairo.h>Furkan Sahin-1/+1
For full context, read https://gitlab.freedesktop.org/cairo/cairo/-/issues/479 TL;DR, cairo’s pc file adds `/cairo` to CFLAGS. So namespace cairo shouldn’t be used.
2021-04-16Use execlp("sh") instead of execl("/bin/sh")Furkan Sahin-4/+4
This stops assuming the POSIX shell command is located in /bin.
2021-02-07swaynag: Use position from wl_pointer.enterFurkan Sahin-0/+2
Only wl_pointer.motion was used to update pointer position, which would cause issues if the pointer was not moved prior to wl_pointer.button. This also fixes touch input through wl_pointer emulation, which fires wl_pointer.button immediately after wl_pointer.enter. Closes: https://github.com/swaywm/sway/issues/5991
2021-02-03Make command line option lists constFurkan Sahin-1/+1
2021-02-03Make Wayland request listeners static const when possibleFurkan Sahin-6/+6
2021-01-16Changed fprintf(stdout,...) to printf(...) for more readable codeFurkan Sahin-1/+1
2020-09-08swaynag: add details background optionFurkan Sahin-2/+23
Adds a new config option for details background for swaynag issue/#5673
2020-09-02swaynag: adds option to separately specify the text color for buttonsFurkan Sahin-27/+49
2020-06-04Fix incorrect format specifiersFurkan Sahin-1/+1
2020-06-10swaynag: sway_abort on failure to properly registerFurkan Sahin-1/+4
In case `wl_display_roundtrip` returns an error after registering for events, print a more user-friendly error message and exit. Previously, if the build did not have assertions enabled, this would likely result in a segfault. With assertions enabled, it's not user friendly to terminate with internal implementation information.
2020-06-07swaynag: allow specifying more buttons which execute and dismissFurkan Sahin-1/+29
I don't love -z / -Z, but I figure this patch is far from being accepted for other reasons too.
2020-03-29swaynag: exit on wl_display_roundtrip errorFurkan Sahin-1/+5
fixes loop when sway closes the socket in the middle of querying outputs, see #5138.
2020-03-29swaynag: fix segfault on exit when arguments are not correctFurkan Sahin-2/+2
swaynag_destroy is called on all cleanup cases and needs the lists to be valid, just init them early
2020-01-03swaynag: Add multi-seat supportFurkan Sahin-34/+89
This also adds cleanup for all seat resources
2019-12-27parse_color: return success + drop fallback colorFurkan Sahin-10/+10
This is the first in a series of commits to refactor the color handling in sway. This changes parse_color to return whether it was success and no longer uses 0xFFFFFFFF as the fallback color. This also verifies that the string actually contains a valid hexadecimal number along with the length checks. In the process of altering the calls to parse_color, I also took the opportunity to heavily refactor swaybar's ipc_parse_colors function. This allowed for several lines of duplicated code to be removed.
2019-08-31Fix markup syntax in man pagesFurkan Sahin-1/+1
2019-06-05check for empty string before calling strtoul() and check errnoFurkan Sahin-2/+3
Note: since strtoul() has no real error return code (both 0 and ULONG_MAX may be returned on both success and failure), set errno=0 before calling strtoul().
2019-06-05swaybar/nag: use xcursor theme defined by XCURSOR_THEME/SIZEFurkan Sahin-2/+12
If the XCURSOR_THEME and/or XCURSOR_SIZE environment variables are set, use the theme and size they define. If they're not set, use the same defaults as before (system default theme, size=24).
2019-04-25swaybg: split into standalone projectFurkan Sahin-1/+0
The new upstream is https://github.com/swaywm/swaybg This commit also refactors our use of gdk-pixbuf a bit, since the only remaining reverse dependency is swaybar tray support.