Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/shell/bar/widget_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ std::unique_ptr<Widget> WidgetFactory::create(
displayMode = SysmonDisplayMode::Text;
else if (display == "graph")
displayMode = SysmonDisplayMode::Graph;
else if (display == "none")
displayMode = SysmonDisplayMode::None;
if (verticalBar && displayMode == SysmonDisplayMode::Graph) {
displayMode = SysmonDisplayMode::Gauge;
}
Expand Down
3 changes: 2 additions & 1 deletion src/shell/bar/widgets/sysmon_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ namespace {

SysmonWidget::SysmonWidget(SystemMonitorService* monitor, ConfigService& configService, SysmonWidgetOptions options)
: m_monitor(monitor), m_stat(options.stat), m_displayMode(options.displayMode),
m_highlightColor(options.highlightColor), m_configService(configService), m_showLabel(options.showLabel),
m_highlightColor(options.highlightColor), m_configService(configService),
m_showLabel(options.showLabel && options.displayMode != SysmonDisplayMode::None),
m_labelMinWidth(options.labelMinWidth), m_diskPath(std::move(options.diskPath)),
m_networkInterface(std::move(options.networkInterface)), m_networkSpeedUnit(options.networkSpeedUnit),
m_networkSpeedLabelStyle(options.networkSpeedLabelStyle), m_glyphOverride(std::move(options.glyph)),
Expand Down
2 changes: 1 addition & 1 deletion src/shell/bar/widgets/sysmon_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ enum class SysmonStat {
NetRx,
NetTx
};
enum class SysmonDisplayMode { Text, Graph, Gauge };
enum class SysmonDisplayMode { Text, Graph, Gauge, None };

struct SysmonWidgetOptions {
SysmonStat stat = SysmonStat::CpuUsage;
Expand Down
18 changes: 14 additions & 4 deletions src/shell/settings/widget_settings_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ namespace settings {
{"gauge", "settings.widgets.options.gauge"},
{"graph", "settings.widgets.options.graph"},
{"text", "settings.widgets.options.text"},
{"none", "settings.widgets.options.none"},
};
const std::vector<WidgetSettingSelectOption> networkSpeedUnits = {
{"auto", "settings.widgets.options.auto"},
Expand Down Expand Up @@ -917,11 +918,20 @@ namespace settings {
}
add(segmentedSpec("display", "gauge", sysmonDisplay));
add(colorSpec("highlight_color", "error"));
add(boolSpec("show_label", true));
{
auto minW = intSpec("label_min_width", 0, 0.0, 200.0, 1.0);
minW.visibleWhen = WidgetSettingVisibility{"show_label", {"true"}};
add(std::move(minW));
auto showLabel = boolSpec("show_label", true);
showLabel.visibleWhen = WidgetSettingVisibility{"display", {"gauge", "graph", "text"}};
add(std::move(showLabel));
}
{
auto minWidth = intSpec("label_min_width", 0, 0.0, 200.0, 1.0);
WidgetSettingVisibility minWidthSettings;
minWidthSettings.all = {
WidgetSettingVisibilityCondition{"display", {"gauge", "graph", "text"}},
WidgetSettingVisibilityCondition{"show_label", {"true"}},
};
minWidth.visibleWhen = minWidthSettings;
add(std::move(minWidth));
}
} else if (type == "power_profile") {
add(boolSpec("enable_scroll", true));
Expand Down
Loading