Commit graph

316 commits

Author SHA1 Message Date
Jan Beich 0a4c4f3e52 Simplify evdev includes on FreeBSD by relying on up-to-date package
evdev-proto is installed by a dependency, so some files have been missed:

  In file included from ../sway/input/cursor.c:3:
  /usr/local/include/libevdev-1.0/libevdev/libevdev.h:30:10: fatal error: 'linux/input.h' file not found
  #include <linux/input.h>
	   ^~~~~~~~~~~~~~~
  ../swaybar/i3bar.c:3:10: fatal error: 'linux/input-event-codes.h' file not found
  #include <linux/input-event-codes.h>
	   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-01-09 11:02:05 +00:00
Ian Fan f87628e2ab swaybar: improve tray logging 2019-01-08 16:03:16 +00:00
Ian Fan d093c3ac55 swaybar: handle SNI signals better
This fixes a crash caused by callbacks not matching the right sender,
and frees old values later, before they are re-assigned.
2019-01-08 12:18:59 +00:00
Ian Fan b666fc76a6 swaybar: free the right item during tray destruction
Also added a comment to make more obvious the reason for comparing
sni->status[0] == 'N'
2019-01-08 12:17:53 +00:00
Ian Fan a82b8a3c14 Remove readline.c
All occurrences of read_line have been replaced by getline.
peek_line has been absorbed into detect_brace.
2019-01-01 09:01:25 +00:00
Ian Fan 9e31f5d79c swaybar: use KDE's SNI IconThemePath property 2018-12-31 20:40:18 +00:00
Ian Fan 371089f62c swaybar: handle new and lost StatusNotifierWatcher 2018-12-31 20:40:18 +00:00
Ian Fan 8ffb7f0529 swaybar: draw a sad face if SNI has no icon 2018-12-31 20:40:18 +00:00
Ian Fan f33b5c5223 swaybar: do not create tray if hidden 2018-12-31 20:40:18 +00:00
Ian Fan 2fd41fe9c8 swaybar: set bar dirty on SNI event 2018-12-31 20:40:18 +00:00
Ian Fan 6becde0246 swaybar: implement mouse events for tray 2018-12-31 20:40:18 +00:00
Ian Fan fa2c5282c1 swaybar: implement tray rendering 2018-12-31 20:40:18 +00:00
Ian Fan 6b03c68775 swaybar: implement tray config 2018-12-31 20:40:18 +00:00
Ian Fan 74655f835a swaybar: add StatusNotifierItem to tray 2018-12-31 20:40:18 +00:00
Ian Fan e6cb55e2f8 swaybar: add StatusNotifierHost to tray 2018-12-31 20:40:18 +00:00
Ian Fan 746600e6ed swaybar: implement icon themes and lookup for tray 2018-12-31 20:40:18 +00:00
Ian Fan 02df3f67aa swaybar: add StatusNotifierWatcher to tray 2018-12-31 20:40:18 +00:00
Ian Fan ef555012fa swaybar: add skeleton dbus code to tray 2018-12-31 20:40:18 +00:00
Ian Fan 5f65f33989 swaybar: add tray interface 2018-12-31 20:40:18 +00:00
Mack Straight 828060af73 swaybar: fix double free
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-12-31 01:19:14 -05:00
Brian Ashworth 35a82a8693 swaybar: fix cursor scale
This fixes a few issues with swaybar's cursor scaling:
1. The cursor scale is now changed when the output scale changes
2. The cursor scale is no longer bound by the max output scale when
swaybar is launched
3. Related to the previous item, the cursor is no longer tiny on low
scale outputs after the max output scale has changed

This also bumps up `wl_compositor` to version 4 to allow usage of
`wl_surface_damage_buffer`.
2018-12-15 09:26:50 +01:00
Brian Ashworth 549d9fe489 swaybar: fix sep block width for mixed scales
When there are outputs with mixed scales, it was possible for swaybar to
alter `block->separator_block_width` for an output with a higher scale,
and use the changed value for a lower scale output. This caused there to
be larger than normal separation between blocks on the lower scale
outputs. The issue is more obvious the larger the scale difference
between the highest scale output and the lowest scale output.

This fixes the issue by using a local variable that is originally set to
`block->separator_block_width` for rendering, but if it needs to be
increased, the local variable is the only thing touched.
2018-12-12 10:23:57 +01:00
Brian Ashworth 8b4fe7dd15 swaybar: handle block->urgent
When `block->urgent` is set, use the urgent colors. This matches i3bar's
behavior. Previously, swaybar just ignored the property.

