From 3bdf5149cda1c50e25b66ebc87c104658b7a3063 Mon Sep 17 00:00:00 2001 From: teamcons_atwork Date: Fri, 17 Oct 2025 11:20:14 +0200 Subject: [PATCH 01/10] Introduce IndicatorPosition enum --- lib/Indicator.vala | 5 +++++ lib/IndicatorPosition.vala | 24 ++++++++++++++++++++++++ lib/meson.build | 1 + src/Widgets/Panel.vala | 15 ++++++++++++--- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 lib/IndicatorPosition.vala diff --git a/lib/Indicator.vala b/lib/Indicator.vala index 52858ab9..06df9b6e 100644 --- a/lib/Indicator.vala +++ b/lib/Indicator.vala @@ -40,6 +40,11 @@ public abstract class Wingpanel.Indicator : GLib.Object { */ public string code_name { get; construct; } + /** + * Set the indicator positioning on the panel + */ + public Enum position { get; set; default = IndicatorPosition.RIGHT;} + /** * Defines if the indicator display widget should be shown or not. */ diff --git a/lib/IndicatorPosition.vala b/lib/IndicatorPosition.vala new file mode 100644 index 00000000..5572b545 --- /dev/null +++ b/lib/IndicatorPosition.vala @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2011-2015 Wingpanel Developers (http://launchpad.net/wingpanel) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + */ + +public Enum Wingpanel.IndicatorPosition { + LEFT, + CENTER, + RIGHT; +} diff --git a/lib/meson.build b/lib/meson.build index 93e2f384..6ff832bf 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -22,6 +22,7 @@ libwingpanel_deps = [ libwingpanel_lib = library('wingpanel', 'Indicator.vala', 'IndicatorManager.vala', + 'IndicatorPosition.vala', 'Widgets/Container.vala', 'Widgets/OverlayIcon.vala', 'Widgets/Separator.vala', diff --git a/src/Widgets/Panel.vala b/src/Widgets/Panel.vala index e10aa8a2..9a36d225 100644 --- a/src/Widgets/Panel.vala +++ b/src/Widgets/Panel.vala @@ -139,8 +139,17 @@ public class Wingpanel.Widgets.Panel : Gtk.EventBox { private IndicatorEntry? get_next_sibling (IndicatorEntry current) { IndicatorEntry? sibling = null; - switch (current.base_indicator.code_name) { - case Indicator.APP_LAUNCHER: + // Workaround until both indicators get their own position prop + if (current.base_indicator.code_name == Indicator.APP_LAUNCHER) { + current.base_indicator.position = IndicatorPosition.LEFT; + }; + + if (current.base_indicator.code_name == Indicator.APP_DATETIME) { + current.base_indicator.position = IndicatorPosition.CENTER; + }; + + switch (current.base_indicator.position) { + case IndicatorPosition.LEFT: var children = left_menubar.get_children (); int index = children.index (current); if (index == -1) { @@ -155,7 +164,7 @@ public class Wingpanel.Widgets.Panel : Gtk.EventBox { } break; - case Indicator.DATETIME: + case IndicatorPosition.CENTER: var children = center_menubar.get_children (); int index = children.index (current); if (index == -1) { From 134b9eee2ea1647c1102c7409b4f43bc66ea981b Mon Sep 17 00:00:00 2001 From: teamcons_atwork Date: Fri, 17 Oct 2025 12:22:13 +0200 Subject: [PATCH 02/10] Move fix to correct blurb of code --- src/Widgets/Panel.vala | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Widgets/Panel.vala b/src/Widgets/Panel.vala index 9a36d225..9ef32486 100644 --- a/src/Widgets/Panel.vala +++ b/src/Widgets/Panel.vala @@ -139,17 +139,8 @@ public class Wingpanel.Widgets.Panel : Gtk.EventBox { private IndicatorEntry? get_next_sibling (IndicatorEntry current) { IndicatorEntry? sibling = null; - // Workaround until both indicators get their own position prop - if (current.base_indicator.code_name == Indicator.APP_LAUNCHER) { - current.base_indicator.position = IndicatorPosition.LEFT; - }; - - if (current.base_indicator.code_name == Indicator.APP_DATETIME) { - current.base_indicator.position = IndicatorPosition.CENTER; - }; - - switch (current.base_indicator.position) { - case IndicatorPosition.LEFT: + switch (current.base_indicator.code_name) { + case Indicator.APP_LAUNCHER: var children = left_menubar.get_children (); int index = children.index (current); if (index == -1) { @@ -164,7 +155,7 @@ public class Wingpanel.Widgets.Panel : Gtk.EventBox { } break; - case IndicatorPosition.CENTER: + case Indicator.DATETIME: var children = center_menubar.get_children (); int index = children.index (current); if (index == -1) { @@ -256,12 +247,21 @@ public class Wingpanel.Widgets.Panel : Gtk.EventBox { private void add_indicator (Indicator indicator) { var indicator_entry = new IndicatorEntry (indicator, popover_manager); - switch (indicator.code_name) { - case Indicator.APP_LAUNCHER: + // Workaround until both indicators get their own position prop + if (current.base_indicator.code_name == Indicator.APP_LAUNCHER) { + current.base_indicator.position = IndicatorPosition.LEFT; + }; + + if (current.base_indicator.code_name == Indicator.APP_DATETIME) { + current.base_indicator.position = IndicatorPosition.CENTER; + }; + + switch (indicator.position) { + case IndicatorPosition.LEFT: indicator_entry.set_transition_type (Gtk.RevealerTransitionType.SLIDE_RIGHT); left_menubar.add (indicator_entry); break; - case Indicator.DATETIME: + case IndicatorPosition.CENTER: indicator_entry.set_transition_type (Gtk.RevealerTransitionType.SLIDE_DOWN); center_menubar.add (indicator_entry); break; From febaf16cb770251c90d25d01bbd6c40a4356e52c Mon Sep 17 00:00:00 2001 From: Stella and Charlie <147658063+teamcons@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:01:03 +0200 Subject: [PATCH 03/10] Update IndicatorPosition.vala --- lib/IndicatorPosition.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/IndicatorPosition.vala b/lib/IndicatorPosition.vala index 5572b545..b5a04baa 100644 --- a/lib/IndicatorPosition.vala +++ b/lib/IndicatorPosition.vala @@ -17,7 +17,7 @@ * Boston, MA 02110-1301 USA. */ -public Enum Wingpanel.IndicatorPosition { +public enum Wingpanel.IndicatorPosition { LEFT, CENTER, RIGHT; From fe1598a023a5de6bc96cac626eef29bbdf7b033b Mon Sep 17 00:00:00 2001 From: Stella and Charlie <147658063+teamcons@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:01:23 +0200 Subject: [PATCH 04/10] Fix enum declaration for position property --- lib/Indicator.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Indicator.vala b/lib/Indicator.vala index 06df9b6e..5ed1795f 100644 --- a/lib/Indicator.vala +++ b/lib/Indicator.vala @@ -43,7 +43,7 @@ public abstract class Wingpanel.Indicator : GLib.Object { /** * Set the indicator positioning on the panel */ - public Enum position { get; set; default = IndicatorPosition.RIGHT;} + public enum position { get; set; default = IndicatorPosition.RIGHT;} /** * Defines if the indicator display widget should be shown or not. From dde4fde986229e214518ecfcf34e448797cf7409 Mon Sep 17 00:00:00 2001 From: Stella and Charlie <147658063+teamcons@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:15:42 +0200 Subject: [PATCH 05/10] Fix broken declaration --- lib/Indicator.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Indicator.vala b/lib/Indicator.vala index 5ed1795f..f5c56424 100644 --- a/lib/Indicator.vala +++ b/lib/Indicator.vala @@ -43,7 +43,7 @@ public abstract class Wingpanel.Indicator : GLib.Object { /** * Set the indicator positioning on the panel */ - public enum position { get; set; default = IndicatorPosition.RIGHT;} + public IndicatorPosition position { get; set; default = IndicatorPosition.RIGHT;} /** * Defines if the indicator display widget should be shown or not. From de20e2481321bd8f02e3febda7409d844cfad67e Mon Sep 17 00:00:00 2001 From: teamcons Date: Mon, 20 Oct 2025 19:46:52 +0200 Subject: [PATCH 06/10] Fix inattention mistakes --- src/Widgets/Panel.vala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Widgets/Panel.vala b/src/Widgets/Panel.vala index 9ef32486..133b779a 100644 --- a/src/Widgets/Panel.vala +++ b/src/Widgets/Panel.vala @@ -248,12 +248,12 @@ public class Wingpanel.Widgets.Panel : Gtk.EventBox { var indicator_entry = new IndicatorEntry (indicator, popover_manager); // Workaround until both indicators get their own position prop - if (current.base_indicator.code_name == Indicator.APP_LAUNCHER) { - current.base_indicator.position = IndicatorPosition.LEFT; + if (indicator.code_name == Indicator.APP_LAUNCHER) { + indicator.position = IndicatorPosition.LEFT; }; - - if (current.base_indicator.code_name == Indicator.APP_DATETIME) { - current.base_indicator.position = IndicatorPosition.CENTER; + + if (indicator.code_name == Indicator.DATETIME) { + indicator.position = IndicatorPosition.CENTER; }; switch (indicator.position) { From abb8978d6380f4221a0b1e81cb6b341ca7559f0d Mon Sep 17 00:00:00 2001 From: teamcons Date: Mon, 20 Oct 2025 19:57:06 +0200 Subject: [PATCH 07/10] Always first applauncher --- src/Services/IndicatorSorter.vala | 1 + src/Widgets/Panel.vala | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Services/IndicatorSorter.vala b/src/Services/IndicatorSorter.vala index 675e5daa..33d41e54 100644 --- a/src/Services/IndicatorSorter.vala +++ b/src/Services/IndicatorSorter.vala @@ -32,6 +32,7 @@ public class Wingpanel.Services.IndicatorSorter : Object { private static Gee.HashMap indicator_order = new Gee.HashMap (); static construct { indicator_order[AYATANA_INDICATOR] = 0; + indicator_order[Indicator.APP_LAUNCHER] = 0; indicator_order[UNKNOWN_INDICATOR] = 1; indicator_order[Indicator.ACCESSIBILITY] = 2; indicator_order[Indicator.NIGHT_LIGHT] = 3; diff --git a/src/Widgets/Panel.vala b/src/Widgets/Panel.vala index 133b779a..987f3b05 100644 --- a/src/Widgets/Panel.vala +++ b/src/Widgets/Panel.vala @@ -259,7 +259,7 @@ public class Wingpanel.Widgets.Panel : Gtk.EventBox { switch (indicator.position) { case IndicatorPosition.LEFT: indicator_entry.set_transition_type (Gtk.RevealerTransitionType.SLIDE_RIGHT); - left_menubar.add (indicator_entry); + left_menubar.insert_sorted (indicator_entry); break; case IndicatorPosition.CENTER: indicator_entry.set_transition_type (Gtk.RevealerTransitionType.SLIDE_DOWN); From 0cfb0346dcb38306724e811d8d1bc83132b361b1 Mon Sep 17 00:00:00 2001 From: Stella and Charlie <147658063+teamcons@users.noreply.github.com> Date: Sat, 25 Oct 2025 13:22:31 +0200 Subject: [PATCH 08/10] Add missing whitespace Co-authored-by: Ryo Nakano --- lib/Indicator.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Indicator.vala b/lib/Indicator.vala index f5c56424..b845bf2d 100644 --- a/lib/Indicator.vala +++ b/lib/Indicator.vala @@ -43,7 +43,7 @@ public abstract class Wingpanel.Indicator : GLib.Object { /** * Set the indicator positioning on the panel */ - public IndicatorPosition position { get; set; default = IndicatorPosition.RIGHT;} + public IndicatorPosition position { get; set; default = IndicatorPosition.RIGHT; } /** * Defines if the indicator display widget should be shown or not. From 34707a520b357e0e1b9537e137de50b95ad38f58 Mon Sep 17 00:00:00 2001 From: Stella and Charlie <147658063+teamcons@users.noreply.github.com> Date: Sat, 25 Oct 2025 13:22:55 +0200 Subject: [PATCH 09/10] Third person form Co-authored-by: Ryo Nakano --- lib/Indicator.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Indicator.vala b/lib/Indicator.vala index b845bf2d..d22094b6 100644 --- a/lib/Indicator.vala +++ b/lib/Indicator.vala @@ -41,7 +41,7 @@ public abstract class Wingpanel.Indicator : GLib.Object { public string code_name { get; construct; } /** - * Set the indicator positioning on the panel + * Sets the indicator positioning on the panel. */ public IndicatorPosition position { get; set; default = IndicatorPosition.RIGHT; } From bddc1371cae12b2699f1a1d9cba873e7c56c6ea3 Mon Sep 17 00:00:00 2001 From: Stella and Charlie <147658063+teamcons@users.noreply.github.com> Date: Sat, 25 Oct 2025 13:23:26 +0200 Subject: [PATCH 10/10] Explicit TODO Co-authored-by: Ryo Nakano --- src/Widgets/Panel.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Widgets/Panel.vala b/src/Widgets/Panel.vala index 987f3b05..c82eac47 100644 --- a/src/Widgets/Panel.vala +++ b/src/Widgets/Panel.vala @@ -247,7 +247,7 @@ public class Wingpanel.Widgets.Panel : Gtk.EventBox { private void add_indicator (Indicator indicator) { var indicator_entry = new IndicatorEntry (indicator, popover_manager); - // Workaround until both indicators get their own position prop + // TODO Workaround until both indicators get their own position prop if (indicator.code_name == Indicator.APP_LAUNCHER) { indicator.position = IndicatorPosition.LEFT; };