1
1
mirror of https://github.com/swaywm/sway synced 2024-11-18 19:03:59 +01:00
Commit Graph

283 Commits

Author SHA1 Message Date
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
Ian Fan
bcc61e5147 swaybar: handle mode/hidden_state changes
As well as adding the hidden_state property to the bar config struct,
this commit handles barconfig_update events when the mode or
hidden_state changes, and uses a new function determine_bar_visibility
to hide or show the bar as required, using, respectively,
destroy_layer_surface, which is also newly added, and add_layer_surface,
which has been changed to allow dynamically adding the surface.
2018-10-14 13:33:12 +01:00
Ian Fan
55ca16f2d8 swaybar: streamline ipc handling
The received json is handled outside of the case statement, which will
allow better extensibility.
This commit also introduces the variable bar_is_dirty, the return value
signifying whether the bar requires rendering.
2018-10-14 13:33:12 +01:00
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
a388ffa127 swaybar: only send initial workspace request if workspace buttons are enabled 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
a67fa8a05d swaybar: only subscribe to required events
This adds barconfig_update to the list of subscribed events, as well as
checking when the other events need to be subscribed to.
2018-10-14 13:33:12 +01:00
Ian Fan
d0b54e932b swaybar: save id upon startup
This adds an id property to the bar, which will be used to filter
barconfig_update events
2018-10-14 13:33:12 +01:00
Ian Fan
cd6917d4a8
Merge branch 'master' into bar-bindsym 2018-10-10 12:23:04 +00:00
Ryan Dwyer
fa8959532b Fix program name in version strings
When running swaymsg -v, the version returned is actually the version of
swaymsg itself, yet the message displayed was "sway version <version>".
This can create confusion if users update sway and swaymsg but don't
restart sway, then use swaymsg to check the version.

This patch changes the wording to be "swaymsg version <version>"
instead, and likewise for swaybar.

To get the version of a running sway instance, users should run swaymsg
-t get_version.
2018-10-10 18:34:50 +10:00
Brian Ashworth
d3f0e52784 bar-bindsym: address ianyfan's comments 2018-10-09 08:12:46 -04:00
Brian Ashworth
1c969e86f5 Implement bar bindsym 2018-10-09 08:12:46 -04:00
Ryan Dwyer
41bfd8c790 swaybar: allow null status_command
Sway sets a default status_command which runs date every second. This
patch removes this behaviour so the user can have a NULL status bar if
desired.

I had to swap swaybar's event_loop_poll and wl_display_flush so that it
would map the initial surface.
2018-10-08 22:23:55 +10:00
emersion
d50f54fa42 swaybar: fix binding to wl_pointer multiple times 2018-10-06 19:13:44 +02:00
Ian Fan
65593f49bc swaybar: add leading comma to click event JSON 2018-10-02 14:05:51 +01:00
Arkadiusz Hiler
eed0bc3ebd Add support for installing binaries with DT_RPATH
It's better to use DT_RPATH dynamic section of the elf binary to store
the paths of libraries to load instead of overwriting LD_LIBRARY_PATH
for the whole environment, causing surprises. This solution is much more
transparent and perfectly suitable for running contained installations
of wayland/wlroots/sway.

The code unsetting the LD_LIBRARY_PATH/LD_PRELOAD was also deleted as
it's a placebo security at best - we should trust the execution path
that leads us to running sway, and it's way too late to care about those
variables since we already started executing our compositor, thus we
would be compromised anyway.
2018-09-30 15:37:01 +03:00
Arkadiusz Hiler
1e70f7b19e Turn funcs() into funcs(void)
If they really do not take undefined number of arguments.
2018-09-30 14:09:05 +03: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
Ian Fan
bcd2a8fe12 swaybar: remove unused focused_output property 2018-09-28 13:54:58 +01:00
Ian Fan
312d009f65 swaybar: fail if bar id is invalid 2018-09-28 13:48:59 +01:00
sghctoma
315b2bf100 Replace getdelim to make swaybar work on FreeBSD
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-26 20:38:16 +02: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
Ian Fan
a4d346627c swaybar: explicitly check return value of getdelim
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-22 11:02:47 +01:00
Brian Ashworth
04862e2121
Merge branch 'master' into swaybar-hotplug 2018-09-21 15:28:53 -04:00
Ian Fan
a2326661e1 swaybar: log invalid i3bar json 2018-09-21 15:10:47 +01:00
Ian Fan
ccdec2a329 swaybar: reset tokener if json is incomplete
If the tokener parses incomplete json, it sets its error value to
json_tokener_continue. This means that extra json should be provided,
but the code was providing the entire object again. In the interest of
simplicity, the tokener is reset so that buffer_pos always points to the
start of the current object.
2018-09-21 15:09:54 +01:00
Ian Fan
dbda5d35eb swaybar: update buffer_pos when moving object to start of buffer 2018-09-21 14:33:49 +01: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
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