Commit Graph

238 Commits

Author SHA1 Message Date
emersion
8a5ff5a4db swaybar: don't wl_display_roundtrip on each frame
This was the source of numerous bugs, from hotplug events not being
received to segfaults because wl_display_roundtrip was making the
bar process unplug events while blocking in an iteration over all
outputs.
2018-09-20 19:31:03 +02:00
emersion
82f1393cbb swaybar: handle hotplugging
Don't kill and respawn swaybars on hotplug.
2018-09-20 18:37:51 +02:00
Ian Fan
47a66da5de swaybar: only free tokener when using i3bar protocol 2018-09-18 18:06:19 +01:00
Ian Fan
5912325d5c swaybar: add debugging statements for handling i3bar json 2018-09-18 16:10:34 +01:00
Ian Fan
7882ac66ef swaybar: rewrite i3bar protocol handling
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-18 11:36:33 +01:00
Ian Fan
8cbce77e1d swaybar: rewrite protocol determination
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-18 11:36:33 +01:00
Ian Fan
70245c2cd5 swaybar: rewrite text protocol handling
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-18 11:36:33 +01:00
Ian Fan
babd9618b9 swaybar: only create i3bar block hotspot if click events are enabled 2018-09-18 11:36:33 +01:00
Ian Fan
87c93d6ad9 swaybar: send trailing comma with click event json 2018-09-18 11:36:33 +01:00
Ian Fan
9932c6a1f1 swaybar: fix empty function prototypes 2018-09-18 11:36:33 +01:00
Ian Fan
952453480f swaybar: invalidate file descriptors upon closing 2018-09-18 11:36:33 +01:00
Ian Fan
4cb28de89f swaybar: remove block links upon exit 2018-09-18 11:36:33 +01:00
emersion
012df55be5 swaybar: use output names instead of output indexes 2018-09-17 16:04:09 +02:00
Ian Fan
e32e86b65d bar: remove i3bar_block_free in favour of i3bar_block_unref 2018-09-14 21:06:54 +01:00
Ian Fan
2eaef80206 i3bar: count references to blocks
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-09-12 08:28:28 +01:00
Ryan Dwyer
9215ca0f01 Align titles to baseline
This does the following:

