From 891c2ebcb8f1b001e8bd366d8fc6df70ad4e463a Mon Sep 17 00:00:00 2001
From: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Date: Mon, 21 Jul 2025 08:45:00 +0200
Subject: [PATCH 6/7] src/service.c: Move 'Show Current Layout' menuitem closer
 HWK settings (i.e. drop one menu separator).

Signed-off-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
---
 src/service.c | 45 +++++++++++----------------------------------
 1 file changed, 11 insertions(+), 34 deletions(-)

diff --git a/src/service.c b/src/service.c
index ee37ef96..54d2327f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -43,8 +43,7 @@ enum
 {
     SECTION_HEADER = (1 << 0),
     SECTION_LAYOUTS = (1 << 1),
-    SECTION_DISPLAY = (1 << 2),
-    SECTION_SETTINGS = (1 << 3)
+    SECTION_SETTINGS = (1 << 2)
 };
 
 enum
@@ -239,6 +238,7 @@ static GMenuModel* createSettingsSection(IndicatorKeyboardService *self, gboolea
 {
     GMenu * pMenu = g_menu_new();
     gboolean bUbuntuTouch = ayatana_common_utils_is_ubuntutouch ();
+    gboolean bDisplay = FALSE;
 
     if (self->pPrivate->bLomiri && bOSK && !bUbuntuTouch)
     {
@@ -259,6 +259,7 @@ static GMenuModel* createSettingsSection(IndicatorKeyboardService *self, gboolea
             if (bHardwareKeyboard)
             {
                 sAction = "indicator.settings";
+                bDisplay = TRUE;
             }
         }
         else if (bOSK)
@@ -274,8 +275,13 @@ static GMenuModel* createSettingsSection(IndicatorKeyboardService *self, gboolea
     else if (!bOSK)
     {
         sAction = "indicator.settings";
+        bDisplay = TRUE;
     }
 
+    if (bDisplay)
+    {
+        g_menu_append (pMenu, _("Show Current Layout"), "indicator.display");
+    }
     if (sAction)
     {
         g_menu_append(pMenu, _("Keyboard Settings…"), sAction);
@@ -284,29 +290,6 @@ static GMenuModel* createSettingsSection(IndicatorKeyboardService *self, gboolea
     return G_MENU_MODEL(pMenu);
 }
 
-static GMenuModel* createDisplaySection (IndicatorKeyboardService *self)
-{
-    GMenu * pMenu = g_menu_new ();
-    gboolean bDisplay = TRUE;
-
-    if (self->pPrivate->bLomiri)
-    {
-        gboolean bHardwareKeyboard = m_fnKeyboardHasHardwareKeyboard (self->pPrivate->pKeyboard);
-
-        if (!bHardwareKeyboard)
-        {
-            bDisplay = FALSE;
-        }
-    }
-
-    if (bDisplay)
-    {
-        g_menu_append (pMenu, _("Show Current Layout"), "indicator.display");
-    }
-
-    return G_MENU_MODEL (pMenu);
-}
-
 static void rebuildSection(GMenu *pMenu, int nPos, GMenuModel *pModel)
 {
     g_menu_remove(pMenu, nPos);
@@ -335,22 +318,17 @@ static void rebuildNow(IndicatorKeyboardService *self, guint nSections)
     if (nSections & SECTION_LAYOUTS)
     {
         rebuildSection(pInfoDesktop->pSubmenu, 0, createLayoutSection(self, HWKBD));
-        rebuildSection(pInfoDesktop->pSubmenu, 3, createLayoutSection(self, OSK));
+        rebuildSection(pInfoDesktop->pSubmenu, 2, createLayoutSection(self, OSK));
         rebuildSection(pInfoPhone->pSubmenu, 0, createLayoutSection(self, HWKBD));
         rebuildSection(pInfoPhone->pSubmenu, 2, createLayoutSection(self, OSK));
         rebuildSection(pInfoGreeter->pSubmenu, 0, createLayoutSection(self, HWKBD));
         rebuildSection(pInfoGreeter->pSubmenu, 1, createLayoutSection(self, OSK));
     }
 
-    if (nSections & SECTION_DISPLAY)
-    {
-        rebuildSection (pInfoDesktop->pSubmenu, 1, createDisplaySection (self));
-    }
-
     if (nSections & SECTION_SETTINGS)
     {
-        rebuildSection(pInfoDesktop->pSubmenu, 2, createSettingsSection(self, HWKBD));
-        rebuildSection(pInfoDesktop->pSubmenu, 4, createSettingsSection(self, OSK));
+        rebuildSection(pInfoDesktop->pSubmenu, 1, createSettingsSection(self, HWKBD));
+        rebuildSection(pInfoDesktop->pSubmenu, 3, createSettingsSection(self, OSK));
         rebuildSection(pInfoPhone->pSubmenu, 1, createSettingsSection(self, HWKBD));
         rebuildSection(pInfoPhone->pSubmenu, 3, createSettingsSection(self, OSK));
     }
@@ -378,7 +356,6 @@ static void createMenu(IndicatorKeyboardService *self, int nProfile)
     else if (nProfile == PROFILE_DESKTOP)
     {
         lSections[nSection++] = createLayoutSection(self, HWKBD);
-        lSections[nSection++] = createDisplaySection(self);
         lSections[nSection++] = createSettingsSection(self, HWKBD);
         lSections[nSection++] = createLayoutSection(self, OSK);
         lSections[nSection++] = createSettingsSection(self, OSK);
-- 
2.47.2

