Commit Graph

65 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Ian Fan
f33b5c5223 swaybar: do not create tray if hidden 2018-12-31 20:40:18 +00:00
Ian Fan
6b03c68775 swaybar: implement tray config 2018-12-31 20:40:18 +00: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
Connor E
4bd46fb079 Implement strip_workspace_name. 2018-11-17 16:11:28 +00: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
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
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
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
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
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
Ryan Dwyer
255dc8bbb0 swaybar: Read urgent colors from IPC 2018-07-17 08:29:43 +10:00
emersion
63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
emersion
aa36899d8a
Fix a bunch of swaybar memory leaks 2018-04-24 22:28:55 +01:00
db
39e3319394 fix swaybar ipc handling
Swap return with break in IPC_EVENT_WORKSPACE case to free resp.

Change default return value to true. This causes IPC_EVENT_MODE changes to be
rendered instantly.
2018-04-10 22:01:22 +02:00
Drew DeVault
efac07db5f Fix workspaces not updated on swaybar 2018-04-06 09:43:52 -04:00
Drew DeVault
f242362e7e Handle output removal on swaybar 2018-04-05 16:04:30 -04:00
Drew DeVault
333dbcbe72 Render i3bar blocks 2018-04-02 11:09:23 -04:00
Drew DeVault
ae14dfc7ae Implement scroll wheel workspace switching 2018-03-30 22:44:08 -04:00
Drew DeVault
2a90d26ebe Fix issues with swaybar on DRM 2018-03-30 00:30:38 -04:00
Drew DeVault
b72825441b Fixed laggy focused output boolean 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
86ba0fc15d Re-render bar on IPC updates 2018-03-29 22:11:08 -04:00
Drew DeVault
3399ad9840 Round up workspaces on each output 2018-03-29 22:11:08 -04:00
Drew DeVault
e5e8094dc3 Only utilize the configured outputs 2018-03-29 22:11:08 -04:00
Drew DeVault
5c9ad035db Wire up basic IPC support 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
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
Drew DeVault
9aed9d9359 UnGNUify the codebase 2017-03-10 23:41:24 -05:00
Drew DeVault
9ad1e6b40f Handle malloc failure in ipc_recv_response 2016-12-15 19:01:40 -05:00