From d5aabf73004d929dd39bfbf7a331758918aaf207 Mon Sep 17 00:00:00 2001 From: Hue Date: Mon, 9 Feb 2026 20:20:34 +0100 Subject: [PATCH 01/32] Added many configuration options to the dock and the panel, still a draft --- metadata/dock.xml | 57 +++++++++++- metadata/panel.xml | 81 ++++++++++++++++- src/dock/dock-app.cpp | 8 +- src/dock/dock.cpp | 149 +++++++++++++++++++++++++++++--- src/dock/dock.hpp | 2 + src/panel/panel.cpp | 121 ++++++++++++++++++++++++-- src/panel/widget.hpp | 15 +++- src/panel/widgets/battery.cpp | 15 ++++ src/panel/widgets/battery.hpp | 3 + src/panel/widgets/launchers.cpp | 19 ++++ src/panel/widgets/launchers.hpp | 3 + src/panel/widgets/network.cpp | 11 +++ src/panel/widgets/network.hpp | 3 + src/panel/widgets/separator.cpp | 15 ++++ src/panel/widgets/separator.hpp | 4 + src/panel/widgets/tray/tray.cpp | 22 +++++ src/panel/widgets/tray/tray.hpp | 3 + src/panel/widgets/volume.hpp | 6 +- src/util/gtk-utils.cpp | 29 +++++++ src/util/gtk-utils.hpp | 5 ++ src/util/wf-autohide-window.cpp | 138 +++++++++++++++++++---------- src/util/wf-autohide-window.hpp | 16 +++- src/util/wf-popover.cpp | 18 +++- wf-shell.ini.example | 9 +- 24 files changed, 675 insertions(+), 77 deletions(-) diff --git a/metadata/dock.xml b/metadata/dock.xml index 3451c111..4ae4dafc 100644 --- a/metadata/dock.xml +++ b/metadata/dock.xml @@ -12,9 +12,26 @@ true + + + + + + + + + + + + - @@ -100,26 +100,6 @@ <_name>Right - - @@ -60,7 +60,7 @@ false + @@ -49,9 +49,10 @@ true @@ -62,21 +63,21 @@ From bba81feba8c3c9198b73ca8c0376cf5d3a32dff4 Mon Sep 17 00:00:00 2001 From: Hue Date: Tue, 10 Feb 2026 13:37:52 +0100 Subject: [PATCH 19/32] drop fucky logic for multiple rows --- src/dock/dock.cpp | 158 ++++++---------------------------------------- 1 file changed, 18 insertions(+), 140 deletions(-) diff --git a/src/dock/dock.cpp b/src/dock/dock.cpp index ce4fc93a..c5048d95 100644 --- a/src/dock/dock.cpp +++ b/src/dock/dock.cpp @@ -2,16 +2,15 @@ #include #include #include - -#include -#include +#include +#include +#include #include -#include #include "dock.hpp" +#include "wf-shell-app.hpp" +#include "wf-autohide-window.hpp" #include "../util/gtk-utils.hpp" -#include - class WfDock::impl { @@ -20,10 +19,7 @@ class WfDock::impl wl_surface *_wl_surface; Gtk::Box out_box; Gtk::Box box; - // for having multiple layers in the dock (max_per_line setting) - // flowbox doesn’t really cut it unfortunately. can’t center the inner widgets and can’t complete the - // down/right row first - // listbox neither, since it can’t even be oriented + Glib::RefPtr layout; WfOption css_path{"dock/css_path"}; WfOption dock_width{"dock/dock_width"}; @@ -32,11 +28,6 @@ class WfDock::impl WfOption position{"dock/position"}; WfOption entries_per_line{"dock/max_per_line"}; - void (Gtk::Box::*ap_or_pre_pend)(Gtk::Widget&); // pointer to Gtk::Box::prepend or Gtk::Box::append, - // updated by update_layout - Gtk::Widget*(Gtk::Widget::*first_or_last_child)(); // similar, for get_first_child and get_last_child - bool reverse_iteration; - public: impl(WayfireOutput *output) { @@ -46,15 +37,19 @@ class WfDock::impl window->set_auto_exclusive_zone(false); gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_TOP); - out_box.get_style_context()->add_class("out-box"); - gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_TOP, 0); gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_BOTTOM, 0); gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, 0); gtk_layer_set_margin(window->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, 0); + layout = Gtk::ConstraintLayout::create(); + box.set_layout_manager(layout); + + out_box.append(box); + out_box.get_style_context()->add_class("out-box"); + box.add_css_class("box"); + window->set_child(out_box); - window->set_default_size(dock_width, dock_height); update_layout(); window->add_css_class("wf-dock"); @@ -76,137 +71,20 @@ class WfDock::impl window->get_surface()->gobj()); } - void prepare_new_layer(Gtk::Box& box) - { - box.get_style_context()->add_class("box"); - box.set_homogeneous(true); - - if (position.value() == "left" or position.value() == "right") - { - box.set_orientation(Gtk::Orientation::VERTICAL); - } else - { - box.set_orientation(Gtk::Orientation::HORIZONTAL); - } - - box.add_tick_callback([=] (Glib::RefPtr fc) - { - set_clickable_region(); - return true; - }); - } - - void update_layout() - { - Gtk::Orientation orientation; - - // this sequence of checking gives a fallback to a horizontal layout if the value is invalid. - // goes with the WfAutohideWindow fallback to go at the top. - if (position.value() == "left" or position.value() == "right") - { - orientation = Gtk::Orientation::VERTICAL; - out_box.set_orientation(Gtk::Orientation::HORIZONTAL); - } else - { - orientation = Gtk::Orientation::HORIZONTAL; - out_box.set_orientation(Gtk::Orientation::VERTICAL); - } + void update_layout(){ + window->set_default_size(dock_width, dock_height); - if (position.value() == "bottom" or position.value() == "right") - { - ap_or_pre_pend = &Gtk::Box::prepend; - first_or_last_child = &Gtk::Widget::get_first_child; - reverse_iteration = true; - } else - { - ap_or_pre_pend = &Gtk::Box::append; - first_or_last_child = &Gtk::Widget::get_last_child; - reverse_iteration = false; - } - for (auto layer : out_box.get_children()) - { - ((Gtk::Box*)layer)->set_orientation(orientation); - } } void add_child(Gtk::Widget& widget) { - // create a box if the last one is full or there is none - if (((int)(out_box.get_children().size()) == 0) || - ((int)((out_box.*first_or_last_child)()->get_children().size()) == entries_per_line)) - { - Gtk::Box new_box; - prepare_new_layer(new_box); - (out_box.*ap_or_pre_pend)(new_box); - } - - Gtk::Box& last_child = *(Gtk::Box*)(out_box.*first_or_last_child)(); - - widget.set_halign(Gtk::Align::CENTER); - widget.set_valign(Gtk::Align::CENTER); - widget.get_style_context()->add_class("re-orient"); - - last_child.append(widget); + box.append(widget); } void rem_child(Gtk::Widget& widget) { - Gtk::Box *prev_row = nullptr; - bool found = false; - - auto check_row = [&] (Gtk::Widget *row) - { - if (!found) - { - for (Gtk::Widget *item : row->get_children()) - { - if (&widget == item) - { - found = true; - ((Gtk::Box*)row)->remove(*item); - break; - } - } - - if (!found) - { - return; - } - } - - // move the first widget of every next line and append it to the previous line - if (prev_row != nullptr) - { - Gtk::Widget *to_move = ((Gtk::Box*)row)->get_last_child(); - prev_row->append(*to_move); - ((Gtk::Box*)row)->remove(*to_move); - } - - prev_row = ((Gtk::Box*)row); - }; - - auto children = out_box.get_children(); - - if (reverse_iteration) - { - for (auto it = children.rbegin(); it != children.rend(); ++it) - { - check_row(*it); - } - } else - { - for (auto it = children.begin(); it != children.end(); ++it) - { - check_row(*it); - } - } - - // if we emptied a row, delete it - if ((out_box.*first_or_last_child)()->get_children().size() == 0) - { - out_box.remove(*(out_box.*first_or_last_child)()); - } + this->box.remove(widget); } wl_surface *get_wl_surface() @@ -219,7 +97,7 @@ class WfDock::impl void set_clickable_region() { auto surface = window->get_surface(); - auto widget_bounds = out_box.compute_bounds(*window); + auto widget_bounds = box.compute_bounds(*window); auto rect = Cairo::RectangleInt{ (int)widget_bounds->get_x(), From 384f107c67261a786dc3855c35c32b08e4ec64cb Mon Sep 17 00:00:00 2001 From: Hue Date: Tue, 10 Feb 2026 17:48:04 +0100 Subject: [PATCH 20/32] =?UTF-8?q?let=E2=80=99s=20try=20a=20constraint=20la?= =?UTF-8?q?yout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dock/dock.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/src/dock/dock.cpp b/src/dock/dock.cpp index c5048d95..16b7b1f7 100644 --- a/src/dock/dock.cpp +++ b/src/dock/dock.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "dock.hpp" #include "wf-shell-app.hpp" @@ -19,7 +20,9 @@ class WfDock::impl wl_surface *_wl_surface; Gtk::Box out_box; Gtk::Box box; + // std::map> widget_to_constraints; Glib::RefPtr layout; + Gtk::Constraint::Attribute new_row_targ_attr, new_row_source_attr, new_itm_targ_attr, new_itm_source_attr; WfOption css_path{"dock/css_path"}; WfOption dock_width{"dock/dock_width"}; @@ -74,11 +77,69 @@ class WfDock::impl void update_layout(){ window->set_default_size(dock_width, dock_height); - + if (position.value() == "top") + { + new_row_targ_attr = Gtk::Constraint::Attribute::TOP; + new_row_source_attr = Gtk::Constraint::Attribute::BOTTOM; + new_itm_targ_attr = Gtk::Constraint::Attribute::LEFT; + new_itm_source_attr = Gtk::Constraint::Attribute::RIGHT; + } + else if (position.value() == "bottom") + { + new_row_targ_attr = Gtk::Constraint::Attribute::BOTTOM; + new_row_source_attr = Gtk::Constraint::Attribute::TOP; + new_itm_targ_attr = Gtk::Constraint::Attribute::LEFT; + new_itm_source_attr = Gtk::Constraint::Attribute::RIGHT; + } + else if (position.value() == "left") + { + new_row_targ_attr = Gtk::Constraint::Attribute::LEFT; + new_row_source_attr = Gtk::Constraint::Attribute::RIGHT; + new_itm_targ_attr = Gtk::Constraint::Attribute::TOP; + new_itm_source_attr = Gtk::Constraint::Attribute::BOTTOM; + } + else if (position.value() == "right") + { + new_row_targ_attr = Gtk::Constraint::Attribute::RIGHT; + new_row_source_attr = Gtk::Constraint::Attribute::LEFT; + new_itm_targ_attr = Gtk::Constraint::Attribute::TOP; + new_itm_source_attr = Gtk::Constraint::Attribute::BOTTOM; + } } void add_child(Gtk::Widget& widget) { + if (box.get_children().size() == 0) + { + box.append(widget); + return; + } + if (box.get_children().size() % entries_per_line == 0){ + auto constraint = Gtk::Constraint::create( + widget.make_refptr_constrainttarget(), + new_row_targ_attr, + Gtk::Constraint::Relation::EQ, + (box.get_children().at(box.get_children().size() - entries_per_line))->make_refptr_constrainttarget(), + new_row_source_attr, + 1.0, + 0.0, + 1 + ); + layout->add_constraint(constraint); + } else + { + auto constraint = Gtk::Constraint::create( + widget.make_refptr_constrainttarget(), + new_itm_targ_attr, + Gtk::Constraint::Relation::EQ, + (box.get_children().at(box.get_children().size()-1))->make_refptr_constrainttarget(), + new_itm_source_attr, + 1.0, + 0.0, + 1 + ); + layout->add_constraint(constraint); + } box.append(widget); } From 168c3361ecf5bc39382a163b7925b0c8bad8fb6f Mon Sep 17 00:00:00 2001 From: Hue Date: Tue, 10 Feb 2026 18:24:04 +0100 Subject: [PATCH 21/32] =?UTF-8?q?Revert=20"let=E2=80=99s=20try=20a=20const?= =?UTF-8?q?raint=20layout"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 384f107c67261a786dc3855c35c32b08e4ec64cb. --- src/dock/dock.cpp | 63 +---------------------------------------------- 1 file changed, 1 insertion(+), 62 deletions(-) diff --git a/src/dock/dock.cpp b/src/dock/dock.cpp index 16b7b1f7..c5048d95 100644 --- a/src/dock/dock.cpp +++ b/src/dock/dock.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include "dock.hpp" #include "wf-shell-app.hpp" @@ -20,9 +19,7 @@ class WfDock::impl wl_surface *_wl_surface; Gtk::Box out_box; Gtk::Box box; - // std::map> widget_to_constraints; Glib::RefPtr layout; - Gtk::Constraint::Attribute new_row_targ_attr, new_row_source_attr, new_itm_targ_attr, new_itm_source_attr; WfOption css_path{"dock/css_path"}; WfOption dock_width{"dock/dock_width"}; @@ -77,69 +74,11 @@ class WfDock::impl void update_layout(){ window->set_default_size(dock_width, dock_height); - if (position.value() == "top") - { - new_row_targ_attr = Gtk::Constraint::Attribute::TOP; - new_row_source_attr = Gtk::Constraint::Attribute::BOTTOM; - new_itm_targ_attr = Gtk::Constraint::Attribute::LEFT; - new_itm_source_attr = Gtk::Constraint::Attribute::RIGHT; - } - else if (position.value() == "bottom") - { - new_row_targ_attr = Gtk::Constraint::Attribute::BOTTOM; - new_row_source_attr = Gtk::Constraint::Attribute::TOP; - new_itm_targ_attr = Gtk::Constraint::Attribute::LEFT; - new_itm_source_attr = Gtk::Constraint::Attribute::RIGHT; - } - else if (position.value() == "left") - { - new_row_targ_attr = Gtk::Constraint::Attribute::LEFT; - new_row_source_attr = Gtk::Constraint::Attribute::RIGHT; - new_itm_targ_attr = Gtk::Constraint::Attribute::TOP; - new_itm_source_attr = Gtk::Constraint::Attribute::BOTTOM; - } - else if (position.value() == "right") - { - new_row_targ_attr = Gtk::Constraint::Attribute::RIGHT; - new_row_source_attr = Gtk::Constraint::Attribute::LEFT; - new_itm_targ_attr = Gtk::Constraint::Attribute::TOP; - new_itm_source_attr = Gtk::Constraint::Attribute::BOTTOM; - } + } void add_child(Gtk::Widget& widget) { - if (box.get_children().size() == 0) - { - box.append(widget); - return; - } - if (box.get_children().size() % entries_per_line == 0){ - auto constraint = Gtk::Constraint::create( - widget.make_refptr_constrainttarget(), - new_row_targ_attr, - Gtk::Constraint::Relation::EQ, - (box.get_children().at(box.get_children().size() - entries_per_line))->make_refptr_constrainttarget(), - new_row_source_attr, - 1.0, - 0.0, - 1 - ); - layout->add_constraint(constraint); - } else - { - auto constraint = Gtk::Constraint::create( - widget.make_refptr_constrainttarget(), - new_itm_targ_attr, - Gtk::Constraint::Relation::EQ, - (box.get_children().at(box.get_children().size()-1))->make_refptr_constrainttarget(), - new_itm_source_attr, - 1.0, - 0.0, - 1 - ); - layout->add_constraint(constraint); - } box.append(widget); } From 57d8b5b09f9ab9366cdfe069d20adaf912ea8b26 Mon Sep 17 00:00:00 2001 From: Hue Date: Wed, 11 Feb 2026 00:46:50 +0100 Subject: [PATCH 22/32] unified span_full_edge (and added to dock) and maybe other things --- metadata/dock.xml | 7 +++++++ src/panel/panel.cpp | 29 ----------------------------- src/util/wf-autohide-window.cpp | 16 ++++++++++++++++ src/util/wf-autohide-window.hpp | 12 +++++++----- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/metadata/dock.xml b/metadata/dock.xml index 3f16cff9..4ba4a860 100644 --- a/metadata/dock.xml +++ b/metadata/dock.xml @@ -65,6 +65,13 @@ <_short>Dock width 100 + - - diff --git a/metadata/panel.xml b/metadata/panel.xml index a7570479..4b16bcb7 100644 --- a/metadata/panel.xml +++ b/metadata/panel.xml @@ -44,7 +44,7 @@ Minimum width the panel takes. diff --git a/src/dock/dock.cpp b/src/dock/dock.cpp index f25e37aa..51c61643 100644 --- a/src/dock/dock.cpp +++ b/src/dock/dock.cpp @@ -17,8 +17,6 @@ class WfDock::impl Gtk::FlowBox box; WfOption css_path{"dock/css_path"}; - WfOption dock_width{"dock/dock_width"}; - WfOption dock_height{"dock/dock_height"}; WfOption position{"dock/position"}; WfOption entries_per_line{"dock/max_per_line"}; @@ -63,11 +61,12 @@ class WfDock::impl } void update_layout(){ - window->set_default_size(dock_width, dock_height); - if (position.value() == "bottom") { - + // this is not great, but we lack better options without doing a + // layout with boxes in boxes (ugly) or some sort of custom layout manager + box.set_orientation(Gtk::Orientation::HORIZONTAL); + box.set_direction(Gtk::TextDirection::LTR); } else if (position.value() == "left") { @@ -79,7 +78,7 @@ class WfDock::impl box.set_orientation(Gtk::Orientation::VERTICAL); box.set_direction(Gtk::TextDirection::RTL); } - else + else // top { box.set_orientation(Gtk::Orientation::HORIZONTAL); box.set_direction(Gtk::TextDirection::LTR); diff --git a/src/panel/panel.cpp b/src/panel/panel.cpp index ad1699e0..61fbc3cc 100644 --- a/src/panel/panel.cpp +++ b/src/panel/panel.cpp @@ -76,12 +76,6 @@ class WayfirePanel::impl } }; - WfOption minimal_panel_height{"panel/minimal_height"}; - WfOption minimal_panel_width{"panel/minimal_width"}; - WfOption force_center{"panel/force_center"}; - - WfOption panel_position{"panel/position"}; - void set_boxes_orientation(Gtk::Orientation orientation) { content_box.set_orientation(orientation); @@ -90,6 +84,9 @@ class WayfirePanel::impl right_box.set_orientation(orientation); } + WfOption panel_position{"panel/position"}; + WfOption force_center{"panel/force_center"}; + void update_orientation() { bool is_horizontal = !(panel_position.value() == "left" or panel_position.value() == @@ -138,8 +135,6 @@ class WayfirePanel::impl { window = std::make_unique(output, "panel"); - window->set_default_size(minimal_panel_width, minimal_panel_height); - window->get_style_context()->add_class("wf-panel"); panel_layer.set_callback(set_panel_layer); set_panel_layer(); // initial setting diff --git a/src/util/wf-autohide-window.cpp b/src/util/wf-autohide-window.cpp index 047d31f0..7731650c 100644 --- a/src/util/wf-autohide-window.cpp +++ b/src/util/wf-autohide-window.cpp @@ -16,6 +16,8 @@ WayfireAutohidingWindow::WayfireAutohidingWindow(WayfireOutput *output, span_full_edge{section + "/span_full_edge"}, autohide_animation{WfOption{section + "/autohide_duration"}}, edge_offset{section + "/edge_offset"}, + minimal_height{section + "/minimal_height"}, + minimal_width{section + "/minimal_width"}, autohide_opt{section + "/autohide"}, autohide_show_delay{section + "/autohide_show_delay"}, autohide_hide_delay{section + "/autohide_hide_delay"} @@ -31,6 +33,11 @@ WayfireAutohidingWindow::WayfireAutohidingWindow(WayfireOutput *output, this->span_full_edge.set_callback([=] () { this->update_position(); }); this->update_position(); + const auto set_size = [=] () { this->set_default_size(minimal_width, minimal_height); }; + this->minimal_height.set_callback(set_size); + this->minimal_width.set_callback(set_size); + set_size(); + auto pointer_gesture = Gtk::EventControllerMotion::create(); pointer_gesture->signal_enter().connect([=] (double x, double y) { diff --git a/src/util/wf-autohide-window.hpp b/src/util/wf-autohide-window.hpp index 784487c9..21f38e09 100644 --- a/src/util/wf-autohide-window.hpp +++ b/src/util/wf-autohide-window.hpp @@ -30,9 +30,11 @@ class WayfireAutohidingWindow : public Gtk::Window * 2. section/span_full_edge * 3. section/autohide_duration * 4. section/edge_offset - * 5. section/autohide - * 6. section/autohide_show_delay - * 7. section/autohide_hide_delay + * 5. section/minimal_height + * 6. section/minimal_width + * 7. section/autohide + * 8. section/autohide_show_delay + * 9. section/autohide_hide_delay */ WayfireAutohidingWindow(WayfireOutput *output, const std::string& section); WayfireAutohidingWindow(WayfireAutohidingWindow&&) = delete; @@ -92,6 +94,9 @@ class WayfireAutohidingWindow : public Gtk::Window WfOption edge_offset; int last_edge_offset = -1; + WfOption minimal_height; + WfOption minimal_width; + WfOption autohide_opt; WfOption autohide_show_delay; WfOption autohide_hide_delay; From bdf39cedb8fcb78eedcedf49cad01185eb03d47c Mon Sep 17 00:00:00 2001 From: Hue Date: Wed, 11 Feb 2026 01:48:38 +0100 Subject: [PATCH 25/32] adjust config loading to use .value and revert non-changes --- src/panel/panel.hpp | 3 ++- src/panel/widgets/battery.cpp | 4 ++-- src/panel/widgets/launchers.cpp | 4 ++-- src/panel/widgets/launchers.hpp | 1 - src/panel/widgets/menu.cpp | 5 +++-- src/panel/widgets/network.cpp | 4 ++-- src/panel/widgets/network.hpp | 1 - .../widgets/notifications/single-notification.cpp | 1 + src/panel/widgets/separator.cpp | 4 ++-- src/panel/widgets/tray/item.cpp | 6 ------ src/panel/widgets/tray/tray.cpp | 5 ++--- src/panel/widgets/tray/tray.hpp | 1 - src/panel/widgets/volume.hpp | 10 ++++------ src/panel/widgets/window-list/window-list.cpp | 1 - src/util/wf-option-wrap.hpp | 3 ++- src/util/wf-shell-app.hpp | 12 ++++++++---- 16 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/panel/panel.hpp b/src/panel/panel.hpp index bc24ddab..fd5dd5d6 100644 --- a/src/panel/panel.hpp +++ b/src/panel/panel.hpp @@ -28,7 +28,8 @@ class WayfirePanelApp : public WayfireShellApp WayfirePanel *panel_for_wl_output(wl_output *output); static WayfirePanelApp& get(); - /* Starts the program. get() is valid afterward the first (and the only) call to create() */ + /* Starts the program. get() is valid afterward the first (and the only) + * call to create() */ static void create(int argc, char **argv); ~WayfirePanelApp(); diff --git a/src/panel/widgets/battery.cpp b/src/panel/widgets/battery.cpp index 2dc02706..4e53702b 100644 --- a/src/panel/widgets/battery.cpp +++ b/src/panel/widgets/battery.cpp @@ -208,9 +208,9 @@ bool WayfireBatteryInfo::setup_dbus() void WayfireBatteryInfo::update_layout() { - std::string panel_position = WfOption{"panel/position"}; + WfOption panel_position{"panel/position"}; - if (panel_position == PANEL_POSITION_LEFT or panel_position == PANEL_POSITION_RIGHT) + if (panel_position.value() == PANEL_POSITION_LEFT or panel_position.value() == PANEL_POSITION_RIGHT) { button_box.set_orientation(Gtk::Orientation::VERTICAL); } else diff --git a/src/panel/widgets/launchers.cpp b/src/panel/widgets/launchers.cpp index e21864b2..d1f72636 100644 --- a/src/panel/widgets/launchers.cpp +++ b/src/panel/widgets/launchers.cpp @@ -165,9 +165,9 @@ void WayfireLaunchers::init(Gtk::Box *container) void WayfireLaunchers::update_layout() { - std::string panel_position = WfOption{"panel/position"}; + WfOption panel_position{"panel/position"}; - if (panel_position == PANEL_POSITION_LEFT or panel_position == PANEL_POSITION_RIGHT) + if (panel_position.value() == PANEL_POSITION_LEFT or panel_position.value() == PANEL_POSITION_RIGHT) { box.set_orientation(Gtk::Orientation::VERTICAL); } else diff --git a/src/panel/widgets/launchers.hpp b/src/panel/widgets/launchers.hpp index e21be582..4a5a5d0d 100644 --- a/src/panel/widgets/launchers.hpp +++ b/src/panel/widgets/launchers.hpp @@ -38,7 +38,6 @@ class WayfireLaunchers : public WayfireWidget virtual void init(Gtk::Box *container); void update_layout(); - virtual void handle_config_reload(); virtual ~WayfireLaunchers() {} diff --git a/src/panel/widgets/menu.cpp b/src/panel/widgets/menu.cpp index b2fe05e3..e2295eda 100644 --- a/src/panel/widgets/menu.cpp +++ b/src/panel/widgets/menu.cpp @@ -199,7 +199,8 @@ static bool fuzzy_match(Glib::ustring text, Glib::ustring pattern) ++j; } else { - /* Try to match current unmatched character in pattern with the next character in text */ + /* Try to match current unmatched character in pattern with the next + * character in text */ ++j; } } @@ -315,7 +316,7 @@ void WayfireMenu::load_menu_item(AppInfo app_info) loaded_apps.insert({name, exec}); /* Check if this has a 'OnlyShownIn' for a different desktop env - * If so, we throw it in a pile at the bottom just to be safe */ + * If so, we throw it in a pile at the bottom just to be safe */ if (!app_info->should_show()) { add_category_app("Hidden", app_info); diff --git a/src/panel/widgets/network.cpp b/src/panel/widgets/network.cpp index 3c2a05fa..56a0f929 100644 --- a/src/panel/widgets/network.cpp +++ b/src/panel/widgets/network.cpp @@ -410,9 +410,9 @@ void WayfireNetworkInfo::init(Gtk::Box *container) void WayfireNetworkInfo::update_layout() { - std::string panel_position = WfOption{"panel/position"}; + WfOption panel_position{"panel/position"}; - if (panel_position == PANEL_POSITION_LEFT or panel_position == PANEL_POSITION_RIGHT) + if (panel_position.value() == PANEL_POSITION_LEFT or panel_position.value() == PANEL_POSITION_RIGHT) { button_content.set_orientation(Gtk::Orientation::VERTICAL); } else diff --git a/src/panel/widgets/network.hpp b/src/panel/widgets/network.hpp index 435a93b0..868b9f33 100644 --- a/src/panel/widgets/network.hpp +++ b/src/panel/widgets/network.hpp @@ -83,7 +83,6 @@ class WayfireNetworkInfo : public WayfireWidget void init(Gtk::Box *container); void update_layout(); - void handle_config_reload(); virtual ~WayfireNetworkInfo(); }; diff --git a/src/panel/widgets/notifications/single-notification.cpp b/src/panel/widgets/notifications/single-notification.cpp index d4853fbb..4e3fd5d5 100644 --- a/src/panel/widgets/notifications/single-notification.cpp +++ b/src/panel/widgets/notifications/single-notification.cpp @@ -68,6 +68,7 @@ WfSingleNotification::WfSingleNotification(const Notification & notification) app_name.add_css_class("app-name"); top_bar.append(app_name); + time_label.set_sensitive(false); time_label.set_label(format_recv_time(notification.additional_info.recv_time)); time_label.add_css_class("time"); diff --git a/src/panel/widgets/separator.cpp b/src/panel/widgets/separator.cpp index 0c0586f4..f5b88295 100644 --- a/src/panel/widgets/separator.cpp +++ b/src/panel/widgets/separator.cpp @@ -17,9 +17,9 @@ void WayfireSeparator::init(Gtk::Box *container) void WayfireSeparator::update_layout() { - std::string panel_position = WfOption{"panel/position"}; + WfOption panel_position{"panel/position"}; - if (panel_position == PANEL_POSITION_LEFT or panel_position == PANEL_POSITION_RIGHT) + if (panel_position.value() == PANEL_POSITION_LEFT or panel_position.value() == PANEL_POSITION_RIGHT) { separator.set_orientation(Gtk::Orientation::VERTICAL); } else diff --git a/src/panel/widgets/tray/item.cpp b/src/panel/widgets/tray/item.cpp index b6e3e823..fae84034 100644 --- a/src/panel/widgets/tray/item.cpp +++ b/src/panel/widgets/tray/item.cpp @@ -9,7 +9,6 @@ #include #include -#include #include static std::pair name_and_obj_path(const Glib::ustring & service) @@ -149,11 +148,6 @@ void StatusNotifierItem::init_widget() } else if (butt == tertiary_click) { item_proxy->call("SecondaryActivate", ev_coords); - } else - { - // Don't claim other buttons - click_gesture->set_state(Gtk::EventSequenceState::DENIED); - return; } return; diff --git a/src/panel/widgets/tray/tray.cpp b/src/panel/widgets/tray/tray.cpp index b6ed495b..b3897114 100644 --- a/src/panel/widgets/tray/tray.cpp +++ b/src/panel/widgets/tray/tray.cpp @@ -1,5 +1,4 @@ #include "tray.hpp" -#include "gtkmm/enums.h" void WayfireStatusNotifier::init(Gtk::Box *container) { @@ -36,9 +35,9 @@ void WayfireStatusNotifier::remove_item(const Glib::ustring & service) void WayfireStatusNotifier::update_layout() { - std::string panel_position = WfOption{"panel/position"}; + WfOption panel_position{"panel/position"}; - if (panel_position == PANEL_POSITION_LEFT or panel_position == PANEL_POSITION_RIGHT) + if (panel_position.value() == PANEL_POSITION_LEFT || panel_position.value() == PANEL_POSITION_RIGHT) { icons_box.set_orientation(Gtk::Orientation::VERTICAL); } else diff --git a/src/panel/widgets/tray/tray.hpp b/src/panel/widgets/tray/tray.hpp index f8fd90e2..a78245ea 100644 --- a/src/panel/widgets/tray/tray.hpp +++ b/src/panel/widgets/tray/tray.hpp @@ -1,7 +1,6 @@ #pragma once #include "item.hpp" -#include "wf-option-wrap.hpp" #include "widgets/tray/host.hpp" #include diff --git a/src/panel/widgets/volume.hpp b/src/panel/widgets/volume.hpp index 4d38f5c2..391bb77d 100644 --- a/src/panel/widgets/volume.hpp +++ b/src/panel/widgets/volume.hpp @@ -1,14 +1,13 @@ #pragma once +#include "../widget.hpp" #include +#include "../../util/animated-scale.hpp" #include #include #include -#include "../widget.hpp" -#include "../../util/animated-scale.hpp" - class WayfireVolume : public WayfireWidget { Gtk::Image main_image; @@ -48,9 +47,8 @@ class WayfireVolume : public WayfireWidget }; /** - * Set the current volume level to volume_level. - * This updates both the popover scale and the real pulseaudio volume, - * depending on the passed flags. + * Set the current volume level to volume_level. This updates both the popover scale and the real + * pulseaudio volume, depending on the passed flags. * * Precondition: volume_level should be between 0 and max_norm */ diff --git a/src/panel/widgets/window-list/window-list.cpp b/src/panel/widgets/window-list/window-list.cpp index c4503e11..8ce61616 100644 --- a/src/panel/widgets/window-list/window-list.cpp +++ b/src/panel/widgets/window-list/window-list.cpp @@ -3,7 +3,6 @@ #include #include "window-list.hpp" -#include "panel.hpp" #define DEFAULT_SIZE_PC 0.1 diff --git a/src/util/wf-option-wrap.hpp b/src/util/wf-option-wrap.hpp index 99130a3f..562a189e 100644 --- a/src/util/wf-option-wrap.hpp +++ b/src/util/wf-option-wrap.hpp @@ -4,7 +4,8 @@ #include "wf-shell-app.hpp" /** - * An implementation of wf::base_option_wrapper_t for wf-shell-app based programs. + * An implementation of wf::base_option_wrapper_t for wf-shell-app based + * programs. */ template class WfOption : public wf::base_option_wrapper_t diff --git a/src/util/wf-shell-app.hpp b/src/util/wf-shell-app.hpp index 9af254f7..cc95c2ba 100644 --- a/src/util/wf-shell-app.hpp +++ b/src/util/wf-shell-app.hpp @@ -30,7 +30,8 @@ struct WayfireOutput /** * A basic shell application. * - * It is suitable for applications that need to show one or more windows per monitor. + * It is suitable for applications that need to show one or more windows + * per monitor. */ class WayfireShellApp { @@ -39,7 +40,8 @@ class WayfireShellApp std::vector> css_rules; protected: - /** This should be initialized by the subclass in each program which uses wf-shell-app */ + /** This should be initialized by the subclass in each program which uses + * wf-shell-app */ static std::unique_ptr instance; std::optional cmdline_config; std::optional cmdline_css; @@ -50,7 +52,8 @@ class WayfireShellApp virtual void add_output(GMonitor monitor); virtual void rem_output(GMonitor monitor); - /* The following functions can be overridden in the shell implementation to handle the events */ + /* The following functions can be overridden in the shell implementation to + * handle the events */ virtual void on_activate(); virtual bool parse_cfgfile(const Glib::ustring & option_name, const Glib::ustring & value, bool has_value); @@ -83,7 +86,8 @@ class WayfireShellApp /** * WayfireShellApp is a singleton class. - * Using this function, any part of the application can get access to the shell app. + * Using this function, any part of the application can get access to the + * shell app. */ static WayfireShellApp& get(); }; From 001697cc46cd0bc66e16000e216bc55c7929a771 Mon Sep 17 00:00:00 2001 From: Hue Date: Wed, 11 Feb 2026 01:55:19 +0100 Subject: [PATCH 26/32] clean up panel --- src/panel/panel.cpp | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/src/panel/panel.cpp b/src/panel/panel.cpp index 61fbc3cc..d6cb9343 100644 --- a/src/panel/panel.cpp +++ b/src/panel/panel.cpp @@ -52,6 +52,9 @@ class WayfirePanel::impl WayfireOutput *output; + WfOption panel_position{"panel/position"}; + WfOption force_center{"panel/force_center"}; + WfOption panel_layer{"panel/layer"}; std::function set_panel_layer = [=] () { @@ -84,9 +87,6 @@ class WayfirePanel::impl right_box.set_orientation(orientation); } - WfOption panel_position{"panel/position"}; - WfOption force_center{"panel/force_center"}; - void update_orientation() { bool is_horizontal = !(panel_position.value() == "left" or panel_position.value() == @@ -96,38 +96,25 @@ class WayfirePanel::impl if (force_center) { + left_box.set_halign(Gtk::Align::CENTER); + right_box.set_halign(Gtk::Align::CENTER); + left_box.set_valign(Gtk::Align::CENTER); + right_box.set_valign(Gtk::Align::CENTER); + if (is_horizontal) { sides_size_group->set_mode(Gtk::SizeGroup::Mode::HORIZONTAL); - left_box.set_halign(Gtk::Align::END); - right_box.set_halign(Gtk::Align::START); - left_box.set_valign(Gtk::Align::CENTER); - right_box.set_valign(Gtk::Align::CENTER); } else { sides_size_group->set_mode(Gtk::SizeGroup::Mode::VERTICAL); - left_box.set_valign(Gtk::Align::END); - right_box.set_valign(Gtk::Align::START); - left_box.set_halign(Gtk::Align::CENTER); - right_box.set_halign(Gtk::Align::CENTER); } } else { - if (is_horizontal) - { - sides_size_group->set_mode(Gtk::SizeGroup::Mode::NONE); - left_box.set_halign(Gtk::Align::START); - right_box.set_halign(Gtk::Align::END); - left_box.set_valign(Gtk::Align::CENTER); - right_box.set_valign(Gtk::Align::CENTER); - } else - { - sides_size_group->set_mode(Gtk::SizeGroup::Mode::NONE); - left_box.set_valign(Gtk::Align::START); - right_box.set_valign(Gtk::Align::END); - left_box.set_halign(Gtk::Align::CENTER); - right_box.set_halign(Gtk::Align::CENTER); - } + sides_size_group->set_mode(Gtk::SizeGroup::Mode::NONE); + left_box.set_halign(Gtk::Align::START); + right_box.set_halign(Gtk::Align::END); + left_box.set_valign(Gtk::Align::CENTER); + right_box.set_valign(Gtk::Align::CENTER); } } @@ -135,7 +122,7 @@ class WayfirePanel::impl { window = std::make_unique(output, "panel"); - window->get_style_context()->add_class("wf-panel"); + window->add_css_class("wf-panel"); panel_layer.set_callback(set_panel_layer); set_panel_layer(); // initial setting From 1e00c12b6656a81026867e4c667ca91029b096c4 Mon Sep 17 00:00:00 2001 From: Hue Date: Wed, 11 Feb 2026 02:03:46 +0100 Subject: [PATCH 27/32] clean up wf-autohide-window + uncrustify --- src/dock/dock.cpp | 12 +++++------- src/panel/widgets/tray/tray.cpp | 4 ++-- src/util/wf-autohide-window.cpp | 17 ++++------------- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/dock/dock.cpp b/src/dock/dock.cpp index 51c61643..1c6ed932 100644 --- a/src/dock/dock.cpp +++ b/src/dock/dock.cpp @@ -60,25 +60,23 @@ class WfDock::impl window->get_surface()->gobj()); } - void update_layout(){ + void update_layout() + { if (position.value() == "bottom") { // this is not great, but we lack better options without doing a // layout with boxes in boxes (ugly) or some sort of custom layout manager box.set_orientation(Gtk::Orientation::HORIZONTAL); box.set_direction(Gtk::TextDirection::LTR); - } - else if (position.value() == "left") + } else if (position.value() == "left") { box.set_orientation(Gtk::Orientation::VERTICAL); box.set_direction(Gtk::TextDirection::LTR); - } - else if (position.value() == "right") + } else if (position.value() == "right") { box.set_orientation(Gtk::Orientation::VERTICAL); box.set_direction(Gtk::TextDirection::RTL); - } - else // top + } else // top { box.set_orientation(Gtk::Orientation::HORIZONTAL); box.set_direction(Gtk::TextDirection::LTR); diff --git a/src/panel/widgets/tray/tray.cpp b/src/panel/widgets/tray/tray.cpp index b3897114..5b5e37ea 100644 --- a/src/panel/widgets/tray/tray.cpp +++ b/src/panel/widgets/tray/tray.cpp @@ -3,7 +3,7 @@ void WayfireStatusNotifier::init(Gtk::Box *container) { icons_box.add_css_class("tray"); - update_layout(); + update_layout(); icons_box.set_halign(Gtk::Align::FILL); icons_box.set_valign(Gtk::Align::FILL); icons_box.set_expand(true); @@ -37,7 +37,7 @@ void WayfireStatusNotifier::update_layout() { WfOption panel_position{"panel/position"}; - if (panel_position.value() == PANEL_POSITION_LEFT || panel_position.value() == PANEL_POSITION_RIGHT) + if ((panel_position.value() == PANEL_POSITION_LEFT) || (panel_position.value() == PANEL_POSITION_RIGHT)) { icons_box.set_orientation(Gtk::Orientation::VERTICAL); } else diff --git a/src/util/wf-autohide-window.cpp b/src/util/wf-autohide-window.cpp index 7731650c..610b8bf4 100644 --- a/src/util/wf-autohide-window.cpp +++ b/src/util/wf-autohide-window.cpp @@ -187,12 +187,11 @@ void WayfireAutohidingWindow::update_position() if (span_full_edge) { - if (anchor == GTK_LAYER_SHELL_EDGE_TOP || anchor == GTK_LAYER_SHELL_EDGE_BOTTOM) + if ((anchor == GTK_LAYER_SHELL_EDGE_TOP) || (anchor == GTK_LAYER_SHELL_EDGE_BOTTOM)) { gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_LEFT, true); gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_RIGHT, true); - } - else if (anchor == GTK_LAYER_SHELL_EDGE_LEFT || anchor == GTK_LAYER_SHELL_EDGE_RIGHT) + } else if ((anchor == GTK_LAYER_SHELL_EDGE_LEFT) || (anchor == GTK_LAYER_SHELL_EDGE_RIGHT)) { gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_TOP, true); gtk_layer_set_anchor(this->gobj(), GTK_LAYER_SHELL_EDGE_BOTTOM, true); @@ -254,19 +253,11 @@ static zwf_hotspot_v2_listener hotspot_listener = { void WayfireAutohidingWindow::setup_hotspot() { - /* No need to recreate hotspots if the height didn't change */ - auto position = check_position(this->position); - int allocated; - if (position == WF_WINDOW_POSITION_LEFT or position == WF_WINDOW_POSITION_RIGHT) - { - allocated = this->get_allocated_width(); - } else - { - allocated = this->get_allocated_height(); - } + int allocated = (this->*get_allocated_height_or_width)(); + /* No need to recreate hotspots if the nothing changed */ if ((allocated == last_hotspot_size) && (edge_offset == last_edge_offset) && (position == last_position)) { return; From eae249c054aabfc99f902677f00c94f34456ba5d Mon Sep 17 00:00:00 2001 From: Hue Date: Wed, 11 Feb 2026 02:11:48 +0100 Subject: [PATCH 28/32] restore differences between h and v align for panel boxes --- src/panel/panel.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/panel/panel.cpp b/src/panel/panel.cpp index d6cb9343..de5dfde4 100644 --- a/src/panel/panel.cpp +++ b/src/panel/panel.cpp @@ -111,10 +111,20 @@ class WayfirePanel::impl } else { sides_size_group->set_mode(Gtk::SizeGroup::Mode::NONE); - left_box.set_halign(Gtk::Align::START); - right_box.set_halign(Gtk::Align::END); - left_box.set_valign(Gtk::Align::CENTER); - right_box.set_valign(Gtk::Align::CENTER); + + if (is_horizontal){ + left_box.set_halign(Gtk::Align::START); + right_box.set_halign(Gtk::Align::END); + left_box.set_valign(Gtk::Align::CENTER); + right_box.set_valign(Gtk::Align::CENTER); + } else + { + left_box.set_valign(Gtk::Align::START); + right_box.set_valign(Gtk::Align::END); + left_box.set_halign(Gtk::Align::CENTER); + right_box.set_halign(Gtk::Align::CENTER); + + } } } From 238109172bfe4d3d4d7a1e03925f8001dbaab038 Mon Sep 17 00:00:00 2001 From: Hue Date: Wed, 11 Feb 2026 12:46:53 +0100 Subject: [PATCH 29/32] fix long formatting, change full_span name, uncrustify --- metadata/dock.xml | 22 ++++++----------- metadata/panel.xml | 42 ++++++++++----------------------- src/panel/panel.cpp | 3 ++- src/util/wf-autohide-window.cpp | 6 ++--- src/util/wf-autohide-window.hpp | 2 +- 5 files changed, 25 insertions(+), 50 deletions(-) diff --git a/metadata/dock.xml b/metadata/dock.xml index 04b77eb1..ca791805 100644 --- a/metadata/dock.xml +++ b/metadata/dock.xml @@ -13,23 +13,17 @@ - - +