From e674e8f6e49e74edde795e012adbfe0fcfd8d729 Mon Sep 17 00:00:00 2001 From: kotontrion Date: Sat, 16 Nov 2024 12:30:21 +0100 Subject: examples(vala): update tray --- examples/vala/simple-bar/widget/Bar.vala | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'examples/vala/simple-bar/widget/Bar.vala') diff --git a/examples/vala/simple-bar/widget/Bar.vala b/examples/vala/simple-bar/widget/Bar.vala index 17db831..3893ec5 100644 --- a/examples/vala/simple-bar/widget/Bar.vala +++ b/examples/vala/simple-bar/widget/Bar.vala @@ -113,26 +113,22 @@ class SysTray : Gtk.Box { var item = tray.get_item(id); - if (item.icon_theme_path != null) - App.instance.add_icons(item.icon_theme_path); - - var menu = item.create_menu(); - var btn = new Astal.Button(); + var btn = new Gtk.MenuButton() { + use_popover = false + }; var icon = new Astal.Icon(); - btn.clicked.connect(() => { - if (menu != null) - menu.popup_at_widget(this, Gdk.Gravity.SOUTH, Gdk.Gravity.NORTH, null); - }); - - btn.destroy.connect(() => { - if (menu != null) - menu.destroy(); + item.bind_property("tooltip-markup", btn, "tooltip-markup", BindingFlags.SYNC_CREATE); + item.bind_property("gicon", icon, "g-icon", BindingFlags.SYNC_CREATE); + item.bind_property("menu-model", btn, "menu-model", BindingFlags.SYNC_CREATE); + btn.insert_action_group("dbusmenu", item.action_group); + item.notify["action-group"].connect(() => { + btn.insert_action_group("dbusmenu", item.action_group); }); - item.bind_property("tooltip-markup", btn, "tooltip-markup", BindingFlags.SYNC_CREATE); - item.bind_property("gicon", icon, "gicon", BindingFlags.SYNC_CREATE); + btn.add(icon); add(btn); + btn.show_all(); items.set(id, btn); } -- cgit v1.2.3 From c5664e2941b33609de0743a8475a40b24522a3dc Mon Sep 17 00:00:00 2001 From: Aylur Date: Thu, 19 Dec 2024 23:42:33 +0100 Subject: update examples, fix styling --- examples/vala/simple-bar/widget/Bar.vala | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'examples/vala/simple-bar/widget/Bar.vala') diff --git a/examples/vala/simple-bar/widget/Bar.vala b/examples/vala/simple-bar/widget/Bar.vala index 3893ec5..ba9f06c 100644 --- a/examples/vala/simple-bar/widget/Bar.vala +++ b/examples/vala/simple-bar/widget/Bar.vala @@ -103,6 +103,7 @@ class SysTray : Gtk.Box { AstalTray.Tray tray = AstalTray.get_default(); public SysTray() { + Astal.widget_set_class_names(this, { "SysTray" }); tray.item_added.connect(add_item); tray.item_removed.connect(remove_item); } @@ -112,23 +113,19 @@ class SysTray : Gtk.Box { return; var item = tray.get_item(id); - - var btn = new Gtk.MenuButton() { - use_popover = false - }; - var icon = new Astal.Icon(); + var btn = new Gtk.MenuButton() { use_popover = false, visible = true }; + var icon = new Astal.Icon() { visible = true }; item.bind_property("tooltip-markup", btn, "tooltip-markup", BindingFlags.SYNC_CREATE); item.bind_property("gicon", icon, "g-icon", BindingFlags.SYNC_CREATE); item.bind_property("menu-model", btn, "menu-model", BindingFlags.SYNC_CREATE); btn.insert_action_group("dbusmenu", item.action_group); item.notify["action-group"].connect(() => { - btn.insert_action_group("dbusmenu", item.action_group); + btn.insert_action_group("dbusmenu", item.action_group); }); btn.add(icon); add(btn); - btn.show_all(); items.set(id, btn); } -- cgit v1.2.3 From d16c856074531b9fb867b8922be370bcfc749614 Mon Sep 17 00:00:00 2001 From: rRedLim <82714753+rRedLim@users.noreply.github.com> Date: Fri, 20 Dec 2024 02:21:09 +0300 Subject: chore: simple-bar filter special workspaces (#168) --- examples/vala/simple-bar/widget/Bar.vala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'examples/vala/simple-bar/widget/Bar.vala') diff --git a/examples/vala/simple-bar/widget/Bar.vala b/examples/vala/simple-bar/widget/Bar.vala index ba9f06c..8913c95 100644 --- a/examples/vala/simple-bar/widget/Bar.vala +++ b/examples/vala/simple-bar/widget/Bar.vala @@ -10,8 +10,12 @@ class Workspaces : Gtk.Box { foreach (var child in get_children()) child.destroy(); - foreach (var ws in hypr.workspaces) - add(button(ws)); + foreach (var ws in hypr.workspaces) { + // filter out special workspaces + if (!(ws.id >= -99 && ws.id <= -2)) { + add(button(ws)); + } + } } Gtk.Button button(AstalHyprland.Workspace ws) { -- cgit v1.2.3