forked from Shinonome/dots-hyprland
bar: add auto hide
This commit is contained in:
@@ -17,11 +17,12 @@ Singleton {
|
|||||||
property bool osdVolumeOpen: false
|
property bool osdVolumeOpen: false
|
||||||
property bool oskOpen: false
|
property bool oskOpen: false
|
||||||
property bool overviewOpen: false
|
property bool overviewOpen: false
|
||||||
property bool sessionOpen: false
|
|
||||||
property bool workspaceShowNumbers: false
|
|
||||||
property bool superReleaseMightTrigger: true
|
|
||||||
property bool screenLocked: false
|
property bool screenLocked: false
|
||||||
property bool screenLockContainsCharacters: false
|
property bool screenLockContainsCharacters: false
|
||||||
|
property bool sessionOpen: false
|
||||||
|
property bool superDown: false
|
||||||
|
property bool superReleaseMightTrigger: true
|
||||||
|
property bool workspaceShowNumbers: false
|
||||||
|
|
||||||
property real screenZoom: 1
|
property real screenZoom: 1
|
||||||
onScreenZoomChanged: {
|
onScreenZoomChanged: {
|
||||||
@@ -51,9 +52,11 @@ Singleton {
|
|||||||
description: "Hold to show workspace numbers, release to show icons"
|
description: "Hold to show workspace numbers, release to show icons"
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
|
root.superDown = true
|
||||||
workspaceShowNumbersTimer.start()
|
workspaceShowNumbersTimer.start()
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
|
root.superDown = false
|
||||||
workspaceShowNumbersTimer.stop()
|
workspaceShowNumbersTimer.stop()
|
||||||
workspaceShowNumbers = false
|
workspaceShowNumbers = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,10 @@ Scope {
|
|||||||
property real useShortenedForm: (Appearance.sizes.barHellaShortenScreenWidthThreshold >= screen.width) ? 2 : (Appearance.sizes.barShortenScreenWidthThreshold >= screen.width) ? 1 : 0
|
property real useShortenedForm: (Appearance.sizes.barHellaShortenScreenWidthThreshold >= screen.width) ? 2 : (Appearance.sizes.barShortenScreenWidthThreshold >= screen.width) ? 1 : 0
|
||||||
readonly property int centerSideModuleWidth: (useShortenedForm == 2) ? Appearance.sizes.barCenterSideModuleWidthHellaShortened : (useShortenedForm == 1) ? Appearance.sizes.barCenterSideModuleWidthShortened : Appearance.sizes.barCenterSideModuleWidth
|
readonly property int centerSideModuleWidth: (useShortenedForm == 2) ? Appearance.sizes.barCenterSideModuleWidthHellaShortened : (useShortenedForm == 1) ? Appearance.sizes.barCenterSideModuleWidthShortened : Appearance.sizes.barCenterSideModuleWidth
|
||||||
|
|
||||||
|
property bool mustShow: hoverRegion.containsMouse || (Config?.options.bar.autoHide.showWhenPressingSuper && GlobalStates.superDown)
|
||||||
exclusionMode: ExclusionMode.Ignore
|
exclusionMode: ExclusionMode.Ignore
|
||||||
exclusiveZone: Appearance.sizes.baseBarHeight + (Config.options.bar.cornerStyle === 1 ? Appearance.sizes.hyprlandGapsOut : 0)
|
exclusiveZone: (Config?.options.bar.autoHide.enabled && (!mustShow || !Config?.options.bar.autoHide.pushWindows)) ? 0 :
|
||||||
|
Appearance.sizes.baseBarHeight + (Config.options.bar.cornerStyle === 1 ? Appearance.sizes.hyprlandGapsOut : 0)
|
||||||
WlrLayershell.namespace: "quickshell:bar"
|
WlrLayershell.namespace: "quickshell:bar"
|
||||||
implicitHeight: Appearance.sizes.barHeight + Appearance.rounding.screenRounding
|
implicitHeight: Appearance.sizes.barHeight + Appearance.rounding.screenRounding
|
||||||
mask: Region {
|
mask: Region {
|
||||||
@@ -55,90 +57,116 @@ Scope {
|
|||||||
right: true
|
right: true
|
||||||
}
|
}
|
||||||
|
|
||||||
BarContent {
|
MouseArea {
|
||||||
id: barContent
|
id: hoverRegion
|
||||||
|
hoverEnabled: true
|
||||||
anchors {
|
anchors.fill: parent
|
||||||
right: parent.right
|
|
||||||
left: parent.left
|
|
||||||
top: parent.top
|
|
||||||
bottom: undefined
|
|
||||||
}
|
|
||||||
implicitHeight: Appearance.sizes.barHeight
|
|
||||||
|
|
||||||
states: State {
|
BarContent {
|
||||||
name: "bottom"
|
id: barContent
|
||||||
when: Config.options.bar.bottom
|
|
||||||
AnchorChanges {
|
implicitHeight: Appearance.sizes.barHeight
|
||||||
target: barContent
|
anchors {
|
||||||
anchors {
|
right: parent.right
|
||||||
right: parent.right
|
left: parent.left
|
||||||
left: parent.left
|
top: parent.top
|
||||||
top: undefined
|
bottom: undefined
|
||||||
bottom: parent.bottom
|
topMargin: (Config?.options.bar.autoHide.enabled && !mustShow) ? -Appearance.sizes.barHeight + 1 : 0
|
||||||
|
bottomMargin: 0
|
||||||
|
}
|
||||||
|
Behavior on anchors.topMargin {
|
||||||
|
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||||
|
}
|
||||||
|
Behavior on anchors.bottomMargin {
|
||||||
|
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
states: State {
|
||||||
|
name: "bottom"
|
||||||
|
when: Config.options.bar.bottom
|
||||||
|
AnchorChanges {
|
||||||
|
target: barContent
|
||||||
|
anchors {
|
||||||
|
right: parent.right
|
||||||
|
left: parent.left
|
||||||
|
top: undefined
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: barContent
|
||||||
|
anchors.topMargin: 0
|
||||||
|
anchors.bottomMargin: (Config?.options.bar.autoHide.enabled && !mustShow) ? -Appearance.sizes.barHeight + 1 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Round decorators
|
// Round decorators
|
||||||
Loader {
|
Loader {
|
||||||
id: roundDecorators
|
id: roundDecorators
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
}
|
top: barContent.bottom
|
||||||
y: Appearance.sizes.barHeight
|
bottom: undefined
|
||||||
width: parent.width
|
|
||||||
height: Appearance.rounding.screenRounding
|
|
||||||
active: showBarBackground && Config.options.bar.cornerStyle === 0 // Hug
|
|
||||||
|
|
||||||
states: State {
|
|
||||||
name: "bottom"
|
|
||||||
when: Config.options.bar.bottom
|
|
||||||
PropertyChanges {
|
|
||||||
roundDecorators.y: 0
|
|
||||||
}
|
}
|
||||||
}
|
width: parent.width
|
||||||
|
height: Appearance.rounding.screenRounding
|
||||||
|
active: showBarBackground && Config.options.bar.cornerStyle === 0 // Hug
|
||||||
|
|
||||||
sourceComponent: Item {
|
states: State {
|
||||||
implicitHeight: Appearance.rounding.screenRounding
|
name: "bottom"
|
||||||
RoundCorner {
|
when: Config.options.bar.bottom
|
||||||
id: leftCorner
|
AnchorChanges {
|
||||||
anchors {
|
target: roundDecorators
|
||||||
top: parent.top
|
anchors {
|
||||||
bottom: parent.bottom
|
right: parent.right
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
top: undefined
|
||||||
|
bottom: barContent.top
|
||||||
implicitSize: Appearance.rounding.screenRounding
|
|
||||||
color: showBarBackground ? Appearance.colors.colLayer0 : "transparent"
|
|
||||||
|
|
||||||
corner: RoundCorner.CornerEnum.TopLeft
|
|
||||||
states: State {
|
|
||||||
name: "bottom"
|
|
||||||
when: Config.options.bar.bottom
|
|
||||||
PropertyChanges {
|
|
||||||
leftCorner.corner: RoundCorner.CornerEnum.BottomLeft
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoundCorner {
|
|
||||||
id: rightCorner
|
|
||||||
anchors {
|
|
||||||
right: parent.right
|
|
||||||
top: !Config.options.bar.bottom ? parent.top : undefined
|
|
||||||
bottom: Config.options.bar.bottom ? parent.bottom : undefined
|
|
||||||
}
|
|
||||||
implicitSize: Appearance.rounding.screenRounding
|
|
||||||
color: showBarBackground ? Appearance.colors.colLayer0 : "transparent"
|
|
||||||
|
|
||||||
corner: RoundCorner.CornerEnum.TopRight
|
sourceComponent: Item {
|
||||||
states: State {
|
implicitHeight: Appearance.rounding.screenRounding
|
||||||
name: "bottom"
|
RoundCorner {
|
||||||
when: Config.options.bar.bottom
|
id: leftCorner
|
||||||
PropertyChanges {
|
anchors {
|
||||||
rightCorner.corner: RoundCorner.CornerEnum.BottomRight
|
top: parent.top
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitSize: Appearance.rounding.screenRounding
|
||||||
|
color: showBarBackground ? Appearance.colors.colLayer0 : "transparent"
|
||||||
|
|
||||||
|
corner: RoundCorner.CornerEnum.TopLeft
|
||||||
|
states: State {
|
||||||
|
name: "bottom"
|
||||||
|
when: Config.options.bar.bottom
|
||||||
|
PropertyChanges {
|
||||||
|
leftCorner.corner: RoundCorner.CornerEnum.BottomLeft
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RoundCorner {
|
||||||
|
id: rightCorner
|
||||||
|
anchors {
|
||||||
|
right: parent.right
|
||||||
|
top: !Config.options.bar.bottom ? parent.top : undefined
|
||||||
|
bottom: Config.options.bar.bottom ? parent.bottom : undefined
|
||||||
|
}
|
||||||
|
implicitSize: Appearance.rounding.screenRounding
|
||||||
|
color: showBarBackground ? Appearance.colors.colLayer0 : "transparent"
|
||||||
|
|
||||||
|
corner: RoundCorner.CornerEnum.TopRight
|
||||||
|
states: State {
|
||||||
|
name: "bottom"
|
||||||
|
when: Config.options.bar.bottom
|
||||||
|
PropertyChanges {
|
||||||
|
rightCorner.corner: RoundCorner.CornerEnum.BottomRight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,6 +124,11 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
property JsonObject bar: JsonObject {
|
property JsonObject bar: JsonObject {
|
||||||
|
property JsonObject autoHide: JsonObject {
|
||||||
|
property bool enabled: false
|
||||||
|
property bool pushWindows: false
|
||||||
|
property bool showWhenPressingSuper: true
|
||||||
|
}
|
||||||
property bool bottom: false // Instead of top
|
property bool bottom: false // Instead of top
|
||||||
property int cornerStyle: 0 // 0: Hug | 1: Float | 2: Plain rectangle
|
property int cornerStyle: 0 // 0: Hug | 1: Float | 2: Plain rectangle
|
||||||
property bool borderless: false // true for no grouping of items
|
property bool borderless: false // true for no grouping of items
|
||||||
|
|||||||
Reference in New Issue
Block a user