mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
meta: Vertical Bar, Notification Popup Position Options, ++
- CC Color picker widget - Tooltips in more places - Attempt to improve niri screen transitiosn
This commit is contained in:
@@ -13,6 +13,8 @@ StyledRect {
|
||||
property int buttonSize: 32
|
||||
|
||||
signal clicked
|
||||
signal entered
|
||||
signal exited
|
||||
|
||||
width: buttonSize
|
||||
height: buttonSize
|
||||
@@ -30,5 +32,7 @@ StyledRect {
|
||||
stateColor: Theme.primary
|
||||
cornerRadius: root.radius
|
||||
onClicked: root.clicked()
|
||||
onEntered: root.entered()
|
||||
onExited: root.exited()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,16 @@ Flow {
|
||||
property int textSize: Theme.fontSizeMedium
|
||||
|
||||
signal selectionChanged(int index, bool selected)
|
||||
signal animationCompleted()
|
||||
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
Timer {
|
||||
id: animationTimer
|
||||
interval: Theme.shortDuration
|
||||
onTriggered: root.animationCompleted()
|
||||
}
|
||||
|
||||
function isSelected(index) {
|
||||
if (multiSelect) {
|
||||
return repeater.itemAt(index)?.selected || false
|
||||
@@ -43,6 +50,7 @@ Flow {
|
||||
|
||||
currentSelection = newSelection
|
||||
selectionChanged(index, !isCurrentlySelected)
|
||||
animationTimer.restart()
|
||||
} else {
|
||||
const oldIndex = currentIndex
|
||||
currentIndex = index
|
||||
@@ -50,6 +58,7 @@ Flow {
|
||||
if (oldIndex !== index && oldIndex >= 0) {
|
||||
selectionChanged(oldIndex, false)
|
||||
}
|
||||
animationTimer.restart()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,7 @@ Rectangle {
|
||||
}
|
||||
size: 18
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: name !== "" && root.width > 60
|
||||
}
|
||||
|
||||
@@ -131,6 +132,7 @@ Rectangle {
|
||||
text: root.currentValue
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: root.width <= 60 ? dropdown.width - expandIcon.width - Theme.spacingS * 2 : dropdown.width - contentRow.x - expandIcon.width - Theme.spacingM - Theme.spacingS
|
||||
elide: root.width <= 60 ? Text.ElideNone : Text.ElideRight
|
||||
horizontalAlignment: root.width <= 60 ? Text.AlignHCenter : Text.AlignLeft
|
||||
|
||||
@@ -12,6 +12,8 @@ StyledText {
|
||||
property int grade: Theme.isLightMode ? 0 : -25
|
||||
property int weight: filled ? 500 : 400
|
||||
|
||||
signal rotationCompleted()
|
||||
|
||||
font.family: "Material Symbols Rounded"
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: weight
|
||||
@@ -40,4 +42,15 @@ StyledText {
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: rotationTimer
|
||||
interval: 16
|
||||
repeat: false
|
||||
onTriggered: icon.rotationCompleted()
|
||||
}
|
||||
|
||||
onRotationChanged: {
|
||||
rotationTimer.restart()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,8 +244,8 @@ Rectangle {
|
||||
width: 36
|
||||
height: 36
|
||||
radius: Theme.cornerRadius
|
||||
color: iconMouseArea.containsMouse ? Theme.primaryHover : "transparent"
|
||||
border.color: root.currentIcon === modelData ? Theme.primary : "transparent"
|
||||
color: iconMouseArea.containsMouse ? Theme.primaryHover : Theme.withAlpha(Theme.primaryHover, 0)
|
||||
border.color: root.currentIcon === modelData ? Theme.primary : Theme.withAlpha(Theme.primary, 0)
|
||||
border.width: 2
|
||||
|
||||
DankIcon {
|
||||
|
||||
@@ -16,6 +16,7 @@ PanelWindow {
|
||||
property real triggerX: 0
|
||||
property real triggerY: 0
|
||||
property real triggerWidth: 40
|
||||
property string triggerSection: ""
|
||||
property string positioning: "center"
|
||||
property int animationDuration: Theme.mediumDuration
|
||||
property var animationEasing: Theme.emphasizedEasing
|
||||
@@ -89,25 +90,29 @@ PanelWindow {
|
||||
|
||||
Item {
|
||||
id: contentContainer
|
||||
layer.enabled: true
|
||||
|
||||
readonly property real screenWidth: root.screen ? root.screen.width : 1920
|
||||
readonly property real screenHeight: root.screen ? root.screen.height : 1080
|
||||
readonly property real gothOffset: SettingsData.dankBarGothCornersEnabled ? Theme.cornerRadius : 0
|
||||
readonly property real calculatedX: {
|
||||
if (positioning === "center") {
|
||||
var centerX = triggerX + (triggerWidth / 2) - (popupWidth / 2)
|
||||
return Math.max(Theme.spacingM, Math.min(screenWidth - popupWidth - Theme.spacingM, centerX))
|
||||
} else if (positioning === "left") {
|
||||
return Math.max(Theme.spacingM, triggerX)
|
||||
} else if (positioning === "right") {
|
||||
return Math.min(screenWidth - popupWidth - Theme.spacingM, triggerX + triggerWidth - popupWidth)
|
||||
if (SettingsData.dankBarPosition === SettingsData.Position.Left) {
|
||||
return triggerY
|
||||
} else if (SettingsData.dankBarPosition === SettingsData.Position.Right) {
|
||||
return screenWidth - triggerY - popupWidth
|
||||
} else {
|
||||
const centerX = triggerX + (triggerWidth / 2) - (popupWidth / 2)
|
||||
return Math.max(Theme.popupDistance, Math.min(screenWidth - popupWidth - Theme.popupDistance, centerX))
|
||||
}
|
||||
return triggerX
|
||||
}
|
||||
readonly property real calculatedY: {
|
||||
if (SettingsData.dankBarAtBottom) {
|
||||
return Math.max(Theme.spacingM, Math.min(screenHeight - popupHeight - Theme.spacingM, screenHeight - triggerY - popupHeight - SettingsData.dankBarSpacing - 10))
|
||||
if (SettingsData.dankBarPosition === SettingsData.Position.Left || SettingsData.dankBarPosition === SettingsData.Position.Right) {
|
||||
const centerY = triggerX + (triggerWidth / 2) - (popupHeight / 2)
|
||||
return Math.max(Theme.popupDistance, Math.min(screenHeight - popupHeight - Theme.popupDistance, centerY))
|
||||
} else if (SettingsData.dankBarPosition === SettingsData.Position.Bottom) {
|
||||
return Math.max(Theme.popupDistance, Math.min(screenHeight - popupHeight - Theme.popupDistance, screenHeight - triggerY - popupHeight + Theme.popupDistance))
|
||||
} else {
|
||||
return Math.max(0, Math.min(screenHeight - popupHeight - Theme.spacingM, triggerY + SettingsData.dankBarSpacing + 10))
|
||||
return Math.max(Theme.popupDistance, Math.min(screenHeight - popupHeight - Theme.popupDistance, triggerY + Theme.popupDistance))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ PanelWindow {
|
||||
|
||||
StyledRect {
|
||||
id: contentRect
|
||||
layer.enabled: true
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
@@ -21,7 +21,6 @@ Item {
|
||||
|
||||
property color thumbOutlineColor: Theme.surfaceContainer
|
||||
property color trackColor: enabled ? Theme.outline : Theme.outline
|
||||
function withAlpha(c, a) { return Qt.rgba(c.r, c.g, c.b, a) }
|
||||
|
||||
signal sliderValueChanged(int newValue)
|
||||
signal sliderDragFinished(int finalValue)
|
||||
@@ -73,7 +72,7 @@ Item {
|
||||
const center = (travel * ratio) + sliderHandle.width / 2
|
||||
return Math.max(0, Math.min(sliderTrack.width, center))
|
||||
}
|
||||
color: slider.enabled ? Theme.primary : withAlpha(Theme.onSurface, 0.12)
|
||||
color: slider.enabled ? Theme.primary : Theme.withAlpha(Theme.onSurface, 0.12)
|
||||
|
||||
}
|
||||
|
||||
@@ -91,7 +90,7 @@ Item {
|
||||
return Math.max(0, Math.min(travel, travel * ratio))
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: slider.enabled ? Theme.primary : withAlpha(Theme.onSurface, 0.12)
|
||||
color: slider.enabled ? Theme.primary : Theme.withAlpha(Theme.onSurface, 0.12)
|
||||
border.width: 3
|
||||
border.color: slider.thumbOutlineColor
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ Item {
|
||||
|
||||
signal clicked
|
||||
signal toggled(bool checked)
|
||||
signal toggleCompleted(bool checked)
|
||||
|
||||
readonly property bool showText: text && !hideText
|
||||
|
||||
@@ -113,10 +114,17 @@ Item {
|
||||
x: (checked && enabled) ? toggleTrack.edgeRight : toggleTrack.edgeLeft
|
||||
|
||||
Behavior on x {
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||
SequentialAnimation {
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||
}
|
||||
ScriptAction {
|
||||
script: {
|
||||
toggle.toggleCompleted(toggle.checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
81
Widgets/DankTooltip.qml
Normal file
81
Widgets/DankTooltip.qml
Normal file
@@ -0,0 +1,81 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Common
|
||||
|
||||
PanelWindow {
|
||||
id: root
|
||||
|
||||
property string text: ""
|
||||
property real targetX: 0
|
||||
property real targetY: 0
|
||||
property var targetScreen: null
|
||||
property bool alignLeft: false
|
||||
property bool alignRight: false
|
||||
|
||||
function show(text, x, y, screen, leftAlign, rightAlign) {
|
||||
root.text = text;
|
||||
if (screen) {
|
||||
targetScreen = screen;
|
||||
const screenX = screen.x || 0;
|
||||
targetX = x - screenX;
|
||||
} else {
|
||||
targetScreen = null;
|
||||
targetX = x;
|
||||
}
|
||||
targetY = y;
|
||||
alignLeft = leftAlign ?? false;
|
||||
alignRight = rightAlign ?? false;
|
||||
visible = true;
|
||||
}
|
||||
|
||||
function hide() {
|
||||
visible = false;
|
||||
}
|
||||
|
||||
screen: targetScreen
|
||||
implicitWidth: Math.min(300, Math.max(120, textContent.implicitWidth + Theme.spacingM * 2))
|
||||
implicitHeight: textContent.implicitHeight + Theme.spacingS * 2
|
||||
color: "transparent"
|
||||
visible: false
|
||||
WlrLayershell.layer: WlrLayershell.Overlay
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
}
|
||||
|
||||
margins {
|
||||
left: {
|
||||
if (alignLeft) return Math.round(targetX)
|
||||
if (alignRight) return Math.round(targetX - implicitWidth)
|
||||
return Math.round(targetX - implicitWidth / 2)
|
||||
}
|
||||
top: {
|
||||
if (alignLeft || alignRight) return Math.round(targetY - implicitHeight / 2)
|
||||
return Math.round(targetY)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.surfaceContainerHigh
|
||||
radius: Theme.cornerRadius
|
||||
border.width: 1
|
||||
border.color: Theme.outlineMedium
|
||||
|
||||
Text {
|
||||
id: textContent
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: root.text
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
wrapMode: Text.NoWrap
|
||||
maximumLineCount: 1
|
||||
elide: Text.ElideRight
|
||||
width: Math.min(implicitWidth, 300 - Theme.spacingM * 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,6 @@ Rectangle {
|
||||
"easing.bezierCurve": Appearance.anim.curves.standard
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: standardAnimation.duration
|
||||
easing.type: standardAnimation["easing.type"]
|
||||
easing.bezierCurve: standardAnimation["easing.bezierCurve"]
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on radius {
|
||||
NumberAnimation {
|
||||
duration: standardAnimation.duration
|
||||
|
||||
@@ -33,14 +33,6 @@ Text {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
antialiasing: true
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: standardAnimation.duration
|
||||
easing.type: standardAnimation["easing.type"]
|
||||
easing.bezierCurve: standardAnimation["easing.bezierCurve"]
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: standardAnimation.duration
|
||||
|
||||
Reference in New Issue
Block a user