traymenu width calc
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ Searcher {
|
|||||||
|
|
||||||
Quickshell.execDetached({
|
Quickshell.execDetached({
|
||||||
command: ["app2unit", "--", ...entry.command],
|
command: ["app2unit", "--", ...entry.command],
|
||||||
workingDirectory: entry.workingDirectory
|
workingDirectory: entry.workingDirectory || Quickshell.env("HOME")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import Quickshell
|
|||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
StackView {
|
StackView {
|
||||||
id: root
|
id: root
|
||||||
@@ -13,6 +14,7 @@ StackView {
|
|||||||
required property Item popouts
|
required property Item popouts
|
||||||
required property QsMenuHandle trayItem
|
required property QsMenuHandle trayItem
|
||||||
|
|
||||||
|
property int rootWidth: 0
|
||||||
property int biggestWidth: 0
|
property int biggestWidth: 0
|
||||||
|
|
||||||
implicitWidth: currentItem.implicitWidth
|
implicitWidth: currentItem.implicitWidth
|
||||||
@@ -97,12 +99,14 @@ StackView {
|
|||||||
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
const entry = item.modelData;
|
const entry = item.modelData;
|
||||||
if (entry.hasChildren)
|
if (entry.hasChildren) {
|
||||||
|
root.rootWidth = root.biggestWidth;
|
||||||
|
root.biggestWidth = 0;
|
||||||
root.push(subMenuComp.createObject(null, {
|
root.push(subMenuComp.createObject(null, {
|
||||||
handle: entry,
|
handle: entry,
|
||||||
isSubMenu: true
|
isSubMenu: true
|
||||||
}));
|
}));
|
||||||
else {
|
} else {
|
||||||
item.modelData.triggered();
|
item.modelData.triggered();
|
||||||
root.popouts.hasCurrent = false;
|
root.popouts.hasCurrent = false;
|
||||||
}
|
}
|
||||||
@@ -119,10 +123,22 @@ StackView {
|
|||||||
active: item.modelData.icon !== ""
|
active: item.modelData.icon !== ""
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
|
||||||
sourceComponent: IconImage {
|
sourceComponent: Item {
|
||||||
implicitSize: label.implicitHeight
|
implicitHeight: label.implicitHeight
|
||||||
|
implicitWidth: label.implicitHeight
|
||||||
|
IconImage {
|
||||||
|
id: iconImage
|
||||||
|
implicitSize: parent.implicitHeight
|
||||||
source: item.modelData.icon
|
source: item.modelData.icon
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiEffect {
|
||||||
|
anchors.fill: iconImage
|
||||||
|
source: iconImage
|
||||||
|
colorization: 1.0
|
||||||
|
colorizationColor: item.modelData.enabled ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3outline
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +203,7 @@ StackView {
|
|||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: 1000
|
radius: 4
|
||||||
color: DynamicColors.palette.m3secondaryContainer
|
color: DynamicColors.palette.m3secondaryContainer
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
@@ -196,6 +212,7 @@ StackView {
|
|||||||
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
root.pop();
|
root.pop();
|
||||||
|
root.biggestWidth = root.rootWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-24
@@ -7,6 +7,7 @@ import QtQuick.Effects
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
import qs.Config
|
import qs.Config
|
||||||
|
import qs.Components
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: itemRoot
|
id: itemRoot
|
||||||
@@ -18,7 +19,7 @@ Item {
|
|||||||
|
|
||||||
property HyprlandMonitor monitor: Hyprland.monitorFor( itemRoot.bar?.screen )
|
property HyprlandMonitor monitor: Hyprland.monitorFor( itemRoot.bar?.screen )
|
||||||
|
|
||||||
implicitWidth: workspacesRow.implicitWidth + 6
|
implicitWidth: workspacesRow.implicitWidth + 10
|
||||||
implicitHeight: 22
|
implicitHeight: 22
|
||||||
|
|
||||||
function shouldShow(monitor) {
|
function shouldShow(monitor) {
|
||||||
@@ -49,35 +50,44 @@ Item {
|
|||||||
id: workspacesRow
|
id: workspacesRow
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.leftMargin: 3
|
anchors.leftMargin: 6
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: Hyprland.workspaces
|
model: Hyprland.workspaces
|
||||||
|
|
||||||
Rectangle {
|
RowLayout {
|
||||||
id: workspaceIndicator
|
id: workspaceIndicator
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
visible: root.shouldShow( workspaceIndicator.modelData.monitor )
|
||||||
|
CustomText {
|
||||||
|
text: workspaceIndicator.modelData.name
|
||||||
|
font.pointSize: 12
|
||||||
|
color: workspaceIndicator.modelData.id === Hyprland.focusedWorkspace.id ? ( Config.useDynamicColors ? DynamicColors.palette.m3primary : Config.accentColor.accents.primary ) : ( Config.useDynamicColors ? DynamicColors.palette.m3onSurfaceVariant : "#606060" )
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
|
||||||
width: 16
|
Rectangle {
|
||||||
height: 16
|
|
||||||
|
implicitWidth: 14
|
||||||
|
implicitHeight: 14
|
||||||
radius: height / 2
|
radius: height / 2
|
||||||
|
|
||||||
color: modelData.id === Hyprland.focusedWorkspace.id ? ( Config.useDynamicColors ? DynamicColors.palette.m3primary : Config.accentColor.accents.primary ) : ( Config.useDynamicColors ? DynamicColors.palette.m3outline : "#606060" )
|
|
||||||
|
|
||||||
border.color: modelData.id === Hyprland.focusedWorkspace.id ? ( Config.useDynamicColors ? DynamicColors.palette.m3onPrimary : Config.accentColor.accents.primaryAlt ) : ( Config.useDynamicColors ? DynamicColors.palette.m3outlineVariant : "#808080" )
|
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
|
||||||
visible: root.shouldShow( modelData.monitor )
|
color: "transparent"
|
||||||
|
border.color: workspaceIndicator.modelData.id === Hyprland.focusedWorkspace.id ? ( Config.useDynamicColors ? DynamicColors.palette.m3primary : Config.accentColor.accents.primary ) : ( Config.useDynamicColors ? DynamicColors.palette.m3onSurfaceVariant : "#606060" )
|
||||||
|
|
||||||
|
|
||||||
scale: 1.0
|
scale: 1.0
|
||||||
opacity: 1.0
|
opacity: 1.0
|
||||||
|
|
||||||
Behavior on color {
|
CustomRect {
|
||||||
ColorAnimation {
|
anchors.centerIn: parent
|
||||||
duration: 150
|
implicitWidth: 8
|
||||||
easing.type: Easing.InOutQuad
|
implicitHeight: 8
|
||||||
}
|
|
||||||
|
radius: implicitHeight / 2
|
||||||
|
color: workspaceIndicator.modelData.id === Hyprland.focusedWorkspace.id ? ( Config.useDynamicColors ? DynamicColors.palette.m3primary : Config.accentColor.accents.primary ) : "transparent"
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on border.color {
|
Behavior on border.color {
|
||||||
@@ -100,18 +110,11 @@ Item {
|
|||||||
duration: 200
|
duration: 200
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text {
|
|
||||||
// anchors.centerIn: parent
|
|
||||||
// text: modelData.id
|
|
||||||
// font.pixelSize: 10
|
|
||||||
// font.family: "Rubik"
|
|
||||||
// color: modelData.id === Hyprland.focusedWorkspace.id ? Config.workspaceWidget.textColor : Config.workspaceWidget.inactiveTextColor
|
|
||||||
// }
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Hyprland.dispatch("workspace " + modelData.id)
|
workspaceIndicator.modelData.activate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
|
||||||
|
FloatingWindow {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
title: "terminal"
|
||||||
|
minimumSize: Qt.size(400, 300)
|
||||||
|
Component.onCompleted: {
|
||||||
|
Hyprland.refreshToplevels()
|
||||||
|
console.log(Hyprland.toplevels.values)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user