]> git.mdlowis.com Git - proto/labwc.git/commitdiff
osd: allow window switcher to temporary unshade windows
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Fri, 3 Oct 2025 00:10:00 +0000 (02:10 +0200)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 13 Oct 2025 17:45:46 +0000 (19:45 +0200)
This can be configured with a new unshade="yes|no"
argument for windowSwitcher in rc.xml

Fixes: #3111
docs/labwc-config.5.scd
docs/rc.xml.all
include/config/rcxml.h
include/labwc.h
src/config/rcxml.c
src/input/keyboard.c
src/osd/osd.c

index 21ac262951f98be0e8858a5d82efacb7c2d3f47d..20149beea64b115450f95fbb5edd608c1ef5691e 100644 (file)
@@ -346,7 +346,7 @@ this is for compatibility with Openbox.
 </windowSwitcher>
 ```
 
-*<windowSwitcher show="" style="" preview="" outlines="" allWorkspaces="">*
+*<windowSwitcher show="" style="" preview="" outlines="" allWorkspaces="" unshade="">*
        *show* [yes|no] Draw the OnScreenDisplay when switching between
        windows. Default is yes.
 
@@ -364,6 +364,9 @@ this is for compatibility with Openbox.
        they are on. Default no (that is only windows on the current workspace
        are shown).
 
+       *unshade* [yes|no] Temporarily unshade windows when switching between
+       them and permanently unshade on the final selection. Default is yes.
+
 *<windowSwitcher><fields><field content="" width="%">*
        Define window switcher fields when using *<windowSwitcher style="classic" />*.
 
index 44ed984a468db690beaad92be7ec05d911f25536..1dd08c4da97cfea0d3fe1b223794908749f5288c 100644 (file)
@@ -79,7 +79,8 @@
     </font>
   </theme>
 
-  <windowSwitcher show="yes" style="classic" preview="yes" outlines="yes" allWorkspaces="no">
+  <windowSwitcher show="yes" style="classic" preview="yes"
+      outlines="yes" allWorkspaces="no" unshade="yes">
     <fields>
       <field content="icon" width="5%" />
       <field content="desktop_entry_name" width="30%" />
index e4fd184b3ac67421c8da23f5448740693c0dd398..50874571e76da7b635386f358781ba77a6c7c377 100644 (file)
@@ -179,6 +179,7 @@ struct rcxml {
                bool show;
                bool preview;
                bool outlines;
+               bool unshade;
                enum lab_view_criteria criteria;
                struct wl_list fields;  /* struct window_switcher_field.link */
                enum window_switcher_style style;
index 5a3bbefa432f451b17ce0038d29835875b5eeb35..735f57b81504f28b254e794629ba087b7658c960 100644 (file)
@@ -303,6 +303,7 @@ struct server {
        /* Set when in cycle (alt-tab) mode */
        struct osd_state {
                struct view *cycle_view;
+               bool preview_was_shaded;
                bool preview_was_enabled;
                struct wlr_scene_node *preview_node;
                struct wlr_scene_tree *preview_parent;
index 4ed6bd6d0aa65ccd14d961fe967a3f35d919d294..be49eaeb72e6fba04abfe2c1b37f0e8f4b322392 100644 (file)
@@ -1217,6 +1217,8 @@ entry(xmlNode *node, char *nodename, char *content)
                        rc.window_switcher.criteria &=
                                ~LAB_VIEW_CRITERIA_CURRENT_WORKSPACE;
                }
+       } else if (!strcasecmp(nodename, "unshade.windowSwitcher")) {
+               set_bool(content, &rc.window_switcher.unshade);
 
        /* Remove this long term - just a friendly warning for now */
        } else if (strstr(nodename, "windowswitcher.core")) {
@@ -1429,6 +1431,7 @@ rcxml_init(void)
        rc.window_switcher.style = WINDOW_SWITCHER_CLASSIC;
        rc.window_switcher.preview = true;
        rc.window_switcher.outlines = true;
+       rc.window_switcher.unshade = true;
        rc.window_switcher.criteria = LAB_VIEW_CRITERIA_CURRENT_WORKSPACE
                | LAB_VIEW_CRITERIA_ROOT_TOPLEVEL
                | LAB_VIEW_CRITERIA_NO_SKIP_WINDOW_SWITCHER;
index ae92e73f76d69ea3b931b14ab7ec3e3a0ef07404..8f7a3e81b58e35b0a72d4dfd36ddc4ee33eec31e 100644 (file)
@@ -96,6 +96,9 @@ end_cycling(struct server *server)
        /* FIXME: osd_finish() transiently sets focus to the old surface */
        osd_finish(server);
        /* Note that server->osd_state.cycle_view is cleared at this point */
+       if (rc.window_switcher.unshade) {
+               view_set_shade(cycle_view, false);
+       }
        desktop_focus_view(cycle_view, /*raise*/ true);
 }
 
index df1b7ad9e75f771deaeb62db66fc17317343ff11..e436c19e9079085ba51f5bb7f250578571869ba6 100644 (file)
@@ -9,6 +9,7 @@
 #include "common/scene-helpers.h"
 #include "config/rcxml.h"
 #include "labwc.h"
+#include "node.h"
 #include "output.h"
 #include "scaled-buffer/scaled-font-buffer.h"
 #include "scaled-buffer/scaled-icon-buffer.h"
@@ -160,9 +161,14 @@ restore_preview_node(struct server *server)
                if (!osd_state->preview_was_enabled) {
                        wlr_scene_node_set_enabled(osd_state->preview_node, false);
                }
+               if (osd_state->preview_was_shaded) {
+                       struct view *view = node_view_from_node(osd_state->preview_node);
+                       view_set_shade(view, true);
+               }
                osd_state->preview_node = NULL;
                osd_state->preview_parent = NULL;
                osd_state->preview_anchor = NULL;
+               osd_state->preview_was_shaded = false;
        }
 }
 
@@ -203,6 +209,7 @@ osd_finish(struct server *server)
        server->osd_state.preview_node = NULL;
        server->osd_state.preview_anchor = NULL;
        server->osd_state.cycle_view = NULL;
+       server->osd_state.preview_was_shaded = false;
 
        destroy_osd_scenes(server);
 
@@ -244,6 +251,10 @@ preview_cycled_view(struct view *view)
        if (!osd_state->preview_was_enabled) {
                wlr_scene_node_set_enabled(osd_state->preview_node, true);
        }
+       if (rc.window_switcher.unshade && view->shaded) {
+               view_set_shade(view, false);
+               osd_state->preview_was_shaded = true;
+       }
 
        /*
         * FIXME: This abuses an implementation detail of the always-on-top tree.
@@ -294,6 +305,10 @@ update_osd(struct server *server)
                }
        }
 
+       if (rc.window_switcher.preview) {
+               preview_cycled_view(server->osd_state.cycle_view);
+       }
+
        /* Outline current window */
        if (rc.window_switcher.outlines) {
                if (view_is_focusable(server->osd_state.cycle_view)) {
@@ -301,9 +316,6 @@ update_osd(struct server *server)
                }
        }
 
-       if (rc.window_switcher.preview) {
-               preview_cycled_view(server->osd_state.cycle_view);
-       }
 out:
        wl_array_release(&views);
 }