aboutsummaryrefslogtreecommitdiff
path: root/swaybar/bar.c
AgeCommit message (Collapse)AuthorLines
2024-09-25swaybar: Fix 100% cpu usage if dbus dies.Furkan Sahin-1/+1
Currently, swaybar does not gracefully die if it detects that the dbus connection was lost. Although it's not recommended to restart dbus without restarting the compositor, it can very easily happen. In the case it does, compositor's tray should not consume 100% cpu until it has to be force killed. apply suggestions just setting the bar to not running will call teardown and unref the dbus.
2024-02-16Define _POSIX_C_SOURCE globallyFurkan Sahin-1/+0
See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
2023-07-30swaybar: Implement wp_cursor_shape_v1Furkan Sahin-8/+13
2022-03-14swaybar: remove swaybar_output.input_regionFurkan Sahin-7/+3
No need to keep the region around, we can immediately destroy it after the wl_surface.set_input_region request.
2021-12-13swaynag: remove xdg-output logicFurkan Sahin-1/+0
We can just get the output name from wl_output directly, now that wl_output version 4 exists.
2021-11-21swaybar: signal status command's process groupFurkan Sahin-1/+1
Make the status command a process group leader and change the kill(2) calls to target the new process group. Signals sent by swaybar will then be received by both the status command and its children, if any. While here, check the result of fork(2). Without this, children spawned by the status command may not receive the signals sent by swaybar. As a result, these children may be orphaned on reload. The issue could be shown by setting the bar to bar { status_command i3status | tee /tmp/i3status.out } which would leave orphaned processes for each reload of sway $ ps o pid,ppid,cmd | grep i3status | grep -v grep 43633 43624 sh -c i3status | tee /tmp/i3status.out 43634 43633 i3status 43635 43633 tee /tmp/i3status.out $ swaymsg reload $ ps o pid,ppid,cmd | grep i3status | grep -v grep 43634 1 i3status 43635 1 tee /tmp/i3status.out 43801 43788 sh -c i3status | tee /tmp/i3status.out 43802 43801 i3status 43803 43801 tee /tmp/i3status.out This fixes #5584.
2021-07-08swaybar: log Wayland display errorsFurkan Sahin-0/+8
2021-07-08swaybar: exit cleanly when disconnected from IPCFurkan Sahin-0/+7
2021-02-03Make Wayland request listeners static const when possibleFurkan Sahin-3/+3
2020-06-11swaybar: ensure correct init order for status_lineFurkan Sahin-4/+5
`$WAYLAND_SOCKET` is unset by `wl_display_connect` after it has successfully connected to the wayland socket. However, subprocesses spawned by swaybar (status-command) don't have access to waybar's fds as $WAYLAND_SOCKET is O_CLOEXEC. This means any status command which itself tries to connect to wayland will fail if this environment variable is set. Reorder display and status-command initialization so that this variable is not set and add an assert so we can enforce this invariant in future.
2020-04-23swaybar: Fix scrolling with precise trackpadsFurkan Sahin-1/+1
2019-09-02swaybar: complete barconfig_update event handlingFurkan Sahin-10/+25
This adds complete support for the barconfig_update ipc event. This also changes the bar command and subcommand handlers to correctly emit the event. This makes it so all bar subcommands other than id and swaybar_command are dynamically changeable at runtime. sway-bar.5 has been updated accordingly
2019-04-23swaybar: add multiseat supportFurkan Sahin-9/+47
This just adds multiseat support to swaybar
2019-04-24swaybar: hide mode visibility improvementsFurkan Sahin-1/+2
This allows swaybar to become visible when the mode changes (to any mode other than the default). swaybar will be hidden again when the modifier is pressed and released or when switching back to the default mode. This also applies the same logic to visible by urgency to hide swaybar when the modifier is pressed and released. These changes are to match i3's behavior.
2019-02-23swaybar: add overlay mode (fix #1620)Furkan Sahin-2/+14
Overlay mode puts the bar above normal windows and passes through/ignores any touch/mouse/keyboard events that would be sent to it.
2019-02-14swaybar: prevent signal handler from firing during terminationFurkan Sahin-3/+3
This prevents a heap-use-after-free crash when sway terminates.
2019-01-20Replace wlr_log with sway_logFurkan Sahin-4/+3
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-13swaybar: allow identifiers for output and trayFurkan Sahin-6/+24
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.
2018-12-11swaybar: do not create tray if hiddenFurkan Sahin-1/+3
2018-12-07swaybar: set bar dirty on SNI eventFurkan Sahin-1/+1
2018-12-07swaybar: implement mouse events for trayFurkan Sahin-2/+6
2018-12-09swaybar: implement tray configFurkan Sahin-0/+1
2018-10-28swaybar: add tray interfaceFurkan Sahin-0/+15
2018-12-15swaybar: fix cursor scaleFurkan Sahin-17/+5
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-11-25Replace _XOPEN_SOURCE with _POSIX_C_SOURCEFurkan Sahin-1/+1
And make sure we don't define both in the same source file.
2018-11-17Implement strip_workspace_name.Furkan Sahin-0/+1
2018-10-24Merge pull request #2925 from ianyfan/swaylockFurkan Sahin-1/+4
swaylock: exit early if unable to get input inhibitor
2018-10-23swaybar: absorb bar_init function into bar_setupFurkan Sahin-7/+3
2018-10-23swaybar: exit on display errorFurkan Sahin-1/+4
2018-10-23Fix swaybar crash when there's no status_commandFurkan Sahin-4/+6
2018-10-21swaybar: fix hotplugFurkan Sahin-32/+28
2018-10-20swaybar: render with minimum height, nominally text heightFurkan Sahin-6/+7
2018-10-20Put swaybar in overlay layer when using mode hideFurkan Sahin-1/+1
This allows the bar to render over fullscreen views.
2018-10-17swaybar: separate input code to new fileFurkan Sahin-247/+1
2018-10-15Sway clients: Exit gracefully when compositor is unavailableFurkan Sahin-1/+5
2018-10-14Remove timerfd from loop implementationFurkan Sahin-3/+3
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-13Move swaybar's event loop to common directory and refactorFurkan Sahin-7/+10
* 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-13swaybar: when hiding bar, save old height to be restored upon reshowFurkan Sahin-1/+0
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-12swaybar: send signal to status when hiding or showing barFurkan Sahin-0/+4
2018-10-12swaybar: handle mode/hidden_state changesFurkan Sahin-7/+55
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-12swaybar: move mode & mode_pango_markup to bar structFurkan Sahin-0/+1
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-12swaybar: only send initial workspace request if workspace buttons are enabledFurkan Sahin-2/+5
2018-10-12swaybar: add free_hotspots helper functionFurkan Sahin-10/+13
2018-09-30swaybar: save id upon startupFurkan Sahin-3/+3
This adds an id property to the bar, which will be used to filter barconfig_update events
2018-10-09bar-bindsym: address ianyfan's commentsFurkan Sahin-4/+9
2018-10-08Implement bar bindsymFurkan Sahin-0/+26
2018-10-08swaybar: allow null status_commandFurkan Sahin-1/+1
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-06swaybar: fix binding to wl_pointer multiple timesFurkan Sahin-1/+5
2018-09-28swaybar: synchronize rendering to output framesFurkan Sahin-19/+22
2018-09-24swaybar: move i3bar definitions into separate fileFurkan Sahin-3/+4