mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 13:32:50 -05:00
top bar manual show/hide
This commit is contained in:
@@ -83,6 +83,7 @@ Singleton {
|
|||||||
property real cornerRadius: 12
|
property real cornerRadius: 12
|
||||||
property bool notificationOverlayEnabled: false
|
property bool notificationOverlayEnabled: false
|
||||||
property bool topBarAutoHide: false
|
property bool topBarAutoHide: false
|
||||||
|
property bool topBarVisible: true
|
||||||
property real topBarSpacing: 4
|
property real topBarSpacing: 4
|
||||||
property real topBarInnerPadding: 8
|
property real topBarInnerPadding: 8
|
||||||
property bool topBarSquareCorners: false
|
property bool topBarSquareCorners: false
|
||||||
@@ -267,6 +268,8 @@ Singleton {
|
|||||||
!== undefined ? settings.notificationOverlayEnabled : false
|
!== undefined ? settings.notificationOverlayEnabled : false
|
||||||
topBarAutoHide = settings.topBarAutoHide
|
topBarAutoHide = settings.topBarAutoHide
|
||||||
!== undefined ? settings.topBarAutoHide : false
|
!== undefined ? settings.topBarAutoHide : false
|
||||||
|
topBarVisible = settings.topBarVisible
|
||||||
|
!== undefined ? settings.topBarVisible : true
|
||||||
notificationTimeoutLow = settings.notificationTimeoutLow
|
notificationTimeoutLow = settings.notificationTimeoutLow
|
||||||
!== undefined ? settings.notificationTimeoutLow : 5000
|
!== undefined ? settings.notificationTimeoutLow : 5000
|
||||||
notificationTimeoutNormal = settings.notificationTimeoutNormal
|
notificationTimeoutNormal = settings.notificationTimeoutNormal
|
||||||
@@ -356,6 +359,7 @@ Singleton {
|
|||||||
"cornerRadius": cornerRadius,
|
"cornerRadius": cornerRadius,
|
||||||
"notificationOverlayEnabled": notificationOverlayEnabled,
|
"notificationOverlayEnabled": notificationOverlayEnabled,
|
||||||
"topBarAutoHide": topBarAutoHide,
|
"topBarAutoHide": topBarAutoHide,
|
||||||
|
"topBarVisible": topBarVisible,
|
||||||
"topBarSpacing": topBarSpacing,
|
"topBarSpacing": topBarSpacing,
|
||||||
"topBarInnerPadding": topBarInnerPadding,
|
"topBarInnerPadding": topBarInnerPadding,
|
||||||
"topBarSquareCorners": topBarSquareCorners,
|
"topBarSquareCorners": topBarSquareCorners,
|
||||||
@@ -858,6 +862,16 @@ Singleton {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setTopBarVisible(visible) {
|
||||||
|
topBarVisible = visible
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleTopBarVisible() {
|
||||||
|
topBarVisible = !topBarVisible
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
function setNotificationTimeoutLow(timeout) {
|
function setNotificationTimeoutLow(timeout) {
|
||||||
notificationTimeoutLow = timeout
|
notificationTimeoutLow = timeout
|
||||||
saveSettings()
|
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
|
// Spacing
|
||||||
StyledRect {
|
StyledRect {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ PanelWindow {
|
|||||||
property real backgroundTransparency: SettingsData.topBarTransparency
|
property real backgroundTransparency: SettingsData.topBarTransparency
|
||||||
readonly property int notificationCount: NotificationService.notifications.length
|
readonly property int notificationCount: NotificationService.notifications.length
|
||||||
property bool autoHide: SettingsData.topBarAutoHide
|
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 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)
|
readonly property real widgetHeight: Math.max(20, 26 + SettingsData.topBarInnerPadding * 0.6)
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ PanelWindow {
|
|||||||
right: true
|
right: true
|
||||||
}
|
}
|
||||||
|
|
||||||
exclusiveZone: autoHide ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing - 2
|
exclusiveZone: !SettingsData.topBarVisible || autoHide ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing - 2
|
||||||
|
|
||||||
mask: Region {
|
mask: Region {
|
||||||
item: topBarMouseArea
|
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
|
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
|
## Modal Controls
|
||||||
|
|
||||||
These targets control various modal windows and overlays.
|
These targets control various modal windows and overlays.
|
||||||
|
|||||||
Reference in New Issue
Block a user