Commit graph

69 commits

Author SHA1 Message Date
Ian Fan
fed11d1c7b swaybar: move mode & mode_pango_markup to bar struct
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.
2018-10-14 13:33:12 +01:00
Ian Fan
19f0bf3864 swaybar: add free_hotspots helper function 2018-10-14 13:33:12 +01:00
Ian Fan
02dfeea54c swaybar: synchronize rendering to output frames 2018-09-30 10:07:33 +01:00
Ian Fan
25e1f32738 swaybar: trim function prototypes 2018-09-28 14:09:33 +01:00
Ian Fan
751bb4a376 swaybar: move i3bar definitions into separate file 2018-09-28 13:54:58 +01:00
Geoff Greer
c495164f60 swaybar, swaylock, & tree/container: Set cairo font options to render text and lines with subpixel hinting (if available). 2018-09-22 11:34:21 -07:00
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
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
babd9618b9 swaybar: only create i3bar block hotspot if click events are enabled 2018-09-18 11:36:33 +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
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
Peter Rice
79a998849b make hotspot callback take an x11 button id 2018-07-16 18:55:04 -04: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
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
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
Ryan Dwyer
7dfc0409eb Check height in surface local coordinates and rename some variables. 2018-04-11 08:34:21 +10:00
Ryan Dwyer
1a0d367f22 Fix swaybar not showing all status blocks. 2018-04-10 16:08:08 +10:00
emersion
16e363e3e2
Fix swaybar HiDPI rounding issue 2018-04-08 13:49:11 -04:00
Drew DeVault
4ba6545c65 Fixup for #1773 2018-04-08 10:04:23 -04:00
db
257a831c72 Use full ws->name in swaybar hotspot callback
If strip_workspace_numbers option is enabled, we must preserve the right
workspace name for hotspot.
2018-04-08 15:48:59 +02:00
Drew DeVault
f242362e7e Handle output removal on swaybar 2018-04-05 16:04:30 -04:00
Drew DeVault
38bdd4bdeb Address review feedback 2018-04-03 22:52:40 -04:00
Drew DeVault
c4e92c81f5 Adjust height calculation, naming 2018-04-03 21:57:47 -04:00
Drew DeVault
2605950769 Add hidpi support to swaybar 2018-04-03 21:06:28 -04:00
Drew DeVault
ef50d84be1 Render blocks the correct order 2018-04-02 13:53:40 -04:00
Drew DeVault
c507727ad2 Fix use-after-free with block hotspots 2018-04-02 11:53:56 -04:00
Drew DeVault
0cbd2a4f49 Send click events for i3bar blocks 2018-04-02 11:09:23 -04:00
Drew DeVault
333dbcbe72 Render i3bar blocks 2018-04-02 11:09:23 -04:00
Drew DeVault
2a5108a278 Implement workspace switch on click 2018-03-30 22:44:08 -04:00
Drew DeVault
d8104db8f1 Early return from render functions if necessary 2018-03-29 23:35:49 -04:00
Drew DeVault
da6e48520b Tear down bar when display exits 2018-03-29 22:11:08 -04:00
Drew DeVault
0d0ab7c5ce Implement status line
Does not yet support i3bar json protocol
2018-03-29 22:11:08 -04:00
Drew DeVault
718502c815 Iterate over workspaces backwards 2018-03-29 22:11:08 -04:00
Drew DeVault
531c175d3e Respect user bar height preference
This is an i3-gaps feature we support
2018-03-29 22:11:08 -04:00
Drew DeVault
1e8faeec02 Pixel-perfect rendering 2018-03-29 22:11:08 -04:00
Drew DeVault
37b61eff2d Add binding mode indicator 2018-03-29 22:11:08 -04:00
Drew DeVault
3a458cd7b5 Implement workspace button rendering 2018-03-29 22:11:08 -04:00
Drew DeVault
cab1352801 Start port of swaybar to layer shell
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.
2018-03-29 22:11:08 -04:00
akokshar@redhat.com
39df3aed82 styling fixes 2017-08-29 17:33:06 +02:00
akokshar@redhat.com
65022e1cbf click_events as documented at https://i3wm.org/docs/i3bar-protocol.html 2017-08-29 11:19:43 +02:00
Calvin Lee
1451ee8fd1 Reorganize Tray Code
Remove tray code from bar.c and render.c
2017-06-07 21:32:48 -07:00
Drew DeVault
790887ce76 Fix cairo blending on tray icons 2017-06-07 22:45:33 -04:00
Calvin Lee
843ad38b3c Implement Tray Icons
This commit implements the StatusNotifierItem protocol, and enables
swaybar to show tray icons. It also uses `xembedsniproxy` in order to
communicate with xembed applications.
The tray is completely optional, and can be disabled on compile time
with the `enable-tray` option. Or on runtime with the bar config option
`tray_output none`.

Overview of changes:
In swaybar very little is changed outside the tray subfolder except
that all events are now polled in `event_loop.c`, this creates no
functional difference.

Six bar configuration options were added, these are detailed in
sway-bar(5)

The tray subfolder is where all protocol implementation takes place and
is organised as follows:

tray/sni_watcher.c:
	This file contains the StatusNotifierWatcher. It keeps track of
	items and hosts and reports when they come or go.
tray/tray.c
	This file contains the StatusNotifierHost. It keeps track of
	sway's version of the items and represents the tray itself.
tray/sni.c
	This file contains the StatusNotifierItem struct and all
	communication with individual items.
tray/icon.c
	This file implements the icon theme protocol. It allows for
	finding icons by name, rather than by pixmap.
tray/dbus.c
	This file allows for asynchronous DBus communication.

See #986 #343
2017-06-07 17:49:16 -07:00
D.B
ad4d21d60b add bar colours for focused_(workspace|statusline|separator)
If these aren't defined in config, color settings without 'focused_'
prefix are used as a fallback.
2016-11-02 18:58:33 +01:00
Drew DeVault
c0916f6138 Use CAIRO_OPERATOR_SOURCE for swaybar 2016-10-12 23:44:19 -04:00