urgent on bell support #157

Closed
opened 1 year ago by piotr · 5 comments
piotr commented 1 year ago

Hi again :)

Could you also add support for setting window's urgency flag once system bell is invoked? I use it to get notifications from tmux.

To test it you can run echo -e '\a'.

I know it's not standardized under Wayland yet, but XWayland terminals (or at least Urxvt) seems to set it via "urgent" flag under Sway (see below)

$ sleep 2; echo -e '\a'  # I changed window to another terminal after this
$ swaymsg -t get_tree | jq -r '..|try select(.name == "urxvt")' 
{
  "id": 27,
  "name": "urxvt",
  "rect": {
    "x": 0,
    "y": 37,
    "width": 3840,
    "height": 2123
  },
  "focused": false,
  "focus": [],
  "border": "pixel",
  "current_border_width": 1,
  "layout": "none",
  "orientation": "none",
  "percent": 1,
  "window_rect": {
    "x": 1,
    "y": 1,
    "width": 3838,
    "height": 2121
  },
  "deco_rect": {
    "x": 0,
    "y": 0,
    "width": 0,
    "height": 0
  },
  "geometry": {
    "x": 0,
    "y": 0,
    "width": 2163,
    "height": 1466
  },
  "window": 14680074,
  "urgent": true,
  "marks": [],
  "fullscreen_mode": 0,
  "nodes": [],
  "floating_nodes": [],
  "sticky": false,
  "type": "con",
  "pid": 269443,
  "app_id": null,
  "visible": true,
  "max_render_time": 0,
  "shell": "xwayland",
  "inhibit_idle": false,
  "idle_inhibitors": {
    "user": "none",
    "application": "none"
  },
  "window_properties": {
    "class": "URxvt",
    "instance": "urxvt",
    "title": "urxvt",
    "transient_for": null
  }
}
Hi again :) Could you also add support for setting window's urgency flag once system bell is invoked? I use it to get notifications from tmux. To test it you can run `echo -e '\a'`. I know it's not standardized under Wayland yet, but XWayland terminals (or at least Urxvt) seems to set it via "urgent" flag under Sway (see below) ``` $ sleep 2; echo -e '\a' # I changed window to another terminal after this $ swaymsg -t get_tree | jq -r '..|try select(.name == "urxvt")'  { "id": 27, "name": "urxvt", "rect": { "x": 0, "y": 37, "width": 3840, "height": 2123 }, "focused": false, "focus": [], "border": "pixel", "current_border_width": 1, "layout": "none", "orientation": "none", "percent": 1, "window_rect": { "x": 1, "y": 1, "width": 3838, "height": 2121 }, "deco_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "geometry": { "x": 0, "y": 0, "width": 2163, "height": 1466 }, "window": 14680074, "urgent": true, "marks": [], "fullscreen_mode": 0, "nodes": [], "floating_nodes": [], "sticky": false, "type": "con", "pid": 269443, "app_id": null, "visible": true, "max_render_time": 0, "shell": "xwayland", "inhibit_idle": false, "idle_inhibitors": { "user": "none", "application": "none" }, "window_properties": { "class": "URxvt", "instance": "urxvt", "title": "urxvt", "transient_for": null } } ```
dnkl commented 1 year ago
Owner

I'm afraid I'll have to disappoint you; this isn't possible in Wayland applications. The urgent flag is a 'hint' X11 programs can set, but there is no corrensponding protocol in Wayland.

Sway supports 'urgency', but only for X11 programs (running under XWayland).

There is a proposal to add support for this to Wayland, at protocol level, but it has met resistance and hasn't yet been merged. See https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/9

I'm afraid I'll have to disappoint you; this isn't possible in Wayland applications. The `urgent` flag is a 'hint' X11 programs can set, but there is no corrensponding protocol in Wayland. Sway supports 'urgency', but **only** for X11 programs (running under XWayland). There is a proposal to add support for this to Wayland, at protocol level, but it has met resistance and hasn't yet been merged. See https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/9
dnkl closed this issue 1 year ago
Poster

How about some kind of workaround for now… like visual animation in Alacritty?

How about some kind of workaround for now… like visual animation in Alacritty?
dnkl commented 1 year ago
Owner

That might make some sense. However, I would want it to be kept very simple, since it's something I'd like to be able to remove once proper urgency support is added to Wayland.

That would mean (almost) no configuration options, and no fancy graphical visualizations.

I've implemented an example in #160. It will render the margins in red when BEL is received while the window is unfocused. The margins will remain red until the window is focused.

Would this suffice?

That might make some sense. However, I would want it to be kept very simple, since it's something I'd like to be able to remove once proper urgency support is added to Wayland. That would mean (almost) no configuration options, and no fancy graphical visualizations. I've implemented an example in https://codeberg.org/dnkl/foot/pulls/160. It will render the margins in red when `BEL` is received while the window is unfocused. The margins will remain red until the window is focused. Would this suffice?
dnkl reopened this issue 1 year ago
dnkl added the
enhancement
label 1 year ago
Poster

just tested it - works great, thanks!
(hopefully Wayland guys will add urgency hint soon, though)

just tested it - works great, thanks! (hopefully Wayland guys will add urgency hint soon, though)
dnkl closed this issue 1 year ago
dnkl commented 1 year ago
Owner

just tested it - works great, thanks!

Thanks for testing this so quickly! And thanks for reporting this. This is something I'll be using as well :)

(hopefully Wayland guys will add urgency hint soon, though)

Me too, me too... even a wlroots protocol extension would do.

> just tested it - works great, thanks! Thanks for testing this so quickly! And thanks for reporting this. This is something I'll be using as well :) > (hopefully Wayland guys will add urgency hint soon, though) Me too, me too... even a wlroots protocol extension would do.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.