This also adds in rendering for right borders, which was missing.
2018-12-12 10:17:39 +01:00
Hristo Venev 24e8ba048a Add relative coordinates in JSON for i3bar click events
Compatibility with i3 commit 161db6f17d734ac9deb0a20e81b78d4b2a92ce68.
2018-12-04 12:49:21 +02:00
Brian Ashworth 1bd8463481 Implement bar gaps
Adds the bar subcommand `gaps <amount>|<horizontal> <vertical>|<top>
<right> <bottom> <left>` to set gaps for swaybar. Due to restrictions on
margins for a layer_surface, only the sides that are anchored to an edge
of the screen can have gaps. Since there is support for per-side outer
gaps for workspaces, those should be able to be used instead for the
last side.
2018-11-28 11:24:14 -05:00
emersion 3a310f92ab
Replace _XOPEN_SOURCE with _POSIX_C_SOURCE
And make sure we don't define both in the same source file.
2018-11-25 17:19:43 +01:00
emersion bf7af9c690
Merge pull request #3083 from c-edw/feature/StripWorkspaceName
Implement strip_workspace_name.
2018-11-19 17:56:18 +01:00
Connor E 4bd46fb079 Implement strip_workspace_name. 2018-11-17 16:11:28 +00:00
Connor E eda1bf769f More frees. 2018-11-13 14:42:00 +00:00
Connor E b5d95f264d Add some missing frees. 2018-11-13 13:45:01 +00:00
Ian Fan 19421373b9 swaybar: when scrolling, check that there are workspaces to scroll on 2018-10-25 14:12:26 +01:00
Ian Fan c5541763c0 swaybar: fix scrolling behaviour
1. wrap_scroll has been fixed
2. release bindings are checked when returning early
2018-10-25 12:57:16 +01:00
Ian Fan c3fdabb725 swaybar: reverse order of workspaces list
This makes it congruent with its visual appearance, making it easier to
reason about.
2018-10-25 12:57:16 +01:00
Drew DeVault 41f744c224
Merge pull request #2925 from ianyfan/swaylock
swaylock: exit early if unable to get input inhibitor
2018-10-24 18:54:22 +02:00
Ian Fan 48cf430cee swaybar: absorb bar_init function into bar_setup 2018-10-23 12:25:52 +01:00
Ian Fan 9afcda59db swaybar: exit on display error 2018-10-23 12:22:51 +01:00
Ryan Dwyer 851b442f73 Fix swaybar crash when there's no status_command 2018-10-23 18:38:01 +10:00
emersion 2a32701b78
swaybar: fix hotplug 2018-10-21 17:46:40 +02:00
Ian Fan 1844a5bafb swaybar: render with minimum height, nominally text height 2018-10-20 21:21:57 +01:00
Ryan Dwyer a4ce5227c2 Put swaybar in overlay layer when using mode hide
This allows the bar to render over fullscreen views.
2018-10-20 16:48:43 +10:00
Rouven Czerwinski f52825336c swaybar: disallow left and right position and print error on default
The positions "left" and "right" are not allowed by the man page, remove them
from the allowed positions. Also print an error to stderr if we default to the
bottom position.

Fixes #2878
2018-10-20 08:21:44 +02:00
ossi.ahosalmi 79011e68df missing headers for swaybar/input.c 2018-10-19 15:55:30 +03:00
Ian Fan 499150a91b swaybar: separate input code to new file 2018-10-18 14:19:00 +01:00
Ryan Dwyer 32ba8154b8 Sway clients: Exit gracefully when compositor is unavailable 2018-10-15 21:57:59 +10:00
Ryan Dwyer 6921fdc6d6 Remove timerfd from loop implementation
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-15 00:26:27 +10:00
Ryan Dwyer 4056c09e13 Move swaybar's event loop to common directory and refactor
* 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-15 00:26:27 +10:00
Ian Fan 4dba7c084a swaybar: when hiding bar, save old height to be restored upon reshow
Previously, when the bar was hidden, the height would be set to 0.
This meant that if the bar was empty upon reshow, it would not render
since the height was still 0, which made it seem there was a problem.
Now, the height is not reset, but the width is, to indicate upon reshow
that the layer surface needed reconfiguring.
2018-10-14 13:33:12 +01:00
Ian Fan a29ee77411 swaybar: send signal to status when hiding or showing bar 2018-10-14 13:33:12 +01:00
Ian Fan f6f72cb949 swaybar: show hidden bar on urgency 2018-10-14 13:33:12 +01:00
Ian Fan 2f1fd80726 swaybar: show hidden bar on key event
Since wayland does not currently allow swaybar to create global
keybinds, this is handled within sway and sent to the bar using a custom
event, so as not to pollute existing events, called bar_state_update.
2018-10-14 13:33:12 +01:00