* Adds a baseline argument to get_text_size (the baseline is the
distance from the top of the texture to the baseline).
* Stores the baseline in the container when calculating the title
height.
* Takes the baseline into account when calculating the config's max font
height.
* When rendering, pads the textures according to the baseline so they
line up.
2018-09-08 16:25:07 +10:00
Jason
13fbe5176b
Fix swaybar block background fill logic
Same as #2571 but for 1.0.
2018-09-05 18:48:31 +09:00
sghctoma
073dcb3a86 Change _XOPEN_SOURCE defines to _POSIX_C_SOURCE 2018-09-03 09:08:49 +02:00
sghctoma
cc16948c85 Fix feature macros for FreeBSD
On FreeBSD, snprintf and vsnprintf are visible only if
_XOPEN_SOURCE >= 600.
2018-08-30 09:34:26 +02:00
minus
bfcfabee2b swaybar: Fix scroll handling on workspace buttons
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-19 21:15:01 +02:00
emersion
48b911a459
Merge pull request #2281 from pvsr/X11_click
Send clicks to swaybar blocks as X11 button ids
2018-07-18 00:16:15 +01:00
Peter Rice
e43c20134a remove unnecessary parens 2018-07-17 19:04:04 -04:00
Peter Rice
14511da75d send scroll events to swaybar blocks 2018-07-16 18:55:11 -04:00
Peter Rice
79a998849b make hotspot callback take an x11 button id 2018-07-16 18:55:04 -04:00
Ryan Dwyer
255dc8bbb0 swaybar: Read urgent colors from IPC 2018-07-17 08:29:43 +10:00
minus
c73a40555f swaybar/bg: Fix crash on DPMS off
When turning off displays via DPMS, swaybar and swaybg still tried to
render, but did not get a valid buffer, causing them to crash.
2018-07-14 00:04:02 +02:00
emersion
63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
Brian Ashworth
1b4c289482 Fix swaybar teardown when workspace buttons hidden 2018-07-06 11:38:02 -04:00
Brian Ashworth
78c08fb0a2 Implement mode --pango_markup 2018-07-05 18:12:14 -04:00
Ryan Dwyer
e012b05b00 Swaybar: Respect pango_markup config
Makes swaybar respect the user's pango_markup configuration in the
workspace buttons and binding mode indicator.
2018-05-09 14:54:22 +10:00
Rostislav Pehlivanov
3b6629af3c Revert "Install swaybar and swaybg under /usr/lib/sway"
This reverts commit f2c209c299.
2018-05-06 00:20:57 +01:00
Rostislav Pehlivanov
2c0c3dc7cc Revert "Make the LIBDIR path configurable"
This reverts commit 1670b46bf6.
2018-05-06 00:19:52 +01:00
Rostislav Pehlivanov
0cdc47ab1e Revert "Meson: Replace option instlibdir with libexecdir"
This reverts commit 830c4ef74c.
2018-05-06 00:19:43 +01:00
Nicolas Braud-Santoni
830c4ef74c Meson: Replace option instlibdir with libexecdir
Derive a value from it, called `rundir` rather than writing join_paths(libexecdir,
'sway') all over the place.
2018-05-05 17:22:46 +02:00
Nicolas Braud-Santoni
1670b46bf6 Make the LIBDIR path configurable 2018-05-05 17:22:46 +02:00
Nicolas Braud-Santoni
f2c209c299 Install swaybar and swaybg under /usr/lib/sway 2018-05-05 17:22:46 +02:00
emersion
aa36899d8a
Fix a bunch of swaybar memory leaks 2018-04-24 22:28:55 +01:00
Alex Xu (Hello71)
63267240bf Work around maybe-uninitialized in bar.c
Fixes #1855.
2018-04-24 12:29:11 -04:00
Scott Anderson
4dfbc3160c Fix swaybar axis event logic
Uses 'visible' instead of 'focused', since we may scroll on a bar which
isn't the focused output.

We can't use "next_on_output" or "prev_on_output" to implement this,
because it only modify the focused output. So scrolling on an unfocused
output will affect the incorrect one.

We just use the "workspace name" command instead.
2018-04-22 17:25:15 +12:00
Scott Anderson
c63554885e Remove void * casts
They're pointless.
2018-04-21 14:45:34 +12:00
Scott Anderson
2ebb6073b7 Remove status command event on error
This prevents very high CPU load when the status command dies,
and poll continuously awoken with POLLHUP.
2018-04-21 14:39:46 +12:00
Scott Anderson
9a3fb33e33 Change remove_event logic
We defer the removal of entries until after the poll loop has finished.
Otherwise we may end up adjusting the poll array while we're still
reading from it, causing us to skip events.
2018-04-21 14:38:34 +12:00
Scott Anderson
e0107c4dd7 Always send POLLHUP and POLLERR with event loop 2018-04-21 13:44:32 +12:00
Bruno Pinto
9bc4565a59
Fix memory leak on swaybar
Code from @NilsBrause

Ref #1820
2018-04-20 01:58:30 +01:00
Scott Anderson
0d67d56c2a Set _POSIX_C_SOURCE properly 2018-04-15 15:50:39 +12:00
Drew DeVault
5785170421 Fix separator height calculation
Fixes #1796

Also rearranged this code to more closely mirror the similar code above
so future discrepancies are easier to spot.
2018-04-10 22:18:54 -04:00
emersion
84243a708e
Merge pull request #1792 from RyanDwyer/fix-swaybar-status-blocks
Fix swaybar not showing all status blocks
2018-04-10 18:38:43 -04:00
Ryan Dwyer
7dfc0409eb Check height in surface local coordinates and rename some variables. 2018-04-11 08:34:21 +10:00
db
39e3319394 fix swaybar ipc handling
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.
2018-04-10 22:01:22 +02:00
Ryan Dwyer
1a0d367f22 Fix swaybar not showing all status blocks. 2018-04-10 16:08:08 +10:00