aboutsummaryrefslogtreecommitdiff
path: root/swaynag
AgeCommit message (Collapse)Author
2022-02-28swaynag: die on all allocation failuresNihal Jere
2022-02-08Remove all sprintf callsSimon Ser
Replace them with snprintf, which ensures buffer overflows won't happen.
2022-01-23swaynag: remove buffer destruction conditionKirill Primak
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 logicSimon Ser
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 outputsxdavidwu
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_textSimon Ser
This avoids using the pango_ prefix, reserved for functions coming from the Pango library.
2021-09-12Simplify swaybar/swaynag scaling codeCaduser2020
Use `cairo_scale` to set the scale factor, removing redundant multiplications by `output->scale`.
2021-06-17swaynag: adds option to set wayland shell layerJames Edwards-Jones
Uses --layer/-y set to overlay|top|bottom|background
2021-05-28details-gackground typo fixsergio
2021-05-10cairo: Replace <cairo/cairo.h> by <cairo.h>Issam E. Maghni
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-22Use execlp("sh") instead of execl("/bin/sh")Simon Ser
This stops assuming the POSIX shell command is located in /bin.
2021-02-07swaynag: Use position from wl_pointer.enterKenny Levinsen
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-04Make command line option lists constManuel Stoeckl
2021-02-04Make Wayland request listeners static const when possibleManuel Stoeckl
2021-01-16Changed fprintf(stdout,...) to printf(...) for more readable codeSpizzyCoder
2020-09-14swaynag: add details background optionMustafa Abdul-Kader
Adds a new config option for details background for swaynag issue/#5673
2020-09-04swaynag: adds option to separately specify the text color for buttonsoliver-giersch
2020-07-30Fix incorrect format specifiersAntonin Décimo
2020-06-10swaynag: sway_abort on failure to properly registerLuke Drummond
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-09swaynag: allow specifying more buttons which execute and dismissGraham Christensen
I don't love -z / -Z, but I figure this patch is far from being accepted for other reasons too.
2020-04-02swaynag: exit on wl_display_roundtrip errorDominique Martinet
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 correctDominique Martinet
swaynag_destroy is called on all cleanup cases and needs the lists to be valid, just init them early
2020-01-05swaynag: Add multi-seat supportAndri Yngvason
This also adds cleanup for all seat resources
2019-12-28parse_color: return success + drop fallback colorBrian Ashworth
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 pagesMartin Michlmayr
2019-06-05check for empty string before calling strtoul() and check errnoDaniel Eklöf
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/SIZEDaniel Eklöf
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 projectDrew DeVault
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.
2019-04-20swaynag: revamp type configsBrian Ashworth
This revamps the type configs for swaynag. All sizing attributes for swaynag are now `ssize_t` instead of `uint32_t` to allow for a default value of `-1`, which allows for `0` to be a valid value. Additionally, the initialization of the type configs has been changed from a simple calloc to use a new function `swaynag_type_new`. `swaynag_type_new` calloc's the memory, checks for an allocation failure, sets the name, and all sizes to -1. The layering order has also been changed to default, general config, type config, and as highest priority command line arguments. Finally, `swaynag_type_merge` has been modified to handle the layering and sizing changes.
2019-04-14Spawn swaynag as a wayland clientBrian Ashworth
This spawns swaynag as a wayland client similar to how swaybar and swaybg are already done
2019-04-14swaynag: fix pointer managementBrian Ashworth
Currently on master, swaynag will retrieve a pointer instance whenever the capabilities change and WL_SEAT_CAPBILITY_POINTER is set. The pointer instances were never being destroyed so swaynag received events multiple times due to having several instances of the pointer. This fixes it so if there is already a pointer instance, swaynag does not attempt to retrieve another. Additionally, if the pointer capability is removed, the pointer instance is destroyed.
2019-03-11Repair swaynag crash reading message from stdinPeter Grayson
When swaynag is run with the -l/--detailed-message option, a crash may occur if the detailed message read from stdin is large enough. E.g.: swaynag -m hello -l < ~/.config/sway/config The root cause is that the read_from_stdin() function under-allocates memory for the destination buffer which causes that buffer to be overflowed when copying line data to it with snprintf(). The repair is to allocate one more byte for the terminating null byte. N.B. although getline() returns the number of bytes read excluding a terminating null byte, the line buffer is terminated with a null byte. Thus we have a guarantee that the line buffer will be null terminated (which is important when copying with snprintf()).
2019-02-05swaynag: remove trailing newlines in configBrian Ashworth
Now that swaynag uses getline (instead of the old readline), the trailing newline characters have to be removed when reading the config
2019-01-23Fix build failure in config.cunraised
2019-01-22Fix dead stores found by scan-buildM Stoeckl
In addition to removing unused code, two minor problems are fixed: (1) `resize set` and `resize adjust` did not error when given too many arguments. (2) `orientation` was incorrectly overridden to be 'U' for scroll events in the swaybar tray `handle_click` function.
2019-01-22swaynag: Small graphical fix, add offset of +1 to X/Y.Connor E
2019-01-21Removed unused wlroots dependency for sway(bg|bar|msg|nag)M Stoeckl
Also remove direct libm dependency where unused.
2019-01-21Replace wlr_log with sway_logM Stoeckl
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-19swaynag: fix XDG_CONFIG_HOME handlingemersion
2019-01-18meson: remove rpath optionsemersion
2019-01-16Fixes for small existing bugs.Connor E
2019-01-16Remove usage of VLAs.Connor E
2019-01-14swaynag: handle empty $XDG_CONFIG_HOME betterIan Fan
Set config path to fallback instead of setting $XDG_CONFIG_HOME
2019-01-01Remove readline.cIan Fan
All occurrences of read_line have been replaced by getline. peek_line has been absorbed into detect_brace.
2018-12-17swaynag: remove double free of details buttonBrian Ashworth
If there are no arguments or invalid arguments given, swaynag will free `swaynag.details.button_details` under the `cleanup` label in main. It then called `swaynag_destroy`, which would attempt to free it again. Since `swaynag.details.button_details` is either freed on line 106 of main (when there is no detailed message) or added to `swaynag.buttons` on line 103 of main, there is no reason to manually free it in `swaynag_destroy`. Although I cannot reproduce a double free on my system, for some reason, it should have actually resulted in a double free in all code paths.
2018-12-15swaynag: damage the cursor surface on updateBrian Ashworth
When the cursor surface gets updated, it should be damaged. This also bumps up `wl_compositor` to version 4 to be able to use `wl_surface_damage_buffer`.
2018-12-09Cleanup list codeIan Fan
2018-11-27Implement swaynag -B/--button-no-terminalBrian Ashworth
In `i3 4.16`, `i3-nagbar` introduces the flags `-B/--button-no-terminal` to run the action directly instead of inside a terminal. This implements the flags for swaynag for compatibility. Since swaynag does not use an equivalent to `i3-sensible-terminal`, the flags `-b/--button` only uses a terminal when the environment variable `TERMINAL` is set, otherwise it acts the same as these new flags.
2018-11-25Replace _XOPEN_SOURCE with _POSIX_C_SOURCEemersion
And make sure we don't define both in the same source file.
2018-11-13More frees.Connor E