aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/ipc.c
Commit message (Collapse)AuthorAge
* Define _POSIX_C_SOURCE globallyLibravatar Simon Ser2024-02-23
| | | | See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
* swaybar: always subscribe to mode and workspaceLibravatar Mukundan3142023-05-09
| | | | | always subscribe to mode and workspace events, since we might need them after bar config updates even if we don't need them initially.
* Reuse parsed PangoFontDescriptionLibravatar Hugo Osvaldo Barrera2022-07-01
| | | | Avoids parsing the configured font each time text is rendered.
* refactor: use JSON_MAX_DEPTH everywhereLibravatar Jason Nader2021-10-25
|
* swaybar: fail gracefully on tokener creation failLibravatar Tudor Brindus2021-03-22
| | | | | | | | | | | | | | | This commit adds missing error-handling to the creation of the tokener instance. The stack depth parameter is used to initialize an array that json-c prefaults ahead of time, causing INT_MAX to result in out of memory errors. Also drop the depth to 256 to prevent this OOM. Though this fix is not very satisfactory -- json-c could be made to not prefault -- it should do for now. At the very least, swaybar will not crash. Fixes #6126.
* swaybar: use INT_MAX max JSON depth when parsing IPC responseLibravatar Tudor Brindus2021-03-21
| | | | | | | | There's no inherent limit on the nesting Sway can generate, and the default used by `json_tokener_new`, 32, can plausibly be hit during regular usage. Fixes #6115.
* Add support for workspace_min_width bar option.Libravatar Tarmack2020-10-11
|
* swaybar: add NULL check when listing workspacesLibravatar Milkey Mouse2020-05-20
| | | | | | | | | | | | For some reason my version of sway doesn't show workspace names: $ swaymsg -t get_outputs Output HDMI-A-1 '(null) (null) (null)' (inactive) Output HDMI-A-2 '(null) (null) (null)' (inactive) Which is weird, but it's no reason to crash swaybar. The field is totally missing from the JSON, so it ends up doing strcmp(NULL, name) which is undefined behavior.
* swaybar: fix memory leaksLibravatar Ian Fan2020-03-30
|
* Only destroy swaybar surface via ipc when neededLibravatar Bill Doyle2020-02-27
|
* parse_color: return success + drop fallback colorLibravatar Brian Ashworth2019-12-28
| | | | | | | | | | | | 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.
* swaybar: complete barconfig_update event handlingLibravatar Brian Ashworth2019-09-04
| | | | | | | | This adds complete support for the barconfig_update ipc event. This also changes the bar command and subcommand handlers to correctly emit the event. This makes it so all bar subcommands other than id and swaybar_command are dynamically changeable at runtime. sway-bar.5 has been updated accordingly
* swaybar: hide mode visibility improvementsLibravatar Brian Ashworth2019-04-24
| | | | | | | | | | | | This allows swaybar to become visible when the mode changes (to any mode other than the default). swaybar will be hidden again when the modifier is pressed and released or when switching back to the default mode. This also applies the same logic to visible by urgency to hide swaybar when the modifier is pressed and released. These changes are to match i3's behavior.
* Make json-c include respect pkg-config --cflagsLibravatar Jan Beich2019-01-23
| | | | | json-c.pc contains `Cflags: -I${includedir}/json-c`, so `<json-c/json.h>` won't be found unless the parent directory is searched by default.
* swaybar: fix command malloc in workspace commandLibravatar Brian Ashworth2019-01-22
| | | | | | | This fixes a typo on the malloc line in ipc_send_workspace_command. The plus one to the size for the null-terminator was outside of the malloc call, which was causing the incorrect pointer to be freed later in the function.
* swaybar: fix workspace commandLibravatar Ian Fan2019-01-22
| | | | | Escape quotes and backslashes, allowing switching to workspace names like "1" (including quotes) and \
* util.c: remove numlen functionLibravatar Ian Fan2019-01-22
| | | | Its uses have been replaced by snprintf, which is more in line with its usage.
* Replace wlr_log with sway_logLibravatar M Stoeckl2019-01-21
| | | | | | | | | | | | | 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.
* Fixes for small existing bugs.Libravatar Connor E2019-01-16
|
* Remove usage of VLAs.Libravatar Connor E2019-01-16
|
* bar_cmd_tray_bind: Use mouse button helpersLibravatar Brian Ashworth2019-01-16
| | | | | | | | | | | | | | | | This modifies `bar_cmd_tray_bindsym` to use `get_mouse_bindsym` for parsing mouse buttons. This also introduces `bar_cmd_tray_bindcode`, which will use `get_mouse_bindcode` for parsing mouse buttons. Like with sway bindings, the two commands are encapsulated in a single file to maximize shared code. This also modifies tray bindings to work off of events codes rather than x11 buttons, which allows for any mouse buttons to be used. For `get_bar_config`, `event_code` has been added to the `tray_bindings` section and will include to event code for the button. If the event code can be mapped to a x11 button, `input_code` will still be the x11 button number. Otherwise, `input_code` will be `0`.
* Merge pull request #3344 from RedSoxFan/bar-mouse-bindings-improvedLibravatar Drew DeVault2019-01-13
|\ | | | | Improve mouse button parsing: bar mouse bindings
| * bar_cmd_bind: utilize mouse button helpersLibravatar Brian Ashworth2019-01-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This modifies `bar_cmd_bindsym` to use `get_mouse_bindsym` for parsing mouse buttons. This also introduces `cmd_bar_bindcode`, which will use `get_mouse_bindcode` for parsing mouse buttons. Like sway bindings, the two commands are encapsulated in a single file with shared code. This also modifies swaybar to operate off of event codes rather than x11 button numbers, which allows for any mouse button to be used. This introduces two new IPC properties: - For `get_bar_config`, `event_code` has been added to the `bindings` section and will include to event code for the button. If the event code can be mapped to a x11 button, `input_code` will still be the x11 button number. Otherwise, `input_code` will be `0`. - Likewise for `click_events`, `event` has been added and will include the event code for the button clicked. If the event code can be mapped to a x11 button, `button` will still be the x11 button number. Otherwise, `button` will be `0`.
* | swaybar: add status_edge_padding commandLibravatar Brian Ashworth2019-01-11
| | | | | | | | | | This adds the bar subcommand `status_edge_padding <padding>` to set the padding used when the status line is on the right edge of the bar.
* | swaybar: add status_padding commandLibravatar Brian Ashworth2019-01-11
|/ | | | | | Adds the bar subcommand `status_padding <padding>` which allows setting the padding used for swaybar. If `status_padding` is set to `0`, blocks will be able to take up the full height of the bar.
* swaybar: do not create tray if hiddenLibravatar Ian Fan2018-12-31
|
* swaybar: implement tray configLibravatar Ian Fan2018-12-31
|
* Implement bar gapsLibravatar Brian Ashworth2018-11-28
| | | | | | | | | Adds the bar subcommand `gaps <amount>|<horizontal> <vertical>|<top> <right> <bottom> <left>` to set gaps for swaybar. Due to restrictions on margins for a layer_surface, only the sides that are anchored to an edge of the screen can have gaps. Since there is support for per-side outer gaps for workspaces, those should be able to be used instead for the last side.
* Implement strip_workspace_name.Libravatar Connor E2018-11-17
|
* swaybar: reverse order of workspaces listLibravatar Ian Fan2018-10-25
| | | | | This makes it congruent with its visual appearance, making it easier to reason about.
* swaybar: show hidden bar on urgencyLibravatar Ian Fan2018-10-14
|
* swaybar: show hidden bar on key eventLibravatar Ian Fan2018-10-14
| | | | | | Since wayland does not currently allow swaybar to create global keybinds, this is handled within sway and sent to the bar using a custom event, so as not to pollute existing events, called bar_state_update.
* swaybar: handle mode/hidden_state changesLibravatar Ian Fan2018-10-14
| | | | | | | | | As well as adding the hidden_state property to the bar config struct, this commit handles barconfig_update events when the mode or hidden_state changes, and uses a new function determine_bar_visibility to hide or show the bar as required, using, respectively, destroy_layer_surface, which is also newly added, and add_layer_surface, which has been changed to allow dynamically adding the surface.
* swaybar: streamline ipc handlingLibravatar Ian Fan2018-10-14
| | | | | | | The received json is handled outside of the case statement, which will allow better extensibility. This commit also introduces the variable bar_is_dirty, the return value signifying whether the bar requires rendering.
* swaybar: move mode & mode_pango_markup to bar structLibravatar Ian Fan2018-10-14
| | | | | | This distinguishes the binding mode from the distinct config mode, as well as removing mode_pango_markup from the config struct where it should not be present.
* swaybar: only subscribe to required eventsLibravatar Ian Fan2018-10-14
| | | | | This adds barconfig_update to the list of subscribed events, as well as checking when the other events need to be subscribed to.
* swaybar: save id upon startupLibravatar Ian Fan2018-10-14
| | | | | This adds an id property to the bar, which will be used to filter barconfig_update events
* bar-bindsym: address ianyfan's commentsLibravatar Brian Ashworth2018-10-09
|
* Implement bar bindsymLibravatar Brian Ashworth2018-10-09
|
* swaybar: remove unused focused_output propertyLibravatar Ian Fan2018-09-28
|
* swaybar: fail if bar id is invalidLibravatar Ian Fan2018-09-28
|
* Change _XOPEN_SOURCE defines to _POSIX_C_SOURCELibravatar sghctoma2018-09-03
|
* Fix feature macros for FreeBSDLibravatar sghctoma2018-08-30
| | | | | On FreeBSD, snprintf and vsnprintf are visible only if _XOPEN_SOURCE >= 600.
* swaybar: Read urgent colors from IPCLibravatar Ryan Dwyer2018-07-17
|
* Update for swaywm/wlroots#1126Libravatar emersion2018-07-09
|
* Fix a bunch of swaybar memory leaksLibravatar emersion2018-04-24
|
* fix swaybar ipc handlingLibravatar db2018-04-10
| | | | | | | Swap return with break in IPC_EVENT_WORKSPACE case to free resp. Change default return value to true. This causes IPC_EVENT_MODE changes to be rendered instantly.
* Fix workspaces not updated on swaybarLibravatar Drew DeVault2018-04-06
|
* Handle output removal on swaybarLibravatar Drew DeVault2018-04-05
|
* Render i3bar blocksLibravatar Drew DeVault2018-04-02
|