Commit Graph

444 Commits

Author SHA1 Message Date
Connor E 49b667272b Revert "Add some missing frees."
This reverts commit b5d95f264d.
2019-02-01 11:51:03 +00:00
v44r 204e1f4712 Rebase #1636 against current master 2019-01-31 15:37:57 +01:00
Jan Beich ba96983bf0 Make json-c include respect pkg-config --cflags
json-c.pc contains `Cflags: -I${includedir}/json-c`, so `<json-c/json.h>`
won't be found unless the parent directory is searched by default.
2019-01-23 21:50:06 -05:00
Drew DeVault 8b056cfc82
Merge pull request #3500 from progandy/validate_pixmaps
swaybar: fix crash with some tray icon pixmaps
2019-01-23 09:21:08 -05:00
Lukas Lihotzki f7ed97e2a7 Fix tray icon updates
Apparently, IconThemePath needs to be reread on NewIcon signal.
This fixes tray icon updates in electron apps with libappindicator-gtk3.
2019-01-23 13:08:43 +01:00
progandy dcabe0e6da swaybar: fix crash with some tray icon pixmaps
Discard pixmaps for icons where width and height are 0 or not equal.

Fixes #3487
2019-01-23 00:04:00 +01:00
Brian Ashworth 9e6c6ce332 swaybar: fix command malloc in workspace command
This fixes a typo on the malloc line in ipc_send_workspace_command. The
plus one to the size for the null-terminator was outside of the malloc
call, which was causing the incorrect pointer to be freed later in the
function.
2019-01-22 20:10:19 +01:00
Ian Fan d8f3e6e19a swaybar: fix workspace command
Escape quotes and backslashes, allowing switching to workspace names
like "1" (including quotes) and \
2019-01-22 18:48:33 +01:00
M Stoeckl 0af5b26e41 Fix dead stores found by scan-build
In addition to removing unused code, two minor problems are fixed:
 (1) `resize set` and `resize adjust` did not error when given
too many arguments.
 (2) `orientation` was incorrectly overridden to be 'U' for
scroll events in the swaybar tray `handle_click` function.
2019-01-22 10:12:04 -05:00
Ian Fan de9a357de8 util.c: remove numlen function
Its uses have been replaced by snprintf, which is more in line with its usage.
2019-01-22 13:10:25 +01:00
M Stoeckl 4b1eaaf731 Removed unused wlroots dependency for sway(bg|bar|msg|nag)
Also remove direct libm dependency where unused.
2019-01-21 13:04:15 -05:00
Ian Fan 410c961388 swaybar: fix setting floating watcher slots 2019-01-21 16:05:15 +01:00
M Stoeckl 1211a81aad Replace wlr_log with sway_log
This commit mostly duplicates the wlr_log functions, although
with a sway_* prefix. (This is very similar to PR #2009.)
However, the logging function no longer needs to be replaceable,
so sway_log_init's second argument is used to set the exit
callback for sway_abort.

wlr_log_init is still invoked in sway/main.c

This commit makes it easier to remove the wlroots dependency for
the helper programs swaymsg, swaybg, swaybar, and swaynag.
2019-01-21 12:59:42 +01:00
M Stoeckl 695948e689 Fix memory leaks in swaybar 2019-01-19 08:42:52 +01:00
emersion bb2f007ad3
meson: remove rpath options 2019-01-18 08:26:44 +01:00
emersion 08a5b304e4
Use Meson feature options 2019-01-17 18:26:24 +01:00
Connor E 70637b40fe Fixes for small existing bugs. 2019-01-16 13:02:26 +01:00
Connor E aa9d7d8ca1 Remove usage of VLAs. 2019-01-16 13:02:26 +01:00
Brian Ashworth 02bbefda20 bar_cmd_tray_bind: Use mouse button helpers
This modifies `bar_cmd_tray_bindsym` to use `get_mouse_bindsym` for
parsing mouse buttons. This also introduces `bar_cmd_tray_bindcode`,
which will use `get_mouse_bindcode` for parsing mouse buttons. Like with
sway bindings, the two commands are encapsulated in a single file to
maximize shared code.

This also modifies tray bindings to work off of events codes rather than
x11 buttons, which allows for any mouse buttons to be used.

For `get_bar_config`, `event_code` has been added to the `tray_bindings`
section and will include to event code for the button. If the event code
can be mapped to a x11 button, `input_code` will still be the x11 button
number. Otherwise, `input_code` will be `0`.
2019-01-16 11:12:45 +01:00
Drew DeVault 81bb675274
Merge pull request #3344 from RedSoxFan/bar-mouse-bindings-improved
Improve mouse button parsing: bar mouse bindings
2019-01-13 20:41:05 -05:00
Drew DeVault fc93cd20dc
Merge pull request #3397 from RedSoxFan/fix-swaybar-height
swaybar: obey height if given
2019-01-13 20:36:08 -05:00
Drew DeVault 9ce4d53e78
Merge pull request #3408 from RedSoxFan/bar-padding
swaybar: adjustable status padding
2019-01-13 20:34:13 -05:00
Brian Ashworth 50d36ef238 swaybar: allow identifiers for output and tray
This allows `bar output` and `bar tray_output` to specify an output
identifier. Output names should still work as well.

This parses the output identifier from the xdg_output description,
which wlroots currently sets to `make model serial (name)`. Since this
could change in the future, all identifier comparisons are guarded by
NULL-checks in case the description cannot be parsed to an identifier.
2019-01-13 12:06:35 -05:00
Brian Ashworth ca0a75d540 swaybar: add status_edge_padding command
This adds the bar subcommand `status_edge_padding <padding>` to set the
padding used when the status line is on the right edge of the bar.
2019-01-11 00:12:24 -05:00
Brian Ashworth c0f92cb2fb swaybar: add status_padding command
Adds the bar subcommand `status_padding <padding>` which allows setting
the padding used for swaybar. If `status_padding` is set to `0`, blocks
will be able to take up the full height of the bar.
2019-01-11 00:07:58 -05:00
Brian Ashworth 3d6440ec26 bar_cmd_bind: utilize mouse button helpers
This modifies `bar_cmd_bindsym` to use `get_mouse_bindsym` for parsing
mouse buttons. This also introduces `cmd_bar_bindcode`, which will use
`get_mouse_bindcode` for parsing mouse buttons. Like sway bindings, the
two commands are encapsulated in a single file with shared code.

This also modifies swaybar to operate off of event codes rather than x11
button numbers, which allows for any mouse button to be used.

This introduces two new IPC properties:
- For `get_bar_config`, `event_code` has been added to the `bindings`
section and will include to event code for the button. If the event code
can be mapped to a x11 button, `input_code` will still be the x11 button
number. Otherwise, `input_code` will be `0`.
- Likewise for `click_events`, `event` has been added and will include
the event code for the button clicked. If the event code can be mapped
to a x11 button, `button` will still be the x11 button number.
Otherwise, `button` will be `0`.
2019-01-10 12:43:10 -05:00
Brian Ashworth 124085eba9 swaybar: obey height if given
If there is a bar height given, use that as the height rather than as a
minimum height. This matches i3-gaps behavior.
2019-01-09 20:58:00 -05:00
Brian Ashworth 39873bc1f0 swaybar: fix rendering of border and background
This fixes the rendering of borders and backgrounds for blocks. This
also makes the following changes:
* both borders and padding are scaled with the output
* both lines and rectangles are rendered without an antialiasing to
avoid bleeding outside the desired area
2019-01-09 20:28:30 -05:00
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
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
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