aboutsummaryrefslogtreecommitdiff
path: root/swaybar/status_line.c
AgeCommit message (Collapse)Author
2020-06-12swaybar: ensure correct init order for status_lineLuke Drummond
`$WAYLAND_SOCKET` is unset by `wl_display_connect` after it has successfully connected to the wayland socket. However, subprocesses spawned by swaybar (status-command) don't have access to waybar's fds as $WAYLAND_SOCKET is O_CLOEXEC. This means any status command which itself tries to connect to wayland will fail if this environment variable is set. Reorder display and status-command initialization so that this variable is not set and add an assert so we can enforce this invariant in future.
2020-02-10swaybar: fix i3bar relative coordinates when scaling is usedHristo Venev
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-09-04swaybar: complete barconfig_update event handlingBrian Ashworth
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
2019-02-01Revert "More frees."Connor E
This reverts commit eda1bf769f239a9e8d5a9907255a330e3113a649.
2019-01-23Make json-c include respect pkg-config --cflagsJan Beich
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
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-01Remove readline.cIan Fan
All occurrences of read_line have been replaced by getline. peek_line has been absorbed into detect_brace.
2018-12-31swaybar: fix double freeMack Straight
status->text should not be freed here. There are two scenarios: * status->text has been set to an error by status_error. In this case the value shouldn't be freed because it's always a reference to a constant. * status->text has been set to status->buffer because the bar is in text protocol mode. In this case it's a double free because the buffer is already freed after.
2018-11-13More frees.Connor E
2018-10-15Remove timerfd from loop implementationRyan Dwyer
timerfd doesn't work on the BSDs, so this replaces it with a timespec for the expiry and uses a poll timeout to check the timers when needed.
2018-10-15Move swaybar's event loop to common directory and refactorRyan Dwyer
* The loop functions are now prefixed with `loop_`. * It is now easy to add timers to the loop. * Timers are implemented using pollfd and timerfd, rather than manually checking them when any other event happens to arrive.
2018-10-14swaybar: send signal to status when hiding or showing barIan Fan
2018-09-28swaybar: move i3bar definitions into separate fileIan Fan
2018-09-26Replace getdelim to make swaybar work on FreeBSDsghctoma
This commit fixes a segfault in swaybar on FreeBSD that was caused by using getdelim with EOF as delimiter on an infinite stream. The FreeBSD implementation handles the "no more data, delimiter not found, and EOF not reached" scenario as an error, so it can't be used to read the output of status command. This commit replaces the getline/getdelim calls with reading all available data from the stream in one go.
2018-09-22swaybar: explicitly check return value of getdelimIan Fan
This prevents an signed-to-unsigned conversion error on buffer_index if getdelim fails and returns -1, which caused swaybar to try to search the header for the array and immediately failing
2018-09-18swaybar: only free tokener when using i3bar protocolIan Fan
2018-09-18swaybar: rewrite i3bar protocol handlingIan Fan
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: rewrite protocol determinationIan Fan
This now uses the getline function to receive the header, replacing read_line_buffer, which has been deleted since it is otherwise unused. Furthermore, once the protocol has been determined, the current status is handled immediately to be shown (though this has not been added for the i3bar protocol since it has not yet been rewritten to handle this).
2018-09-18swaybar: rewrite text protocol handlingIan Fan
This now uses getline to correctly handle multiple or long statuses. It also removes the struct text_protocol_state and moves its members into the status_line struct.
2018-09-18swaybar: invalidate file descriptors upon closingIan Fan
2018-09-18swaybar: remove block links upon exitIan Fan
2018-09-12i3bar: count references to blocksIan Fan
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-09Update for swaywm/wlroots#1126emersion
2018-04-24Fix a bunch of swaybar memory leaksemersion
2018-04-15Set _POSIX_C_SOURCE properlyScott Anderson
2018-04-03Fix #1709Drew DeVault
2018-04-02Render i3bar blocksDrew DeVault
2018-04-02Demarcate i3bar JSON into individual updatesDrew DeVault
2018-03-29Do some small cleanupDrew DeVault
- Fix workspace events (security config isn't in use so it wasn't being sent) - Kill status bar process when swaybar exits - Don't rearrange windows on every layer surface commit
2018-03-29Clean up status line on exitDrew DeVault
2018-03-29Implement status lineDrew DeVault
Does not yet support i3bar json protocol
2018-03-29Start port of swaybar to layer shellDrew DeVault
This starts up the event loop and wayland display and shims out the basic top level rendering concepts. Also includes some changes to incorporate pango into the 1.x codebase properly.
2017-10-28Removed trailing comma from swaybar click event jsonJoona Romppanen
2017-10-14Fix build on FreeBSD adjusting/removing _XOPEN_SOURCE declaration.Johannes Lundberg
2017-08-30styling fixesakokshar@redhat.com
2017-08-29styling fixesakokshar@redhat.com
2017-08-29style fixesakokshar@redhat.com
2017-08-29click_events as documented at https://i3wm.org/docs/i3bar-protocol.htmlakokshar@redhat.com
2017-03-10UnGNUify the codebaseDrew DeVault
2016-09-01Reorganize includesDrew DeVault
2016-07-30implement solid color rendering for swaybgZandr Martin
2016-04-24Use i3bar format for markup field.Mikkel Oscar Lyderik
In the i3bar protocol the value of the markup field is a string: "pango" or "none" rather than a bool. This patch makes swaybar compatible with that. http://i3wm.org/docs/i3bar-protocol.html
2016-04-17Flesh out pango markup implementationDrew DeVault
2016-01-24swaybar: move headers to include/barMikkel Oscar Lyderik
2016-01-24swaybar: rename state to barMikkel Oscar Lyderik
2016-01-24swaybar: Move swaybar_teardown to free_stateMikkel Oscar Lyderik
2016-01-24swaybar: move ipc stuff to ipc.{h,c}Mikkel Oscar Lyderik
2016-01-24swaybar: feactor render, statuslineMikkel Oscar Lyderik