Commit graph

443 commits

Author SHA1 Message Date
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
Scott Anderson
0d67d56c2a Set _POSIX_C_SOURCE properly 2018-04-15 15:50:39 +12: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
emersion
84243a708e
Merge pull request #1792 from RyanDwyer/fix-swaybar-status-blocks
Fix swaybar not showing all status blocks
2018-04-10 18:38:43 -04:00
Ryan Dwyer
7dfc0409eb Check height in surface local coordinates and rename some variables. 2018-04-11 08:34:21 +10: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
Ryan Dwyer
1a0d367f22 Fix swaybar not showing all status blocks. 2018-04-10 16:08:08 +10:00
Ryan Dwyer
c38de16722 Fix swaybar output config. 2018-04-10 13:38:15 +10:00
Drew DeVault
ac3be29517 Fix some more bugs 2018-04-09 08:07:54 -04:00
Ryan Dwyer
bac65078a2 Fix buffer issues in swaybar status line. 2018-04-09 17:25:39 +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
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
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
d48e7036aa Don't use asserts with side-effects 2018-04-03 21:29:43 -04:00
Drew DeVault
2605950769 Add hidpi support to swaybar 2018-04-03 21:06:28 -04:00
Drew DeVault
f366ef373e Fix #1709 2018-04-03 11:17:34 -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
ee85c91831 Demarcate i3bar JSON into individual updates 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
ae14dfc7ae Implement scroll wheel workspace switching 2018-03-30 22:44:08 -04:00
Drew DeVault
8d1425bde9 Initialize seat pointer in swaybar 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
d8104db8f1 Early return from render functions if necessary 2018-03-29 23:35:49 -04:00
Drew DeVault
095ac31921 Use render_all_frames from bar_setup 2018-03-29 22:32:17 -04:00
Drew DeVault
6fe66d0e6c Fix layer_surface_closed 2018-03-29 22:25:25 -04:00
Drew DeVault
f3fbf19312 Do some small cleanup
- Fix workspace events (security config isn't in use so it wasn't being
  sent)
- Kill status bar process when swaybar exits
- Don't rearrange windows on every layer surface commit
2018-03-29 22:11:08 -04:00
Drew DeVault
b72825441b Fixed laggy focused output boolean 2018-03-29 22:11:08 -04:00
Drew DeVault
da6e48520b Tear down bar when display exits 2018-03-29 22:11:08 -04:00
Drew DeVault
0464a9910d Clean up status line on exit 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
86ba0fc15d Re-render bar on IPC updates 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
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
Tony Crisci
d071ff08ae remove the rest of cmake 2017-12-01 05:21:03 -05:00
Joona Romppanen
675e4b7de7 Removed trailing comma from swaybar click event json 2017-10-28 17:35:48 +03:00
Johannes Lundberg
44e72573cb Fix include path to input-event-codes.h for FreeBSD. 2017-10-15 10:54:47 +02:00
Johannes Lundberg
5a63f0f57b Fix build on FreeBSD adjusting/removing _XOPEN_SOURCE declaration. 2017-10-14 20:38:33 +02:00
John Axel Eriksson
feb8bb96ee
swaybar protocol: handle button 4 and 5
i3 bar handles scroll events as button 4 and 5. An example use
case would be volume up/down.
2017-09-23 15:22:40 +02:00
akokshar@redhat.com
2b927685ca styling fixes 2017-08-30 08:16:17 +02:00
akokshar@redhat.com
39df3aed82 styling fixes 2017-08-29 17:33:06 +02:00
akokshar@redhat.com
d873d09f23 style fixes 2017-08-29 15:55:30 +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
ba6224f4e5 Prevent crash if DBus connection is NULL
Fixes #1307
2017-08-12 12:52:31 +02:00
Tobias Blass
8976a47f62 [swaybar] fix non-dbus build
Swaybar's CMakeLists.txt uses the enable-tray option directly to decide whether to build the tray. This leads to a compilation error if dbus is not installed.
This patch uses the ENABLE_TRAY variable instead, which is only true if the user enabled the tray *and* dbus is available.
2017-07-20 23:03:16 +02:00
Calvin Lee
e8f589c3dc Fix memory leaks in swaybar tray 2017-07-16 19:06:24 -07:00
Calvin Lee
5ceb52962e Fix name validation in sni_watcher.c
This commit also fixes a memory leak that occurs on failure.
2017-07-13 20:57:23 -07:00
Calvin Lee
62223e8fbb Don't trust SNI names, fixes #1274
If an item doesn't have a well-formed name, it will not be added to the
tray.
2017-07-13 07:47:21 -07:00
Johannes Lundberg
6a525b23dd Adjust _XOPEN_SOURCE value for build on FreeBSD and fix pointer comparison error. 2017-07-08 08:31:10 +02:00
Drew DeVault
387eca1b29 Revert "swaybar: Group child processes for signalling"
This reverts commit 8f4bc0a374.
2017-06-29 13:22:54 -04:00
Drew DeVault
5f915a9d03 Fix #1252 2017-06-26 16:59:19 -04:00
Mykyta Holubakha
ed8f56ba38
Handle getline failure in icon theme parsing 2017-06-23 19:23:44 +03:00
Drew DeVault
0fc9628f03 Merge branch 'master' into tray 2017-06-14 18:14:22 -04:00
Calvin Lee
33fdae2001 Remove Xembed Support
Xembed support is premature in sway and should be postponed. This commit
only removes swaybar starting xembedsniproxy, if users would like, they
can still start xembedsniproxy manually, however there will be no
official support.
2017-06-13 12:42:11 -07:00
Yury Krivopalov
8f4bc0a374 swaybar: Group child processes for signalling
Fixes child proccess killing, when status_command is a complex command
like "i3status | wrapper.sh".

