mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
ui(widgets): replace active indicator in grouped taskbar with a much more visible dot
This commit is contained in:
@@ -869,10 +869,6 @@
|
||||
"text": "Text"
|
||||
},
|
||||
"settings": {
|
||||
"active_indicator_width": {
|
||||
"label": "Active Indicator Width",
|
||||
"description": "Width of the active-task underline in pixels; set to 0 to hide"
|
||||
},
|
||||
"anchor": {
|
||||
"label": "Anchor",
|
||||
"description": "Pin this widget as the center alignment anchor"
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
|
||||
namespace {
|
||||
constexpr Logger kLog("shell");
|
||||
constexpr double kTaskbarActiveIndicatorWidthMax = 15.0;
|
||||
|
||||
std::string resolveDistroLogo(IconResolver& iconResolver) {
|
||||
if (const auto info = DistroDetector::detect(); info.has_value()) {
|
||||
@@ -327,10 +326,7 @@ std::unique_ptr<Widget> WidgetFactory::create(const std::string& name, wl_output
|
||||
|
||||
if (type == "taskbar") {
|
||||
const bool groupByWorkspace = wc != nullptr ? wc->getBool("group_by_workspace", false) : false;
|
||||
const double rawWidth = wc != nullptr ? wc->getDouble("active_indicator_width", 14.0) : 14.0;
|
||||
const float activeIndicatorWidth = static_cast<float>(std::clamp(rawWidth, 0.0, kTaskbarActiveIndicatorWidthMax));
|
||||
auto widget =
|
||||
std::make_unique<TaskbarWidget>(m_wayland, output, groupByWorkspace, barPosition, activeIndicatorWidth);
|
||||
auto widget = std::make_unique<TaskbarWidget>(m_wayland, output, groupByWorkspace, barPosition);
|
||||
widget->setContentScale(contentScale);
|
||||
return widget;
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
#include <wayland-client-protocol.h>
|
||||
|
||||
TaskbarWidget::TaskbarWidget(WaylandConnection& connection, wl_output* output, bool groupByWorkspace,
|
||||
std::string barPosition, float activeIndicatorWidth)
|
||||
std::string barPosition)
|
||||
: m_connection(connection), m_output(output), m_groupByWorkspace(groupByWorkspace),
|
||||
m_activeIndicatorWidth(activeIndicatorWidth), m_barPosition(std::move(barPosition)) {
|
||||
m_barPosition(std::move(barPosition)) {
|
||||
buildDesktopIconIndex();
|
||||
}
|
||||
|
||||
@@ -194,14 +194,14 @@ void TaskbarWidget::buildTaskButtons(Renderer& renderer) {
|
||||
area->addChild(std::move(glyph));
|
||||
}
|
||||
|
||||
const float lineWidth = m_activeIndicatorWidth * m_contentScale;
|
||||
if (task.active && lineWidth > 0.0f) {
|
||||
const float lineThickness = std::max(1.0f, Style::spaceXs * 0.25f * m_contentScale);
|
||||
if (task.active) {
|
||||
const float d = std::max(4.0f, std::round(Style::barGlyphSize * 0.32f * m_contentScale));
|
||||
const float bottomInset = 0.25f * m_contentScale;
|
||||
auto indicator = std::make_unique<Box>();
|
||||
indicator->setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
indicator->setRadius(lineThickness * 0.5f);
|
||||
indicator->setFrameSize(lineWidth, lineThickness);
|
||||
indicator->setPosition(std::round((tileSize - lineWidth) * 0.5f), std::round(tileSize - lineThickness));
|
||||
indicator->setRadius(d * 0.5f);
|
||||
indicator->setFrameSize(d, d);
|
||||
indicator->setPosition(std::round((tileSize - d) * 0.5f), std::round(tileSize - d - bottomInset));
|
||||
area->addChild(std::move(indicator));
|
||||
}
|
||||
return area;
|
||||
|
||||
@@ -20,8 +20,7 @@ struct PointerEvent;
|
||||
|
||||
class TaskbarWidget : public Widget {
|
||||
public:
|
||||
TaskbarWidget(WaylandConnection& connection, wl_output* output, bool groupByWorkspace, std::string barPosition,
|
||||
float activeIndicatorWidth);
|
||||
TaskbarWidget(WaylandConnection& connection, wl_output* output, bool groupByWorkspace, std::string barPosition);
|
||||
~TaskbarWidget() override;
|
||||
|
||||
void create() override;
|
||||
@@ -75,7 +74,6 @@ private:
|
||||
WaylandConnection& m_connection;
|
||||
wl_output* m_output = nullptr;
|
||||
bool m_groupByWorkspace = false;
|
||||
float m_activeIndicatorWidth = 0.0f;
|
||||
std::string m_barPosition;
|
||||
bool m_rebuildPending = true;
|
||||
bool m_vertical = false;
|
||||
|
||||
@@ -473,7 +473,6 @@ namespace settings {
|
||||
add(segmentedSpec("display", "gauge", sysmonDisplay));
|
||||
add(boolSpec("show_label", true));
|
||||
} else if (type == "taskbar") {
|
||||
add(doubleSpec("active_indicator_width", 14.0, 0.0, 15.0, 1.0));
|
||||
add(boolSpec("group_by_workspace", false));
|
||||
} else if (type == "tray") {
|
||||
add(stringListSpec("hidden"));
|
||||
|
||||
Reference in New Issue
Block a user