]> git.mdlowis.com Git - proto/labwc.git/commitdiff
osd: update the default window switcher layout
authortokyo4j <hrak1529@gmail.com>
Mon, 31 Mar 2025 03:20:30 +0000 (12:20 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 2 Apr 2025 19:49:38 +0000 (20:49 +0100)
The default window switcher layout is updated from:

  <windowSwitcher>
    <fields>
      <field content="type" width="25%" />
      <field content="trimmed_identifier" width="25%" />
      <field content="title" width="50%" />
    </fields>
  </windowSwitcher>

to:

  <windowSwitcher>
    <fields>
      <field content="icon" width="5%" />
      <field content="desktop_entry_name" width="30%" />
      <field content="title" width="65%" />
    </fields>
  </windowSwitcher>

Only desktop entry name and title are shown when libsfdo is not linked.

docs/labwc-config.5.scd
docs/rc.xml.all
src/config/rcxml.c

index f52f257dd4fa32ac68632a0dac28d5bcef0ad95f..258eaa038b861629b746e6eee280392d88ea9025 100644 (file)
@@ -269,9 +269,9 @@ this is for compatibility with Openbox.
 ```
 <windowSwitcher show="yes" preview="yes" outlines="yes" allWorkspaces="no">
   <fields>
-    <field content="type" width="25%"/>
-    <field content="trimmed_identifier" width="25%"/>
-    <field content="title" width="50%"/>
+    <field content="icon" width="5%" />
+    <field content="desktop_entry_name" width="30%" />
+    <field content="title" width="65%" />
   </fields>
 </windowSwitcher>
 ```
index 8dea2ec33d45bd1c33c37b7d9e597f19a54f1e87..061996efcc88e2ee5f2d6de6ce0639b09031529d 100644 (file)
     </font>
   </theme>
 
-  <!--
-    Just as for window-rules, 'identifier' relates to app_id for native Wayland
-    windows and WM_CLASS for XWayland clients.
-  -->
   <windowSwitcher show="yes" preview="yes" outlines="yes" allWorkspaces="no">
     <fields>
-      <field content="type" width="25%" />
-      <field content="trimmed_identifier" width="25%" />
-      <!-- <field content="identifier" width="25%" /> -->
-      <field content="title" width="50%" />
+      <field content="icon" width="5%" />
+      <field content="desktop_entry_name" width="30%" />
+      <field content="title" width="65%" />
+      <!--
+        Just as for window-rules, you can use 'identifier' or
+        'trimmed_identifier' to show the app_id for native wayland clients or
+        WM_CLASS for XWayland clients.
+
+        <field content="trimmed_identifier" width="65%" />
+      -->
     </fields>
   </windowSwitcher>
 
   <!--
-    When using all workspaces option of window switcher, there are extra fields
-    that can be used, workspace (variable length), state (single space),
-    type_short (3 spaces), output (variable length), and can be set up
-    like this. Note: output only shows if more than one output available.
+    We support many other kinds of contents in the window switcher like below.
+    Some contents are fixed-length and others are variable-length.
+    See "man 5 labwc" for details.
 
     <windowSwitcher show="yes" preview="no" outlines="no" allWorkspaces="yes">
       <fields>
 
     custom format - (introduced in 0.7.2)
     It allows one to replace all the above "fields" with one line, using a
-    printf style format. For field explanations, "man 5 labwc-config".
+    printf style format. For field explanations, see "man 5 labwc-config".
 
-    The example below would print "foobar",then type of window (wayland, X),
+    The example below would print "foobar", then type of window (wayland, X),
     then state of window (M/m/F), then output (shows if more than 1 active),
     then workspace name, then identifier/app-id, then the window title.
-    Uses 100% of OSD window width.
+    It uses 100% of OSD window width.
 
     <windowSwitcher show="yes" preview="no" outlines="no" allWorkspaces="yes">
       <fields>
index fb2995514d74b0e1ab728c8a105c8ee171f98bed..419e8daa3b93698146e960096e7a5f8b4b857eac 100644 (file)
@@ -1673,22 +1673,25 @@ deduplicate_key_bindings(void)
        }
 }
 
-static struct {
-       enum window_switcher_field_content content;
-       int width;
-} fields[] = {
-       { LAB_FIELD_TYPE, 25 },
-       { LAB_FIELD_TRIMMED_IDENTIFIER, 25 },
-       { LAB_FIELD_TITLE, 50 },
-       { LAB_FIELD_NONE, 0 },
-};
-
 static void
 load_default_window_switcher_fields(void)
 {
-       struct window_switcher_field *field;
+       static const struct {
+               enum window_switcher_field_content content;
+               int width;
+       } fields[] = {
+#if HAVE_LIBSFDO
+               { LAB_FIELD_ICON, 5 },
+               { LAB_FIELD_DESKTOP_ENTRY_NAME, 30 },
+               { LAB_FIELD_TITLE, 65 },
+#else
+               { LAB_FIELD_DESKTOP_ENTRY_NAME, 30 },
+               { LAB_FIELD_TITLE, 70 },
+#endif
+       };
 
-       for (int i = 0; fields[i].content != LAB_FIELD_NONE; i++) {
+       struct window_switcher_field *field;
+       for (size_t i = 0; i < ARRAY_SIZE(fields); i++) {
                field = znew(*field);
                field->content = fields[i].content;
                field->width = fields[i].width;