Set the process group id of the child process by calling `setpgid` after
forking and before calling `exec`.

The process group ID will be set to the process ID of the forked
process. Processes spawned by this child process will also have this
group ID.

Send signals to the process group with `killpg`. This will send the
signal to all of the process group.
2017-06-12 23:12:31 +03:00
Calvin Lee
0a71aa6e97 Fix Catching NewIcon Signal
The unique name was not copied out of the wire marshalled DBus message
data so `sni_uniq_cmp` would always match against junk data.
2017-06-08 08:24:35 -07: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
Sebastian Noack
173b338567 Add -DVERSION flag for release version numbers 2017-04-26 15:56:46 +02: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
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
Mykyta Holubakha
2a24772c4b config: set pango_markup default to false 2016-10-20 16:43:38 +03: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 &#230; 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
Ryan Dwyer
e4cb4d1b5c Fix swaybar when running on named outputs.
When using a bar on a named output, load_swaybars() requires the
output to be active (ie. in the root container), but this is not the case if
the bar is added to the last output. To fix this, load_swaybars() is now
called after the output has been added to the root container.

After fixing that, swaybar would segfault due to using the wrong index
variable when loading outputs and config.
2016-09-17 17:25:45 +10:00
D.B
c239f228c2 swaybar sends workspace name in quotes
fixes #894
2016-09-12 06:58:53 +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
61184e3208 Initial testing on hidpi clients 2016-09-05 10:32:21 -04:00
Drew DeVault
416417a54c Reorganize includes 2016-09-01 08:18:37 -04:00
Zandr Martin
98aa59fdda
implement solid color rendering for swaybg 2016-07-30 18:50:13 -05:00
Hummer12007
06f46955c0 Fix a warning 2016-07-18 00:57:49 +03:00
Drew DeVault
3bb880bf20 Implement configurable wrapping on bar ws scroll 2016-07-17 11:26:38 -04:00
Drew DeVault
147a88260a Fix #753 2016-07-16 09:09:22 -04:00
David Eklov
e38d6b94b8 Change workspace when mouse wheel is scrolled while hovering over the bar 2016-07-15 19:14:31 -05:00
David Eklov
250ddc66c6 Rename pointer_input::notify to indicate that is called on button clicks 2016-07-15 19:14:31 -05:00
David Eklov
8a232c8cfd Send command to sway to change workspace when workspace button is clicked 2016-07-14 17:18:01 -05:00
David Eklov
a0c8799c80 Compute what workspace button is clicked
This commit does not do anything with this information other than logging it.
2016-07-14 17:18:01 -05: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
David Eklov
103954dd2b Setup to receive mouse click events and log them 2016-07-14 17:18:01 -05:00
David Eklov
d3752b4140 swaybar: Make swaybar a shell surface 2016-07-04 21:59:47 -05:00
Drew DeVault
c55ae9956b Fix another -Wunused-result 2016-04-29 11:04:21 -04:00
Tomáš Čech
468ddfb34d Fix missing include paths
When headers were installed in more sofisticated places (but package
config knows it right), it revealed missing paths in CMake
configuration. Lets fix it.
2016-04-28 20:08:41 +02: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
2e6c43e62b Added plaintext_markup to swaybar IPC 2016-04-24 20:14:02 +03:00