Commit graph

111 commits

Author SHA1 Message Date
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
D.B 6f2c39610e parse pango markup in workspace names (and bugfix)
This change allows using numeric character references in workspace names
- for example æ which stands for sharp s. A fix was necessary in
get_pango_layout, since markup and parsed markup had different width.
2016-10-07 11:27:06 +02:00
D.B fe89d7fba3 Correctly scale swaybar
Fixes #910. There were some missing multiplications with window->scale.
2016-09-29 14:31:35 +02:00
Drew DeVault af44154119 Fix constant scale factor in font code 2016-09-05 11:52:52 -04:00
Drew DeVault b2226ac655 Add client support for HiDPI
This adds HiDPI support to swaybar, swaybg, and swaylock.
2016-09-05 11:36:48 -04:00
Drew DeVault 416417a54c Reorganize includes 2016-09-01 08:18:37 -04:00
David Eklov c805e42635 Extract workspace size computation from render_workspace_button()
Also remove some unnecessary strtup()s and rename a few variables and functions.
2016-07-14 17:18:01 -05:00
Mykyta Holubakha 0f1cfdec61 Renamed to pango_markup 2016-04-24 20:35:21 +03:00
Mykyta Holubakha ee4e245f16 Fix line length calculation 2016-04-24 20:20:07 +03:00
Mykyta Holubakha 53b53dd8c2 Added plaintext markup configuration 2016-04-24 19:57:35 +03:00
Mykyta Holubakha a25c35f859 Passing missing argument to get_text_size 2016-04-24 10:39:42 +03:00
Drew DeVault 84fae94ab9 Flesh out pango markup implementation 2016-04-17 11:36:03 -04:00
Mikkel Oscar Lyderik cefcce48aa Make client/pango.h not depend on client/window.h 2016-03-30 00:47:58 +02:00
Christoph Gysin a5345e807e extract cairo_set_source_u32() 2016-01-25 22:44:33 +02:00
Mikkel Oscar Lyderik 123de86001 swaybar: Fix plaintext handling.
Fix #473
2016-01-25 15:24:12 +01:00
Mikkel Oscar Lyderik 96935f2682 Fix colors off by one 2016-01-25 01:11:33 +01:00
Mikkel Oscar Lyderik ed227f5664 swaybar: move headers to include/bar 2016-01-24 15:55:58 +01:00
Mikkel Oscar Lyderik aa6ad09183 swaybar: rename state to bar 2016-01-24 14:22:19 +01:00
Mikkel Oscar Lyderik fcc47cb3bd swaybar: move ipc stuff to ipc.{h,c} 2016-01-24 14:22:19 +01:00
Mikkel Oscar Lyderik a6349a2444 swaybar: feactor render, statusline 2016-01-24 14:22:19 +01:00