aboutsummaryrefslogtreecommitdiff
path: root/swaybar/i3bar.c
AgeCommit message (Collapse)AuthorLines
2024-02-23Define _POSIX_C_SOURCE globallySimon Ser-1/+0
See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
2022-11-26swaybar: Make hotspots block bar release bindingsJoan Bruguera-1/+6
The previous commit prioritized hotspots before bar bindings for press events, which matches i3's behaviour. However, since hotspots don't need to do any processing on release events, those were not handled, and simply fell through to `bindsym --release` bar bindings (if any). This is counter-intuitive, and doesn't match i3's behaviour. Instead in case a hotspot handles the press event, it should also handle the release event, doing nothing, but blocking the event from triggering a --release bar binding. E.g., in Sway, without this commit, this config. shows a text on tray clicks: bar { # ... bindsym --release button1 exec swaynag -m I_got_the_release_event. } But the same configuration in i3 (with i3-nagbar) doesn't show the text. Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2021-09-20swaybar: properly draw blocks with transparent black borderNathan Schulte-15/+16
while the draw itself is a no-op, alignment must still be accounted this requires more signalling about the blocks (border_set; was the border set?)
2020-02-10swaybar: fix i3bar relative coordinates when scaling is usedHristo Venev-8/+18
24e8ba048aef4751c6fa1d5982ee634f921e6cf6 did not take scaling into account. The hotspot size used pixel coordinates, the absolute coordinates were logical, and the relative coordinates were completely wrong. This commit makes all coordinates use logical values. If `"float_event_coords":true` is sent in the handshake message, coordinates are sent as floating-point values. The "scale" field is an integer containing the scale value.
2019-12-28parse_color: return success + drop fallback colorBrian Ashworth-7/+13
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-01-31Rebase #1636 against current masterv44r-1/+2
2019-01-23Make json-c include respect pkg-config --cflagsJan Beich-1/+1
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.
2019-01-21Replace wlr_log with sway_logM Stoeckl-7/+7
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-16bar_cmd_tray_bind: Use mouse button helpersBrian Ashworth-25/+0
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`.
2019-01-10bar_cmd_bind: utilize mouse button helpersBrian Ashworth-2/+29
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`.
2018-12-04Add relative coordinates in JSON for i3bar click eventsHristo Venev-1/+6
Compatibility with i3 commit 161db6f17d734ac9deb0a20e81b78d4b2a92ce68.
2018-10-18swaybar: separate input code to new fileIan Fan-29/+1
2018-10-02swaybar: add leading comma to click event JSONIan Fan-2/+3
2018-09-28swaybar: move i3bar definitions into separate fileIan Fan-0/+2
2018-09-21swaybar: log invalid i3bar jsonIan Fan-3/+12
2018-09-21swaybar: reset tokener if json is incompleteIan Fan-0/+1
If the tokener parses incomplete json, it sets its error value to json_tokener_continue. This means that extra json should be provided, but the code was providing the entire object again. In the interest of simplicity, the tokener is reset so that buffer_pos always points to the start of the current object.
2018-09-21swaybar: update buffer_pos when moving object to start of bufferIan Fan-0/+1
2018-09-18swaybar: add debugging statements for handling i3bar jsonIan Fan-0/+16
2018-09-18swaybar: rewrite i3bar protocol handlingIan Fan-78/+111
This now correctly handles an incoming json infinite array by shifting most of the heavy listing to the json-c parser, as well as sending multiple statuses at once. It also removes the struct i3bar_protocol_state and moves its members into the status_line struct, allowing the same buffer to be used for both protocols.
2018-09-18swaybar: send trailing comma with click event jsonIan Fan-1/+1
2018-09-14bar: remove i3bar_block_free in favour of i3bar_block_unrefIan Fan-12/+9
2018-09-12i3bar: count references to blocksIan Fan-3/+10
This prevents blocks from being destroyed before their hotspots are destroyed, in case it is used for a pending click event that fires between the bar receiving a new status, which destroys the block, and the bar rendering the new status, which destroys the hotspot; this problem can be easily produced by scrolling on a block that immediately causes a new status to be sent, with multiple outputs
2018-07-19swaybar: Fix scroll handling on workspace buttonsminus-2/+3
As well as ignoring scroll events on status elements when click_events is enabled. Previously, using the scroll wheel on a workspace button would switch to that workspace instead of scrolling through them. Clicks and scrolling on status elements would always be processed by swaybar, too. So in case you were using scrolling as volume control on a status item, swaybar would additionally scroll through your workspaces.
2018-07-17remove unnecessary parensPeter Rice-5/+5
2018-07-16make hotspot callback take an x11 button idPeter Rice-1/+31
2018-07-09Update for swaywm/wlroots#1126emersion-2/+2
2018-04-24Fix a bunch of swaybar memory leaksemersion-1/+2
2018-04-20Fix memory leak on swaybarBruno Pinto-0/+1
Code from @NilsBrause Ref #1820
2018-04-09Fix some more bugsDrew DeVault-3/+4
2018-04-09Fix buffer issues in swaybar status line.Ryan Dwyer-0/+3
2018-04-03Fix #1709Drew DeVault-1/+4
2018-04-02Fix use-after-free with block hotspotsDrew DeVault-3/+1
2018-04-02Send click events for i3bar blocksDrew DeVault-0/+22
2018-04-02Render i3bar blocksDrew DeVault-10/+110
2018-04-02Demarcate i3bar JSON into individual updatesDrew DeVault-0/+88