mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
top bar manual show/hide
This commit is contained in:
@@ -83,6 +83,7 @@ Singleton {
|
||||
property real cornerRadius: 12
|
||||
property bool notificationOverlayEnabled: false
|
||||
property bool topBarAutoHide: false
|
||||
property bool topBarVisible: true
|
||||
property real topBarSpacing: 4
|
||||
property real topBarInnerPadding: 8
|
||||
property bool topBarSquareCorners: false
|
||||
@@ -267,6 +268,8 @@ Singleton {
|
||||
!== undefined ? settings.notificationOverlayEnabled : false
|
||||
topBarAutoHide = settings.topBarAutoHide
|
||||
!== undefined ? settings.topBarAutoHide : false
|
||||
topBarVisible = settings.topBarVisible
|
||||
!== undefined ? settings.topBarVisible : true
|
||||
notificationTimeoutLow = settings.notificationTimeoutLow
|
||||
!== undefined ? settings.notificationTimeoutLow : 5000
|
||||
notificationTimeoutNormal = settings.notificationTimeoutNormal
|
||||
@@ -356,6 +359,7 @@ Singleton {
|
||||
"cornerRadius": cornerRadius,
|
||||
"notificationOverlayEnabled": notificationOverlayEnabled,
|
||||
"topBarAutoHide": topBarAutoHide,
|
||||
"topBarVisible": topBarVisible,
|
||||
"topBarSpacing": topBarSpacing,
|
||||
"topBarInnerPadding": topBarInnerPadding,
|
||||
"topBarSquareCorners": topBarSquareCorners,
|
||||
@@ -858,6 +862,16 @@ Singleton {
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setTopBarVisible(visible) {
|
||||
topBarVisible = visible
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function toggleTopBarVisible() {
|
||||
topBarVisible = !topBarVisible
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setNotificationTimeoutLow(timeout) {
|
||||
notificationTimeoutLow = timeout
|
||||
saveSettings()
|
||||
@@ -1010,4 +1024,27 @@ Singleton {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function show() {
|
||||
root.setTopBarVisible(true)
|
||||
return "BAR_SHOW_SUCCESS"
|
||||
}
|
||||
|
||||
function hide() {
|
||||
root.setTopBarVisible(false)
|
||||
return "BAR_HIDE_SUCCESS"
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
root.toggleTopBarVisible()
|
||||
return topBarVisible ? "BAR_SHOW_SUCCESS" : "BAR_HIDE_SUCCESS"
|
||||
}
|
||||
|
||||
function status() {
|
||||
return topBarVisible ? "visible" : "hidden"
|
||||
}
|
||||
|
||||
target: "bar"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,6 +554,71 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Manual Visibility Toggle
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: topBarVisibilitySection.implicitHeight + Theme.spacingL * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
|
||||
Theme.surfaceVariant.b, 0.3)
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
||||
Theme.outline.b, 0.2)
|
||||
border.width: 1
|
||||
|
||||
Column {
|
||||
id: topBarVisibilitySection
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingL
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
DankIcon {
|
||||
name: "visibility"
|
||||
size: Theme.iconSize
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width - Theme.iconSize - Theme.spacingM
|
||||
- visibilityToggle.width - Theme.spacingM
|
||||
spacing: Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
StyledText {
|
||||
text: "Manual Show/Hide"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Toggle top bar visibility manually (can be controlled via IPC)"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
id: visibilityToggle
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: SettingsData.topBarVisible
|
||||
onToggled: toggled => {
|
||||
return SettingsData.setTopBarVisible(
|
||||
toggled)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Spacing
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
|
||||
@@ -22,7 +22,7 @@ PanelWindow {
|
||||
property real backgroundTransparency: SettingsData.topBarTransparency
|
||||
readonly property int notificationCount: NotificationService.notifications.length
|
||||
property bool autoHide: SettingsData.topBarAutoHide
|
||||
property bool reveal: !autoHide || topBarMouseArea.containsMouse
|
||||
property bool reveal: SettingsData.topBarVisible && (!autoHide || topBarMouseArea.containsMouse)
|
||||
readonly property real effectiveBarHeight: Math.max(root.widgetHeight + SettingsData.topBarInnerPadding + 4, Theme.barHeight - 4 - (8 - SettingsData.topBarInnerPadding))
|
||||
readonly property real widgetHeight: Math.max(20, 26 + SettingsData.topBarInnerPadding * 0.6)
|
||||
|
||||
@@ -155,7 +155,7 @@ PanelWindow {
|
||||
right: true
|
||||
}
|
||||
|
||||
exclusiveZone: autoHide ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing - 2
|
||||
exclusiveZone: !SettingsData.topBarVisible || autoHide ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing - 2
|
||||
|
||||
mask: Region {
|
||||
item: topBarMouseArea
|
||||
|
||||
29
docs/IPC.md
29
docs/IPC.md
@@ -258,6 +258,35 @@ qs -c dms ipc call theme toggle
|
||||
qs -c dms ipc call theme dark
|
||||
```
|
||||
|
||||
## Target: `bar`
|
||||
|
||||
Top bar visibility control.
|
||||
|
||||
### Functions
|
||||
|
||||
**`show`**
|
||||
- Show the top bar
|
||||
- Returns: Success confirmation
|
||||
|
||||
**`hide`**
|
||||
- Hide the top bar
|
||||
- Returns: Success confirmation
|
||||
|
||||
**`toggle`**
|
||||
- Toggle top bar visibility
|
||||
- Returns: Success confirmation with current state
|
||||
|
||||
**`status`**
|
||||
- Get current top bar visibility status
|
||||
- Returns: "visible" or "hidden"
|
||||
|
||||
### Examples
|
||||
```bash
|
||||
qs -c dms ipc call bar toggle
|
||||
qs -c dms ipc call bar hide
|
||||
qs -c dms ipc call bar status
|
||||
```
|
||||
|
||||
## Modal Controls
|
||||
|
||||
These targets control various modal windows and overlays.
|
||||
|
||||
Reference in New Issue
Block a user