From 25e1d0c4420c3fecc118c76f4d2b9c799086b27a Mon Sep 17 00:00:00 2001 From: fwsmit Date: Sat, 26 Dec 2020 16:49:08 +0100 Subject: [PATCH] Added option for forcing X11 on wayland. Also added some more documentation. --- config.h | 3 +++ docs/dunst.pod | 31 +++++++++++++++++++++++++++++-- src/draw.c | 2 +- src/output.c | 4 ++-- src/output.h | 2 +- src/settings.c | 6 ++++++ src/settings.h | 1 + 7 files changed, 43 insertions(+), 6 deletions(-) diff --git a/config.h b/config.h index 0963136..09c75ae 100644 --- a/config.h +++ b/config.h @@ -48,6 +48,9 @@ struct settings defaults = { .notification_height = 0, /* if notification height < font height and padding, it will be raised */ .corner_radius = 0, +.force_xinerama = false, +.force_xwayland = false, + .separator_height = 2, /* height of the separator line between two notifications */ .padding = 0, .h_padding = 0, /* horizontal padding */ diff --git a/docs/dunst.pod b/docs/dunst.pod index d9c53c6..afedf98 100644 --- a/docs/dunst.pod +++ b/docs/dunst.pod @@ -82,6 +82,10 @@ starts at 0. See the B setting. Defines where the notifications should be placed in a multi-monitor setup. All values except I override the B setting. +On Wayland there is no difference between mouse and keyboard focus. When either +of the is used, the compositor will choose an output. This will generally be +the output last interacted with. + =over 4 =item B @@ -278,7 +282,7 @@ The bottom layer is below all windows and above the background. Default: top -=item B (values: [true/false], default: false) (Wayland only) +=item B (values: [true/false], default: false) (Wayland only) Force the use of X11 output, even on a wayland compositor. This setting has no effect when not using a Wayland compositor. @@ -569,7 +573,7 @@ the notification sent before the user defined timeout. =back -=head2 Shortcut section B +=head2 Shortcut section B (X11 only) Keyboard shortcuts are defined in the following format: "Modifier+key" where the modifier is one of ctrl,mod1,mod2,mod3,mod4 and key is any keyboard key. @@ -679,6 +683,29 @@ Past notifications are redisplayed in a first-in-last-out order, meaning that pressing the history key once will bring up the most recent notification that had been closed/timed out. +=head1 WAYLAND + +Dunst has Wayland support since version 1.6.0. Because the Wayland protocol +is more focused on security, some things that are possible in X11 are not +possible in Wayland. Those differences are reflected in the configuration. +The main things that change are that dunst on Wayland cannot use global +hotkeys (they are deprecated anyways, use dunstctl) and it cannot detect +if an application is fullscreen. If you want to see notifications when in +fullscreen, set B in the global options. + +Note that the same limitations exist when using xwayland. +If something doesn't quite work in Wayland, please file a bug report. In the +mean time, you can try if the X11 output does work on wayland. Use +B for that. + +If you have your dunst notifications on the same side of your display as your +status bar, you might notice that your notifications appear a bit higher or +lower than on X11. This is because the notification cannot be placed on top of +your status bar. The notifications are placed relative to your status bar, +making them appear higher or lower by the height of your status bar. We cannot +do anything about that behavior, so you will need to change your B +variable accordingly. + =head1 RULES Rules allow the conditional modification of notifications. They are defined by diff --git a/src/draw.c b/src/draw.c index d31c3b8..f03b4fb 100644 --- a/src/draw.c +++ b/src/draw.c @@ -48,7 +48,7 @@ PangoFontDescription *pango_fdesc; void draw_setup(void) { - const struct output *out = output_create(); + const struct output *out = output_create(settings.force_xwayland); output = out; out->init(); diff --git a/src/output.c b/src/output.c index 0ea1f45..de0d412 100644 --- a/src/output.c +++ b/src/output.c @@ -55,9 +55,9 @@ const struct output output_wl = { wl_have_fullscreen_window }; -const struct output* output_create(void) +const struct output* output_create(bool force_xwayland) { - if (is_running_wayland()) { + if (!force_xwayland && is_running_wayland()) { LOG_I("Using Wayland output"); return &output_wl; } else { diff --git a/src/output.h b/src/output.h index 7e611c5..5cd7d50 100644 --- a/src/output.h +++ b/src/output.h @@ -47,7 +47,7 @@ struct output { bool (*have_fullscreen_window)(void); }; -const struct output* output_create(void); +const struct output* output_create(bool force_xwayland); const bool is_running_wayland(void); diff --git a/src/settings.c b/src/settings.c index c72c2be..16e22b2 100644 --- a/src/settings.c +++ b/src/settings.c @@ -118,6 +118,12 @@ void load_settings(char *cmdline_config_path) "Force the use of the Xinerama extension" ); + settings.force_xwayland = option_get_bool( + "global", + "force_xwayland", "-force_xwayland", false, + "Force the use of the xwayland output" + ); + settings.font = option_get_string( "global", "font", "-font/-fn", defaults.font, diff --git a/src/settings.h b/src/settings.h index 28e08f6..3aab1ac 100644 --- a/src/settings.h +++ b/src/settings.h @@ -90,6 +90,7 @@ struct settings { struct keyboard_shortcut history_ks; struct keyboard_shortcut context_ks; bool force_xinerama; + bool force_xwayland; int corner_radius; enum mouse_action *mouse_left_click; enum mouse_action *mouse_middle_click;