aboutsummaryrefslogtreecommitdiff
path: root/swaynag/config.c
AgeCommit message (Collapse)Author
2022-12-22swaynag: drop swaynag_type.fontSimon Ser
It's too easy to have this go out of sync with font_description.
2022-07-01Reuse parsed PangoFontDescriptionHugo Osvaldo Barrera
Avoids parsing the configured font each time text is rendered.
2022-05-07swaynag: combine consecutive declaration/assignmentsNihal Jere
2022-05-07swaynag: improve robustness when loading configNihal Jere
2022-05-07swaynag: do error checking and rename read_from_stdinNihal Jere
read_from_stdin not only read from stdin, but trimming trailing newlines, so rename it to reflect this.
2022-03-15swaynag: allocate button_details with detailsNihal Jere
They are used together, so it doesn't make sense to allocate them separately.
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.
2021-06-17swaynag: adds option to set wayland shell layerJames Edwards-Jones
Uses --layer/-y set to overlay|top|bottom|background
2021-02-04Make command line option lists constManuel 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-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.
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-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-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-19swaynag: fix XDG_CONFIG_HOME handlingemersion
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-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-09-30Turn funcs() into funcs(void)Arkadiusz Hiler
If they really do not take undefined number of arguments.
2018-08-20Fix bad-free in swaynagBrian Ashworth
2018-08-01swaynag: don't drop \n for first lineBrian Ashworth
2018-08-01swaynag: allow more config optionsBrian Ashworth
2018-08-01swaynag: refactor {sway_,}nagbar to swaynagBrian Ashworth
2018-08-01swaynag: split config into own file and fix optindBrian Ashworth