Skip to content
Open
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
39 changes: 34 additions & 5 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,8 @@
"wallpaper": "Wallpaper",
"weather": "Weather",
"widget-list": "Widget List",
"widgets": "Widgets"
"widgets": "Widgets",
"workspace-tray": "Workspace Tray"
},
"sections": {
"appearance": "Appearance",
Expand Down Expand Up @@ -2094,6 +2095,10 @@
"description": "Position the session menu panel near the bar click instead of centering it along the bar",
"label": "Open Near Click"
},
"open-near-click-workspace-tray": {
"description": "Position the workspace tray panel near the bar click instead of centering it along the bar",
"label": "Open Near Click"
},
"open-near-click-wallpaper": {
"description": "Position the wallpaper picker panel near the bar click instead of centering it along the bar",
"label": "Open Near Click"
Expand All @@ -2118,6 +2123,10 @@
"description": "Choose whether the session menu attaches to the bar or floats at a chosen screen position",
"label": "Placement"
},
"placement-workspace-tray": {
"description": "Choose whether the workspace tray attaches to the bar, floats near it, or opens centered",
"label": "Placement"
},
"placement-wallpaper": {
"description": "Choose whether the wallpaper picker attaches to the bar or floats at a chosen screen position",
"label": "Placement"
Expand Down Expand Up @@ -2924,7 +2933,8 @@
"description": "Only highlight the active workspace on the focused monitor",
"label": "Highlight Focused Monitor Only",
"taskbar-description": "Only use the focused color for the active workspace on the monitor that has keyboard or pointer focus; other monitors use the occupied color",
"workspaces-description": "Only highlight the active workspace on the monitor that has keyboard or pointer focus; other monitors show their active workspace as occupied instead"
"workspaces-description": "Only highlight the active workspace on the monitor that has keyboard or pointer focus; other monitors show their active workspace as occupied instead",
"workspace-tray-description": "Only use the focused color on the monitor that has keyboard or pointer focus; other monitors use the occupied color"
},
"font-family": {
"description": "Typeface for this widget; leave empty to inherit the bar font",
Expand Down Expand Up @@ -2975,7 +2985,8 @@
"hide-when-empty": {
"description": "Hide workspace pills when there are no open windows",
"label": "Hide When Empty",
"workspaces-description": "Hide workspace pills that have no open windows"
"workspaces-description": "Hide workspace pills that have no open windows",
"workspace-tray-description": "Hide the widget when all workspaces on this monitor are empty"
},
"hide-when-full": {
"description": "Hide the battery widget when fully charged",
Expand Down Expand Up @@ -3066,7 +3077,8 @@
"max-label-chars": {
"description": "Maximum number of characters to show for workspace names",
"label": "Max Label Characters",
"workspaces-description": "Maximum characters for workspace name labels"
"workspaces-description": "Maximum characters for workspace name labels",
"workspace-tray-description": "Maximum characters for the workspace name shown on the bar pill"
},
"max-length": {
"description": "Maximum widget length in pixels",
Expand Down Expand Up @@ -3117,6 +3129,14 @@
"description": "Hide windows on inactive workspaces.",
"label": "Only Active Workspace"
},
"new-workspace-command": {
"description": "Shell command run when the new workspace button is clicked",
"label": "New Workspace Command"
},
"new-workspace-glyph": {
"description": "Icon shown on the new workspace button",
"label": "New Workspace Icon"
},
"path": {
"description": "Path used by disk statistics",
"label": "Path"
Expand Down Expand Up @@ -3178,6 +3198,10 @@
"description": "Show weather condition text",
"label": "Show Condition"
},
"show-chevron": {
"description": "Show a dropdown arrow next to the workspace label",
"label": "Show Chevron"
},
"show-empty-label": {
"description": "Show placeholder text when no window is focused instead of hiding the widget",
"label": "Show Empty Label"
Expand All @@ -3194,6 +3218,10 @@
"description": "Show Num Lock state",
"label": "Show Num Lock"
},
"show-new-workspace": {
"description": "Show a button at the bottom of the workspace list to create a new workspace",
"label": "Show New Workspace Button"
},
"show-scroll-lock": {
"description": "Show Scroll Lock state",
"label": "Show Scroll Lock"
Expand Down Expand Up @@ -3296,7 +3324,8 @@
"volume": "Volume",
"wallpaper": "Wallpaper",
"weather": "Weather",
"workspaces": "Workspaces"
"workspaces": "Workspaces",
"workspace-tray": "Workspace Tray"
}
},
"window": {
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,8 @@ _noctalia_sources = files(
'src/shell/bar/widgets/wallpaper_widget.cpp',
'src/shell/bar/widgets/weather_widget.cpp',
'src/shell/bar/widgets/workspaces_widget.cpp',
'src/shell/bar/widgets/workspace_tray_widget.cpp',
'src/shell/workspace_tray/workspace_tray_panel.cpp',
'src/system/dependency_service.cpp',
'src/system/desktop_entry.cpp',
'src/system/desktop_entry_launch.cpp',
Expand Down
4 changes: 4 additions & 0 deletions src/app/application_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
#include "shell/tray/tray_drawer_panel.h"
#include "shell/wallpaper/panel/wallpaper_panel.h"
#include "shell/wallpaper/wallpaper_paths.h"
#include "shell/workspace_tray/workspace_tray_panel.h"
#include "system/brightness_poll_source.h"
#include "system/brightness_service.h"
#include "system/distro_info.h"
Expand Down Expand Up @@ -632,6 +633,9 @@ void Application::initPanelManagerAndPanels() {
return m_polkitAgent.get();
}));
m_panelManager.registerPanel("setup-wizard", std::make_unique<SetupWizardPanel>(&m_configService, &m_wayland));
m_panelManager.registerPanel(
"workspace-tray", std::make_unique<WorkspaceTrayPanel>(&m_compositorPlatform, &m_configService)
);

if (SetupWizardPanel::isFirstRun(m_configService)) {
DeferredCall::callLater([]() { PanelManager::instance().togglePanel("setup-wizard"); });
Expand Down
3 changes: 3 additions & 0 deletions src/config/config_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ struct ShellConfig {
PanelPlacement wallpaperPlacement = PanelPlacement::Attached;
PanelPlacement sessionPlacement = PanelPlacement::Attached;
PanelPlacement polkitPlacement = PanelPlacement::Floating;
PanelPlacement workspaceTrayPlacement = PanelPlacement::Attached;
// Floating screen position per panel (one of kPanelPositions). "auto" = bar-relative.
// Launcher/clipboard default to "center" (the historical centered placement).
std::string launcherPosition = "center";
Expand All @@ -858,12 +859,14 @@ struct ShellConfig {
std::string wallpaperPosition = "auto";
std::string sessionPosition = "auto";
std::string polkitPosition = "center";
std::string workspaceTrayPosition = "auto";
std::int32_t floatingOffset = 8; // logical px gap between a floating/detached panel and the bar edge
bool openNearClickControlCenter = false;
bool openNearClickLauncher = false;
bool openNearClickClipboard = false;
bool openNearClickWallpaper = false;
bool openNearClickSession = false;
bool openNearClickWorkspaceTray = false;

bool operator==(const PanelConfig&) const = default;
};
Expand Down
3 changes: 3 additions & 0 deletions src/config/schema/config_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,18 +1194,21 @@ namespace noctalia::config::schema {
enumField(&ShellConfig::PanelConfig::wallpaperPlacement, "wallpaper_placement", kPanelPlacements),
enumField(&ShellConfig::PanelConfig::sessionPlacement, "session_placement", kPanelPlacements),
enumField(&ShellConfig::PanelConfig::polkitPlacement, "polkit_placement", kPanelPlacements),
enumField(&ShellConfig::PanelConfig::workspaceTrayPlacement, "workspace_tray_placement", kPanelPlacements),
field(&ShellConfig::PanelConfig::launcherPosition, "launcher_position"),
field(&ShellConfig::PanelConfig::clipboardPosition, "clipboard_position"),
field(&ShellConfig::PanelConfig::controlCenterPosition, "control_center_position"),
field(&ShellConfig::PanelConfig::wallpaperPosition, "wallpaper_position"),
field(&ShellConfig::PanelConfig::sessionPosition, "session_position"),
field(&ShellConfig::PanelConfig::polkitPosition, "polkit_position"),
field(&ShellConfig::PanelConfig::workspaceTrayPosition, "workspace_tray_position"),
field(&ShellConfig::PanelConfig::floatingOffset, "floating_offset", Range<std::int64_t>{0, 100}),
field(&ShellConfig::PanelConfig::openNearClickControlCenter, "open_near_click_control_center"),
field(&ShellConfig::PanelConfig::openNearClickLauncher, "open_near_click_launcher"),
field(&ShellConfig::PanelConfig::openNearClickClipboard, "open_near_click_clipboard"),
field(&ShellConfig::PanelConfig::openNearClickWallpaper, "open_near_click_wallpaper"),
field(&ShellConfig::PanelConfig::openNearClickSession, "open_near_click_session"),
field(&ShellConfig::PanelConfig::openNearClickWorkspaceTray, "open_near_click_workspace_tray"),
};
return s;
}
Expand Down
30 changes: 30 additions & 0 deletions src/shell/bar/widget_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "shell/bar/widgets/volume_widget.h"
#include "shell/bar/widgets/wallpaper_widget.h"
#include "shell/bar/widgets/weather_widget.h"
#include "shell/bar/widgets/workspace_tray_widget.h"
#include "shell/bar/widgets/workspaces_widget.h"
#include "system/format_units.h"
#include "ui/style.h"
Expand Down Expand Up @@ -679,6 +680,35 @@ std::unique_ptr<Widget> WidgetFactory::create(
return widget;
}

if (type == "workspace_tray") {
const std::string display = wc != nullptr ? wc->getString("display", "id") : std::string("id");
const ColorSpec focusedColor = wc != nullptr
? wc->getColorSpec("focused_color", colorSpecFromRole(ColorRole::Primary), "widget." + name + ".focused_color")
: colorSpecFromRole(ColorRole::Primary);
const ColorSpec occupiedColor = wc != nullptr
? wc->getColorSpec(
"occupied_color", colorSpecFromRole(ColorRole::Secondary), "widget." + name + ".occupied_color"
)
: colorSpecFromRole(ColorRole::Secondary);
WorkspaceTrayWidget::DisplayMode displayMode = WorkspaceTrayWidget::DisplayMode::Id;
if (display == "name") {
displayMode = WorkspaceTrayWidget::DisplayMode::Name;
}
std::size_t maxLabelChars = 3;
if (wc != nullptr && wc->hasSetting("max_label_chars")) {
maxLabelChars = static_cast<std::size_t>(wc->getInt("max_label_chars", 3));
}
const bool showChevron = wc != nullptr ? wc->getBool("show_chevron", true) : true;
const bool focusedOnly = wc != nullptr ? wc->getBool("focused_only", false) : false;
const bool hideWhenEmpty = wc != nullptr ? wc->getBool("hide_when_empty", false) : false;
auto widget = std::make_unique<WorkspaceTrayWidget>(
m_platform, output, displayMode, maxLabelChars, focusedColor, occupiedColor, showChevron, focusedOnly,
hideWhenEmpty
);
widget->setContentScale(contentScale);
return widget;
}

#ifndef NDEBUG
if (type == "debug_indicator") {
auto widget = std::make_unique<DebugIndicatorWidget>();
Expand Down
Loading
Loading