From 9890e69c4f3191b06d671e4a44f3cf1a43a5560b Mon Sep 17 00:00:00 2001 From: Hue Date: Tue, 10 Mar 2026 14:58:44 +0100 Subject: [PATCH 1/8] =?UTF-8?q?utils=C2=A0:=20icons=C2=A0:=20introduce=20m?= =?UTF-8?q?ultiple=20icon=20possibilities=20with=20priorities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/icon-select.cpp | 20 ++++++++++++++++++-- src/util/icon-select.hpp | 20 ++++++++++++-------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/util/icon-select.cpp b/src/util/icon-select.cpp index 678354a6..5308ec37 100644 --- a/src/util/icon-select.cpp +++ b/src/util/icon-select.cpp @@ -1,12 +1,28 @@ +#include +#include + #include "icon-select.hpp" -std::string icon_from_range(std::map icons, double value) +std::string icon_from_range(std::map> icons, double value) { + for (auto pair : icons) { if (value <= pair.first) { - return pair.second; + auto theme = Gtk::IconTheme::get_for_display(Gdk::Display::get_default()); + if (!theme) + { // let’s stick to standard icons in this case + return *pair.second.end(); + } + + for (auto name : pair.second) + { + if (theme->has_icon(name)) + { + return name; + } + } } } diff --git a/src/util/icon-select.hpp b/src/util/icon-select.hpp index 88f46f91..6473f8ce 100644 --- a/src/util/icon-select.hpp +++ b/src/util/icon-select.hpp @@ -1,17 +1,21 @@ #include +#include #include #include -std::string icon_from_range(std::map icons, double value); +std::string icon_from_range(std::map> icons, double value); // the number in the first term is the maximal value at which this icon will be shown // selection values of the tables are expected to be ordered from least to greatest +// the vector of icons is the different possibilites of icons to show, +// with the prefered one as the first. This is to be able to use non-standard icons +// if they are present in the current theme, and fall back to a standard one if not. -const std::map volume_icons = { - {std::numeric_limits::min(), "emblem-unreadable"}, - {0.0, "audio-volume-muted"}, - {0.33, "audio-volume-low"}, - {0.66, "audio-volume-medium"}, - {1.0, "audio-volume-high"}, - {std::numeric_limits::max(), "dialog-warning"} +const std::map> volume_icons = { + {std::numeric_limits::min(), {"emblem-unreadable"}}, + {0.0, {"audio-volume-muted"}}, + {0.33, {"audio-volume-low"}}, + {0.66, {"audio-volume-medium"}}, + {1.0, {"audio-volume-high"}}, + {std::numeric_limits::max(), {"audio-volume-high-danger", "dialog-warning"}} }; From 8fadf3d7f10637915cf8df6c2e13eafe7baf152e Mon Sep 17 00:00:00 2001 From: Hue Date: Sun, 1 Mar 2026 16:42:37 +0100 Subject: [PATCH 2/8] Added options for panel/dock positions and finer autohide configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adjusted the naming of a few options in adequation with new features - Added options to control the delay before doing the showing/hiding animations - Added options to place the panel and dock on the left and right edges of the screen - Added minimal width option - Added option to force spanning the full edge - Option to force the panel to be centered by the middle box instead of the total width. This will lead to more spaced out elements in the side that takes less space For the panel, most widgets have a layout adaptation for the vertical panel. Exceptions are network and window-list, because i couldn’t figure out a clean or good way to do it are. Textual widgets (clock, command-output and arguably both of the previously mentionned unchanged) don’t have special adaptations, the formatting for the text they output should be adapted to account for it. Maybe it would be a good idea to add examples to the default config file/wiki. Breaking stuff : - dock/dock_height is replaced by dock/minimal_height Adresses #259 --- metadata/dock.xml | 36 ++++++- metadata/panel.xml | 54 ++++++++-- src/dock/dock.cpp | 46 ++++++--- src/dock/dock.hpp | 3 +- src/panel/panel.cpp | 98 +++++++++++++++---- src/panel/widget.hpp | 4 +- src/panel/widgets/battery.cpp | 20 ++++ src/panel/widgets/battery.hpp | 3 + src/panel/widgets/launchers.cpp | 20 ++++ src/panel/widgets/launchers.hpp | 4 + src/panel/widgets/network.cpp | 19 +++- src/panel/widgets/network.hpp | 2 + src/panel/widgets/separator.cpp | 20 ++++ src/panel/widgets/separator.hpp | 4 + src/panel/widgets/tray/tray.cpp | 10 ++ src/panel/widgets/volume.hpp | 3 +- src/panel/widgets/workspace-switcher.cpp | 79 ++++++++++----- src/panel/widgets/workspace-switcher.hpp | 10 +- src/util/wf-autohide-window.cpp | 119 ++++++++++++++++++----- src/util/wf-autohide-window.hpp | 39 +++++--- src/util/wf-popover.cpp | 16 ++- src/util/wf-shell-app.hpp | 3 +- wf-shell.ini.example | 9 +- 23 files changed, 495 insertions(+), 126 deletions(-) diff --git a/metadata/dock.xml b/metadata/dock.xml index 7343d75f..c7ee25bc 100644 --- a/metadata/dock.xml +++ b/metadata/dock.xml @@ -12,9 +12,20 @@ true + + + + - + + + + + @@ -196,7 +234,7 @@ - - + - + + +