mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
settings: more control on panels attachment
This commit is contained in:
@@ -721,13 +721,14 @@
|
||||
"built-in": "Built-in",
|
||||
"clipboard": "Clipboard",
|
||||
"community": "Community",
|
||||
"control-center": "Control Center",
|
||||
"control-center": "Control Center:",
|
||||
"directories": "Directories",
|
||||
"effects": "Effects",
|
||||
"focus-styling": "Focus Styling",
|
||||
"general": "General",
|
||||
"grouping": "Grouping",
|
||||
"interface": "Interface",
|
||||
"launcher": "Launcher",
|
||||
"layout": "Layout",
|
||||
"location": "Location",
|
||||
"media": "Media",
|
||||
@@ -747,6 +748,7 @@
|
||||
"transition": "Transition",
|
||||
"user": "User",
|
||||
"weather": "Weather",
|
||||
"wallpaper": "Wallpaper",
|
||||
"widget-list": "Widget List",
|
||||
"widgets": "Widgets"
|
||||
}
|
||||
@@ -1326,6 +1328,22 @@
|
||||
"overview-shortcuts": {
|
||||
"label": "Overview Shortcuts",
|
||||
"description": "Choose up to six shortcut buttons for the overview tab"
|
||||
},
|
||||
"attach-control-center": {
|
||||
"label": "Attach to Bar",
|
||||
"description": "Attach the Control Center panel to the bar when a suitable bar is available"
|
||||
},
|
||||
"attach-launcher": {
|
||||
"label": "Attach to Bar",
|
||||
"description": "Attach the Launcher panel to the bar when a suitable bar is available"
|
||||
},
|
||||
"attach-clipboard": {
|
||||
"label": "Attach to Bar",
|
||||
"description": "Attach the Clipboard panel to the bar when a suitable bar is available"
|
||||
},
|
||||
"attach-wallpaper": {
|
||||
"label": "Attach to Bar",
|
||||
"description": "Attach the Wallpaper panel to the bar when a suitable bar is available"
|
||||
}
|
||||
},
|
||||
"backdrop": {
|
||||
|
||||
@@ -27,6 +27,13 @@ offset_x = 2
|
||||
offset_y = 2 # positive = down
|
||||
alpha = 0.55 # multiplied by each component's background opacity
|
||||
|
||||
[shell.panel]
|
||||
background_blur = true # request compositor blur behind panels
|
||||
attach_launcher = false # attach launcher to the bar when a suitable bar is available
|
||||
attach_clipboard = false # attach clipboard history to the bar when a suitable bar is available
|
||||
attach_control_center = true # attach Control Center to the bar when a suitable bar is available
|
||||
attach_wallpaper = true # attach wallpaper picker to the bar when a suitable bar is available
|
||||
|
||||
[shell.mpris]
|
||||
blacklist = [] # ignore MPRIS players by bus/identity/desktop entry token
|
||||
|
||||
|
||||
@@ -292,7 +292,10 @@ namespace {
|
||||
a.showLocation == b.showLocation && a.clipboardAutoPaste == b.clipboardAutoPaste &&
|
||||
a.shadow.blur == b.shadow.blur && a.shadow.offsetX == b.shadow.offsetX &&
|
||||
a.shadow.offsetY == b.shadow.offsetY && nearlyEqual(a.shadow.alpha, b.shadow.alpha) &&
|
||||
a.panel.backgroundBlur == b.panel.backgroundBlur && a.screenCorners.enabled == b.screenCorners.enabled &&
|
||||
a.panel.backgroundBlur == b.panel.backgroundBlur && a.panel.attachLauncher == b.panel.attachLauncher &&
|
||||
a.panel.attachClipboard == b.panel.attachClipboard &&
|
||||
a.panel.attachControlCenter == b.panel.attachControlCenter &&
|
||||
a.panel.attachWallpaper == b.panel.attachWallpaper && a.screenCorners.enabled == b.screenCorners.enabled &&
|
||||
a.screenCorners.size == b.screenCorners.size && a.mpris.blacklist == b.mpris.blacklist;
|
||||
}
|
||||
|
||||
|
||||
@@ -1186,6 +1186,18 @@ void ConfigService::parseTableInto(const toml::table& tbl, Config& config, bool
|
||||
if (auto v = (*panelTbl)["background_blur"].value<bool>()) {
|
||||
shell.panel.backgroundBlur = *v;
|
||||
}
|
||||
if (auto v = (*panelTbl)["attach_launcher"].value<bool>()) {
|
||||
shell.panel.attachLauncher = *v;
|
||||
}
|
||||
if (auto v = (*panelTbl)["attach_clipboard"].value<bool>()) {
|
||||
shell.panel.attachClipboard = *v;
|
||||
}
|
||||
if (auto v = (*panelTbl)["attach_control_center"].value<bool>()) {
|
||||
shell.panel.attachControlCenter = *v;
|
||||
}
|
||||
if (auto v = (*panelTbl)["attach_wallpaper"].value<bool>()) {
|
||||
shell.panel.attachWallpaper = *v;
|
||||
}
|
||||
}
|
||||
if (const auto* screenCornersTbl = (*shellTbl)["screen_corners"].as_table()) {
|
||||
if (auto v = (*screenCornersTbl)["enabled"].value<bool>()) {
|
||||
|
||||
@@ -346,6 +346,10 @@ struct ShellConfig {
|
||||
|
||||
struct PanelConfig {
|
||||
bool backgroundBlur = true; // request compositor blur behind panels via ext-background-effect-v1
|
||||
bool attachLauncher = false;
|
||||
bool attachClipboard = false;
|
||||
bool attachControlCenter = true;
|
||||
bool attachWallpaper = true;
|
||||
|
||||
bool operator==(const PanelConfig&) const = default;
|
||||
};
|
||||
|
||||
@@ -364,6 +364,10 @@ ClipboardPanel::ClipboardPanel(ClipboardService* clipboard, ConfigService* confi
|
||||
|
||||
ClipboardPanel::~ClipboardPanel() = default;
|
||||
|
||||
bool ClipboardPanel::prefersAttachedToBar() const noexcept {
|
||||
return m_config != nullptr && m_config->config().shell.panel.attachClipboard;
|
||||
}
|
||||
|
||||
void ClipboardPanel::setActivateCallback(std::function<void(const ClipboardEntry&)> callback) {
|
||||
m_activateCallback = std::move(callback);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
[[nodiscard]] LayerShellLayer layer() const override { return LayerShellLayer::Overlay; }
|
||||
[[nodiscard]] LayerShellKeyboard keyboardMode() const override { return LayerShellKeyboard::Exclusive; }
|
||||
[[nodiscard]] InputArea* initialFocusArea() const override;
|
||||
[[nodiscard]] bool prefersAttachedToBar() const noexcept override;
|
||||
|
||||
private:
|
||||
void doLayout(Renderer& renderer, float width, float height) override;
|
||||
|
||||
@@ -47,6 +47,10 @@ ControlCenterPanel::ControlCenterPanel(
|
||||
m_tabHeaderActions.fill(nullptr);
|
||||
}
|
||||
|
||||
bool ControlCenterPanel::prefersAttachedToBar() const noexcept {
|
||||
return m_config == nullptr || m_config->config().shell.panel.attachControlCenter;
|
||||
}
|
||||
|
||||
bool ControlCenterPanel::dismissTransientUi() {
|
||||
const std::size_t activeIdx = tabIndex(m_activeTab);
|
||||
return m_tabs[activeIdx] != nullptr && m_tabs[activeIdx]->dismissTransientUi();
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
[[nodiscard]] float preferredHeight() const override { return scaled(520.0f); }
|
||||
[[nodiscard]] bool centeredHorizontally() const override { return true; }
|
||||
[[nodiscard]] bool centeredVertically() const override { return true; }
|
||||
[[nodiscard]] bool prefersAttachedToBar() const noexcept override { return true; }
|
||||
[[nodiscard]] bool prefersAttachedToBar() const noexcept override;
|
||||
|
||||
private:
|
||||
void doLayout(Renderer& renderer, float width, float height) override;
|
||||
|
||||
@@ -270,6 +270,10 @@ LauncherPanel::LauncherPanel(ConfigService* config, AsyncTextureCache* asyncText
|
||||
|
||||
LauncherPanel::~LauncherPanel() = default;
|
||||
|
||||
bool LauncherPanel::prefersAttachedToBar() const noexcept {
|
||||
return m_config != nullptr && m_config->config().shell.panel.attachLauncher;
|
||||
}
|
||||
|
||||
void LauncherPanel::addProvider(std::unique_ptr<LauncherProvider> provider) {
|
||||
provider->initialize();
|
||||
m_providers.push_back(std::move(provider));
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
[[nodiscard]] LayerShellLayer layer() const override { return LayerShellLayer::Overlay; }
|
||||
[[nodiscard]] LayerShellKeyboard keyboardMode() const override { return LayerShellKeyboard::Exclusive; }
|
||||
[[nodiscard]] InputArea* initialFocusArea() const override;
|
||||
[[nodiscard]] bool prefersAttachedToBar() const noexcept override;
|
||||
|
||||
private:
|
||||
void doLayout(Renderer& renderer, float width, float height) override;
|
||||
|
||||
@@ -537,6 +537,22 @@ namespace settings {
|
||||
ShortcutListSetting{
|
||||
.items = cfg.controlCenter.shortcuts, .suggestedOptions = controlCenterShortcutOptions(), .maxItems = 6},
|
||||
"quick settings shortcuts toggles wifi bluetooth caffeine night light dnd power media weather clipboard"));
|
||||
entries.push_back(makeEntry("panels", "control-center", tr("settings.schema.panels.attach-control-center.label"),
|
||||
tr("settings.schema.panels.attach-control-center.description"),
|
||||
{"shell", "panel", "attach_control_center"},
|
||||
ToggleSetting{cfg.shell.panel.attachControlCenter}, "attach bar panel"));
|
||||
entries.push_back(makeEntry("panels", "launcher", tr("settings.schema.panels.attach-launcher.label"),
|
||||
tr("settings.schema.panels.attach-launcher.description"),
|
||||
{"shell", "panel", "attach_launcher"}, ToggleSetting{cfg.shell.panel.attachLauncher},
|
||||
"attach bar panel"));
|
||||
entries.push_back(makeEntry("panels", "clipboard", tr("settings.schema.panels.attach-clipboard.label"),
|
||||
tr("settings.schema.panels.attach-clipboard.description"),
|
||||
{"shell", "panel", "attach_clipboard"}, ToggleSetting{cfg.shell.panel.attachClipboard},
|
||||
"attach bar panel"));
|
||||
entries.push_back(makeEntry("panels", "wallpaper", tr("settings.schema.panels.attach-wallpaper.label"),
|
||||
tr("settings.schema.panels.attach-wallpaper.description"),
|
||||
{"shell", "panel", "attach_wallpaper"}, ToggleSetting{cfg.shell.panel.attachWallpaper},
|
||||
"attach bar panel"));
|
||||
|
||||
// Desktop
|
||||
entries.push_back(makeEntry("desktop", "widgets", tr("settings.schema.desktop.widgets.label"),
|
||||
|
||||
@@ -119,6 +119,10 @@ WallpaperPanel::WallpaperPanel(WaylandConnection* wayland, ConfigService* config
|
||||
|
||||
WallpaperPanel::~WallpaperPanel() = default;
|
||||
|
||||
bool WallpaperPanel::prefersAttachedToBar() const noexcept {
|
||||
return m_config == nullptr || m_config->config().shell.panel.attachWallpaper;
|
||||
}
|
||||
|
||||
void WallpaperPanel::create() {
|
||||
const float scale = contentScale();
|
||||
const auto configureIconButton = [scale](Button* button) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
[[nodiscard]] float preferredHeight() const override { return scaled(700.0f); }
|
||||
[[nodiscard]] bool centeredHorizontally() const override { return true; }
|
||||
[[nodiscard]] bool centeredVertically() const override { return true; }
|
||||
[[nodiscard]] bool prefersAttachedToBar() const noexcept override { return true; }
|
||||
[[nodiscard]] bool prefersAttachedToBar() const noexcept override;
|
||||
[[nodiscard]] LayerShellLayer layer() const override { return LayerShellLayer::Overlay; }
|
||||
[[nodiscard]] LayerShellKeyboard keyboardMode() const override { return LayerShellKeyboard::Exclusive; }
|
||||
[[nodiscard]] InputArea* initialFocusArea() const override;
|
||||
|
||||
Reference in New Issue
Block a user