mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
SettingsWindow: add snap to bar toggle
This commit is contained in:
@@ -24,6 +24,7 @@ Item {
|
||||
property color panelBackgroundColor: Color.mSurface
|
||||
property color panelBorderColor: Color.mOutline
|
||||
property var buttonItem: null
|
||||
property bool forceAttachToBar: false
|
||||
|
||||
// Anchoring properties
|
||||
property bool panelAnchorHorizontalCenter: false
|
||||
@@ -546,9 +547,9 @@ Item {
|
||||
anchors.fill: parent
|
||||
|
||||
// Screen-dependent attachment properties
|
||||
readonly property bool couldAttach: Settings.data.ui.panelsAttachedToBar
|
||||
readonly property bool couldAttach: Settings.data.ui.panelsAttachedToBar || root.forceAttachToBar
|
||||
readonly property bool couldAttachToBar: {
|
||||
if (!Settings.data.ui.panelsAttachedToBar || Settings.data.bar.backgroundOpacity < 1.0) {
|
||||
if (!(Settings.data.ui.panelsAttachedToBar || root.forceAttachToBar) || Settings.data.bar.backgroundOpacity < 1.0) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,23 @@ SmartPanel {
|
||||
|
||||
preferredWidth: 820 * Style.uiScaleRatio
|
||||
preferredHeight: 900 * Style.uiScaleRatio
|
||||
readonly property bool attachToBar: Settings.data.ui.settingsPanelAttachToBar
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
|
||||
panelAnchorHorizontalCenter: true
|
||||
panelAnchorVerticalCenter: true
|
||||
forceAttachToBar: attachToBar
|
||||
|
||||
panelAnchorHorizontalCenter: attachToBar ? (barPosition === "top" || barPosition === "bottom") : true
|
||||
panelAnchorVerticalCenter: attachToBar ? (barPosition === "left" || barPosition === "right") : true
|
||||
panelAnchorTop: attachToBar && barPosition === "top"
|
||||
panelAnchorBottom: attachToBar && barPosition === "bottom"
|
||||
panelAnchorLeft: attachToBar && barPosition === "left"
|
||||
panelAnchorRight: attachToBar && barPosition === "right"
|
||||
|
||||
onAttachToBarChanged: {
|
||||
if (isPanelOpen) {
|
||||
Qt.callLater(root.setPosition)
|
||||
}
|
||||
}
|
||||
|
||||
// Tabs enumeration, order is NOT relevant
|
||||
enum Tab {
|
||||
|
||||
@@ -40,6 +40,14 @@ ColumnLayout {
|
||||
onToggled: checked => Settings.data.ui.panelsAttachedToBar = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("settings.user-interface.settings-panel-attached-to-bar.label")
|
||||
description: I18n.tr("settings.user-interface.settings-panel-attached-to-bar.description")
|
||||
checked: Settings.data.ui.settingsPanelAttachToBar
|
||||
enabled: Settings.data.ui.panelsAttachedToBar
|
||||
onToggled: checked => Settings.data.ui.settingsPanelAttachToBar = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("settings.user-interface.shadows.label")
|
||||
description: I18n.tr("settings.user-interface.shadows.description")
|
||||
|
||||
Reference in New Issue
Block a user