forked from Shinonome/dots-hyprland
bar: tray overflow menu
This commit is contained in:
@@ -317,6 +317,7 @@ Item { // Bar content region
|
|||||||
visible: root.useShortenedForm === 0
|
visible: root.useShortenedForm === 0
|
||||||
Layout.fillWidth: false
|
Layout.fillWidth: false
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
invertSide: Config?.options.bar.bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Quickshell.Wayland
|
|||||||
LazyLoader {
|
LazyLoader {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property MouseArea hoverTarget
|
property Item hoverTarget
|
||||||
default property Item contentItem
|
default property Item contentItem
|
||||||
|
|
||||||
active: hoverTarget && hoverTarget.containsMouse
|
active: hoverTarget && hoverTarget.containsMouse
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import qs.modules.common
|
|||||||
import qs.modules.common.widgets
|
import qs.modules.common.widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
import Quickshell.Services.SystemTray
|
import Quickshell.Services.SystemTray
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -9,18 +10,76 @@ Item {
|
|||||||
implicitWidth: gridLayout.implicitWidth
|
implicitWidth: gridLayout.implicitWidth
|
||||||
implicitHeight: gridLayout.implicitHeight
|
implicitHeight: gridLayout.implicitHeight
|
||||||
property bool vertical: false
|
property bool vertical: false
|
||||||
|
property bool invertSide: false
|
||||||
|
property bool trayOverflowOpen: false
|
||||||
|
|
||||||
|
property list<var> pinnedItems: SystemTray.items.values.filter(i => Config.options.bar.tray.pinnedItems.includes(i.id))
|
||||||
|
property list<var> unpinnedItems: SystemTray.items.values.filter(i => !Config.options.bar.tray.pinnedItems.includes(i.id))
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
id: gridLayout
|
id: gridLayout
|
||||||
columns: root.vertical ? 1 : -1
|
columns: root.vertical ? 1 : -1
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
rowSpacing: 10
|
rowSpacing: 6
|
||||||
columnSpacing: 15
|
columnSpacing: 15
|
||||||
|
|
||||||
Repeater {
|
RippleButton {
|
||||||
model: SystemTray.items
|
id: trayOverflowButton
|
||||||
|
visible: root.unpinnedItems.length > 0
|
||||||
|
toggled: root.trayOverflowOpen
|
||||||
|
property bool containsMouse: hovered
|
||||||
|
|
||||||
SysTrayItem {
|
onClicked: root.trayOverflowOpen = !root.trayOverflowOpen
|
||||||
|
|
||||||
|
Layout.fillHeight: !root.vertical
|
||||||
|
Layout.fillWidth: root.vertical
|
||||||
|
background.implicitWidth: 24
|
||||||
|
background.implicitHeight: 24
|
||||||
|
background.anchors.centerIn: this
|
||||||
|
colBackgroundToggled: Appearance.colors.colSecondaryContainer
|
||||||
|
colBackgroundToggledHover: Appearance.colors.colSecondaryContainerHover
|
||||||
|
colRippleToggled: Appearance.colors.colSecondaryContainerActive
|
||||||
|
|
||||||
|
contentItem: MaterialSymbol {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
iconSize: Appearance.font.pixelSize.larger
|
||||||
|
text: "expand_more"
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
color: root.trayOverflowOpen ? Appearance.colors.colOnSecondaryContainer : Appearance.colors.colOnLayer2
|
||||||
|
rotation: (root.trayOverflowOpen ? 180 : 0) - (90 * root.vertical) + (180 * root.invertSide)
|
||||||
|
Behavior on rotation {
|
||||||
|
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledPopup {
|
||||||
|
hoverTarget: trayOverflowButton
|
||||||
|
active: root.trayOverflowOpen
|
||||||
|
|
||||||
|
GridLayout {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
columns: 4
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: root.unpinnedItems
|
||||||
|
|
||||||
|
delegate: SysTrayItem {
|
||||||
|
required property SystemTrayItem modelData
|
||||||
|
item: modelData
|
||||||
|
Layout.fillHeight: !root.vertical
|
||||||
|
Layout.fillWidth: root.vertical
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: ScriptModel {
|
||||||
|
values: root.pinnedItems
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate: SysTrayItem {
|
||||||
required property SystemTrayItem modelData
|
required property SystemTrayItem modelData
|
||||||
item: modelData
|
item: modelData
|
||||||
Layout.fillHeight: !root.vertical
|
Layout.fillHeight: !root.vertical
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
property JsonObject tray: JsonObject {
|
property JsonObject tray: JsonObject {
|
||||||
property bool monochromeIcons: true
|
property bool monochromeIcons: true
|
||||||
|
property list<string> pinnedItems: [ "Fcitx" ]
|
||||||
}
|
}
|
||||||
property JsonObject workspaces: JsonObject {
|
property JsonObject workspaces: JsonObject {
|
||||||
property bool monochromeIcons: true
|
property bool monochromeIcons: true
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ Item { // Bar content region
|
|||||||
vertical: true
|
vertical: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: false
|
Layout.fillHeight: false
|
||||||
|
invertSide: Config?.options.bar.bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
RippleButton { // Right sidebar button
|
RippleButton { // Right sidebar button
|
||||||
|
|||||||
Reference in New Issue
Block a user