branch
This commit is contained in:
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,28 +0,0 @@
|
|||||||
# Generated by makepkg 7.1.0
|
|
||||||
# using fakeroot version 1.37.2
|
|
||||||
pkgname = zshell
|
|
||||||
pkgbase = zshell
|
|
||||||
xdata = pkgtype=pkg
|
|
||||||
pkgver = 0.1.0-1
|
|
||||||
pkgdesc = The cli for zshell
|
|
||||||
url = https://github.com/Zacharias-Brohn/z-bar-qt
|
|
||||||
builddate = 1771871772
|
|
||||||
packager = Unknown Packager
|
|
||||||
size = 1533615
|
|
||||||
arch = any
|
|
||||||
license = GPL-3.0-only
|
|
||||||
depend = python
|
|
||||||
depend = python-pillow
|
|
||||||
depend = python-materialyoucolor
|
|
||||||
depend = libnotify
|
|
||||||
depend = swappy
|
|
||||||
depend = dart-sass
|
|
||||||
depend = app2unit
|
|
||||||
depend = wl-clipboard
|
|
||||||
depend = dconf
|
|
||||||
depend = cliphist
|
|
||||||
depend = python-typer
|
|
||||||
makedepend = python-build
|
|
||||||
makedepend = python-installer
|
|
||||||
makedepend = python-hatch
|
|
||||||
makedepend = python-hatch-vcs
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Modules
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
NumberAnimation {
|
|
||||||
duration: MaterialEasing.standardTime
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: MaterialEasing.standard
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Modules
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
ColorAnimation {
|
|
||||||
duration: MaterialEasing.standardTime
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: MaterialEasing.standard
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
import qs.Helpers
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import ZShell.Internal
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Templates
|
|
||||||
|
|
||||||
BusyIndicator {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
enum AnimType {
|
|
||||||
Advance = 0,
|
|
||||||
Retreat
|
|
||||||
}
|
|
||||||
|
|
||||||
enum AnimState {
|
|
||||||
Stopped,
|
|
||||||
Running,
|
|
||||||
Completing
|
|
||||||
}
|
|
||||||
|
|
||||||
property real implicitSize: Appearance.font.size.normal * 3
|
|
||||||
property real strokeWidth: Appearance.padding.small * 0.8
|
|
||||||
property color fgColour: DynamicColors.palette.m3primary
|
|
||||||
property color bgColour: DynamicColors.palette.m3secondaryContainer
|
|
||||||
|
|
||||||
property alias type: manager.indeterminateAnimationType
|
|
||||||
readonly property alias progress: manager.progress
|
|
||||||
|
|
||||||
property real internalStrokeWidth: strokeWidth
|
|
||||||
property int animState
|
|
||||||
|
|
||||||
padding: 0
|
|
||||||
implicitWidth: implicitSize
|
|
||||||
implicitHeight: implicitSize
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (running) {
|
|
||||||
running = false;
|
|
||||||
running = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onRunningChanged: {
|
|
||||||
if (running) {
|
|
||||||
manager.completeEndProgress = 0;
|
|
||||||
animState = CircularIndicator.Running;
|
|
||||||
} else {
|
|
||||||
if (animState == CircularIndicator.Running)
|
|
||||||
animState = CircularIndicator.Completing;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
states: State {
|
|
||||||
name: "stopped"
|
|
||||||
when: !root.running
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
root.opacity: 0
|
|
||||||
root.internalStrokeWidth: root.strokeWidth / 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transitions: Transition {
|
|
||||||
Anim {
|
|
||||||
properties: "opacity,internalStrokeWidth"
|
|
||||||
duration: manager.completeEndDuration * Appearance.anim.durations.scale
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
contentItem: CircularProgress {
|
|
||||||
anchors.fill: parent
|
|
||||||
strokeWidth: root.internalStrokeWidth
|
|
||||||
fgColour: root.fgColour
|
|
||||||
bgColour: root.bgColour
|
|
||||||
padding: root.padding
|
|
||||||
rotation: manager.rotation
|
|
||||||
startAngle: manager.startFraction * 360
|
|
||||||
value: manager.endFraction - manager.startFraction
|
|
||||||
}
|
|
||||||
|
|
||||||
CircularIndicatorManager {
|
|
||||||
id: manager
|
|
||||||
}
|
|
||||||
|
|
||||||
NumberAnimation {
|
|
||||||
running: root.animState !== CircularIndicator.Stopped
|
|
||||||
loops: Animation.Infinite
|
|
||||||
target: manager
|
|
||||||
property: "progress"
|
|
||||||
from: 0
|
|
||||||
to: 1
|
|
||||||
duration: manager.duration * Appearance.anim.durations.scale
|
|
||||||
}
|
|
||||||
|
|
||||||
NumberAnimation {
|
|
||||||
running: root.animState === CircularIndicator.Completing
|
|
||||||
target: manager
|
|
||||||
property: "completeEndProgress"
|
|
||||||
from: 0
|
|
||||||
to: 1
|
|
||||||
duration: manager.completeEndDuration * Appearance.anim.durations.scale
|
|
||||||
onFinished: {
|
|
||||||
if (root.animState === CircularIndicator.Completing)
|
|
||||||
root.animState = CircularIndicator.Stopped;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Shapes
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
Shape {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property real value
|
|
||||||
property int startAngle: -90
|
|
||||||
property int strokeWidth: Appearance.padding.smaller
|
|
||||||
property int padding: 0
|
|
||||||
property int spacing: Appearance.spacing.small
|
|
||||||
property color fgColour: DynamicColors.palette.m3primary
|
|
||||||
property color bgColour: DynamicColors.palette.m3secondaryContainer
|
|
||||||
|
|
||||||
readonly property real size: Math.min(width, height)
|
|
||||||
readonly property real arcRadius: (size - padding - strokeWidth) / 2
|
|
||||||
readonly property real vValue: value || 1 / 360
|
|
||||||
readonly property real gapAngle: ((spacing + strokeWidth) / (arcRadius || 1)) * (180 / Math.PI)
|
|
||||||
|
|
||||||
preferredRendererType: Shape.CurveRenderer
|
|
||||||
asynchronous: true
|
|
||||||
|
|
||||||
ShapePath {
|
|
||||||
fillColor: "transparent"
|
|
||||||
strokeColor: root.bgColour
|
|
||||||
strokeWidth: root.strokeWidth
|
|
||||||
capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
|
|
||||||
|
|
||||||
PathAngleArc {
|
|
||||||
startAngle: root.startAngle + 360 * root.vValue + root.gapAngle
|
|
||||||
sweepAngle: Math.max(-root.gapAngle, 360 * (1 - root.vValue) - root.gapAngle * 2)
|
|
||||||
radiusX: root.arcRadius
|
|
||||||
radiusY: root.arcRadius
|
|
||||||
centerX: root.size / 2
|
|
||||||
centerY: root.size / 2
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on strokeColor {
|
|
||||||
CAnim {
|
|
||||||
duration: Appearance.anim.durations.large
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ShapePath {
|
|
||||||
fillColor: "transparent"
|
|
||||||
strokeColor: root.fgColour
|
|
||||||
strokeWidth: root.strokeWidth
|
|
||||||
capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
|
|
||||||
|
|
||||||
PathAngleArc {
|
|
||||||
startAngle: root.startAngle
|
|
||||||
sweepAngle: 360 * root.vValue
|
|
||||||
radiusX: root.arcRadius
|
|
||||||
radiusY: root.arcRadius
|
|
||||||
centerX: root.size / 2
|
|
||||||
centerY: root.size / 2
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on strokeColor {
|
|
||||||
CAnim {
|
|
||||||
duration: Appearance.anim.durations.large
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import ZShell
|
|
||||||
import Quickshell.Widgets
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
IconImage {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property color color
|
|
||||||
|
|
||||||
asynchronous: true
|
|
||||||
|
|
||||||
layer.enabled: true
|
|
||||||
layer.effect: Coloriser {
|
|
||||||
sourceColor: analyser.dominantColour
|
|
||||||
colorizationColor: root.color
|
|
||||||
}
|
|
||||||
|
|
||||||
layer.onEnabledChanged: {
|
|
||||||
if (layer.enabled && status === Image.Ready)
|
|
||||||
analyser.requestUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
onStatusChanged: {
|
|
||||||
if (layer.enabled && status === Image.Ready)
|
|
||||||
analyser.requestUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageAnalyser {
|
|
||||||
id: analyser
|
|
||||||
|
|
||||||
sourceItem: root
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Effects
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
MultiEffect {
|
|
||||||
property color sourceColor: "black"
|
|
||||||
|
|
||||||
colorization: 1
|
|
||||||
brightness: 1 - sourceColor.hslLightness
|
|
||||||
|
|
||||||
Behavior on colorizationColor {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Templates
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
Slider {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property real peak
|
|
||||||
property color nonPeakColor: DynamicColors.tPalette.m3primary
|
|
||||||
property color peakColor: DynamicColors.palette.m3primary
|
|
||||||
|
|
||||||
background: Item {
|
|
||||||
CustomRect {
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.topMargin: root.implicitHeight / 3
|
|
||||||
anchors.bottomMargin: root.implicitHeight / 3
|
|
||||||
|
|
||||||
implicitWidth: root.handle.x - root.implicitHeight
|
|
||||||
|
|
||||||
color: root.nonPeakColor
|
|
||||||
radius: 1000
|
|
||||||
topRightRadius: root.implicitHeight / 15
|
|
||||||
bottomRightRadius: root.implicitHeight / 15
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
|
|
||||||
implicitWidth: parent.width * root.peak
|
|
||||||
radius: 1000
|
|
||||||
topRightRadius: root.implicitHeight / 15
|
|
||||||
bottomRightRadius: root.implicitHeight / 15
|
|
||||||
|
|
||||||
color: root.peakColor
|
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
|
||||||
Anim { duration: 50 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.topMargin: root.implicitHeight / 3
|
|
||||||
anchors.bottomMargin: root.implicitHeight / 3
|
|
||||||
|
|
||||||
implicitWidth: root.implicitWidth - root.handle.x - root.handle.implicitWidth - root.implicitHeight
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
console.log(root.handle.x, implicitWidth)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
color: DynamicColors.tPalette.m3surfaceContainer
|
|
||||||
radius: 1000
|
|
||||||
topLeftRadius: root.implicitHeight / 15
|
|
||||||
bottomLeftRadius: root.implicitHeight / 15
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handle: CustomRect {
|
|
||||||
x: root.visualPosition * root.availableWidth - implicitWidth / 2
|
|
||||||
|
|
||||||
implicitWidth: 5
|
|
||||||
implicitHeight: 15
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
color: DynamicColors.palette.m3primary
|
|
||||||
radius: 1000
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Controls.Basic
|
|
||||||
|
|
||||||
BusyIndicator {
|
|
||||||
id: control
|
|
||||||
property color color: delegate.color
|
|
||||||
property int busySize: 64
|
|
||||||
|
|
||||||
contentItem: Item {
|
|
||||||
implicitWidth: control.busySize
|
|
||||||
implicitHeight: control.busySize
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: item
|
|
||||||
x: parent.width / 2 - (control.busySize / 2)
|
|
||||||
y: parent.height / 2 - (control.busySize / 2)
|
|
||||||
width: control.busySize
|
|
||||||
height: control.busySize
|
|
||||||
opacity: control.running ? 1 : 0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
OpacityAnimator {
|
|
||||||
duration: 250
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RotationAnimator {
|
|
||||||
target: item
|
|
||||||
running: control.visible && control.running
|
|
||||||
from: 0
|
|
||||||
to: 360
|
|
||||||
loops: Animation.Infinite
|
|
||||||
duration: 1250
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
id: repeater
|
|
||||||
model: 6
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
id: delegate
|
|
||||||
x: item.width / 2 - width / 2
|
|
||||||
y: item.height / 2 - height / 2
|
|
||||||
implicitWidth: 10
|
|
||||||
implicitHeight: 10
|
|
||||||
radius: 5
|
|
||||||
color: control.color
|
|
||||||
|
|
||||||
required property int index
|
|
||||||
|
|
||||||
transform: [
|
|
||||||
Translate {
|
|
||||||
y: -Math.min(item.width, item.height) * 0.5 + 5
|
|
||||||
},
|
|
||||||
Rotation {
|
|
||||||
angle: delegate.index / repeater.count * 360
|
|
||||||
origin.x: 5
|
|
||||||
origin.y: 5
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: control
|
|
||||||
|
|
||||||
required property color textColor
|
|
||||||
required property color bgColor
|
|
||||||
property int radius: 4
|
|
||||||
|
|
||||||
contentItem: CustomText {
|
|
||||||
text: control.text
|
|
||||||
|
|
||||||
opacity: control.enabled ? 1.0 : 0.5
|
|
||||||
color: control.textColor
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
background: CustomRect {
|
|
||||||
opacity: control.enabled ? 1.0 : 0.5
|
|
||||||
|
|
||||||
radius: control.radius
|
|
||||||
color: control.bgColor
|
|
||||||
}
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
radius: control.radius
|
|
||||||
function onClicked(): void {
|
|
||||||
control.clicked();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
CheckBox {
|
|
||||||
id: control
|
|
||||||
|
|
||||||
property int checkWidth: 20
|
|
||||||
property int checkHeight: 20
|
|
||||||
|
|
||||||
indicator: CustomRect {
|
|
||||||
implicitWidth: control.checkWidth
|
|
||||||
implicitHeight: control.checkHeight
|
|
||||||
// x: control.leftPadding
|
|
||||||
// y: parent.implicitHeight / 2 - implicitHeight / 2
|
|
||||||
border.color: control.checked ? DynamicColors.palette.m3primary : "transparent"
|
|
||||||
color: DynamicColors.palette.m3surfaceVariant
|
|
||||||
|
|
||||||
radius: 4
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
implicitWidth: control.checkWidth - (x * 2)
|
|
||||||
implicitHeight: control.checkHeight - (y * 2)
|
|
||||||
x: 4
|
|
||||||
y: 4
|
|
||||||
radius: 3
|
|
||||||
color: DynamicColors.palette.m3primary
|
|
||||||
visible: control.checked
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
contentItem: CustomText {
|
|
||||||
text: control.text
|
|
||||||
font.pointSize: control.font.pointSize
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: control.checkWidth + control.leftPadding + 8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import Quickshell.Widgets
|
|
||||||
import QtQuick
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
ClippingRectangle {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
Flickable {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
maximumFlickVelocity: 3000
|
|
||||||
|
|
||||||
rebound: Transition {
|
|
||||||
Anim {
|
|
||||||
properties: "x,y"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import Quickshell.Widgets
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
IconImage {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
asynchronous: true
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
ListView {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
maximumFlickVelocity: 3000
|
|
||||||
|
|
||||||
rebound: Transition {
|
|
||||||
Anim {
|
|
||||||
properties: "x,y"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
property int scrollAccumulatedY: 0
|
|
||||||
|
|
||||||
function onWheel(event: WheelEvent): void {
|
|
||||||
}
|
|
||||||
|
|
||||||
onWheel: event => {
|
|
||||||
if (Math.sign(event.angleDelta.y) !== Math.sign(scrollAccumulatedY))
|
|
||||||
scrollAccumulatedY = 0;
|
|
||||||
scrollAccumulatedY += event.angleDelta.y;
|
|
||||||
|
|
||||||
if (Math.abs(scrollAccumulatedY) >= 120) {
|
|
||||||
onWheel(event);
|
|
||||||
scrollAccumulatedY = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Templates
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
RadioButton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
font.pointSize: 12
|
|
||||||
|
|
||||||
implicitWidth: implicitIndicatorWidth + implicitContentWidth + contentItem.anchors.leftMargin
|
|
||||||
implicitHeight: Math.max(implicitIndicatorHeight, implicitContentHeight)
|
|
||||||
|
|
||||||
indicator: Rectangle {
|
|
||||||
id: outerCircle
|
|
||||||
|
|
||||||
implicitWidth: 16
|
|
||||||
implicitHeight: 16
|
|
||||||
radius: 1000
|
|
||||||
color: "transparent"
|
|
||||||
border.color: root.checked ? DynamicColors.palette.m3primary : DynamicColors.palette.m3onSurfaceVariant
|
|
||||||
border.width: 2
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
anchors.margins: -7
|
|
||||||
color: root.checked ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3primary
|
|
||||||
z: -1
|
|
||||||
|
|
||||||
function onClicked(): void {
|
|
||||||
root.click();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
implicitWidth: 8
|
|
||||||
implicitHeight: 8
|
|
||||||
|
|
||||||
radius: 1000
|
|
||||||
color: Qt.alpha(DynamicColors.palette.m3primary, root.checked ? 1 : 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on border.color {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
contentItem: CustomText {
|
|
||||||
text: root.text
|
|
||||||
font.pointSize: root.font.pointSize
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: outerCircle.right
|
|
||||||
anchors.leftMargin: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,189 +0,0 @@
|
|||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Templates
|
|
||||||
|
|
||||||
ScrollBar {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property Flickable flickable
|
|
||||||
property bool shouldBeActive
|
|
||||||
property real nonAnimPosition
|
|
||||||
property bool animating
|
|
||||||
|
|
||||||
onHoveredChanged: {
|
|
||||||
if (hovered)
|
|
||||||
shouldBeActive = true;
|
|
||||||
else
|
|
||||||
shouldBeActive = flickable.moving;
|
|
||||||
}
|
|
||||||
|
|
||||||
property bool _updatingFromFlickable: false
|
|
||||||
property bool _updatingFromUser: false
|
|
||||||
|
|
||||||
// Sync nonAnimPosition with Qt's automatic position binding
|
|
||||||
onPositionChanged: {
|
|
||||||
if (_updatingFromUser) {
|
|
||||||
_updatingFromUser = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (position === nonAnimPosition) {
|
|
||||||
animating = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!animating && !_updatingFromFlickable && !fullMouse.pressed) {
|
|
||||||
nonAnimPosition = position;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sync nonAnimPosition with flickable when not animating
|
|
||||||
Connections {
|
|
||||||
target: flickable
|
|
||||||
function onContentYChanged() {
|
|
||||||
if (!animating && !fullMouse.pressed) {
|
|
||||||
_updatingFromFlickable = true;
|
|
||||||
const contentHeight = flickable.contentHeight;
|
|
||||||
const height = flickable.height;
|
|
||||||
if (contentHeight > height) {
|
|
||||||
nonAnimPosition = Math.max(0, Math.min(1, flickable.contentY / (contentHeight - height)));
|
|
||||||
} else {
|
|
||||||
nonAnimPosition = 0;
|
|
||||||
}
|
|
||||||
_updatingFromFlickable = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (flickable) {
|
|
||||||
const contentHeight = flickable.contentHeight;
|
|
||||||
const height = flickable.height;
|
|
||||||
if (contentHeight > height) {
|
|
||||||
nonAnimPosition = Math.max(0, Math.min(1, flickable.contentY / (contentHeight - height)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
implicitWidth: 8
|
|
||||||
|
|
||||||
contentItem: CustomRect {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
opacity: {
|
|
||||||
if (root.size === 1)
|
|
||||||
return 0;
|
|
||||||
if (fullMouse.pressed)
|
|
||||||
return 1;
|
|
||||||
if (mouse.containsMouse)
|
|
||||||
return 0.8;
|
|
||||||
if (root.policy === ScrollBar.AlwaysOn || root.shouldBeActive)
|
|
||||||
return 0.6;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
radius: 1000
|
|
||||||
color: DynamicColors.palette.m3secondary
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: mouse
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
hoverEnabled: true
|
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root.flickable
|
|
||||||
|
|
||||||
function onMovingChanged(): void {
|
|
||||||
if (root.flickable.moving)
|
|
||||||
root.shouldBeActive = true;
|
|
||||||
else
|
|
||||||
hideDelay.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: hideDelay
|
|
||||||
|
|
||||||
interval: 600
|
|
||||||
onTriggered: root.shouldBeActive = root.flickable.moving || root.hovered
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomMouseArea {
|
|
||||||
id: fullMouse
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
preventStealing: true
|
|
||||||
|
|
||||||
onPressed: event => {
|
|
||||||
root.animating = true;
|
|
||||||
root._updatingFromUser = true;
|
|
||||||
const newPos = Math.max(0, Math.min(1 - root.size, event.y / root.height - root.size / 2));
|
|
||||||
root.nonAnimPosition = newPos;
|
|
||||||
// Update flickable position
|
|
||||||
// Map scrollbar position [0, 1-size] to contentY [0, maxContentY]
|
|
||||||
if (root.flickable) {
|
|
||||||
const contentHeight = root.flickable.contentHeight;
|
|
||||||
const height = root.flickable.height;
|
|
||||||
if (contentHeight > height) {
|
|
||||||
const maxContentY = contentHeight - height;
|
|
||||||
const maxPos = 1 - root.size;
|
|
||||||
const contentY = maxPos > 0 ? (newPos / maxPos) * maxContentY : 0;
|
|
||||||
root.flickable.contentY = Math.max(0, Math.min(maxContentY, contentY));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPositionChanged: event => {
|
|
||||||
root._updatingFromUser = true;
|
|
||||||
const newPos = Math.max(0, Math.min(1 - root.size, event.y / root.height - root.size / 2));
|
|
||||||
root.nonAnimPosition = newPos;
|
|
||||||
// Update flickable position
|
|
||||||
// Map scrollbar position [0, 1-size] to contentY [0, maxContentY]
|
|
||||||
if (root.flickable) {
|
|
||||||
const contentHeight = root.flickable.contentHeight;
|
|
||||||
const height = root.flickable.height;
|
|
||||||
if (contentHeight > height) {
|
|
||||||
const maxContentY = contentHeight - height;
|
|
||||||
const maxPos = 1 - root.size;
|
|
||||||
const contentY = maxPos > 0 ? (newPos / maxPos) * maxContentY : 0;
|
|
||||||
root.flickable.contentY = Math.max(0, Math.min(maxContentY, contentY));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onWheel(event: WheelEvent): void {
|
|
||||||
root.animating = true;
|
|
||||||
root._updatingFromUser = true;
|
|
||||||
let newPos = root.nonAnimPosition;
|
|
||||||
if (event.angleDelta.y > 0)
|
|
||||||
newPos = Math.max(0, root.nonAnimPosition - 0.1);
|
|
||||||
else if (event.angleDelta.y < 0)
|
|
||||||
newPos = Math.min(1 - root.size, root.nonAnimPosition + 0.1);
|
|
||||||
root.nonAnimPosition = newPos;
|
|
||||||
// Update flickable position
|
|
||||||
// Map scrollbar position [0, 1-size] to contentY [0, maxContentY]
|
|
||||||
if (root.flickable) {
|
|
||||||
const contentHeight = root.flickable.contentHeight;
|
|
||||||
const height = root.flickable.height;
|
|
||||||
if (contentHeight > height) {
|
|
||||||
const maxContentY = contentHeight - height;
|
|
||||||
const maxPos = 1 - root.size;
|
|
||||||
const contentY = maxPos > 0 ? (newPos / maxPos) * maxContentY : 0;
|
|
||||||
root.flickable.contentY = Math.max(0, Math.min(maxContentY, contentY));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on position {
|
|
||||||
enabled: !fullMouse.pressed
|
|
||||||
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import Quickshell.Hyprland
|
|
||||||
|
|
||||||
GlobalShortcut {
|
|
||||||
appid: "zshell"
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Templates
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
Slider {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
background: Item {
|
|
||||||
CustomRect {
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
|
|
||||||
implicitWidth: root.handle.x - root.implicitHeight / 2
|
|
||||||
|
|
||||||
color: DynamicColors.palette.m3primary
|
|
||||||
radius: 1000
|
|
||||||
topRightRadius: root.implicitHeight / 6
|
|
||||||
bottomRightRadius: root.implicitHeight / 6
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
implicitWidth: parent.width - root.handle.x - root.handle.implicitWidth - root.implicitHeight / 2
|
|
||||||
|
|
||||||
color: DynamicColors.tPalette.m3surfaceContainer
|
|
||||||
radius: 1000
|
|
||||||
topLeftRadius: root.implicitHeight / 6
|
|
||||||
bottomLeftRadius: root.implicitHeight / 6
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handle: CustomRect {
|
|
||||||
x: root.visualPosition * root.availableWidth - implicitWidth / 2
|
|
||||||
|
|
||||||
implicitWidth: 5
|
|
||||||
implicitHeight: 15
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
color: DynamicColors.palette.m3primary
|
|
||||||
radius: 1000
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Templates
|
|
||||||
import QtQuick.Shapes
|
|
||||||
|
|
||||||
Switch {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property int cLayer: 1
|
|
||||||
|
|
||||||
implicitWidth: implicitIndicatorWidth
|
|
||||||
implicitHeight: implicitIndicatorHeight
|
|
||||||
|
|
||||||
indicator: CustomRect {
|
|
||||||
radius: 1000
|
|
||||||
color: root.checked ? DynamicColors.palette.m3primary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, root.cLayer)
|
|
||||||
|
|
||||||
implicitWidth: implicitHeight * 1.7
|
|
||||||
implicitHeight: 13 + 7 * 2
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
readonly property real nonAnimWidth: root.pressed ? implicitHeight * 1.3 : implicitHeight
|
|
||||||
|
|
||||||
radius: 1000
|
|
||||||
color: root.checked ? DynamicColors.palette.m3onPrimary : DynamicColors.layer(DynamicColors.palette.m3outline, root.cLayer + 1)
|
|
||||||
|
|
||||||
x: root.checked ? parent.implicitWidth - nonAnimWidth - 10 / 2 : 10 / 2
|
|
||||||
implicitWidth: nonAnimWidth
|
|
||||||
implicitHeight: parent.implicitHeight - 10
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: parent.radius
|
|
||||||
|
|
||||||
color: root.checked ? DynamicColors.palette.m3primary : DynamicColors.palette.m3onSurface
|
|
||||||
opacity: root.pressed ? 0.1 : root.hovered ? 0.08 : 0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on x {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
enabled: false
|
|
||||||
}
|
|
||||||
|
|
||||||
component PropAnim: PropertyAnimation {
|
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
|
||||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool animate: false
|
|
||||||
property string animateProp: "scale"
|
|
||||||
property real animateFrom: 0
|
|
||||||
property real animateTo: 1
|
|
||||||
property int animateDuration: 400
|
|
||||||
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
textFormat: Text.PlainText
|
|
||||||
color: DynamicColors.palette.m3onSurface
|
|
||||||
font.family: Appearance.font.family.sans
|
|
||||||
font.pointSize: 12
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on text {
|
|
||||||
enabled: root.animate
|
|
||||||
|
|
||||||
SequentialAnimation {
|
|
||||||
Anim {
|
|
||||||
to: root.animateFrom
|
|
||||||
easing.bezierCurve: MaterialEasing.standardAccel
|
|
||||||
}
|
|
||||||
PropertyAction {}
|
|
||||||
Anim {
|
|
||||||
to: root.animateTo
|
|
||||||
easing.bezierCurve: MaterialEasing.standardDecel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component Anim: NumberAnimation {
|
|
||||||
target: root
|
|
||||||
property: root.animateProp.split(",").length === 1 ? root.animateProp : ""
|
|
||||||
properties: root.animateProp.split(",").length > 1 ? root.animateProp : ""
|
|
||||||
duration: root.animateDuration / 2
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
color: DynamicColors.palette.m3onSurface
|
|
||||||
placeholderTextColor: DynamicColors.palette.m3outline
|
|
||||||
font.family: Appearance.font.family.sans
|
|
||||||
font.pointSize: Appearance.font.size.smaller
|
|
||||||
renderType: echoMode === TextField.Password ? TextField.QtRendering : TextField.NativeRendering
|
|
||||||
cursorVisible: !readOnly
|
|
||||||
|
|
||||||
background: null
|
|
||||||
|
|
||||||
cursorDelegate: CustomRect {
|
|
||||||
id: cursor
|
|
||||||
|
|
||||||
property bool disableBlink
|
|
||||||
|
|
||||||
implicitWidth: 2
|
|
||||||
color: DynamicColors.palette.m3primary
|
|
||||||
radius: Appearance.rounding.normal
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root
|
|
||||||
|
|
||||||
function onCursorPositionChanged(): void {
|
|
||||||
if (root.activeFocus && root.cursorVisible) {
|
|
||||||
cursor.opacity = 1;
|
|
||||||
cursor.disableBlink = true;
|
|
||||||
enableBlink.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: enableBlink
|
|
||||||
|
|
||||||
interval: 100
|
|
||||||
onTriggered: cursor.disableBlink = false
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
running: root.activeFocus && root.cursorVisible && !cursor.disableBlink
|
|
||||||
repeat: true
|
|
||||||
triggeredOnStart: true
|
|
||||||
interval: 500
|
|
||||||
onTriggered: parent.opacity = parent.opacity === 1 ? 0 : 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Binding {
|
|
||||||
when: !root.activeFocus || !root.cursorVisible
|
|
||||||
cursor.opacity: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {
|
|
||||||
duration: Appearance.anim.durations.small
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on placeholderTextColor {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import qs.Components
|
|
||||||
|
|
||||||
ToolTip {
|
|
||||||
id: root
|
|
||||||
property bool extraVisibleCondition: true
|
|
||||||
property bool alternativeVisibleCondition: false
|
|
||||||
readonly property bool internalVisibleCondition: (extraVisibleCondition && (parent.hovered === undefined || parent?.hovered)) || alternativeVisibleCondition
|
|
||||||
verticalPadding: 5
|
|
||||||
horizontalPadding: 10
|
|
||||||
background: null
|
|
||||||
|
|
||||||
visible: internalVisibleCondition
|
|
||||||
|
|
||||||
contentItem: CustomTooltipContent {
|
|
||||||
id: contentItem
|
|
||||||
text: root.text
|
|
||||||
shown: root.internalVisibleCondition
|
|
||||||
horizontalPadding: root.horizontalPadding
|
|
||||||
verticalPadding: root.verticalPadding
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Components
|
|
||||||
import qs.Modules
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
required property string text
|
|
||||||
property bool shown: false
|
|
||||||
property real horizontalPadding: 10
|
|
||||||
property real verticalPadding: 5
|
|
||||||
implicitWidth: tooltipTextObject.implicitWidth + 2 * root.horizontalPadding
|
|
||||||
implicitHeight: tooltipTextObject.implicitHeight + 2 * root.verticalPadding
|
|
||||||
|
|
||||||
property bool isVisible: backgroundRectangle.implicitHeight > 0
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: backgroundRectangle
|
|
||||||
anchors {
|
|
||||||
bottom: root.bottom
|
|
||||||
horizontalCenter: root.horizontalCenter
|
|
||||||
}
|
|
||||||
color: DynamicColors.tPalette.m3inverseSurface ?? "#3C4043"
|
|
||||||
radius: 8
|
|
||||||
opacity: shown ? 1 : 0
|
|
||||||
implicitWidth: shown ? (tooltipTextObject.implicitWidth + 2 * root.horizontalPadding) : 0
|
|
||||||
implicitHeight: shown ? (tooltipTextObject.implicitHeight + 2 * root.verticalPadding) : 0
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
Behavior on implicitHeight {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
id: tooltipTextObject
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: root.text
|
|
||||||
color: DynamicColors.palette.m3inverseOnSurface ?? "#FFFFFF"
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Effects
|
|
||||||
|
|
||||||
RectangularShadow {
|
|
||||||
property int level
|
|
||||||
property real dp: [0, 1, 3, 6, 8, 12][level]
|
|
||||||
|
|
||||||
color: Qt.alpha(DynamicColors.palette.m3shadow, 0.7)
|
|
||||||
blur: (dp * 5) ** 0.7
|
|
||||||
spread: -dp * 0.3 + (dp * 0.1) ** 2
|
|
||||||
offset.y: dp / 2
|
|
||||||
|
|
||||||
Behavior on dp {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
required property int extra
|
|
||||||
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.margins: 8
|
|
||||||
|
|
||||||
color: DynamicColors.palette.m3tertiary
|
|
||||||
radius: 8
|
|
||||||
|
|
||||||
implicitWidth: count.implicitWidth + 8 * 2
|
|
||||||
implicitHeight: count.implicitHeight + 4 * 2
|
|
||||||
|
|
||||||
opacity: extra > 0 ? 1 : 0
|
|
||||||
scale: extra > 0 ? 1 : 0.5
|
|
||||||
|
|
||||||
Elevation {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: parent.radius
|
|
||||||
opacity: parent.opacity
|
|
||||||
z: -1
|
|
||||||
level: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
id: count
|
|
||||||
|
|
||||||
anchors.centerIn: parent
|
|
||||||
animate: parent.opacity > 0
|
|
||||||
text: qsTr("+%1").arg(parent.extra)
|
|
||||||
color: DynamicColors.palette.m3onTertiary
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {
|
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on scale {
|
|
||||||
Anim {
|
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
|
||||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Templates
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
|
|
||||||
Slider {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property string icon
|
|
||||||
property real oldValue
|
|
||||||
property bool initialized
|
|
||||||
property color color: DynamicColors.palette.m3secondary
|
|
||||||
|
|
||||||
orientation: Qt.Vertical
|
|
||||||
|
|
||||||
background: CustomRect {
|
|
||||||
color: DynamicColors.layer(DynamicColors.palette.m3surfaceContainer, 2)
|
|
||||||
radius: Appearance.rounding.full
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
y: root.handle.y
|
|
||||||
implicitHeight: parent.height - y
|
|
||||||
|
|
||||||
color: root.color
|
|
||||||
radius: parent.radius
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handle: Item {
|
|
||||||
id: handle
|
|
||||||
|
|
||||||
property alias moving: icon.moving
|
|
||||||
|
|
||||||
y: root.visualPosition * (root.availableHeight - height)
|
|
||||||
implicitWidth: root.width
|
|
||||||
implicitHeight: root.width
|
|
||||||
|
|
||||||
Elevation {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: rect.radius
|
|
||||||
level: handleInteraction.containsMouse ? 2 : 1
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
id: rect
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
color: DynamicColors.palette.m3inverseSurface
|
|
||||||
radius: Appearance.rounding.full
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: handleInteraction
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
}
|
|
||||||
|
|
||||||
MaterialIcon {
|
|
||||||
id: icon
|
|
||||||
|
|
||||||
property bool moving
|
|
||||||
|
|
||||||
function update(): void {
|
|
||||||
animate = !moving;
|
|
||||||
binding.when = moving;
|
|
||||||
font.pointSize = moving ? Appearance.font.size.small : Appearance.font.size.larger;
|
|
||||||
font.family = moving ? Appearance.font.family.sans : Appearance.font.family.material;
|
|
||||||
}
|
|
||||||
|
|
||||||
text: root.icon
|
|
||||||
color: DynamicColors.palette.m3inverseOnSurface
|
|
||||||
anchors.centerIn: parent
|
|
||||||
|
|
||||||
onMovingChanged: anim.restart()
|
|
||||||
|
|
||||||
Binding {
|
|
||||||
id: binding
|
|
||||||
|
|
||||||
target: icon
|
|
||||||
property: "text"
|
|
||||||
value: Math.round(root.value * 100)
|
|
||||||
when: false
|
|
||||||
}
|
|
||||||
|
|
||||||
SequentialAnimation {
|
|
||||||
id: anim
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
target: icon
|
|
||||||
property: "scale"
|
|
||||||
to: 0
|
|
||||||
duration: Appearance.anim.durations.normal / 2
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.standardAccel
|
|
||||||
}
|
|
||||||
ScriptAction {
|
|
||||||
script: icon.update()
|
|
||||||
}
|
|
||||||
Anim {
|
|
||||||
target: icon
|
|
||||||
property: "scale"
|
|
||||||
to: 1
|
|
||||||
duration: Appearance.anim.durations.normal / 2
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPressedChanged: handle.moving = pressed
|
|
||||||
|
|
||||||
onValueChanged: {
|
|
||||||
if (!initialized) {
|
|
||||||
initialized = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Math.abs(value - oldValue) < 0.01)
|
|
||||||
return;
|
|
||||||
oldValue = value;
|
|
||||||
handle.moving = true;
|
|
||||||
stateChangeDelay.restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: stateChangeDelay
|
|
||||||
|
|
||||||
interval: 500
|
|
||||||
onTriggered: {
|
|
||||||
if (!root.pressed)
|
|
||||||
handle.moving = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on value {
|
|
||||||
Anim {
|
|
||||||
duration: Appearance.anim.durations.large
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
enum Type {
|
|
||||||
Filled,
|
|
||||||
Tonal,
|
|
||||||
Text
|
|
||||||
}
|
|
||||||
|
|
||||||
property alias icon: label.text
|
|
||||||
property bool checked
|
|
||||||
property bool toggle
|
|
||||||
property real padding: type === IconButton.Text ? 10 / 2 : 7
|
|
||||||
property alias font: label.font
|
|
||||||
property int type: IconButton.Filled
|
|
||||||
property bool disabled
|
|
||||||
|
|
||||||
property alias stateLayer: stateLayer
|
|
||||||
property alias label: label
|
|
||||||
property alias radiusAnim: radiusAnim
|
|
||||||
|
|
||||||
property bool internalChecked
|
|
||||||
property color activeColour: type === IconButton.Filled ? DynamicColors.palette.m3primary : DynamicColors.palette.m3secondary
|
|
||||||
property color inactiveColour: {
|
|
||||||
if (!toggle && type === IconButton.Filled)
|
|
||||||
return DynamicColors.palette.m3primary;
|
|
||||||
return type === IconButton.Filled ? DynamicColors.tPalette.m3surfaceContainer : DynamicColors.palette.m3secondaryContainer;
|
|
||||||
}
|
|
||||||
property color activeOnColour: type === IconButton.Filled ? DynamicColors.palette.m3onPrimary : type === IconButton.Tonal ? DynamicColors.palette.m3onSecondary : DynamicColors.palette.m3primary
|
|
||||||
property color inactiveOnColour: {
|
|
||||||
if (!toggle && type === IconButton.Filled)
|
|
||||||
return DynamicColors.palette.m3onPrimary;
|
|
||||||
return type === IconButton.Tonal ? DynamicColors.palette.m3onSecondaryContainer : DynamicColors.palette.m3onSurfaceVariant;
|
|
||||||
}
|
|
||||||
property color disabledColour: Qt.alpha(DynamicColors.palette.m3onSurface, 0.1)
|
|
||||||
property color disabledOnColour: Qt.alpha(DynamicColors.palette.m3onSurface, 0.38)
|
|
||||||
|
|
||||||
signal clicked
|
|
||||||
|
|
||||||
onCheckedChanged: internalChecked = checked
|
|
||||||
|
|
||||||
radius: internalChecked ? 6 : implicitHeight / 2 * Math.min(1, 1)
|
|
||||||
color: type === IconButton.Text ? "transparent" : disabled ? disabledColour : internalChecked ? activeColour : inactiveColour
|
|
||||||
|
|
||||||
implicitWidth: implicitHeight
|
|
||||||
implicitHeight: label.implicitHeight + padding * 2
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
id: stateLayer
|
|
||||||
|
|
||||||
color: root.internalChecked ? root.activeOnColour : root.inactiveOnColour
|
|
||||||
disabled: root.disabled
|
|
||||||
|
|
||||||
function onClicked(): void {
|
|
||||||
if (root.toggle)
|
|
||||||
root.internalChecked = !root.internalChecked;
|
|
||||||
root.clicked();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MaterialIcon {
|
|
||||||
id: label
|
|
||||||
|
|
||||||
anchors.centerIn: parent
|
|
||||||
color: root.disabled ? root.disabledOnColour : root.internalChecked ? root.activeOnColour : root.inactiveOnColour
|
|
||||||
fill: !root.toggle || root.internalChecked ? 1 : 0
|
|
||||||
|
|
||||||
Behavior on fill {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on radius {
|
|
||||||
Anim {
|
|
||||||
id: radiusAnim
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import qs.Config
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
property real fill
|
|
||||||
property int grade: DynamicColors.light ? 0 : -25
|
|
||||||
|
|
||||||
font.family: "Material Symbols Rounded"
|
|
||||||
font.pointSize: 15
|
|
||||||
font.variableAxes: ({
|
|
||||||
FILL: fill.toFixed(1),
|
|
||||||
GRAD: grade,
|
|
||||||
opsz: fontInfo.pixelSize,
|
|
||||||
wght: fontInfo.weight
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
ShaderEffect {
|
|
||||||
required property Item source
|
|
||||||
required property Item maskSource
|
|
||||||
|
|
||||||
fragmentShader: Qt.resolvedUrl(`${Quickshell.shellDir}/assets/shaders/opacitymask.frag.qsb`)
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
required property var service
|
|
||||||
|
|
||||||
Component.onCompleted: service.refCount++
|
|
||||||
Component.onDestruction: service.refCount--
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool disabled
|
|
||||||
property color color: DynamicColors.palette.m3onSurface
|
|
||||||
property real radius: parent?.radius ?? 0
|
|
||||||
property alias rect: hoverLayer
|
|
||||||
|
|
||||||
function onClicked(): void {
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
enabled: !disabled
|
|
||||||
cursorShape: disabled ? undefined : Qt.PointingHandCursor
|
|
||||||
hoverEnabled: true
|
|
||||||
|
|
||||||
onPressed: event => {
|
|
||||||
if (disabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
rippleAnim.x = event.x;
|
|
||||||
rippleAnim.y = event.y;
|
|
||||||
|
|
||||||
const dist = (ox, oy) => ox * ox + oy * oy;
|
|
||||||
rippleAnim.radius = Math.sqrt(Math.max(dist(event.x, event.y), dist(event.x, height - event.y), dist(width - event.x, event.y), dist(width - event.x, height - event.y)));
|
|
||||||
|
|
||||||
rippleAnim.restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: event => !disabled && onClicked(event)
|
|
||||||
|
|
||||||
SequentialAnimation {
|
|
||||||
id: rippleAnim
|
|
||||||
|
|
||||||
property real x
|
|
||||||
property real y
|
|
||||||
property real radius
|
|
||||||
|
|
||||||
PropertyAction {
|
|
||||||
target: ripple
|
|
||||||
property: "x"
|
|
||||||
value: rippleAnim.x
|
|
||||||
}
|
|
||||||
PropertyAction {
|
|
||||||
target: ripple
|
|
||||||
property: "y"
|
|
||||||
value: rippleAnim.y
|
|
||||||
}
|
|
||||||
PropertyAction {
|
|
||||||
target: ripple
|
|
||||||
property: "opacity"
|
|
||||||
value: 0.08
|
|
||||||
}
|
|
||||||
Anim {
|
|
||||||
target: ripple
|
|
||||||
properties: "implicitWidth,implicitHeight"
|
|
||||||
from: 0
|
|
||||||
to: rippleAnim.radius * 2
|
|
||||||
easing.bezierCurve: MaterialEasing.standardDecel
|
|
||||||
}
|
|
||||||
Anim {
|
|
||||||
target: ripple
|
|
||||||
property: "opacity"
|
|
||||||
to: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomClippingRect {
|
|
||||||
id: hoverLayer
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
border.pixelAligned: false
|
|
||||||
|
|
||||||
color: Qt.alpha(root.color, root.disabled ? 0 : root.pressed ? 0.1 : root.containsMouse ? 0.08 : 0)
|
|
||||||
radius: root.radius
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
id: ripple
|
|
||||||
|
|
||||||
radius: 1000
|
|
||||||
color: root.color
|
|
||||||
opacity: 0
|
|
||||||
border.pixelAligned: false
|
|
||||||
|
|
||||||
transform: Translate {
|
|
||||||
x: -ripple.width / 2
|
|
||||||
y: -ripple.height / 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,135 +0,0 @@
|
|||||||
import ZShell
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import qs.Modules
|
|
||||||
import qs.Components
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property Toast modelData
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
implicitHeight: layout.implicitHeight + Appearance.padding.smaller * 2
|
|
||||||
|
|
||||||
radius: Appearance.rounding.normal
|
|
||||||
color: {
|
|
||||||
if (root.modelData.type === Toast.Success)
|
|
||||||
return DynamicColors.palette.m3successContainer;
|
|
||||||
if (root.modelData.type === Toast.Warning)
|
|
||||||
return DynamicColors.palette.m3secondary;
|
|
||||||
if (root.modelData.type === Toast.Error)
|
|
||||||
return DynamicColors.palette.m3errorContainer;
|
|
||||||
return DynamicColors.palette.m3surface;
|
|
||||||
}
|
|
||||||
|
|
||||||
border.width: 1
|
|
||||||
border.color: {
|
|
||||||
let colour = DynamicColors.palette.m3outlineVariant;
|
|
||||||
if (root.modelData.type === Toast.Success)
|
|
||||||
colour = DynamicColors.palette.m3success;
|
|
||||||
if (root.modelData.type === Toast.Warning)
|
|
||||||
colour = DynamicColors.palette.m3secondaryContainer;
|
|
||||||
if (root.modelData.type === Toast.Error)
|
|
||||||
colour = DynamicColors.palette.m3error;
|
|
||||||
return Qt.alpha(colour, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
Elevation {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: parent.radius
|
|
||||||
opacity: parent.opacity
|
|
||||||
z: -1
|
|
||||||
level: 3
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: layout
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Appearance.padding.smaller
|
|
||||||
anchors.leftMargin: Appearance.padding.normal
|
|
||||||
anchors.rightMargin: Appearance.padding.normal
|
|
||||||
spacing: Appearance.spacing.normal
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
radius: Appearance.rounding.normal
|
|
||||||
color: {
|
|
||||||
if (root.modelData.type === Toast.Success)
|
|
||||||
return DynamicColors.palette.m3success;
|
|
||||||
if (root.modelData.type === Toast.Warning)
|
|
||||||
return DynamicColors.palette.m3secondaryContainer;
|
|
||||||
if (root.modelData.type === Toast.Error)
|
|
||||||
return DynamicColors.palette.m3error;
|
|
||||||
return DynamicColors.palette.m3surfaceContainerHigh;
|
|
||||||
}
|
|
||||||
|
|
||||||
implicitWidth: implicitHeight
|
|
||||||
implicitHeight: icon.implicitHeight + Appearance.padding.smaller * 2
|
|
||||||
|
|
||||||
MaterialIcon {
|
|
||||||
id: icon
|
|
||||||
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: root.modelData.icon
|
|
||||||
color: {
|
|
||||||
if (root.modelData.type === Toast.Success)
|
|
||||||
return DynamicColors.palette.m3onSuccess;
|
|
||||||
if (root.modelData.type === Toast.Warning)
|
|
||||||
return DynamicColors.palette.m3onSecondaryContainer;
|
|
||||||
if (root.modelData.type === Toast.Error)
|
|
||||||
return DynamicColors.palette.m3onError;
|
|
||||||
return DynamicColors.palette.m3onSurfaceVariant;
|
|
||||||
}
|
|
||||||
font.pointSize: Math.round(Appearance.font.size.large * 1.2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
id: title
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: root.modelData.title
|
|
||||||
color: {
|
|
||||||
if (root.modelData.type === Toast.Success)
|
|
||||||
return DynamicColors.palette.m3onSuccessContainer;
|
|
||||||
if (root.modelData.type === Toast.Warning)
|
|
||||||
return DynamicColors.palette.m3onSecondary;
|
|
||||||
if (root.modelData.type === Toast.Error)
|
|
||||||
return DynamicColors.palette.m3onErrorContainer;
|
|
||||||
return DynamicColors.palette.m3onSurface;
|
|
||||||
}
|
|
||||||
font.pointSize: Appearance.font.size.normal
|
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
textFormat: Text.StyledText
|
|
||||||
text: root.modelData.message
|
|
||||||
color: {
|
|
||||||
if (root.modelData.type === Toast.Success)
|
|
||||||
return DynamicColors.palette.m3onSuccessContainer;
|
|
||||||
if (root.modelData.type === Toast.Warning)
|
|
||||||
return DynamicColors.palette.m3onSecondary;
|
|
||||||
if (root.modelData.type === Toast.Error)
|
|
||||||
return DynamicColors.palette.m3onErrorContainer;
|
|
||||||
return DynamicColors.palette.m3onSurface;
|
|
||||||
}
|
|
||||||
opacity: 0.8
|
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on border.color {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import qs.Components
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import ZShell
|
|
||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
readonly property int spacing: Appearance.spacing.small
|
|
||||||
property bool flag
|
|
||||||
|
|
||||||
implicitWidth: Config.utilities.sizes.toastWidth - Appearance.padding.normal * 2
|
|
||||||
implicitHeight: {
|
|
||||||
let h = -spacing;
|
|
||||||
for (let i = 0; i < repeater.count; i++) {
|
|
||||||
const item = repeater.itemAt(i) as ToastWrapper;
|
|
||||||
if (!item.modelData.closed && !item.previewHidden)
|
|
||||||
h += item.implicitHeight + spacing;
|
|
||||||
}
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
id: repeater
|
|
||||||
|
|
||||||
model: ScriptModel {
|
|
||||||
values: {
|
|
||||||
const toasts = [];
|
|
||||||
let count = 0;
|
|
||||||
for (const toast of Toaster.toasts) {
|
|
||||||
toasts.push(toast);
|
|
||||||
if (!toast.closed) {
|
|
||||||
count++;
|
|
||||||
if (count > Config.utilities.maxToasts)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return toasts;
|
|
||||||
}
|
|
||||||
onValuesChanged: root.flagChanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
ToastWrapper {}
|
|
||||||
}
|
|
||||||
|
|
||||||
component ToastWrapper: MouseArea {
|
|
||||||
id: toast
|
|
||||||
|
|
||||||
required property int index
|
|
||||||
required property Toast modelData
|
|
||||||
|
|
||||||
readonly property bool previewHidden: {
|
|
||||||
let extraHidden = 0;
|
|
||||||
for (let i = 0; i < index; i++)
|
|
||||||
if (Toaster.toasts[i].closed)
|
|
||||||
extraHidden++;
|
|
||||||
return index >= Config.utilities.maxToasts + extraHidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
onPreviewHiddenChanged: {
|
|
||||||
if (initAnim.running && previewHidden)
|
|
||||||
initAnim.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
opacity: modelData.closed || previewHidden ? 0 : 1
|
|
||||||
scale: modelData.closed || previewHidden ? 0.7 : 1
|
|
||||||
|
|
||||||
anchors.bottomMargin: {
|
|
||||||
root.flag; // Force update
|
|
||||||
let y = 0;
|
|
||||||
for (let i = 0; i < index; i++) {
|
|
||||||
const item = repeater.itemAt(i) as ToastWrapper;
|
|
||||||
if (item && !item.modelData.closed && !item.previewHidden)
|
|
||||||
y += item.implicitHeight + root.spacing;
|
|
||||||
}
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
implicitHeight: toastInner.implicitHeight
|
|
||||||
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
|
||||||
onClicked: modelData.close()
|
|
||||||
|
|
||||||
Component.onCompleted: modelData.lock(this)
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
id: initAnim
|
|
||||||
|
|
||||||
Component.onCompleted: running = !toast.previewHidden
|
|
||||||
|
|
||||||
target: toast
|
|
||||||
properties: "opacity,scale"
|
|
||||||
from: 0
|
|
||||||
to: 1
|
|
||||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
|
||||||
}
|
|
||||||
|
|
||||||
ParallelAnimation {
|
|
||||||
running: toast.modelData.closed
|
|
||||||
onStarted: toast.anchors.bottomMargin = toast.anchors.bottomMargin
|
|
||||||
onFinished: toast.modelData.unlock(toast)
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
target: toast
|
|
||||||
property: "opacity"
|
|
||||||
to: 0
|
|
||||||
}
|
|
||||||
Anim {
|
|
||||||
target: toast
|
|
||||||
property: "scale"
|
|
||||||
to: 0.7
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ToastItem {
|
|
||||||
id: toastInner
|
|
||||||
|
|
||||||
modelData: toast.modelData
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on scale {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on anchors.bottomMargin {
|
|
||||||
Anim {
|
|
||||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property Accents accents: Accents {}
|
|
||||||
|
|
||||||
component Accents: JsonObject {
|
|
||||||
property string primary: "#4080ff"
|
|
||||||
property string primaryAlt: "#60a0ff"
|
|
||||||
property string warning: "#ff6b6b"
|
|
||||||
property string warningAlt: "#ff8787"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
// Literally just here to shorten accessing stuff :woe:
|
|
||||||
// Also kinda so I can keep accessing it with `Appearance.xxx` instead of `Conf.appearance.xxx`
|
|
||||||
readonly property AppearanceConf.Rounding rounding: Config.appearance.rounding
|
|
||||||
readonly property AppearanceConf.Spacing spacing: Config.appearance.spacing
|
|
||||||
readonly property AppearanceConf.Padding padding: Config.appearance.padding
|
|
||||||
readonly property AppearanceConf.FontStuff font: Config.appearance.font
|
|
||||||
readonly property AppearanceConf.Anim anim: Config.appearance.anim
|
|
||||||
readonly property AppearanceConf.Transparency transparency: Config.appearance.transparency
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property Rounding rounding: Rounding {}
|
|
||||||
property Spacing spacing: Spacing {}
|
|
||||||
property Padding padding: Padding {}
|
|
||||||
property FontStuff font: FontStuff {}
|
|
||||||
property Anim anim: Anim {}
|
|
||||||
property Transparency transparency: Transparency {}
|
|
||||||
|
|
||||||
component Rounding: JsonObject {
|
|
||||||
property real scale: 1
|
|
||||||
property int small: 12 * scale
|
|
||||||
property int normal: 17 * scale
|
|
||||||
property int large: 25 * scale
|
|
||||||
property int full: 1000 * scale
|
|
||||||
}
|
|
||||||
|
|
||||||
component Spacing: JsonObject {
|
|
||||||
property real scale: 1
|
|
||||||
property int small: 7 * scale
|
|
||||||
property int smaller: 10 * scale
|
|
||||||
property int normal: 12 * scale
|
|
||||||
property int larger: 15 * scale
|
|
||||||
property int large: 20 * scale
|
|
||||||
}
|
|
||||||
|
|
||||||
component Padding: JsonObject {
|
|
||||||
property real scale: 1
|
|
||||||
property int small: 5 * scale
|
|
||||||
property int smaller: 7 * scale
|
|
||||||
property int normal: 10 * scale
|
|
||||||
property int larger: 12 * scale
|
|
||||||
property int large: 15 * scale
|
|
||||||
}
|
|
||||||
|
|
||||||
component FontFamily: JsonObject {
|
|
||||||
property string sans: "Segoe UI Variable Text"
|
|
||||||
property string mono: "CaskaydiaCove NF"
|
|
||||||
property string material: "Material Symbols Rounded"
|
|
||||||
property string clock: "Rubik"
|
|
||||||
}
|
|
||||||
|
|
||||||
component FontSize: JsonObject {
|
|
||||||
property real scale: 1
|
|
||||||
property int small: 11 * scale
|
|
||||||
property int smaller: 12 * scale
|
|
||||||
property int normal: 13 * scale
|
|
||||||
property int larger: 15 * scale
|
|
||||||
property int large: 18 * scale
|
|
||||||
property int extraLarge: 28 * scale
|
|
||||||
}
|
|
||||||
|
|
||||||
component FontStuff: JsonObject {
|
|
||||||
property FontFamily family: FontFamily {}
|
|
||||||
property FontSize size: FontSize {}
|
|
||||||
}
|
|
||||||
|
|
||||||
component AnimCurves: JsonObject {
|
|
||||||
property list<real> emphasized: [0.05, 0, 2 / 15, 0.06, 1 / 6, 0.4, 5 / 24, 0.82, 0.25, 1, 1, 1]
|
|
||||||
property list<real> emphasizedAccel: [0.3, 0, 0.8, 0.15, 1, 1]
|
|
||||||
property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1]
|
|
||||||
property list<real> standard: [0.2, 0, 0, 1, 1, 1]
|
|
||||||
property list<real> standardAccel: [0.3, 0, 1, 1, 1, 1]
|
|
||||||
property list<real> standardDecel: [0, 0, 0, 1, 1, 1]
|
|
||||||
property list<real> expressiveFastSpatial: [0.42, 1.67, 0.21, 0.9, 1, 1]
|
|
||||||
property list<real> expressiveDefaultSpatial: [0.38, 1.21, 0.22, 1, 1, 1]
|
|
||||||
property list<real> expressiveEffects: [0.34, 0.8, 0.34, 1, 1, 1]
|
|
||||||
}
|
|
||||||
|
|
||||||
component AnimDurations: JsonObject {
|
|
||||||
property real scale: 1
|
|
||||||
property int small: 200 * scale
|
|
||||||
property int normal: 400 * scale
|
|
||||||
property int large: 600 * scale
|
|
||||||
property int extraLarge: 1000 * scale
|
|
||||||
property int expressiveFastSpatial: 350 * scale
|
|
||||||
property int expressiveDefaultSpatial: 500 * scale
|
|
||||||
property int expressiveEffects: 200 * scale
|
|
||||||
}
|
|
||||||
|
|
||||||
component Anim: JsonObject {
|
|
||||||
property real mediaGifSpeedAdjustment: 300
|
|
||||||
property real sessionGifSpeed: 0.7
|
|
||||||
property AnimCurves curves: AnimCurves {}
|
|
||||||
property AnimDurations durations: AnimDurations {}
|
|
||||||
}
|
|
||||||
|
|
||||||
component Transparency: JsonObject {
|
|
||||||
property bool enabled: false
|
|
||||||
property real base: 0.85
|
|
||||||
property real layers: 0.4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property int wallFadeDuration: MaterialEasing.standardTime
|
|
||||||
property bool enabled: true
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property bool autoHide: false
|
|
||||||
property int rounding: 8
|
|
||||||
property Popouts popouts: Popouts {}
|
|
||||||
|
|
||||||
property list<var> entries: [
|
|
||||||
{
|
|
||||||
id: "workspaces",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "audio",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "resources",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "updates",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "dash",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "spacer",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "activeWindow",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "spacer",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "tray",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "upower",
|
|
||||||
enabled: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "network",
|
|
||||||
enabled: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "clock",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "notifBell",
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
component Popouts: JsonObject {
|
|
||||||
property bool tray: true
|
|
||||||
property bool audio: true
|
|
||||||
property bool activeWindow: true
|
|
||||||
property bool resources: true
|
|
||||||
property bool clock: true
|
|
||||||
property bool network: true
|
|
||||||
property bool upower: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property string schemeType: "vibrant"
|
|
||||||
}
|
|
||||||
@@ -1,380 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import ZShell
|
|
||||||
import QtQuick
|
|
||||||
import qs.Modules as Modules
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Paths
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property alias background: adapter.background
|
|
||||||
property alias barConfig: adapter.barConfig
|
|
||||||
property alias lock: adapter.lock
|
|
||||||
property alias overview: adapter.overview
|
|
||||||
property alias services: adapter.services
|
|
||||||
property alias notifs: adapter.notifs
|
|
||||||
property alias sidebar: adapter.sidebar
|
|
||||||
property alias utilities: adapter.utilities
|
|
||||||
property alias general: adapter.general
|
|
||||||
property alias dashboard: adapter.dashboard
|
|
||||||
property alias appearance: adapter.appearance
|
|
||||||
property alias osd: adapter.osd
|
|
||||||
property alias launcher: adapter.launcher
|
|
||||||
property alias colors: adapter.colors
|
|
||||||
|
|
||||||
function save(): void {
|
|
||||||
saveTimer.restart();
|
|
||||||
recentlySaved = true;
|
|
||||||
recentSaveCooldown.restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
property bool recentlySaved: false
|
|
||||||
|
|
||||||
ElapsedTimer {
|
|
||||||
id: timer
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: saveTimer
|
|
||||||
|
|
||||||
interval: 500
|
|
||||||
onTriggered: {
|
|
||||||
timer.restart();
|
|
||||||
try {
|
|
||||||
let config = {};
|
|
||||||
try {
|
|
||||||
config = JSON.parse(fileView.text());
|
|
||||||
} catch (e) {
|
|
||||||
config = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
config = root.serializeConfig();
|
|
||||||
|
|
||||||
fileView.setText(JSON.stringify(config, null, 4));
|
|
||||||
} catch (e) {
|
|
||||||
Toaster.toast(qsTr("Failed to serialize config"), e.message, "settings_alert", Toast.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: recentSaveCooldown
|
|
||||||
|
|
||||||
interval: 2000
|
|
||||||
onTriggered: {
|
|
||||||
root.recentlySaved = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeConfig(): var {
|
|
||||||
return {
|
|
||||||
barConfig: serializeBar(),
|
|
||||||
lock: serializeLock(),
|
|
||||||
general: serializeGeneral(),
|
|
||||||
services: serializeServices(),
|
|
||||||
notifs: serializeNotifs(),
|
|
||||||
sidebar: serializeSidebar(),
|
|
||||||
utilities: serializeUtilities(),
|
|
||||||
dashboard: serializeDashboard(),
|
|
||||||
appearance: serializeAppearance(),
|
|
||||||
osd: serializeOsd(),
|
|
||||||
background: serializeBackground(),
|
|
||||||
launcher: serializeLauncher(),
|
|
||||||
colors: serializeColors()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeBar(): var {
|
|
||||||
return {
|
|
||||||
autoHide: barConfig.autoHide,
|
|
||||||
rounding: barConfig.rounding,
|
|
||||||
popouts: {
|
|
||||||
tray: barConfig.popouts.tray,
|
|
||||||
audio: barConfig.popouts.audio,
|
|
||||||
activeWindow: barConfig.popouts.activeWindow,
|
|
||||||
resources: barConfig.popouts.resources,
|
|
||||||
clock: barConfig.popouts.clock,
|
|
||||||
network: barConfig.popouts.network,
|
|
||||||
upower: barConfig.popouts.upower
|
|
||||||
},
|
|
||||||
entries: barConfig.entries
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeLock(): var {
|
|
||||||
return {
|
|
||||||
recolorLogo: lock.recolorLogo,
|
|
||||||
enableFprint: lock.enableFprint,
|
|
||||||
maxFprintTries: lock.maxFprintTries,
|
|
||||||
blurAmount: lock.blurAmount,
|
|
||||||
sizes: {
|
|
||||||
heightMult: lock.sizes.heightMult,
|
|
||||||
ratio: lock.sizes.ratio,
|
|
||||||
centerWidth: lock.sizes.centerWidth
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeGeneral(): var {
|
|
||||||
return {
|
|
||||||
logo: general.logo,
|
|
||||||
wallpaperPath: general.wallpaperPath,
|
|
||||||
color: {
|
|
||||||
wallust: general.color.wallust,
|
|
||||||
mode: general.color.mode,
|
|
||||||
schemeGeneration: general.color.schemeGeneration,
|
|
||||||
scheduleDarkStart: general.color.scheduleDarkStart,
|
|
||||||
scheduleDarkEnd: general.color.scheduleDarkEnd,
|
|
||||||
neovimColors: general.color.neovimColors
|
|
||||||
},
|
|
||||||
apps: {
|
|
||||||
terminal: general.apps.terminal,
|
|
||||||
audio: general.apps.audio,
|
|
||||||
playback: general.apps.playback,
|
|
||||||
explorer: general.apps.explorer,
|
|
||||||
},
|
|
||||||
idle: {
|
|
||||||
timouts: general.idle.timeouts
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeServices(): var {
|
|
||||||
return {
|
|
||||||
weatherLocation: services.weatherLocation,
|
|
||||||
useFahrenheit: services.useFahrenheit,
|
|
||||||
useTwelveHourClock: services.useTwelveHourClock,
|
|
||||||
gpuType: services.gpuType,
|
|
||||||
audioIncrement: services.audioIncrement,
|
|
||||||
brightnessIncrement: services.brightnessIncrement,
|
|
||||||
maxVolume: services.maxVolume,
|
|
||||||
defaultPlayer: services.defaultPlayer,
|
|
||||||
playerAliases: services.playerAliases
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeNotifs(): var {
|
|
||||||
return {
|
|
||||||
expire: notifs.expire,
|
|
||||||
defaultExpireTimeout: notifs.defaultExpireTimeout,
|
|
||||||
clearThreshold: notifs.clearThreshold,
|
|
||||||
expandThreshold: notifs.expandThreshold,
|
|
||||||
actionOnClick: notifs.actionOnClick,
|
|
||||||
groupPreviewNum: notifs.groupPreviewNum,
|
|
||||||
sizes: {
|
|
||||||
width: notifs.sizes.width,
|
|
||||||
image: notifs.sizes.image,
|
|
||||||
badge: notifs.sizes.badge
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeSidebar(): var {
|
|
||||||
return {
|
|
||||||
enabled: sidebar.enabled,
|
|
||||||
sizes: {
|
|
||||||
width: sidebar.sizes.width
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeUtilities(): var {
|
|
||||||
return {
|
|
||||||
enabled: utilities.enabled,
|
|
||||||
maxToasts: utilities.maxToasts,
|
|
||||||
sizes: {
|
|
||||||
width: utilities.sizes.width,
|
|
||||||
toastWidth: utilities.sizes.toastWidth
|
|
||||||
},
|
|
||||||
toasts: {
|
|
||||||
configLoaded: utilities.toasts.configLoaded,
|
|
||||||
chargingChanged: utilities.toasts.chargingChanged,
|
|
||||||
gameModeChanged: utilities.toasts.gameModeChanged,
|
|
||||||
dndChanged: utilities.toasts.dndChanged,
|
|
||||||
audioOutputChanged: utilities.toasts.audioOutputChanged,
|
|
||||||
audioInputChanged: utilities.toasts.audioInputChanged,
|
|
||||||
capsLockChanged: utilities.toasts.capsLockChanged,
|
|
||||||
numLockChanged: utilities.toasts.numLockChanged,
|
|
||||||
kbLayoutChanged: utilities.toasts.kbLayoutChanged,
|
|
||||||
vpnChanged: utilities.toasts.vpnChanged,
|
|
||||||
nowPlaying: utilities.toasts.nowPlaying
|
|
||||||
},
|
|
||||||
vpn: {
|
|
||||||
enabled: utilities.vpn.enabled,
|
|
||||||
provider: utilities.vpn.provider
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeDashboard(): var {
|
|
||||||
return {
|
|
||||||
enabled: dashboard.enabled,
|
|
||||||
mediaUpdateInterval: dashboard.mediaUpdateInterval,
|
|
||||||
dragThreshold: dashboard.dragThreshold,
|
|
||||||
sizes: {
|
|
||||||
tabIndicatorHeight: dashboard.sizes.tabIndicatorHeight,
|
|
||||||
tabIndicatorSpacing: dashboard.sizes.tabIndicatorSpacing,
|
|
||||||
infoWidth: dashboard.sizes.infoWidth,
|
|
||||||
infoIconSize: dashboard.sizes.infoIconSize,
|
|
||||||
dateTimeWidth: dashboard.sizes.dateTimeWidth,
|
|
||||||
mediaWidth: dashboard.sizes.mediaWidth,
|
|
||||||
mediaProgressSweep: dashboard.sizes.mediaProgressSweep,
|
|
||||||
mediaProgressThickness: dashboard.sizes.mediaProgressThickness,
|
|
||||||
resourceProgessThickness: dashboard.sizes.resourceProgessThickness,
|
|
||||||
weatherWidth: dashboard.sizes.weatherWidth,
|
|
||||||
mediaCoverArtSize: dashboard.sizes.mediaCoverArtSize,
|
|
||||||
mediaVisualiserSize: dashboard.sizes.mediaVisualiserSize,
|
|
||||||
resourceSize: dashboard.sizes.resourceSize
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeOsd(): var {
|
|
||||||
return {
|
|
||||||
enabled: osd.enabled,
|
|
||||||
hideDelay: osd.hideDelay,
|
|
||||||
enableBrightness: osd.enableBrightness,
|
|
||||||
enableMicrophone: osd.enableMicrophone,
|
|
||||||
allMonBrightness: osd.allMonBrightness,
|
|
||||||
sizes: {
|
|
||||||
sliderWidth: osd.sizes.sliderWidth,
|
|
||||||
sliderHeight: osd.sizes.sliderHeight
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeLauncher(): var {
|
|
||||||
return {
|
|
||||||
maxAppsShown: launcher.maxAppsShown,
|
|
||||||
maxWallpapers: launcher.maxWallpapers,
|
|
||||||
actionPrefix: launcher.actionPrefix,
|
|
||||||
specialPrefix: launcher.specialPrefix,
|
|
||||||
useFuzzy: {
|
|
||||||
apps: launcher.useFuzzy.apps,
|
|
||||||
actions: launcher.useFuzzy.actions,
|
|
||||||
schemes: launcher.useFuzzy.schemes,
|
|
||||||
variants: launcher.useFuzzy.variants,
|
|
||||||
wallpapers: launcher.useFuzzy.wallpapers
|
|
||||||
},
|
|
||||||
sizes: {
|
|
||||||
itemWidth: launcher.sizes.itemWidth,
|
|
||||||
itemHeight: launcher.sizes.itemHeight,
|
|
||||||
wallpaperWidth: launcher.sizes.wallpaperWidth,
|
|
||||||
wallpaperHeight: launcher.sizes.wallpaperHeight
|
|
||||||
},
|
|
||||||
actions: launcher.actions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeBackground(): var {
|
|
||||||
return {
|
|
||||||
wallFadeDuration: background.wallFadeDuration,
|
|
||||||
enabled: background.enabled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeAppearance(): var {
|
|
||||||
return {
|
|
||||||
rounding: {
|
|
||||||
scale: appearance.rounding.scale
|
|
||||||
},
|
|
||||||
spacing: {
|
|
||||||
scale: appearance.spacing.scale
|
|
||||||
},
|
|
||||||
padding: {
|
|
||||||
scale: appearance.padding.scale
|
|
||||||
},
|
|
||||||
font: {
|
|
||||||
family: {
|
|
||||||
sans: appearance.font.family.sans,
|
|
||||||
mono: appearance.font.family.mono,
|
|
||||||
material: appearance.font.family.material,
|
|
||||||
clock: appearance.font.family.clock
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
scale: appearance.font.size.scale
|
|
||||||
}
|
|
||||||
},
|
|
||||||
anim: {
|
|
||||||
mediaGifSpeedAdjustment: 300,
|
|
||||||
sessionGifSpeed: 0.7,
|
|
||||||
durations: {
|
|
||||||
scale: appearance.anim.durations.scale
|
|
||||||
}
|
|
||||||
},
|
|
||||||
transparency: {
|
|
||||||
enabled: appearance.transparency.enabled,
|
|
||||||
base: appearance.transparency.base,
|
|
||||||
layers: appearance.transparency.layers
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeColors(): var {
|
|
||||||
return {
|
|
||||||
schemeType: colors.schemeType,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
id: fileView
|
|
||||||
|
|
||||||
path: `${Paths.config}/config.json`
|
|
||||||
|
|
||||||
watchChanges: true
|
|
||||||
|
|
||||||
onFileChanged: {
|
|
||||||
if ( !root.recentlySaved ) {
|
|
||||||
timer.restart();
|
|
||||||
reload();
|
|
||||||
} else {
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onLoaded: {
|
|
||||||
ModeScheduler.checkStartup();
|
|
||||||
try {
|
|
||||||
JSON.parse(text());
|
|
||||||
const elapsed = timer.elapsedMs();
|
|
||||||
|
|
||||||
if ( adapter.utilities.toasts.configLoaded && !root.recentlySaved ) {
|
|
||||||
Toaster.toast(qsTr("Config loaded"), qsTr("Config loaded in %1ms").arg(elapsed), "rule_settings");
|
|
||||||
} else if ( adapter.utilities.toasts.configLoaded && root.recentlySaved ) {
|
|
||||||
Toaster.toast(qsTr("Config saved"), qsTr("Config reloaded in %1ms").arg(elapsed), "settings_alert");
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
Toaster.toast(qsTr("Failed to load config"), e.message, "settings_alert", Toast.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onLoadFailed: err => {
|
|
||||||
if ( err !== FileViewError.FileNotFound )
|
|
||||||
Toaster.toast(qsTr("Failed to read config"), FileViewError.toString(err), "settings_alert", Toast.Warning);
|
|
||||||
}
|
|
||||||
|
|
||||||
onSaveFailed: err => Toaster.toast(qsTr("Failed to save config"), FileViewError.toString(err), "settings_alert", Toast.Error)
|
|
||||||
|
|
||||||
JsonAdapter {
|
|
||||||
id: adapter
|
|
||||||
property BackgroundConfig background: BackgroundConfig {}
|
|
||||||
property BarConfig barConfig: BarConfig {}
|
|
||||||
property LockConf lock: LockConf {}
|
|
||||||
property Overview overview: Overview {}
|
|
||||||
property Services services: Services {}
|
|
||||||
property NotifConfig notifs: NotifConfig {}
|
|
||||||
property SidebarConfig sidebar: SidebarConfig {}
|
|
||||||
property UtilConfig utilities: UtilConfig {}
|
|
||||||
property General general: General {}
|
|
||||||
property DashboardConfig dashboard: DashboardConfig {}
|
|
||||||
property AppearanceConf appearance: AppearanceConf {}
|
|
||||||
property Osd osd: Osd {}
|
|
||||||
property Launcher launcher: Launcher {}
|
|
||||||
property Colors colors: Colors {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property bool enabled: true
|
|
||||||
property int mediaUpdateInterval: 500
|
|
||||||
property int dragThreshold: 50
|
|
||||||
property Sizes sizes: Sizes {}
|
|
||||||
|
|
||||||
component Sizes: JsonObject {
|
|
||||||
readonly property int tabIndicatorHeight: 3
|
|
||||||
readonly property int tabIndicatorSpacing: 5
|
|
||||||
readonly property int infoWidth: 200
|
|
||||||
readonly property int infoIconSize: 25
|
|
||||||
readonly property int dateTimeWidth: 110
|
|
||||||
readonly property int mediaWidth: 200
|
|
||||||
readonly property int mediaProgressSweep: 180
|
|
||||||
readonly property int mediaProgressThickness: 8
|
|
||||||
readonly property int resourceProgessThickness: 10
|
|
||||||
readonly property int weatherWidth: 250
|
|
||||||
readonly property int mediaCoverArtSize: 150
|
|
||||||
readonly property int mediaVisualiserSize: 80
|
|
||||||
readonly property int resourceSize: 200
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,278 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
|
||||||
import ZShell
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Paths
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool showPreview
|
|
||||||
property string scheme
|
|
||||||
property string flavour
|
|
||||||
readonly property bool light: showPreview ? previewLight : currentLight
|
|
||||||
property bool currentLight
|
|
||||||
property bool previewLight
|
|
||||||
readonly property M3Palette palette: showPreview ? preview : current
|
|
||||||
readonly property M3TPalette tPalette: M3TPalette {}
|
|
||||||
readonly property M3Palette current: M3Palette {}
|
|
||||||
readonly property M3Palette preview: M3Palette {}
|
|
||||||
readonly property Transparency transparency: Transparency {}
|
|
||||||
readonly property alias wallLuminance: analyser.luminance
|
|
||||||
|
|
||||||
function getLuminance(c: color): real {
|
|
||||||
if (c.r == 0 && c.g == 0 && c.b == 0)
|
|
||||||
return 0;
|
|
||||||
return Math.sqrt(0.299 * (c.r ** 2) + 0.587 * (c.g ** 2) + 0.114 * (c.b ** 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
function alterColor(c: color, a: real, layer: int): color {
|
|
||||||
const luminance = getLuminance(c);
|
|
||||||
|
|
||||||
const offset = (!light || layer == 1 ? 1 : -layer / 2) * (light ? 0.2 : 0.3) * (1 - transparency.base) * (1 + wallLuminance * (light ? (layer == 1 ? 3 : 1) : 2.5));
|
|
||||||
const scale = (luminance + offset) / luminance;
|
|
||||||
const r = Math.max(0, Math.min(1, c.r * scale));
|
|
||||||
const g = Math.max(0, Math.min(1, c.g * scale));
|
|
||||||
const b = Math.max(0, Math.min(1, c.b * scale));
|
|
||||||
|
|
||||||
return Qt.rgba(r, g, b, a);
|
|
||||||
}
|
|
||||||
|
|
||||||
function layer(c: color, layer: var): color {
|
|
||||||
if (!transparency.enabled)
|
|
||||||
return c;
|
|
||||||
|
|
||||||
return layer === 0 ? Qt.alpha(c, transparency.base) : alterColor(c, transparency.layers, layer ?? 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function on(c: color): color {
|
|
||||||
if (c.hslLightness < 0.5)
|
|
||||||
return Qt.hsla(c.hslHue, c.hslSaturation, 0.9, 1);
|
|
||||||
return Qt.hsla(c.hslHue, c.hslSaturation, 0.1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function load(data: string, isPreview: bool): void {
|
|
||||||
const colors = isPreview ? preview : current;
|
|
||||||
const scheme = JSON.parse(data);
|
|
||||||
|
|
||||||
if (!isPreview) {
|
|
||||||
root.scheme = scheme.name;
|
|
||||||
flavour = scheme.flavor;
|
|
||||||
currentLight = scheme.mode === "light";
|
|
||||||
} else {
|
|
||||||
previewLight = scheme.mode === "light";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const [name, color] of Object.entries(scheme.colors)) {
|
|
||||||
const propName = name.startsWith("term") ? name : `m3${name}`;
|
|
||||||
if (colors.hasOwnProperty(propName))
|
|
||||||
colors[propName] = `${color}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
path: `${Paths.state}/scheme.json`
|
|
||||||
watchChanges: true
|
|
||||||
onFileChanged: reload()
|
|
||||||
onLoaded: root.load(text(), false)
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageAnalyser {
|
|
||||||
id: analyser
|
|
||||||
|
|
||||||
source: WallpaperPath.currentWallpaperPath
|
|
||||||
}
|
|
||||||
|
|
||||||
component Transparency: QtObject {
|
|
||||||
readonly property bool enabled: Appearance.transparency.enabled
|
|
||||||
readonly property real base: Appearance.transparency.base - (root.light ? 0.1 : 0)
|
|
||||||
readonly property real layers: Appearance.transparency.layers
|
|
||||||
}
|
|
||||||
|
|
||||||
component M3TPalette: QtObject {
|
|
||||||
readonly property color m3primary_paletteKeyColor: root.layer(root.palette.m3primary_paletteKeyColor)
|
|
||||||
readonly property color m3secondary_paletteKeyColor: root.layer(root.palette.m3secondary_paletteKeyColor)
|
|
||||||
readonly property color m3tertiary_paletteKeyColor: root.layer(root.palette.m3tertiary_paletteKeyColor)
|
|
||||||
readonly property color m3neutral_paletteKeyColor: root.layer(root.palette.m3neutral_paletteKeyColor)
|
|
||||||
readonly property color m3neutral_variant_paletteKeyColor: root.layer(root.palette.m3neutral_variant_paletteKeyColor)
|
|
||||||
readonly property color m3background: root.layer(root.palette.m3background, 0)
|
|
||||||
readonly property color m3onBackground: root.layer(root.palette.m3onBackground)
|
|
||||||
readonly property color m3surface: root.layer(root.palette.m3surface, 0)
|
|
||||||
readonly property color m3surfaceDim: root.layer(root.palette.m3surfaceDim, 0)
|
|
||||||
readonly property color m3surfaceBright: root.layer(root.palette.m3surfaceBright, 0)
|
|
||||||
readonly property color m3surfaceContainerLowest: root.layer(root.palette.m3surfaceContainerLowest)
|
|
||||||
readonly property color m3surfaceContainerLow: root.layer(root.palette.m3surfaceContainerLow)
|
|
||||||
readonly property color m3surfaceContainer: root.layer(root.palette.m3surfaceContainer)
|
|
||||||
readonly property color m3surfaceContainerHigh: root.layer(root.palette.m3surfaceContainerHigh)
|
|
||||||
readonly property color m3surfaceContainerHighest: root.layer(root.palette.m3surfaceContainerHighest)
|
|
||||||
readonly property color m3onSurface: root.layer(root.palette.m3onSurface)
|
|
||||||
readonly property color m3surfaceVariant: root.layer(root.palette.m3surfaceVariant, 0)
|
|
||||||
readonly property color m3onSurfaceVariant: root.layer(root.palette.m3onSurfaceVariant)
|
|
||||||
readonly property color m3inverseSurface: root.layer(root.palette.m3inverseSurface, 0)
|
|
||||||
readonly property color m3inverseOnSurface: root.layer(root.palette.m3inverseOnSurface)
|
|
||||||
readonly property color m3outline: root.layer(root.palette.m3outline)
|
|
||||||
readonly property color m3outlineVariant: root.layer(root.palette.m3outlineVariant)
|
|
||||||
readonly property color m3shadow: root.layer(root.palette.m3shadow)
|
|
||||||
readonly property color m3scrim: root.layer(root.palette.m3scrim)
|
|
||||||
readonly property color m3surfaceTint: root.layer(root.palette.m3surfaceTint)
|
|
||||||
readonly property color m3primary: root.layer(root.palette.m3primary)
|
|
||||||
readonly property color m3onPrimary: root.layer(root.palette.m3onPrimary)
|
|
||||||
readonly property color m3primaryContainer: root.layer(root.palette.m3primaryContainer)
|
|
||||||
readonly property color m3onPrimaryContainer: root.layer(root.palette.m3onPrimaryContainer)
|
|
||||||
readonly property color m3inversePrimary: root.layer(root.palette.m3inversePrimary)
|
|
||||||
readonly property color m3secondary: root.layer(root.palette.m3secondary)
|
|
||||||
readonly property color m3onSecondary: root.layer(root.palette.m3onSecondary)
|
|
||||||
readonly property color m3secondaryContainer: root.layer(root.palette.m3secondaryContainer)
|
|
||||||
readonly property color m3onSecondaryContainer: root.layer(root.palette.m3onSecondaryContainer)
|
|
||||||
readonly property color m3tertiary: root.layer(root.palette.m3tertiary)
|
|
||||||
readonly property color m3onTertiary: root.layer(root.palette.m3onTertiary)
|
|
||||||
readonly property color m3tertiaryContainer: root.layer(root.palette.m3tertiaryContainer)
|
|
||||||
readonly property color m3onTertiaryContainer: root.layer(root.palette.m3onTertiaryContainer)
|
|
||||||
readonly property color m3error: root.layer(root.palette.m3error)
|
|
||||||
readonly property color m3onError: root.layer(root.palette.m3onError)
|
|
||||||
readonly property color m3errorContainer: root.layer(root.palette.m3errorContainer)
|
|
||||||
readonly property color m3onErrorContainer: root.layer(root.palette.m3onErrorContainer)
|
|
||||||
readonly property color m3success: root.layer(root.palette.m3success)
|
|
||||||
readonly property color m3onSuccess: root.layer(root.palette.m3onSuccess)
|
|
||||||
readonly property color m3successContainer: root.layer(root.palette.m3successContainer)
|
|
||||||
readonly property color m3onSuccessContainer: root.layer(root.palette.m3onSuccessContainer)
|
|
||||||
readonly property color m3primaryFixed: root.layer(root.palette.m3primaryFixed)
|
|
||||||
readonly property color m3primaryFixedDim: root.layer(root.palette.m3primaryFixedDim)
|
|
||||||
readonly property color m3onPrimaryFixed: root.layer(root.palette.m3onPrimaryFixed)
|
|
||||||
readonly property color m3onPrimaryFixedVariant: root.layer(root.palette.m3onPrimaryFixedVariant)
|
|
||||||
readonly property color m3secondaryFixed: root.layer(root.palette.m3secondaryFixed)
|
|
||||||
readonly property color m3secondaryFixedDim: root.layer(root.palette.m3secondaryFixedDim)
|
|
||||||
readonly property color m3onSecondaryFixed: root.layer(root.palette.m3onSecondaryFixed)
|
|
||||||
readonly property color m3onSecondaryFixedVariant: root.layer(root.palette.m3onSecondaryFixedVariant)
|
|
||||||
readonly property color m3tertiaryFixed: root.layer(root.palette.m3tertiaryFixed)
|
|
||||||
readonly property color m3tertiaryFixedDim: root.layer(root.palette.m3tertiaryFixedDim)
|
|
||||||
readonly property color m3onTertiaryFixed: root.layer(root.palette.m3onTertiaryFixed)
|
|
||||||
readonly property color m3onTertiaryFixedVariant: root.layer(root.palette.m3onTertiaryFixedVariant)
|
|
||||||
}
|
|
||||||
|
|
||||||
component M3Palette: QtObject {
|
|
||||||
property color m3primary_paletteKeyColor: "#a8627b"
|
|
||||||
property color m3secondary_paletteKeyColor: "#8e6f78"
|
|
||||||
property color m3tertiary_paletteKeyColor: "#986e4c"
|
|
||||||
property color m3neutral_paletteKeyColor: "#807477"
|
|
||||||
property color m3neutral_variant_paletteKeyColor: "#837377"
|
|
||||||
property color m3background: "#191114"
|
|
||||||
property color m3onBackground: "#efdfe2"
|
|
||||||
property color m3surface: "#191114"
|
|
||||||
property color m3surfaceDim: "#191114"
|
|
||||||
property color m3surfaceBright: "#403739"
|
|
||||||
property color m3surfaceContainerLowest: "#130c0e"
|
|
||||||
property color m3surfaceContainerLow: "#22191c"
|
|
||||||
property color m3surfaceContainer: "#261d20"
|
|
||||||
property color m3surfaceContainerHigh: "#31282a"
|
|
||||||
property color m3surfaceContainerHighest: "#3c3235"
|
|
||||||
property color m3onSurface: "#efdfe2"
|
|
||||||
property color m3surfaceVariant: "#514347"
|
|
||||||
property color m3onSurfaceVariant: "#d5c2c6"
|
|
||||||
property color m3inverseSurface: "#efdfe2"
|
|
||||||
property color m3inverseOnSurface: "#372e30"
|
|
||||||
property color m3outline: "#9e8c91"
|
|
||||||
property color m3outlineVariant: "#514347"
|
|
||||||
property color m3shadow: "#000000"
|
|
||||||
property color m3scrim: "#000000"
|
|
||||||
property color m3surfaceTint: "#ffb0ca"
|
|
||||||
property color m3primary: "#ffb0ca"
|
|
||||||
property color m3onPrimary: "#541d34"
|
|
||||||
property color m3primaryContainer: "#6f334a"
|
|
||||||
property color m3onPrimaryContainer: "#ffd9e3"
|
|
||||||
property color m3inversePrimary: "#8b4a62"
|
|
||||||
property color m3secondary: "#e2bdc7"
|
|
||||||
property color m3onSecondary: "#422932"
|
|
||||||
property color m3secondaryContainer: "#5a3f48"
|
|
||||||
property color m3onSecondaryContainer: "#ffd9e3"
|
|
||||||
property color m3tertiary: "#f0bc95"
|
|
||||||
property color m3onTertiary: "#48290c"
|
|
||||||
property color m3tertiaryContainer: "#b58763"
|
|
||||||
property color m3onTertiaryContainer: "#000000"
|
|
||||||
property color m3error: "#ffb4ab"
|
|
||||||
property color m3onError: "#690005"
|
|
||||||
property color m3errorContainer: "#93000a"
|
|
||||||
property color m3onErrorContainer: "#ffdad6"
|
|
||||||
property color m3success: "#B5CCBA"
|
|
||||||
property color m3onSuccess: "#213528"
|
|
||||||
property color m3successContainer: "#374B3E"
|
|
||||||
property color m3onSuccessContainer: "#D1E9D6"
|
|
||||||
property color m3primaryFixed: "#ffd9e3"
|
|
||||||
property color m3primaryFixedDim: "#ffb0ca"
|
|
||||||
property color m3onPrimaryFixed: "#39071f"
|
|
||||||
property color m3onPrimaryFixedVariant: "#6f334a"
|
|
||||||
property color m3secondaryFixed: "#ffd9e3"
|
|
||||||
property color m3secondaryFixedDim: "#e2bdc7"
|
|
||||||
property color m3onSecondaryFixed: "#2b151d"
|
|
||||||
property color m3onSecondaryFixedVariant: "#5a3f48"
|
|
||||||
property color m3tertiaryFixed: "#ffdcc3"
|
|
||||||
property color m3tertiaryFixedDim: "#f0bc95"
|
|
||||||
property color m3onTertiaryFixed: "#2f1500"
|
|
||||||
property color m3onTertiaryFixedVariant: "#623f21"
|
|
||||||
}
|
|
||||||
|
|
||||||
component M3MaccchiatoPalette: QtObject {
|
|
||||||
property color m3primary_paletteKeyColor: "#6a73ac"
|
|
||||||
property color m3secondary_paletteKeyColor: "#72758e"
|
|
||||||
property color m3tertiary_paletteKeyColor: "#9b6592"
|
|
||||||
property color m3neutral_paletteKeyColor: "#77767b"
|
|
||||||
property color m3neutral_variant_paletteKeyColor: "#767680"
|
|
||||||
property color m3background: "#131317"
|
|
||||||
property color m3onBackground: "#e4e1e7"
|
|
||||||
property color m3surface: "#131317"
|
|
||||||
property color m3surfaceDim: "#131317"
|
|
||||||
property color m3surfaceBright: "#39393d"
|
|
||||||
property color m3surfaceContainerLowest: "#0e0e12"
|
|
||||||
property color m3surfaceContainerLow: "#1b1b1f"
|
|
||||||
property color m3surfaceContainer: "#1f1f23"
|
|
||||||
property color m3surfaceContainerHigh: "#2a2a2e"
|
|
||||||
property color m3surfaceContainerHighest: "#353438"
|
|
||||||
property color m3onSurface: "#e4e1e7"
|
|
||||||
property color m3surfaceVariant: "#46464f"
|
|
||||||
property color m3onSurfaceVariant: "#c6c5d1"
|
|
||||||
property color m3inverseSurface: "#e4e1e7"
|
|
||||||
property color m3inverseOnSurface: "#303034"
|
|
||||||
property color m3outline: "#90909a"
|
|
||||||
property color m3outlineVariant: "#46464f"
|
|
||||||
property color m3shadow: "#000000"
|
|
||||||
property color m3scrim: "#000000"
|
|
||||||
property color m3surfaceTint: "#bac3ff"
|
|
||||||
property color m3primary: "#bac3ff"
|
|
||||||
property color m3onPrimary: "#232c60"
|
|
||||||
property color m3primaryContainer: "#6a73ac"
|
|
||||||
property color m3onPrimaryContainer: "#ffffff"
|
|
||||||
property color m3inversePrimary: "#525b92"
|
|
||||||
property color m3secondary: "#c3c5e0"
|
|
||||||
property color m3onSecondary: "#2c2f44"
|
|
||||||
property color m3secondaryContainer: "#42455c"
|
|
||||||
property color m3onSecondaryContainer: "#b1b3ce"
|
|
||||||
property color m3tertiary: "#f1b3e5"
|
|
||||||
property color m3onTertiary: "#4c1f48"
|
|
||||||
property color m3tertiaryContainer: "#b77ead"
|
|
||||||
property color m3onTertiaryContainer: "#000000"
|
|
||||||
property color m3error: "#ffb4ab"
|
|
||||||
property color m3onError: "#690005"
|
|
||||||
property color m3errorContainer: "#93000a"
|
|
||||||
property color m3onErrorContainer: "#ffdad6"
|
|
||||||
property color m3primaryFixed: "#dee0ff"
|
|
||||||
property color m3primaryFixedDim: "#bac3ff"
|
|
||||||
property color m3onPrimaryFixed: "#0b154b"
|
|
||||||
property color m3onPrimaryFixedVariant: "#3a4378"
|
|
||||||
property color m3secondaryFixed: "#dfe1fd"
|
|
||||||
property color m3secondaryFixedDim: "#c3c5e0"
|
|
||||||
property color m3onSecondaryFixed: "#171a2e"
|
|
||||||
property color m3onSecondaryFixedVariant: "#42455c"
|
|
||||||
property color m3tertiaryFixed: "#ffd7f4"
|
|
||||||
property color m3tertiaryFixedDim: "#f1b3e5"
|
|
||||||
property color m3onTertiaryFixed: "#340831"
|
|
||||||
property color m3onTertiaryFixedVariant: "#66365f"
|
|
||||||
property color m3success: "#B5CCBA"
|
|
||||||
property color m3onSuccess: "#213528"
|
|
||||||
property color m3successContainer: "#374B3E"
|
|
||||||
property color m3onSuccessContainer: "#D1E9D6"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property string logo: ""
|
|
||||||
property string wallpaperPath: Quickshell.env("HOME") + "/Pictures/Wallpapers"
|
|
||||||
property Color color: Color {}
|
|
||||||
property Apps apps: Apps {}
|
|
||||||
property Idle idle: Idle {}
|
|
||||||
|
|
||||||
component Color: JsonObject {
|
|
||||||
property bool wallust: false
|
|
||||||
property bool schemeGeneration: true
|
|
||||||
property string mode: "dark"
|
|
||||||
property int scheduleDarkStart: 0
|
|
||||||
property int scheduleDarkEnd: 0
|
|
||||||
property bool neovimColors: false
|
|
||||||
}
|
|
||||||
|
|
||||||
component Apps: JsonObject {
|
|
||||||
property list<string> terminal: ["kitty"]
|
|
||||||
property list<string> audio: ["pavucontrol"]
|
|
||||||
property list<string> playback: ["mpv"]
|
|
||||||
property list<string> explorer: ["dolphin"]
|
|
||||||
}
|
|
||||||
|
|
||||||
component Idle: JsonObject {
|
|
||||||
property list<var> timeouts: [
|
|
||||||
{
|
|
||||||
timeout: 180,
|
|
||||||
idleAction: "lock"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
timeout: 300,
|
|
||||||
idleAction: "dpms off",
|
|
||||||
activeAction: "dpms on"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property list<var> timeouts: [
|
|
||||||
{
|
|
||||||
timeout: 180,
|
|
||||||
idleAction: "lock"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
timeout: 300,
|
|
||||||
idleAction: "dpms off",
|
|
||||||
activeAction: "dpms on"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property int maxAppsShown: 10
|
|
||||||
property int maxWallpapers: 7
|
|
||||||
property string actionPrefix: ">"
|
|
||||||
property string specialPrefix: "@"
|
|
||||||
property Sizes sizes: Sizes {}
|
|
||||||
property UseFuzzy useFuzzy: UseFuzzy {}
|
|
||||||
|
|
||||||
component UseFuzzy: JsonObject {
|
|
||||||
property bool apps: false
|
|
||||||
property bool actions: false
|
|
||||||
property bool schemes: false
|
|
||||||
property bool variants: false
|
|
||||||
property bool wallpapers: false
|
|
||||||
}
|
|
||||||
|
|
||||||
component Sizes: JsonObject {
|
|
||||||
property int itemWidth: 600
|
|
||||||
property int itemHeight: 50
|
|
||||||
property int wallpaperWidth: 280
|
|
||||||
property int wallpaperHeight: 200
|
|
||||||
}
|
|
||||||
|
|
||||||
property list<var> actions: [
|
|
||||||
{
|
|
||||||
name: "Calculator",
|
|
||||||
icon: "calculate",
|
|
||||||
description: "Do simple math equations (powered by Qalc)",
|
|
||||||
command: ["autocomplete", "calc"],
|
|
||||||
enabled: true,
|
|
||||||
dangerous: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Wallpaper",
|
|
||||||
icon: "image",
|
|
||||||
description: "Change the current wallpaper",
|
|
||||||
command: ["autocomplete", "wallpaper"],
|
|
||||||
enabled: true,
|
|
||||||
dangerous: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Shutdown",
|
|
||||||
icon: "power_settings_new",
|
|
||||||
description: "Shutdown the system",
|
|
||||||
command: ["systemctl", "poweroff"],
|
|
||||||
enabled: true,
|
|
||||||
dangerous: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Reboot",
|
|
||||||
icon: "cached",
|
|
||||||
description: "Reboot the system",
|
|
||||||
command: ["systemctl", "reboot"],
|
|
||||||
enabled: true,
|
|
||||||
dangerous: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Logout",
|
|
||||||
icon: "exit_to_app",
|
|
||||||
description: "Log out of the current session",
|
|
||||||
command: ["loginctl", "terminate-user", ""],
|
|
||||||
enabled: true,
|
|
||||||
dangerous: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Lock",
|
|
||||||
icon: "lock",
|
|
||||||
description: "Lock the current session",
|
|
||||||
command: ["loginctl", "lock-session"],
|
|
||||||
enabled: true,
|
|
||||||
dangerous: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Sleep",
|
|
||||||
icon: "bedtime",
|
|
||||||
description: "Suspend then hibernate",
|
|
||||||
command: ["systemctl", "suspend-then-hibernate"],
|
|
||||||
enabled: true,
|
|
||||||
dangerous: false
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property bool recolorLogo: false
|
|
||||||
property bool enableFprint: true
|
|
||||||
property int maxFprintTries: 3
|
|
||||||
property Sizes sizes: Sizes {}
|
|
||||||
property int blurAmount: 40
|
|
||||||
|
|
||||||
component Sizes: JsonObject {
|
|
||||||
property real heightMult: 0.7
|
|
||||||
property real ratio: 16 / 9
|
|
||||||
property int centerWidth: 600
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property real scale: Appearance.anim.durations.scale
|
|
||||||
|
|
||||||
readonly property list<real> emphasized: [0.05, 0, 2 / 15, 0.06, 1 / 6, 0.4, 5 / 24, 0.82, 0.25, 1, 1, 1]
|
|
||||||
readonly property list<real> emphasizedAccel: [0.3, 0, 0.8, 0.15, 1, 1]
|
|
||||||
readonly property int emphasizedAccelTime: 200 * scale
|
|
||||||
readonly property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1]
|
|
||||||
readonly property int emphasizedDecelTime: 400 * scale
|
|
||||||
readonly property int emphasizedTime: 500 * scale
|
|
||||||
readonly property list<real> expressiveDefaultSpatial: [0.38, 1.21, 0.22, 1.00, 1, 1]
|
|
||||||
readonly property int expressiveDefaultSpatialTime: 500 * scale
|
|
||||||
readonly property list<real> expressiveEffects: [0.34, 0.80, 0.34, 1.00, 1, 1]
|
|
||||||
readonly property int expressiveEffectsTime: 200 * scale
|
|
||||||
readonly property list<real> expressiveFastSpatial: [0.42, 1.67, 0.21, 0.90, 1, 1]
|
|
||||||
readonly property int expressiveFastSpatialTime: 350 * scale
|
|
||||||
readonly property list<real> standard: [0.2, 0, 0, 1, 1, 1]
|
|
||||||
readonly property list<real> standardAccel: [0.3, 0, 1, 1, 1, 1]
|
|
||||||
readonly property int standardAccelTime: 200 * scale
|
|
||||||
readonly property list<real> standardDecel: [0, 0, 0, 1, 1, 1]
|
|
||||||
readonly property int standardDecelTime: 250 * scale
|
|
||||||
readonly property int standardTime: 300 * scale
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property bool expire: true
|
|
||||||
property int defaultExpireTimeout: 5000
|
|
||||||
property real clearThreshold: 0.3
|
|
||||||
property int expandThreshold: 20
|
|
||||||
property bool actionOnClick: false
|
|
||||||
property int groupPreviewNum: 3
|
|
||||||
property bool openExpanded: false
|
|
||||||
property Sizes sizes: Sizes {}
|
|
||||||
|
|
||||||
component Sizes: JsonObject {
|
|
||||||
property int width: 400
|
|
||||||
property int image: 41
|
|
||||||
property int badge: 20
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property bool enabled: true
|
|
||||||
property int hideDelay: 3000
|
|
||||||
property bool enableBrightness: true
|
|
||||||
property bool enableMicrophone: true
|
|
||||||
property bool allMonBrightness: false
|
|
||||||
property Sizes sizes: Sizes {}
|
|
||||||
|
|
||||||
component Sizes: JsonObject {
|
|
||||||
property int sliderWidth: 30
|
|
||||||
property int sliderHeight: 150
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property int rows: 2
|
|
||||||
property int columns: 5
|
|
||||||
property real scale: 0.16
|
|
||||||
property bool enable: false
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property string weatherLocation: ""
|
|
||||||
property bool useFahrenheit: false
|
|
||||||
property bool useTwelveHourClock: Qt.locale().timeFormat(Locale.ShortFormat).toLowerCase().includes("a")
|
|
||||||
property string gpuType: ""
|
|
||||||
property real audioIncrement: 0.1
|
|
||||||
property real brightnessIncrement: 0.1
|
|
||||||
property real maxVolume: 1.0
|
|
||||||
property string defaultPlayer: "Spotify"
|
|
||||||
property list<var> playerAliases: [
|
|
||||||
{
|
|
||||||
"from": "com.github.th_ch.youtube_music",
|
|
||||||
"to": "YT Music"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property bool enabled: true
|
|
||||||
property Sizes sizes: Sizes {}
|
|
||||||
|
|
||||||
component Sizes: JsonObject {
|
|
||||||
property int width: 430
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property bool enabled: false
|
|
||||||
property real base: 0.85
|
|
||||||
property real layers: 0.4
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property bool enabled: true
|
|
||||||
property int maxToasts: 4
|
|
||||||
|
|
||||||
property Sizes sizes: Sizes {}
|
|
||||||
property Toasts toasts: Toasts {}
|
|
||||||
property Vpn vpn: Vpn {}
|
|
||||||
|
|
||||||
component Sizes: JsonObject {
|
|
||||||
property int width: 430
|
|
||||||
property int toastWidth: 430
|
|
||||||
}
|
|
||||||
|
|
||||||
component Toasts: JsonObject {
|
|
||||||
property bool configLoaded: true
|
|
||||||
property bool chargingChanged: true
|
|
||||||
property bool gameModeChanged: true
|
|
||||||
property bool dndChanged: true
|
|
||||||
property bool audioOutputChanged: true
|
|
||||||
property bool audioInputChanged: true
|
|
||||||
property bool capsLockChanged: true
|
|
||||||
property bool numLockChanged: true
|
|
||||||
property bool kbLayoutChanged: true
|
|
||||||
property bool kbLimit: true
|
|
||||||
property bool vpnChanged: true
|
|
||||||
property bool nowPlaying: false
|
|
||||||
}
|
|
||||||
|
|
||||||
component Vpn: JsonObject {
|
|
||||||
property bool enabled: false
|
|
||||||
property list<var> provider: ["netbird"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property string textColor: "black"
|
|
||||||
property string inactiveTextColor: "white"
|
|
||||||
}
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import qs.Config
|
|
||||||
import ZShell.Services
|
|
||||||
import ZShell
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Services.Pipewire
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property string previousSinkName: ""
|
|
||||||
property string previousSourceName: ""
|
|
||||||
|
|
||||||
readonly property var nodes: Pipewire.nodes.values.reduce((acc, node) => {
|
|
||||||
if (!node.isStream) {
|
|
||||||
if (node.isSink)
|
|
||||||
acc.sinks.push(node);
|
|
||||||
else if (node.audio)
|
|
||||||
acc.sources.push(node);
|
|
||||||
} else if (node.isStream && node.audio) {
|
|
||||||
// Application streams (output streams)
|
|
||||||
acc.streams.push(node);
|
|
||||||
}
|
|
||||||
return acc;
|
|
||||||
}, {
|
|
||||||
sources: [],
|
|
||||||
sinks: [],
|
|
||||||
streams: []
|
|
||||||
})
|
|
||||||
|
|
||||||
readonly property list<PwNode> sinks: nodes.sinks
|
|
||||||
readonly property list<PwNode> sources: nodes.sources
|
|
||||||
readonly property list<PwNode> streams: nodes.streams
|
|
||||||
|
|
||||||
readonly property PwNode sink: Pipewire.defaultAudioSink
|
|
||||||
readonly property PwNode source: Pipewire.defaultAudioSource
|
|
||||||
|
|
||||||
readonly property bool muted: !!sink?.audio?.muted
|
|
||||||
readonly property real volume: sink?.audio?.volume ?? 0
|
|
||||||
|
|
||||||
readonly property bool sourceMuted: !!source?.audio?.muted
|
|
||||||
readonly property real sourceVolume: source?.audio?.volume ?? 0
|
|
||||||
|
|
||||||
function setVolume(newVolume: real): void {
|
|
||||||
if (sink?.ready && sink?.audio) {
|
|
||||||
sink.audio.muted = false;
|
|
||||||
sink.audio.volume = Math.max(0, Math.min(Config.services.maxVolume, newVolume));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function incrementVolume(amount: real): void {
|
|
||||||
setVolume(volume + (amount || Config.services.audioIncrement));
|
|
||||||
}
|
|
||||||
|
|
||||||
function decrementVolume(amount: real): void {
|
|
||||||
setVolume(volume - (amount || Config.services.audioIncrement));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setSourceVolume(newVolume: real): void {
|
|
||||||
if (source?.ready && source?.audio) {
|
|
||||||
source.audio.muted = false;
|
|
||||||
source.audio.volume = Math.max(0, Math.min(Config.services.maxVolume, newVolume));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function incrementSourceVolume(amount: real): void {
|
|
||||||
setSourceVolume(sourceVolume + (amount || Config.services.audioIncrement));
|
|
||||||
}
|
|
||||||
|
|
||||||
function decrementSourceVolume(amount: real): void {
|
|
||||||
setSourceVolume(sourceVolume - (amount || Config.services.audioIncrement));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setAudioSink(newSink: PwNode): void {
|
|
||||||
Pipewire.preferredDefaultAudioSink = newSink;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setAudioSource(newSource: PwNode): void {
|
|
||||||
Pipewire.preferredDefaultAudioSource = newSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setStreamVolume(stream: PwNode, newVolume: real): void {
|
|
||||||
if (stream?.ready && stream?.audio) {
|
|
||||||
stream.audio.muted = false;
|
|
||||||
stream.audio.volume = Math.max(0, Math.min(Config.services.maxVolume, newVolume));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setStreamMuted(stream: PwNode, muted: bool): void {
|
|
||||||
if (stream?.ready && stream?.audio) {
|
|
||||||
stream.audio.muted = muted;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getStreamVolume(stream: PwNode): real {
|
|
||||||
return stream?.audio?.volume ?? 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getStreamMuted(stream: PwNode): bool {
|
|
||||||
return !!stream?.audio?.muted;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getStreamName(stream: PwNode): string {
|
|
||||||
if (!stream)
|
|
||||||
return qsTr("Unknown");
|
|
||||||
// Try application name first, then description, then name
|
|
||||||
return stream.applicationName || stream.description || stream.name || qsTr("Unknown Application");
|
|
||||||
}
|
|
||||||
|
|
||||||
onSinkChanged: {
|
|
||||||
if (!sink?.ready)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const newSinkName = sink.description || sink.name || qsTr("Unknown Device");
|
|
||||||
|
|
||||||
if (previousSinkName && previousSinkName !== newSinkName && Config.utilities.toasts.audioOutputChanged)
|
|
||||||
Toaster.toast(qsTr("Audio output changed"), qsTr("Now using: %1").arg(newSinkName), "volume_up");
|
|
||||||
|
|
||||||
previousSinkName = newSinkName;
|
|
||||||
}
|
|
||||||
|
|
||||||
onSourceChanged: {
|
|
||||||
if (!source?.ready)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const newSourceName = source.description || source.name || qsTr("Unknown Device");
|
|
||||||
|
|
||||||
if (previousSourceName && previousSourceName !== newSourceName && Config.utilities.toasts.audioInputChanged)
|
|
||||||
Toaster.toast(qsTr("Audio input changed"), qsTr("Now using: %1").arg(newSourceName), "mic");
|
|
||||||
|
|
||||||
previousSourceName = newSourceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
previousSinkName = sink?.description || sink?.name || qsTr("Unknown Device");
|
|
||||||
previousSourceName = source?.description || source?.name || qsTr("Unknown Device");
|
|
||||||
}
|
|
||||||
|
|
||||||
PwObjectTracker {
|
|
||||||
objects: [...root.sinks, ...root.sources, ...root.streams]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,323 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
// Trigger ethernet device detection after initialization
|
|
||||||
Qt.callLater(() => {
|
|
||||||
getEthernetDevices();
|
|
||||||
});
|
|
||||||
// Load saved connections on startup
|
|
||||||
Nmcli.loadSavedConnections(() => {
|
|
||||||
root.savedConnections = Nmcli.savedConnections;
|
|
||||||
root.savedConnectionSsids = Nmcli.savedConnectionSsids;
|
|
||||||
});
|
|
||||||
// Get initial WiFi status
|
|
||||||
Nmcli.getWifiStatus(enabled => {
|
|
||||||
root.wifiEnabled = enabled;
|
|
||||||
});
|
|
||||||
// Sync networks from Nmcli on startup
|
|
||||||
Qt.callLater(() => {
|
|
||||||
syncNetworksFromNmcli();
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property list<AccessPoint> networks: []
|
|
||||||
readonly property AccessPoint active: networks.find(n => n.active) ?? null
|
|
||||||
property bool wifiEnabled: true
|
|
||||||
readonly property bool scanning: Nmcli.scanning
|
|
||||||
|
|
||||||
property list<var> ethernetDevices: []
|
|
||||||
readonly property var activeEthernet: ethernetDevices.find(d => d.connected) ?? null
|
|
||||||
property int ethernetDeviceCount: 0
|
|
||||||
property bool ethernetProcessRunning: false
|
|
||||||
property var ethernetDeviceDetails: null
|
|
||||||
property var wirelessDeviceDetails: null
|
|
||||||
|
|
||||||
function enableWifi(enabled: bool): void {
|
|
||||||
Nmcli.enableWifi(enabled, result => {
|
|
||||||
if (result.success) {
|
|
||||||
root.getWifiStatus();
|
|
||||||
Nmcli.getNetworks(() => {
|
|
||||||
syncNetworksFromNmcli();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleWifi(): void {
|
|
||||||
Nmcli.toggleWifi(result => {
|
|
||||||
if (result.success) {
|
|
||||||
root.getWifiStatus();
|
|
||||||
Nmcli.getNetworks(() => {
|
|
||||||
syncNetworksFromNmcli();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function rescanWifi(): void {
|
|
||||||
Nmcli.rescanWifi();
|
|
||||||
}
|
|
||||||
|
|
||||||
property var pendingConnection: null
|
|
||||||
signal connectionFailed(string ssid)
|
|
||||||
|
|
||||||
function connectToNetwork(ssid: string, password: string, bssid: string, callback: var): void {
|
|
||||||
// Set up pending connection tracking if callback provided
|
|
||||||
if (callback) {
|
|
||||||
const hasBssid = bssid !== undefined && bssid !== null && bssid.length > 0;
|
|
||||||
root.pendingConnection = {
|
|
||||||
ssid: ssid,
|
|
||||||
bssid: hasBssid ? bssid : "",
|
|
||||||
callback: callback
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Nmcli.connectToNetwork(ssid, password, bssid, result => {
|
|
||||||
if (result && result.success) {
|
|
||||||
// Connection successful
|
|
||||||
if (callback)
|
|
||||||
callback(result);
|
|
||||||
root.pendingConnection = null;
|
|
||||||
} else if (result && result.needsPassword) {
|
|
||||||
// Password needed - callback will handle showing dialog
|
|
||||||
if (callback)
|
|
||||||
callback(result);
|
|
||||||
} else {
|
|
||||||
// Connection failed
|
|
||||||
if (result && result.error) {
|
|
||||||
root.connectionFailed(ssid);
|
|
||||||
}
|
|
||||||
if (callback)
|
|
||||||
callback(result);
|
|
||||||
root.pendingConnection = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function connectToNetworkWithPasswordCheck(ssid: string, isSecure: bool, callback: var, bssid: string): void {
|
|
||||||
// Set up pending connection tracking
|
|
||||||
const hasBssid = bssid !== undefined && bssid !== null && bssid.length > 0;
|
|
||||||
root.pendingConnection = {
|
|
||||||
ssid: ssid,
|
|
||||||
bssid: hasBssid ? bssid : "",
|
|
||||||
callback: callback
|
|
||||||
};
|
|
||||||
|
|
||||||
Nmcli.connectToNetworkWithPasswordCheck(ssid, isSecure, result => {
|
|
||||||
if (result && result.success) {
|
|
||||||
// Connection successful
|
|
||||||
if (callback)
|
|
||||||
callback(result);
|
|
||||||
root.pendingConnection = null;
|
|
||||||
} else if (result && result.needsPassword) {
|
|
||||||
// Password needed - callback will handle showing dialog
|
|
||||||
if (callback)
|
|
||||||
callback(result);
|
|
||||||
} else {
|
|
||||||
// Connection failed
|
|
||||||
if (result && result.error) {
|
|
||||||
root.connectionFailed(ssid);
|
|
||||||
}
|
|
||||||
if (callback)
|
|
||||||
callback(result);
|
|
||||||
root.pendingConnection = null;
|
|
||||||
}
|
|
||||||
}, bssid);
|
|
||||||
}
|
|
||||||
|
|
||||||
function disconnectFromNetwork(): void {
|
|
||||||
// Try to disconnect - use connection name if available, otherwise use device
|
|
||||||
Nmcli.disconnectFromNetwork();
|
|
||||||
// Refresh network list after disconnection
|
|
||||||
Qt.callLater(() => {
|
|
||||||
Nmcli.getNetworks(() => {
|
|
||||||
syncNetworksFromNmcli();
|
|
||||||
});
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
function forgetNetwork(ssid: string): void {
|
|
||||||
// Delete the connection profile for this network
|
|
||||||
// This will remove the saved password and connection settings
|
|
||||||
Nmcli.forgetNetwork(ssid, result => {
|
|
||||||
if (result.success) {
|
|
||||||
// Refresh network list after deletion
|
|
||||||
Qt.callLater(() => {
|
|
||||||
Nmcli.getNetworks(() => {
|
|
||||||
syncNetworksFromNmcli();
|
|
||||||
});
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
property list<string> savedConnections: []
|
|
||||||
property list<string> savedConnectionSsids: []
|
|
||||||
|
|
||||||
// Sync saved connections from Nmcli when they're updated
|
|
||||||
Connections {
|
|
||||||
target: Nmcli
|
|
||||||
function onSavedConnectionsChanged() {
|
|
||||||
root.savedConnections = Nmcli.savedConnections;
|
|
||||||
}
|
|
||||||
function onSavedConnectionSsidsChanged() {
|
|
||||||
root.savedConnectionSsids = Nmcli.savedConnectionSsids;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function syncNetworksFromNmcli(): void {
|
|
||||||
const rNetworks = root.networks;
|
|
||||||
const nNetworks = Nmcli.networks;
|
|
||||||
|
|
||||||
// Build a map of existing networks by key
|
|
||||||
const existingMap = new Map();
|
|
||||||
for (const rn of rNetworks) {
|
|
||||||
const key = `${rn.frequency}:${rn.ssid}:${rn.bssid}`;
|
|
||||||
existingMap.set(key, rn);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build a map of new networks by key
|
|
||||||
const newMap = new Map();
|
|
||||||
for (const nn of nNetworks) {
|
|
||||||
const key = `${nn.frequency}:${nn.ssid}:${nn.bssid}`;
|
|
||||||
newMap.set(key, nn);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove networks that no longer exist
|
|
||||||
for (const [key, network] of existingMap) {
|
|
||||||
if (!newMap.has(key)) {
|
|
||||||
const index = rNetworks.indexOf(network);
|
|
||||||
if (index >= 0) {
|
|
||||||
rNetworks.splice(index, 1);
|
|
||||||
network.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add or update networks from Nmcli
|
|
||||||
for (const [key, nNetwork] of newMap) {
|
|
||||||
const existing = existingMap.get(key);
|
|
||||||
if (existing) {
|
|
||||||
// Update existing network's lastIpcObject
|
|
||||||
existing.lastIpcObject = nNetwork.lastIpcObject;
|
|
||||||
} else {
|
|
||||||
// Create new AccessPoint from Nmcli's data
|
|
||||||
rNetworks.push(apComp.createObject(root, {
|
|
||||||
lastIpcObject: nNetwork.lastIpcObject
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component AccessPoint: QtObject {
|
|
||||||
required property var lastIpcObject
|
|
||||||
readonly property string ssid: lastIpcObject.ssid
|
|
||||||
readonly property string bssid: lastIpcObject.bssid
|
|
||||||
readonly property int strength: lastIpcObject.strength
|
|
||||||
readonly property int frequency: lastIpcObject.frequency
|
|
||||||
readonly property bool active: lastIpcObject.active
|
|
||||||
readonly property string security: lastIpcObject.security
|
|
||||||
readonly property bool isSecure: security.length > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: apComp
|
|
||||||
AccessPoint {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function hasSavedProfile(ssid: string): bool {
|
|
||||||
// Use Nmcli's hasSavedProfile which has the same logic
|
|
||||||
return Nmcli.hasSavedProfile(ssid);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWifiStatus(): void {
|
|
||||||
Nmcli.getWifiStatus(enabled => {
|
|
||||||
root.wifiEnabled = enabled;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEthernetDevices(): void {
|
|
||||||
root.ethernetProcessRunning = true;
|
|
||||||
Nmcli.getEthernetInterfaces(interfaces => {
|
|
||||||
root.ethernetDevices = Nmcli.ethernetDevices;
|
|
||||||
root.ethernetDeviceCount = Nmcli.ethernetDevices.length;
|
|
||||||
root.ethernetProcessRunning = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function connectEthernet(connectionName: string, interfaceName: string): void {
|
|
||||||
Nmcli.connectEthernet(connectionName, interfaceName, result => {
|
|
||||||
if (result.success) {
|
|
||||||
getEthernetDevices();
|
|
||||||
// Refresh device details after connection
|
|
||||||
Qt.callLater(() => {
|
|
||||||
const activeDevice = root.ethernetDevices.find(function (d) {
|
|
||||||
return d.connected;
|
|
||||||
});
|
|
||||||
if (activeDevice && activeDevice.interface) {
|
|
||||||
updateEthernetDeviceDetails(activeDevice.interface);
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function disconnectEthernet(connectionName: string): void {
|
|
||||||
Nmcli.disconnectEthernet(connectionName, result => {
|
|
||||||
if (result.success) {
|
|
||||||
getEthernetDevices();
|
|
||||||
// Clear device details after disconnection
|
|
||||||
Qt.callLater(() => {
|
|
||||||
root.ethernetDeviceDetails = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateEthernetDeviceDetails(interfaceName: string): void {
|
|
||||||
Nmcli.getEthernetDeviceDetails(interfaceName, details => {
|
|
||||||
root.ethernetDeviceDetails = details;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateWirelessDeviceDetails(): void {
|
|
||||||
// Find the wireless interface by looking for wifi devices
|
|
||||||
// Pass empty string to let Nmcli find the active interface automatically
|
|
||||||
Nmcli.getWirelessDeviceDetails("", details => {
|
|
||||||
root.wirelessDeviceDetails = details;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function cidrToSubnetMask(cidr: string): string {
|
|
||||||
// Convert CIDR notation (e.g., "24") to subnet mask (e.g., "255.255.255.0")
|
|
||||||
const cidrNum = parseInt(cidr);
|
|
||||||
if (isNaN(cidrNum) || cidrNum < 0 || cidrNum > 32) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
const mask = (0xffffffff << (32 - cidrNum)) >>> 0;
|
|
||||||
const octets = [(mask >>> 24) & 0xff, (mask >>> 16) & 0xff, (mask >>> 8) & 0xff, mask & 0xff];
|
|
||||||
|
|
||||||
return octets.join(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
running: true
|
|
||||||
command: ["nmcli", "m"]
|
|
||||||
stdout: SplitParser {
|
|
||||||
onRead: {
|
|
||||||
Nmcli.getNetworks(() => {
|
|
||||||
syncNetworksFromNmcli();
|
|
||||||
});
|
|
||||||
getEthernetDevices();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,348 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import Quickshell.Services.Notifications
|
|
||||||
import Quickshell.Hyprland
|
|
||||||
import QtQuick
|
|
||||||
import ZShell
|
|
||||||
import qs.Components
|
|
||||||
import qs.Modules
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Paths
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property list<Notif> list: []
|
|
||||||
readonly property list<Notif> notClosed: list.filter( n => !n.closed )
|
|
||||||
readonly property list<Notif> popups: list.filter( n => n.popup )
|
|
||||||
property alias dnd: props.dnd
|
|
||||||
property alias server: server
|
|
||||||
|
|
||||||
property bool loaded
|
|
||||||
|
|
||||||
onListChanged: {
|
|
||||||
if ( loaded ) {
|
|
||||||
saveTimer.restart();
|
|
||||||
}
|
|
||||||
if ( root.list.length > 0 ) {
|
|
||||||
HasNotifications.hasNotifications = true;
|
|
||||||
} else {
|
|
||||||
HasNotifications.hasNotifications = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: saveTimer
|
|
||||||
interval: 1000
|
|
||||||
onTriggered: storage.setText( JSON.stringify( root.notClosed.map( n => ({
|
|
||||||
time: n.time,
|
|
||||||
id: n.id,
|
|
||||||
summary: n.summary,
|
|
||||||
body: n.body,
|
|
||||||
appIcon: n.appIcon,
|
|
||||||
appName: n.appName,
|
|
||||||
image: n.image,
|
|
||||||
expireTimeout: n.expireTimeout,
|
|
||||||
urgency: n.urgency,
|
|
||||||
resident: n.resident,
|
|
||||||
hasActionIcons: n.hasActionIcons,
|
|
||||||
actions: n.actions
|
|
||||||
}))));
|
|
||||||
}
|
|
||||||
|
|
||||||
PersistentProperties {
|
|
||||||
id: props
|
|
||||||
|
|
||||||
property bool dnd
|
|
||||||
|
|
||||||
reloadableId: "notifs"
|
|
||||||
}
|
|
||||||
|
|
||||||
NotificationServer {
|
|
||||||
id: server
|
|
||||||
|
|
||||||
keepOnReload: false
|
|
||||||
actionsSupported: true
|
|
||||||
bodyHyperlinksSupported: true
|
|
||||||
bodyImagesSupported: true
|
|
||||||
bodyMarkupSupported: true
|
|
||||||
imageSupported: true
|
|
||||||
persistenceSupported: true
|
|
||||||
|
|
||||||
onNotification: notif => {
|
|
||||||
notif.tracked = true;
|
|
||||||
|
|
||||||
const comp = notifComp.createObject(root, {
|
|
||||||
popup: !props.dnd,
|
|
||||||
notification: notif
|
|
||||||
});
|
|
||||||
root.list = [comp, ...root.list];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
id: storage
|
|
||||||
path: `${Paths.state}/notifs.json`
|
|
||||||
|
|
||||||
onLoaded: {
|
|
||||||
const data = JSON.parse(text());
|
|
||||||
for (const notif of data)
|
|
||||||
root.list.push(notifComp.createObject(root, notif));
|
|
||||||
root.list.sort((a, b) => b.time - a.time);
|
|
||||||
root.loaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
onLoadFailed: err => {
|
|
||||||
if (err === FileViewError.FileNotFound) {
|
|
||||||
root.loaded = true;
|
|
||||||
setText("[]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "clearnotifs"
|
|
||||||
description: "Clear all notifications"
|
|
||||||
onPressed: {
|
|
||||||
for (const notif of root.list.slice())
|
|
||||||
notif.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "notifs"
|
|
||||||
|
|
||||||
function clear(): void {
|
|
||||||
for (const notif of root.list.slice())
|
|
||||||
notif.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function isDndEnabled(): bool {
|
|
||||||
return props.dnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleDnd(): void {
|
|
||||||
props.dnd = !props.dnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
function enableDnd(): void {
|
|
||||||
props.dnd = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function disableDnd(): void {
|
|
||||||
props.dnd = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component Notif: QtObject {
|
|
||||||
id: notif
|
|
||||||
|
|
||||||
property bool popup
|
|
||||||
property bool closed
|
|
||||||
property var locks: new Set()
|
|
||||||
|
|
||||||
property date time: new Date()
|
|
||||||
readonly property string timeStr: {
|
|
||||||
const diff = Time.date.getTime() - time.getTime();
|
|
||||||
const m = Math.floor(diff / 60000);
|
|
||||||
|
|
||||||
if (m < 1)
|
|
||||||
return qsTr("now");
|
|
||||||
|
|
||||||
const h = Math.floor(m / 60);
|
|
||||||
const d = Math.floor(h / 24);
|
|
||||||
|
|
||||||
if (d > 0)
|
|
||||||
return `${d}d`;
|
|
||||||
if (h > 0)
|
|
||||||
return `${h}h`;
|
|
||||||
return `${m}m`;
|
|
||||||
}
|
|
||||||
|
|
||||||
property Notification notification
|
|
||||||
property string id
|
|
||||||
property string summary
|
|
||||||
property string body
|
|
||||||
property string appIcon
|
|
||||||
property string appName
|
|
||||||
property string image
|
|
||||||
property real expireTimeout: 5
|
|
||||||
property int urgency: NotificationUrgency.Normal
|
|
||||||
property bool resident
|
|
||||||
property bool hasActionIcons
|
|
||||||
property list<var> actions
|
|
||||||
|
|
||||||
readonly property Timer timer: Timer {
|
|
||||||
property int totalTime: Config.notifs.defaultExpireTimeout
|
|
||||||
property int remainingTime: totalTime
|
|
||||||
property bool paused: false
|
|
||||||
|
|
||||||
running: !paused
|
|
||||||
repeat: true
|
|
||||||
interval: 50
|
|
||||||
onTriggered: {
|
|
||||||
remainingTime -= interval;
|
|
||||||
|
|
||||||
if ( remainingTime <= 0 ) {
|
|
||||||
remainingTime = 0;
|
|
||||||
notif.popup = false;
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property LazyLoader dummyImageLoader: LazyLoader {
|
|
||||||
active: false
|
|
||||||
|
|
||||||
PanelWindow {
|
|
||||||
implicitWidth: Config.notifs.sizes.image
|
|
||||||
implicitHeight: Config.notifs.sizes.image
|
|
||||||
color: "transparent"
|
|
||||||
mask: Region {}
|
|
||||||
|
|
||||||
Image {
|
|
||||||
function tryCache(): void {
|
|
||||||
if (status !== Image.Ready || width != Config.notifs.sizes.image || height != Config.notifs.sizes.image)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const cacheKey = notif.appName + notif.summary + notif.id;
|
|
||||||
let h1 = 0xdeadbeef, h2 = 0x41c6ce57, ch;
|
|
||||||
for (let i = 0; i < cacheKey.length; i++) {
|
|
||||||
ch = cacheKey.charCodeAt(i);
|
|
||||||
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
||||||
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
||||||
}
|
|
||||||
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
|
|
||||||
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
||||||
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
|
|
||||||
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
||||||
const hash = (h2 >>> 0).toString(16).padStart(8, 0) + (h1 >>> 0).toString(16).padStart(8, 0);
|
|
||||||
|
|
||||||
const cache = `${Paths.notifimagecache}/${hash}.png`;
|
|
||||||
ZShellIo.saveItem(this, Qt.resolvedUrl(cache), () => {
|
|
||||||
notif.image = cache;
|
|
||||||
notif.dummyImageLoader.active = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
source: Qt.resolvedUrl(notif.image)
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
cache: false
|
|
||||||
asynchronous: true
|
|
||||||
opacity: 0
|
|
||||||
|
|
||||||
onStatusChanged: tryCache()
|
|
||||||
onWidthChanged: tryCache()
|
|
||||||
onHeightChanged: tryCache()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property Connections conn: Connections {
|
|
||||||
target: notif.notification
|
|
||||||
|
|
||||||
function onClosed(): void {
|
|
||||||
notif.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSummaryChanged(): void {
|
|
||||||
notif.summary = notif.notification.summary;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onBodyChanged(): void {
|
|
||||||
notif.body = notif.notification.body;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onAppIconChanged(): void {
|
|
||||||
notif.appIcon = notif.notification.appIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onAppNameChanged(): void {
|
|
||||||
notif.appName = notif.notification.appName;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onImageChanged(): void {
|
|
||||||
notif.image = notif.notification.image;
|
|
||||||
if (notif.notification?.image)
|
|
||||||
notif.dummyImageLoader.active = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onExpireTimeoutChanged(): void {
|
|
||||||
notif.expireTimeout = notif.notification.expireTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onUrgencyChanged(): void {
|
|
||||||
notif.urgency = notif.notification.urgency;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onResidentChanged(): void {
|
|
||||||
notif.resident = notif.notification.resident;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onHasActionIconsChanged(): void {
|
|
||||||
notif.hasActionIcons = notif.notification.hasActionIcons;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onActionsChanged(): void {
|
|
||||||
notif.actions = notif.notification.actions.map(a => ({
|
|
||||||
identifier: a.identifier,
|
|
||||||
text: a.text,
|
|
||||||
invoke: () => a.invoke()
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function lock(item: Item): void {
|
|
||||||
locks.add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unlock(item: Item): void {
|
|
||||||
locks.delete(item);
|
|
||||||
if (closed)
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function close(): void {
|
|
||||||
closed = true;
|
|
||||||
if (locks.size === 0 && root.list.includes(this)) {
|
|
||||||
root.list = root.list.filter(n => n !== this);
|
|
||||||
notification?.dismiss();
|
|
||||||
destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (!notification)
|
|
||||||
return;
|
|
||||||
|
|
||||||
id = notification.id;
|
|
||||||
summary = notification.summary;
|
|
||||||
body = notification.body;
|
|
||||||
appIcon = notification.appIcon;
|
|
||||||
appName = notification.appName;
|
|
||||||
image = notification.image;
|
|
||||||
if (notification?.image)
|
|
||||||
dummyImageLoader.active = true;
|
|
||||||
expireTimeout = notification.expireTimeout;
|
|
||||||
urgency = notification.urgency;
|
|
||||||
resident = notification.resident;
|
|
||||||
hasActionIcons = notification.hasActionIcons;
|
|
||||||
actions = notification.actions.map(a => ({
|
|
||||||
identifier: a.identifier,
|
|
||||||
text: a.text,
|
|
||||||
invoke: () => a.invoke()
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: notifComp
|
|
||||||
|
|
||||||
Notif {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Shapes
|
|
||||||
import qs.Modules as Modules
|
|
||||||
import qs.Modules.Notifications as Notifications
|
|
||||||
import qs.Modules.Notifications.Sidebar as Sidebar
|
|
||||||
import qs.Modules.Notifications.Sidebar.Utils as Utils
|
|
||||||
import qs.Modules.Dashboard as Dashboard
|
|
||||||
import qs.Modules.Osd as Osd
|
|
||||||
import qs.Modules.Launcher as Launcher
|
|
||||||
import qs.Modules.Settings as Settings
|
|
||||||
|
|
||||||
Shape {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property Panels panels
|
|
||||||
required property Item bar
|
|
||||||
required property PersistentProperties visibilities
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
// anchors.margins: 8
|
|
||||||
anchors.topMargin: bar.implicitHeight
|
|
||||||
preferredRendererType: Shape.CurveRenderer
|
|
||||||
|
|
||||||
Component.onCompleted: console.log(root.bar.implicitHeight, root.bar.anchors.topMargin)
|
|
||||||
|
|
||||||
Osd.Background {
|
|
||||||
wrapper: root.panels.osd
|
|
||||||
|
|
||||||
startX: root.width - root.panels.sidebar.width
|
|
||||||
startY: ( root.height - wrapper.height ) / 2 - rounding
|
|
||||||
}
|
|
||||||
|
|
||||||
Modules.Background {
|
|
||||||
wrapper: root.panels.popouts
|
|
||||||
invertBottomRounding: wrapper.x <= 0
|
|
||||||
|
|
||||||
startX: wrapper.x - 8
|
|
||||||
startY: wrapper.y
|
|
||||||
}
|
|
||||||
|
|
||||||
Notifications.Background {
|
|
||||||
wrapper: root.panels.notifications
|
|
||||||
sidebar: sidebar
|
|
||||||
|
|
||||||
startX: root.width
|
|
||||||
startY: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Launcher.Background {
|
|
||||||
wrapper: root.panels.launcher
|
|
||||||
|
|
||||||
startX: ( root.width - wrapper.width ) / 2 - rounding
|
|
||||||
startY: root.height
|
|
||||||
}
|
|
||||||
|
|
||||||
Dashboard.Background {
|
|
||||||
wrapper: root.panels.dashboard
|
|
||||||
|
|
||||||
startX: root.width - root.panels.dashboard.width - rounding
|
|
||||||
startY: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils.Background {
|
|
||||||
wrapper: root.panels.utilities
|
|
||||||
sidebar: sidebar
|
|
||||||
|
|
||||||
startX: root.width
|
|
||||||
startY: root.height
|
|
||||||
}
|
|
||||||
|
|
||||||
Sidebar.Background {
|
|
||||||
id: sidebar
|
|
||||||
|
|
||||||
wrapper: root.panels.sidebar
|
|
||||||
panels: root.panels
|
|
||||||
|
|
||||||
startX: root.width
|
|
||||||
startY: root.panels.notifications.height
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings.Background {
|
|
||||||
id: settings
|
|
||||||
|
|
||||||
wrapper: root.panels.settings
|
|
||||||
|
|
||||||
startX: ( root.width - wrapper.width ) / 2 - rounding
|
|
||||||
startY: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,198 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Effects
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Wayland
|
|
||||||
import Quickshell.Hyprland
|
|
||||||
import qs.Daemons
|
|
||||||
import qs.Components
|
|
||||||
import qs.Modules
|
|
||||||
import qs.Modules.Bar
|
|
||||||
import qs.Config
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Drawers
|
|
||||||
|
|
||||||
Variants {
|
|
||||||
model: Quickshell.screens
|
|
||||||
Scope {
|
|
||||||
id: scope
|
|
||||||
required property var modelData
|
|
||||||
PanelWindow {
|
|
||||||
id: bar
|
|
||||||
property bool trayMenuVisible: false
|
|
||||||
screen: scope.modelData
|
|
||||||
color: "transparent"
|
|
||||||
property var root: Quickshell.shellDir
|
|
||||||
|
|
||||||
WlrLayershell.namespace: "ZShell-Bar"
|
|
||||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
|
||||||
WlrLayershell.keyboardFocus: visibilities.launcher || visibilities.sidebar || visibilities.dashboard ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
|
||||||
|
|
||||||
contentItem.focus: true
|
|
||||||
|
|
||||||
contentItem.Keys.onEscapePressed: {
|
|
||||||
if ( Config.barConfig.autoHide )
|
|
||||||
visibilities.bar = false;
|
|
||||||
visibilities.sidebar = false;
|
|
||||||
visibilities.dashboard = false;
|
|
||||||
visibilities.osd = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
PanelWindow {
|
|
||||||
id: exclusionZone
|
|
||||||
WlrLayershell.namespace: "ZShell-Bar-Exclusion"
|
|
||||||
screen: bar.screen
|
|
||||||
WlrLayershell.layer: WlrLayer.Bottom
|
|
||||||
WlrLayershell.exclusionMode: Config.barConfig.autoHide ? ExclusionMode.Ignore : ExclusionMode.Auto
|
|
||||||
anchors {
|
|
||||||
left: true
|
|
||||||
right: true
|
|
||||||
top: true
|
|
||||||
}
|
|
||||||
color: "transparent"
|
|
||||||
implicitHeight: 34
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
top: true
|
|
||||||
left: true
|
|
||||||
right: true
|
|
||||||
bottom: true
|
|
||||||
}
|
|
||||||
|
|
||||||
mask: Region {
|
|
||||||
id: region
|
|
||||||
x: 0
|
|
||||||
y: Config.barConfig.autoHide && !visibilities.bar ? 4 : 34
|
|
||||||
|
|
||||||
property list<Region> nullRegions: []
|
|
||||||
|
|
||||||
width: bar.width
|
|
||||||
height: bar.screen.height - backgroundRect.implicitHeight
|
|
||||||
intersection: Intersection.Xor
|
|
||||||
|
|
||||||
regions: popoutRegions.instances
|
|
||||||
}
|
|
||||||
|
|
||||||
Variants {
|
|
||||||
id: popoutRegions
|
|
||||||
model: panels.children
|
|
||||||
|
|
||||||
Region {
|
|
||||||
required property Item modelData
|
|
||||||
|
|
||||||
x: modelData.x
|
|
||||||
y: modelData.y + backgroundRect.implicitHeight
|
|
||||||
width: modelData.width
|
|
||||||
height: modelData.height
|
|
||||||
intersection: Intersection.Subtract
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HyprlandFocusGrab {
|
|
||||||
id: focusGrab
|
|
||||||
|
|
||||||
active: visibilities.launcher || visibilities.sidebar || visibilities.dashboard || ( panels.popouts.hasCurrent && panels.popouts.currentName.startsWith( "traymenu" ))
|
|
||||||
windows: [bar]
|
|
||||||
onCleared: {
|
|
||||||
visibilities.launcher = false;
|
|
||||||
visibilities.sidebar = false;
|
|
||||||
visibilities.dashboard = false;
|
|
||||||
visibilities.osd = false;
|
|
||||||
panels.popouts.hasCurrent = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PersistentProperties {
|
|
||||||
id: visibilities
|
|
||||||
|
|
||||||
property bool sidebar
|
|
||||||
property bool dashboard
|
|
||||||
property bool bar
|
|
||||||
property bool osd
|
|
||||||
property bool launcher
|
|
||||||
property bool notif: NotifServer.popups.length > 0
|
|
||||||
property bool settings
|
|
||||||
|
|
||||||
Component.onCompleted: Visibilities.load(scope.modelData, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
Binding {
|
|
||||||
target: visibilities
|
|
||||||
property: "bar"
|
|
||||||
value: visibilities.sidebar || visibilities.dashboard || visibilities.osd || visibilities.notif
|
|
||||||
when: Config.barConfig.autoHide
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
opacity: Appearance.transparency.enabled ? DynamicColors.transparency.base : 1
|
|
||||||
layer.enabled: true
|
|
||||||
layer.effect: MultiEffect {
|
|
||||||
shadowEnabled: true
|
|
||||||
blurMax: 32
|
|
||||||
shadowColor: Qt.alpha(DynamicColors.palette.m3shadow, 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
Border {
|
|
||||||
bar: backgroundRect
|
|
||||||
visibilities: visibilities
|
|
||||||
}
|
|
||||||
|
|
||||||
Backgrounds {
|
|
||||||
visibilities: visibilities
|
|
||||||
panels: panels
|
|
||||||
bar: backgroundRect
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Interactions {
|
|
||||||
id: mouseArea
|
|
||||||
screen: scope.modelData
|
|
||||||
popouts: panels.popouts
|
|
||||||
visibilities: visibilities
|
|
||||||
panels: panels
|
|
||||||
bar: barLoader
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
Panels {
|
|
||||||
id: panels
|
|
||||||
screen: scope.modelData
|
|
||||||
bar: backgroundRect
|
|
||||||
visibilities: visibilities
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
id: backgroundRect
|
|
||||||
property Wrapper popouts: panels.popouts
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
implicitHeight: 34
|
|
||||||
anchors.topMargin: Config.barConfig.autoHide && !visibilities.bar ? -30 : 0
|
|
||||||
color: "transparent"
|
|
||||||
radius: 0
|
|
||||||
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on anchors.topMargin {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
BarLoader {
|
|
||||||
id: barLoader
|
|
||||||
anchors.fill: parent
|
|
||||||
popouts: panels.popouts
|
|
||||||
bar: bar
|
|
||||||
visibilities: visibilities
|
|
||||||
screen: scope.modelData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,278 +0,0 @@
|
|||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
import qs.Components
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules as BarPopouts
|
|
||||||
|
|
||||||
CustomMouseArea {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property ShellScreen screen
|
|
||||||
required property BarPopouts.Wrapper popouts
|
|
||||||
required property PersistentProperties visibilities
|
|
||||||
required property Panels panels
|
|
||||||
required property Item bar
|
|
||||||
|
|
||||||
property point dragStart
|
|
||||||
property bool dashboardShortcutActive
|
|
||||||
property bool osdShortcutActive
|
|
||||||
property bool utilitiesShortcutActive
|
|
||||||
|
|
||||||
function withinPanelHeight(panel: Item, x: real, y: real): bool {
|
|
||||||
const panelY = panel.y + bar.implicitHeight;
|
|
||||||
return y >= panelY && y <= panelY + panel.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
function withinPanelWidth(panel: Item, x: real, y: real): bool {
|
|
||||||
const panelX = panel.x;
|
|
||||||
return x >= panelX && x <= panelX + panel.width;
|
|
||||||
}
|
|
||||||
|
|
||||||
function inLeftPanel(panel: Item, x: real, y: real): bool {
|
|
||||||
return x < panel.x + panel.width && withinPanelHeight(panel, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
function inRightPanel(panel: Item, x: real, y: real): bool {
|
|
||||||
return x > panel.x && withinPanelHeight(panel, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
function inTopPanel(panel: Item, x: real, y: real): bool {
|
|
||||||
return y < bar.implicitHeight + panel.height && withinPanelWidth(panel, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
|
||||||
return y > root.height - panel.height && withinPanelWidth(panel, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onWheel(event: WheelEvent): void {
|
|
||||||
if (event.x < bar.implicitWidth) {
|
|
||||||
bar.handleWheel(event.y, event.angleDelta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
|
|
||||||
// onPressed: event => {
|
|
||||||
// if ( root.popouts.hasCurrent && !inTopPanel( root.popouts, event.x, event.y )) {
|
|
||||||
// root.popouts.hasCurrent = false;
|
|
||||||
// } else if (root.visibilities.sidebar && !inRightPanel( panels.sidebar, event.x, event.y )) {
|
|
||||||
// root.visibilities.sidebar = false;
|
|
||||||
// } else if (root.visibilities.dashboard && !inTopPanel( panels.dashboard, event.x, event.y )) {
|
|
||||||
// root.visibilities.dashboard = false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
onContainsMouseChanged: {
|
|
||||||
if (!containsMouse) {
|
|
||||||
// Only hide if not activated by shortcut
|
|
||||||
if (!osdShortcutActive) {
|
|
||||||
visibilities.osd = false;
|
|
||||||
root.panels.osd.hovered = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!popouts.currentName.startsWith("traymenu")) {
|
|
||||||
popouts.hasCurrent = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Config.barConfig.autoHide && !root.visibilities.sidebar && !root.visibilities.dashboard)
|
|
||||||
root.visibilities.bar = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPositionChanged: event => {
|
|
||||||
if (popouts.isDetached)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const x = event.x;
|
|
||||||
const y = event.y;
|
|
||||||
const dragX = x - dragStart.x;
|
|
||||||
const dragY = y - dragStart.y;
|
|
||||||
|
|
||||||
// Show bar in non-exclusive mode on hover
|
|
||||||
if (!visibilities.bar && Config.barConfig.autoHide && y < bar.implicitHeight + bar.anchors.topMargin)
|
|
||||||
visibilities.bar = true;
|
|
||||||
|
|
||||||
if (panels.sidebar.width === 0) {
|
|
||||||
// Show osd on hover
|
|
||||||
const showOsd = inRightPanel(panels.osd, x, y);
|
|
||||||
|
|
||||||
// // Always update visibility based on hover if not in shortcut mode
|
|
||||||
if (!osdShortcutActive) {
|
|
||||||
visibilities.osd = showOsd;
|
|
||||||
root.panels.osd.hovered = showOsd;
|
|
||||||
} else if (showOsd) {
|
|
||||||
// If hovering over OSD area while in shortcut mode, transition to hover control
|
|
||||||
osdShortcutActive = false;
|
|
||||||
root.panels.osd.hovered = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// const showSidebar = pressed && dragStart.x > bar.implicitWidth + panels.sidebar.x;
|
|
||||||
//
|
|
||||||
// // Show/hide session on drag
|
|
||||||
// if (pressed && inRightPanel(panels.session, dragStart.x, dragStart.y) && withinPanelHeight(panels.session, x, y)) {
|
|
||||||
// if (dragX < -Config.session.dragThreshold)
|
|
||||||
// visibilities.session = true;
|
|
||||||
// else if (dragX > Config.session.dragThreshold)
|
|
||||||
// visibilities.session = false;
|
|
||||||
//
|
|
||||||
// // Show sidebar on drag if in session area and session is nearly fully visible
|
|
||||||
// if (showSidebar && panels.session.width >= panels.session.nonAnimWidth && dragX < -Config.sidebar.dragThreshold)
|
|
||||||
// visibilities.sidebar = true;
|
|
||||||
// } else if (showSidebar && dragX < -Config.sidebar.dragThreshold) {
|
|
||||||
// // Show sidebar on drag if not in session area
|
|
||||||
// visibilities.sidebar = true;
|
|
||||||
// }
|
|
||||||
} else {
|
|
||||||
const outOfSidebar = x < width - panels.sidebar.width;
|
|
||||||
// Show osd on hover
|
|
||||||
const showOsd = outOfSidebar && inRightPanel(panels.osd, x, y);
|
|
||||||
|
|
||||||
// Always update visibility based on hover if not in shortcut mode
|
|
||||||
if (!osdShortcutActive) {
|
|
||||||
visibilities.osd = showOsd;
|
|
||||||
root.panels.osd.hovered = showOsd;
|
|
||||||
} else if (showOsd) {
|
|
||||||
// If hovering over OSD area while in shortcut mode, transition to hover control
|
|
||||||
osdShortcutActive = false;
|
|
||||||
root.panels.osd.hovered = true;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// // Show/hide session on drag
|
|
||||||
// if (pressed && outOfSidebar && inRightPanel(panels.session, dragStart.x, dragStart.y) && withinPanelHeight(panels.session, x, y)) {
|
|
||||||
// if (dragX < -Config.session.dragThreshold)
|
|
||||||
// visibilities.session = true;
|
|
||||||
// else if (dragX > Config.session.dragThreshold)
|
|
||||||
// visibilities.session = false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Hide sidebar on drag
|
|
||||||
// if (pressed && inRightPanel(panels.sidebar, dragStart.x, 0) && dragX > Config.sidebar.dragThreshold)
|
|
||||||
// visibilities.sidebar = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show launcher on hover, or show/hide on drag if hover is disabled
|
|
||||||
// if (Config.launcher.showOnHover) {
|
|
||||||
// if (!visibilities.launcher && inBottomPanel(panels.launcher, x, y))
|
|
||||||
// visibilities.launcher = true;
|
|
||||||
// } else if (pressed && inBottomPanel(panels.launcher, dragStart.x, dragStart.y) && withinPanelWidth(panels.launcher, x, y)) {
|
|
||||||
// if (dragY < -Config.launcher.dragThreshold)
|
|
||||||
// visibilities.launcher = true;
|
|
||||||
// else if (dragY > Config.launcher.dragThreshold)
|
|
||||||
// visibilities.launcher = false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Show dashboard on hover
|
|
||||||
// const showDashboard = Config.dashboard.showOnHover && inTopPanel(panels.dashboard, x, y);
|
|
||||||
//
|
|
||||||
// // Always update visibility based on hover if not in shortcut mode
|
|
||||||
// if (!dashboardShortcutActive) {
|
|
||||||
// visibilities.dashboard = showDashboard;
|
|
||||||
// } else if (showDashboard) {
|
|
||||||
// // If hovering over dashboard area while in shortcut mode, transition to hover control
|
|
||||||
// dashboardShortcutActive = false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Show/hide dashboard on drag (for touchscreen devices)
|
|
||||||
// if (pressed && inTopPanel(panels.dashboard, dragStart.x, dragStart.y) && withinPanelWidth(panels.dashboard, x, y)) {
|
|
||||||
// if (dragY > Config.dashboard.dragThreshold)
|
|
||||||
// visibilities.dashboard = true;
|
|
||||||
// else if (dragY < -Config.dashboard.dragThreshold)
|
|
||||||
// visibilities.dashboard = false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Show utilities on hover
|
|
||||||
// const showUtilities = inBottomPanel(panels.utilities, x, y);
|
|
||||||
//
|
|
||||||
// // Always update visibility based on hover if not in shortcut mode
|
|
||||||
// if (!utilitiesShortcutActive) {
|
|
||||||
// visibilities.utilities = showUtilities;
|
|
||||||
// } else if (showUtilities) {
|
|
||||||
// // If hovering over utilities area while in shortcut mode, transition to hover control
|
|
||||||
// utilitiesShortcutActive = false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Show popouts on hover
|
|
||||||
if (y < bar.implicitHeight) {
|
|
||||||
bar.checkPopout(x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Monitor individual visibility changes
|
|
||||||
Connections {
|
|
||||||
target: root.visibilities
|
|
||||||
|
|
||||||
function onLauncherChanged() {
|
|
||||||
// If launcher is hidden, clear shortcut flags for dashboard and OSD
|
|
||||||
if (!root.visibilities.launcher) {
|
|
||||||
root.dashboardShortcutActive = false;
|
|
||||||
root.osdShortcutActive = false;
|
|
||||||
root.utilitiesShortcutActive = false;
|
|
||||||
|
|
||||||
// Also hide dashboard and OSD if they're not being hovered
|
|
||||||
const inDashboardArea = root.inTopPanel(root.panels.dashboard, root.mouseX, root.mouseY);
|
|
||||||
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
|
||||||
|
|
||||||
if (!inDashboardArea) {
|
|
||||||
root.visibilities.dashboard = false;
|
|
||||||
}
|
|
||||||
if (!inOsdArea) {
|
|
||||||
root.visibilities.osd = false;
|
|
||||||
root.panels.osd.hovered = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSidebarChanged() {
|
|
||||||
if ( root.visibilities.sidebar ) {
|
|
||||||
root.visibilities.dashboard = false;
|
|
||||||
root.popouts.hasCurrent = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDashboardChanged() {
|
|
||||||
if (root.visibilities.dashboard) {
|
|
||||||
// Dashboard became visible, immediately check if this should be shortcut mode
|
|
||||||
const inDashboardArea = root.inTopPanel(root.panels.dashboard, root.mouseX, root.mouseY);
|
|
||||||
if (!inDashboardArea) {
|
|
||||||
root.dashboardShortcutActive = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
root.visibilities.sidebar = false;
|
|
||||||
root.popouts.hasCurrent = false;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Dashboard hidden, clear shortcut flag
|
|
||||||
root.dashboardShortcutActive = false;
|
|
||||||
// root.visibilities.bar = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onOsdChanged() {
|
|
||||||
if (root.visibilities.osd) {
|
|
||||||
// OSD became visible, immediately check if this should be shortcut mode
|
|
||||||
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
|
||||||
console.log(inOsdArea);
|
|
||||||
if (!inOsdArea) {
|
|
||||||
root.osdShortcutActive = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// OSD hidden, clear shortcut flag
|
|
||||||
root.osdShortcutActive = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onUtilitiesChanged() {
|
|
||||||
if (root.visibilities.utilities) {
|
|
||||||
// Utilities became visible, immediately check if this should be shortcut mode
|
|
||||||
const inUtilitiesArea = root.inBottomPanel(root.panels.utilities, root.mouseX, root.mouseY);
|
|
||||||
if (!inUtilitiesArea) {
|
|
||||||
root.utilitiesShortcutActive = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Utilities hidden, clear shortcut flag
|
|
||||||
root.utilitiesShortcutActive = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
import qs.Components
|
|
||||||
import qs.Modules as Modules
|
|
||||||
import qs.Modules.Notifications as Notifications
|
|
||||||
import qs.Modules.Notifications.Sidebar as Sidebar
|
|
||||||
import qs.Modules.Notifications.Sidebar.Utils as Utils
|
|
||||||
import qs.Modules.Dashboard as Dashboard
|
|
||||||
import qs.Modules.Osd as Osd
|
|
||||||
import qs.Components.Toast as Toasts
|
|
||||||
import qs.Modules.Launcher as Launcher
|
|
||||||
import qs.Modules.Settings as Settings
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property ShellScreen screen
|
|
||||||
required property Item bar
|
|
||||||
required property PersistentProperties visibilities
|
|
||||||
|
|
||||||
readonly property alias popouts: popouts
|
|
||||||
readonly property alias sidebar: sidebar
|
|
||||||
readonly property alias notifications: notifications
|
|
||||||
readonly property alias utilities: utilities
|
|
||||||
readonly property alias dashboard: dashboard
|
|
||||||
readonly property alias osd: osd
|
|
||||||
readonly property alias toasts: toasts
|
|
||||||
readonly property alias launcher: launcher
|
|
||||||
readonly property alias settings: settings
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
// anchors.margins: 8
|
|
||||||
anchors.topMargin: Config.barConfig.autoHide && !visibilities.bar ? 0 : bar.implicitHeight
|
|
||||||
Behavior on anchors.topMargin {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Osd.Wrapper {
|
|
||||||
id: osd
|
|
||||||
|
|
||||||
clip: sidebar.width > 0
|
|
||||||
screen: root.screen
|
|
||||||
visibilities: root.visibilities
|
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: sidebar.width
|
|
||||||
}
|
|
||||||
|
|
||||||
Modules.Wrapper {
|
|
||||||
id: popouts
|
|
||||||
|
|
||||||
screen: root.screen
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
|
||||||
|
|
||||||
x: {
|
|
||||||
const off = currentCenter - nonAnimWidth / 2;
|
|
||||||
const diff = root.width - Math.floor(off + nonAnimWidth);
|
|
||||||
if ( diff < 0 )
|
|
||||||
return off + diff;
|
|
||||||
return Math.floor( Math.max( off, 0 ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Toasts.Toasts {
|
|
||||||
id: toasts
|
|
||||||
|
|
||||||
anchors.bottom: sidebar.visible ? parent.bottom : utilities.top
|
|
||||||
anchors.right: sidebar.left
|
|
||||||
anchors.margins: Appearance.padding.normal
|
|
||||||
}
|
|
||||||
|
|
||||||
Notifications.Wrapper {
|
|
||||||
id: notifications
|
|
||||||
|
|
||||||
visibilities: root.visibilities
|
|
||||||
panels: root
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.right: parent.right
|
|
||||||
}
|
|
||||||
|
|
||||||
Launcher.Wrapper {
|
|
||||||
id: launcher
|
|
||||||
|
|
||||||
screen: root.screen
|
|
||||||
visibilities: root.visibilities
|
|
||||||
panels: root
|
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils.Wrapper {
|
|
||||||
id: utilities
|
|
||||||
|
|
||||||
visibilities: root.visibilities
|
|
||||||
sidebar: sidebar
|
|
||||||
popouts: popouts
|
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.right: parent.right
|
|
||||||
}
|
|
||||||
|
|
||||||
Dashboard.Wrapper {
|
|
||||||
id: dashboard
|
|
||||||
|
|
||||||
visibilities: root.visibilities
|
|
||||||
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
|
||||||
}
|
|
||||||
|
|
||||||
Sidebar.Wrapper {
|
|
||||||
id: sidebar
|
|
||||||
|
|
||||||
visibilities: root.visibilities
|
|
||||||
panels: root
|
|
||||||
|
|
||||||
anchors.top: notifications.bottom
|
|
||||||
anchors.bottom: utilities.top
|
|
||||||
anchors.right: parent.right
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings.Wrapper {
|
|
||||||
id: settings
|
|
||||||
|
|
||||||
visibilities: root.visibilities
|
|
||||||
panels: root
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Effects
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
property real radius
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: shadowRect
|
|
||||||
anchors.fill: root
|
|
||||||
radius: root.radius
|
|
||||||
layer.enabled: true
|
|
||||||
color: "black"
|
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
|
|
||||||
MultiEffect {
|
|
||||||
id: effects
|
|
||||||
source: shadowRect
|
|
||||||
anchors.fill: shadowRect
|
|
||||||
shadowBlur: 2.0
|
|
||||||
shadowEnabled: true
|
|
||||||
shadowOpacity: 1
|
|
||||||
shadowColor: "black"
|
|
||||||
maskSource: shadowRect
|
|
||||||
maskEnabled: true
|
|
||||||
maskInverted: true
|
|
||||||
autoPaddingEnabled: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Wayland
|
|
||||||
import Quickshell.Io
|
|
||||||
import Quickshell.Hyprland
|
|
||||||
import ZShell
|
|
||||||
import qs.Components
|
|
||||||
|
|
||||||
Scope {
|
|
||||||
LazyLoader {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool freeze
|
|
||||||
property bool closing
|
|
||||||
|
|
||||||
Variants {
|
|
||||||
model: Quickshell.screens
|
|
||||||
PanelWindow {
|
|
||||||
id: win
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
required property ShellScreen modelData
|
|
||||||
|
|
||||||
screen: modelData
|
|
||||||
WlrLayershell.namespace: "areapicker"
|
|
||||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
|
||||||
WlrLayershell.keyboardFocus: root.closing ? WlrKeyboardFocus.None : WlrKeyboardFocus.Exclusive
|
|
||||||
mask: root.closing ? empty : null
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
top: true
|
|
||||||
bottom: true
|
|
||||||
left: true
|
|
||||||
right: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Region {
|
|
||||||
id: empty
|
|
||||||
}
|
|
||||||
|
|
||||||
Picker {
|
|
||||||
loader: root
|
|
||||||
screen: win.modelData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "picker"
|
|
||||||
|
|
||||||
function open(): void {
|
|
||||||
root.freeze = false;
|
|
||||||
root.closing = false;
|
|
||||||
root.activeAsync = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function openFreeze(): void {
|
|
||||||
root.freeze = true;
|
|
||||||
root.closing = false;
|
|
||||||
root.activeAsync = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "screenshot"
|
|
||||||
onPressed: {
|
|
||||||
root.freeze = false;
|
|
||||||
root.closing = false;
|
|
||||||
root.activeAsync = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "screenshotFreeze"
|
|
||||||
onPressed: {
|
|
||||||
root.freeze = true;
|
|
||||||
root.closing = false;
|
|
||||||
root.activeAsync = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
|
||||||
import qs.Config
|
|
||||||
import qs.Components
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property list<var> ddcMonitors: []
|
|
||||||
readonly property list<Monitor> monitors: variants.instances
|
|
||||||
property bool appleDisplayPresent: false
|
|
||||||
|
|
||||||
function getMonitorForScreen(screen: ShellScreen): var {
|
|
||||||
return monitors.find(m => m.modelData === screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMonitor(query: string): var {
|
|
||||||
if (query === "active") {
|
|
||||||
return monitors.find(m => Hypr.monitorFor(m.modelData)?.focused);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query.startsWith("model:")) {
|
|
||||||
const model = query.slice(6);
|
|
||||||
return monitors.find(m => m.modelData.model === model);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query.startsWith("serial:")) {
|
|
||||||
const serial = query.slice(7);
|
|
||||||
return monitors.find(m => m.modelData.serialNumber === serial);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query.startsWith("id:")) {
|
|
||||||
const id = parseInt(query.slice(3), 10);
|
|
||||||
return monitors.find(m => Hypr.monitorFor(m.modelData)?.id === id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return monitors.find(m => m.modelData.name === query);
|
|
||||||
}
|
|
||||||
|
|
||||||
function increaseBrightness(): void {
|
|
||||||
const monitor = getMonitor("active");
|
|
||||||
if (monitor)
|
|
||||||
monitor.setBrightness(monitor.brightness + Config.services.brightnessIncrement);
|
|
||||||
}
|
|
||||||
|
|
||||||
function decreaseBrightness(): void {
|
|
||||||
const monitor = getMonitor("active");
|
|
||||||
if (monitor)
|
|
||||||
monitor.setBrightness(monitor.brightness - Config.services.brightnessIncrement);
|
|
||||||
}
|
|
||||||
|
|
||||||
onMonitorsChanged: {
|
|
||||||
ddcMonitors = [];
|
|
||||||
ddcProc.running = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Variants {
|
|
||||||
id: variants
|
|
||||||
|
|
||||||
model: Quickshell.screens
|
|
||||||
|
|
||||||
Monitor {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
running: true
|
|
||||||
command: ["sh", "-c", "asdbctl get"] // To avoid warnings if asdbctl is not installed
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: root.appleDisplayPresent = text.trim().length > 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: ddcProc
|
|
||||||
|
|
||||||
command: ["ddcutil", "detect", "--brief"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: root.ddcMonitors = text.trim().split("\n\n").filter(d => d.startsWith("Display ")).map(d => ({
|
|
||||||
busNum: d.match(/I2C bus:[ ]*\/dev\/i2c-([0-9]+)/)[1],
|
|
||||||
connector: d.match(/DRM connector:\s+(.*)/)[1].replace(/^card\d+-/, "") // strip "card1-"
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "brightnessUp"
|
|
||||||
description: "Increase brightness"
|
|
||||||
onPressed: root.increaseBrightness()
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "brightnessDown"
|
|
||||||
description: "Decrease brightness"
|
|
||||||
onPressed: root.decreaseBrightness()
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "brightness"
|
|
||||||
|
|
||||||
function get(): real {
|
|
||||||
return getFor("active");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allows searching by active/model/serial/id/name
|
|
||||||
function getFor(query: string): real {
|
|
||||||
return root.getMonitor(query)?.brightness ?? -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function set(value: string): string {
|
|
||||||
return setFor("active", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handles brightness value like brightnessctl: 0.1, +0.1, 0.1-, 10%, +10%, 10%-
|
|
||||||
function setFor(query: string, value: string): string {
|
|
||||||
const monitor = root.getMonitor(query);
|
|
||||||
if (!monitor)
|
|
||||||
return "Invalid monitor: " + query;
|
|
||||||
|
|
||||||
let targetBrightness;
|
|
||||||
if (value.endsWith("%-")) {
|
|
||||||
const percent = parseFloat(value.slice(0, -2));
|
|
||||||
targetBrightness = monitor.brightness - (percent / 100);
|
|
||||||
} else if (value.startsWith("+") && value.endsWith("%")) {
|
|
||||||
const percent = parseFloat(value.slice(1, -1));
|
|
||||||
targetBrightness = monitor.brightness + (percent / 100);
|
|
||||||
} else if (value.endsWith("%")) {
|
|
||||||
const percent = parseFloat(value.slice(0, -1));
|
|
||||||
targetBrightness = percent / 100;
|
|
||||||
} else if (value.startsWith("+")) {
|
|
||||||
const increment = parseFloat(value.slice(1));
|
|
||||||
targetBrightness = monitor.brightness + increment;
|
|
||||||
} else if (value.endsWith("-")) {
|
|
||||||
const decrement = parseFloat(value.slice(0, -1));
|
|
||||||
targetBrightness = monitor.brightness - decrement;
|
|
||||||
} else if (value.includes("%") || value.includes("-") || value.includes("+")) {
|
|
||||||
return `Invalid brightness format: ${value}\nExpected: 0.1, +0.1, 0.1-, 10%, +10%, 10%-`;
|
|
||||||
} else {
|
|
||||||
targetBrightness = parseFloat(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNaN(targetBrightness))
|
|
||||||
return `Failed to parse value: ${value}\nExpected: 0.1, +0.1, 0.1-, 10%, +10%, 10%-`;
|
|
||||||
|
|
||||||
monitor.setBrightness(targetBrightness);
|
|
||||||
|
|
||||||
return `Set monitor ${monitor.modelData.name} brightness to ${+monitor.brightness.toFixed(2)}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component Monitor: QtObject {
|
|
||||||
id: monitor
|
|
||||||
|
|
||||||
required property ShellScreen modelData
|
|
||||||
readonly property bool isDdc: root.ddcMonitors.some(m => m.connector === modelData.name)
|
|
||||||
readonly property string busNum: root.ddcMonitors.find(m => m.connector === modelData.name)?.busNum ?? ""
|
|
||||||
readonly property bool isAppleDisplay: root.appleDisplayPresent && modelData.model.startsWith("StudioDisplay")
|
|
||||||
property real brightness
|
|
||||||
property real queuedBrightness: NaN
|
|
||||||
|
|
||||||
readonly property Process initProc: Process {
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
if (monitor.isAppleDisplay) {
|
|
||||||
const val = parseInt(text.trim());
|
|
||||||
monitor.brightness = val / 101;
|
|
||||||
} else {
|
|
||||||
const [, , , cur, max] = text.split(" ");
|
|
||||||
monitor.brightness = parseInt(cur) / parseInt(max);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property Timer timer: Timer {
|
|
||||||
interval: 500
|
|
||||||
onTriggered: {
|
|
||||||
if (!isNaN(monitor.queuedBrightness)) {
|
|
||||||
monitor.setBrightness(monitor.queuedBrightness);
|
|
||||||
monitor.queuedBrightness = NaN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setBrightness(value: real): void {
|
|
||||||
value = Math.max(0, Math.min(1, value));
|
|
||||||
const rounded = Math.round(value * 100);
|
|
||||||
if (Math.round(brightness * 100) === rounded)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (isDdc && timer.running) {
|
|
||||||
queuedBrightness = value;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
brightness = value;
|
|
||||||
|
|
||||||
if (isAppleDisplay)
|
|
||||||
Quickshell.execDetached(["asdbctl", "set", rounded]);
|
|
||||||
else if (isDdc)
|
|
||||||
Quickshell.execDetached(["ddcutil", "--disable-dynamic-sleep", "--sleep-multiplier", ".1", "--skip-ddc-checks", "-b", busNum, "setvcp", "10", rounded]);
|
|
||||||
else
|
|
||||||
Quickshell.execDetached(["brightnessctl", "s", `${rounded}%`]);
|
|
||||||
|
|
||||||
if (isDdc)
|
|
||||||
timer.restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
function initBrightness(): void {
|
|
||||||
if (isAppleDisplay)
|
|
||||||
initProc.command = ["asdbctl", "get"];
|
|
||||||
else if (isDdc)
|
|
||||||
initProc.command = ["ddcutil", "-b", busNum, "getvcp", "10", "--brief"];
|
|
||||||
else
|
|
||||||
initProc.command = ["sh", "-c", "echo a b c $(brightnessctl g) $(brightnessctl m)"];
|
|
||||||
|
|
||||||
initProc.running = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
onBusNumChanged: initBrightness()
|
|
||||||
Component.onCompleted: initBrightness()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import ZShell.Internal
|
|
||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
import qs.Paths
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property alias path: manager.path
|
|
||||||
|
|
||||||
asynchronous: true
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: QsWindow.window
|
|
||||||
|
|
||||||
function onDevicePixelRatioChanged(): void {
|
|
||||||
manager.updateSource();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CachingImageManager {
|
|
||||||
id: manager
|
|
||||||
|
|
||||||
item: root
|
|
||||||
cacheDir: Qt.resolvedUrl(Paths.imagecache)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import qs.Helpers
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property int displayMonth: new Date().getMonth()
|
|
||||||
property int displayYear: new Date().getFullYear()
|
|
||||||
readonly property int weekStartDay: 1 // 0 = Sunday, 1 = Monday
|
|
||||||
|
|
||||||
function getWeeksForMonth(month: int, year: int): var {
|
|
||||||
const firstDayOfMonth = new Date(year, month, 1);
|
|
||||||
const lastDayOfMonth = new Date(year, month + 1, 0);
|
|
||||||
|
|
||||||
const days = [];
|
|
||||||
let currentDate = new Date(year, month, 1);
|
|
||||||
|
|
||||||
// Back up to the start of the first week (Sunday or Monday based on locale)
|
|
||||||
const dayOfWeek = firstDayOfMonth.getDay();
|
|
||||||
const daysToBackup = (dayOfWeek - root.weekStartDay + 7) % 7;
|
|
||||||
currentDate.setDate(currentDate.getDate() - daysToBackup);
|
|
||||||
|
|
||||||
// Collect all days, including padding from previous/next month to complete the weeks
|
|
||||||
while (true) {
|
|
||||||
days.push({
|
|
||||||
day: currentDate.getDate(),
|
|
||||||
month: currentDate.getMonth(),
|
|
||||||
year: currentDate.getFullYear(),
|
|
||||||
isCurrentMonth: currentDate.getMonth() === month,
|
|
||||||
isToday: isDateToday(currentDate)
|
|
||||||
});
|
|
||||||
|
|
||||||
currentDate.setDate(currentDate.getDate() + 1);
|
|
||||||
|
|
||||||
// Stop after we've completed a full week following the last day of the month
|
|
||||||
if (currentDate > lastDayOfMonth && days.length % 7 === 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return days;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWeekNumbers(month: int, year: int): var {
|
|
||||||
const days = getWeeksForMonth(month, year);
|
|
||||||
const weekNumbers = [];
|
|
||||||
let lastWeekNumber = -1;
|
|
||||||
|
|
||||||
for (let i = 0; i < days.length; i++) {
|
|
||||||
// Only add week numbers for days that belong to the current month
|
|
||||||
if (days[i].isCurrentMonth) {
|
|
||||||
const dayDate = new Date(days[i].year, days[i].month, days[i].day);
|
|
||||||
const weekNumber = getISOWeekNumber(dayDate);
|
|
||||||
|
|
||||||
// Only push if this is a new week
|
|
||||||
if (weekNumber !== lastWeekNumber) {
|
|
||||||
weekNumbers.push(weekNumber);
|
|
||||||
lastWeekNumber = weekNumber;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return weekNumbers;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getISOWeekNumber(date: var): int {
|
|
||||||
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
||||||
const dayNum = d.getUTCDay() || 7;
|
|
||||||
d.setUTCDate(d.getUTCDate() + 4 - dayNum);
|
|
||||||
const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
|
|
||||||
return Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isDateToday(date: var): bool {
|
|
||||||
const today = new Date();
|
|
||||||
return date.getDate() === today.getDate() &&
|
|
||||||
date.getMonth() === today.getMonth() &&
|
|
||||||
date.getFullYear() === today.getFullYear();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWeekStartIndex(month: int, year: int): int {
|
|
||||||
const today = new Date();
|
|
||||||
if (today.getMonth() !== month || today.getFullYear() !== year) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const days = getWeeksForMonth(month, year);
|
|
||||||
for (let i = 0; i < days.length; i++) {
|
|
||||||
if (days[i].isToday) {
|
|
||||||
// Return the start index of the week containing today
|
|
||||||
return Math.floor(i / 7) * 7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
function getTrayIcon(id: string, icon: string): string {
|
|
||||||
if (icon.includes("?path=")) {
|
|
||||||
const [name, path] = icon.split("?path=");
|
|
||||||
icon = Qt.resolvedUrl(`${path}/${name.slice(name.lastIndexOf("/") + 1)}`);
|
|
||||||
} else if (icon.includes("qspixmap") && id === "chrome_status_icon_1") {
|
|
||||||
icon = icon.replace("qspixmap", "icon/discord-tray");
|
|
||||||
}
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property alias hasNotifications: adapter.hasNotifications
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
id: adapter
|
|
||||||
property bool hasNotifications: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import ZShell
|
|
||||||
import ZShell.Internal
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Hyprland
|
|
||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
|
||||||
import qs.Components
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
readonly property var toplevels: Hyprland.toplevels
|
|
||||||
readonly property var workspaces: Hyprland.workspaces
|
|
||||||
readonly property var monitors: Hyprland.monitors
|
|
||||||
|
|
||||||
readonly property HyprlandToplevel activeToplevel: Hyprland.activeToplevel
|
|
||||||
readonly property HyprlandWorkspace focusedWorkspace: Hyprland.focusedWorkspace
|
|
||||||
readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor
|
|
||||||
readonly property int activeWsId: focusedWorkspace?.id ?? 1
|
|
||||||
|
|
||||||
property string activeName
|
|
||||||
property string applicationDir: "/usr/share/applications/"
|
|
||||||
property string desktopName: ""
|
|
||||||
|
|
||||||
readonly property HyprKeyboard keyboard: extras.devices.keyboards.find(kb => kb.main) ?? null
|
|
||||||
readonly property bool capsLock: keyboard?.capsLock ?? false
|
|
||||||
readonly property bool numLock: keyboard?.numLock ?? false
|
|
||||||
readonly property string defaultKbLayout: keyboard?.layout.split(",")[0] ?? "??"
|
|
||||||
readonly property string kbLayoutFull: keyboard?.activeKeymap ?? "Unknown"
|
|
||||||
readonly property string kbLayout: kbMap.get(kbLayoutFull) ?? "??"
|
|
||||||
readonly property var kbMap: new Map()
|
|
||||||
|
|
||||||
readonly property alias extras: extras
|
|
||||||
readonly property alias options: extras.options
|
|
||||||
readonly property alias devices: extras.devices
|
|
||||||
|
|
||||||
property bool hadKeyboard
|
|
||||||
|
|
||||||
signal configReloaded
|
|
||||||
|
|
||||||
function getActiveScreen(): ShellScreen {
|
|
||||||
return Quickshell.screens.find(screen => root.monitorFor(screen) === root.focusedMonitor)
|
|
||||||
}
|
|
||||||
|
|
||||||
function dispatch(request: string): void {
|
|
||||||
Hyprland.dispatch(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
function monitorFor(screen: ShellScreen): HyprlandMonitor {
|
|
||||||
return Hyprland.monitorFor(screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadDynamicConfs(): void {
|
|
||||||
extras.batchMessage(["keyword bindlni ,Caps_Lock,global,zshell:refreshDevices", "keyword bindlni ,Num_Lock,global,zshell:refreshDevices"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: reloadDynamicConfs()
|
|
||||||
|
|
||||||
// function updateActiveWindow(): void {
|
|
||||||
// root.desktopName = root.applicationDir + root.activeToplevel?.lastIpcObject.class + ".desktop";
|
|
||||||
// }
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: Hyprland
|
|
||||||
|
|
||||||
function onRawEvent(event: HyprlandEvent): void {
|
|
||||||
const n = event.name;
|
|
||||||
if (n.endsWith("v2"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (n === "configreloaded") {
|
|
||||||
root.configReloaded();
|
|
||||||
root.reloadDynamicConfs();
|
|
||||||
} else if (["workspace", "moveworkspace", "activespecial", "focusedmon"].includes(n)) {
|
|
||||||
Hyprland.refreshWorkspaces();
|
|
||||||
Hyprland.refreshMonitors();
|
|
||||||
// Qt.callLater( root.updateActiveWindow );
|
|
||||||
} else if (["openwindow", "closewindow", "movewindow"].includes(n)) {
|
|
||||||
Hyprland.refreshToplevels();
|
|
||||||
Hyprland.refreshWorkspaces();
|
|
||||||
// Qt.callLater( root.updateActiveWindow );
|
|
||||||
} else if (n.includes("mon")) {
|
|
||||||
Hyprland.refreshMonitors();
|
|
||||||
// Qt.callLater( root.updateActiveWindow );
|
|
||||||
} else if (n.includes("workspace")) {
|
|
||||||
Hyprland.refreshWorkspaces();
|
|
||||||
// Qt.callLater( root.updateActiveWindow );
|
|
||||||
} else if (n.includes("window") || n.includes("group") || ["pin", "fullscreen", "changefloatingmode", "minimize"].includes(n)) {
|
|
||||||
Hyprland.refreshToplevels();
|
|
||||||
// Qt.callLater( root.updateActiveWindow );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
id: desktopEntryName
|
|
||||||
|
|
||||||
path: root.desktopName
|
|
||||||
|
|
||||||
onLoaded: {
|
|
||||||
const lines = text().split( "\n" );
|
|
||||||
for ( const line of lines ) {
|
|
||||||
if ( line.startsWith( "Name=" )) {
|
|
||||||
let name = line.replace( "Name=", "" );
|
|
||||||
let caseFix = name[ 0 ].toUpperCase() + name.slice( 1 );
|
|
||||||
root.activeName = caseFix;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
id: kbLayoutFile
|
|
||||||
|
|
||||||
path: Quickshell.env("ZSHELL_XKB_RULES_PATH") || "/usr/share/X11/xkb/rules/base.lst"
|
|
||||||
onLoaded: {
|
|
||||||
const layoutMatch = text().match(/! layout\n([\s\S]*?)\n\n/);
|
|
||||||
if (layoutMatch) {
|
|
||||||
const lines = layoutMatch[1].split("\n");
|
|
||||||
for (const line of lines) {
|
|
||||||
if (!line.trim() || line.trim().startsWith("!"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const match = line.match(/^\s*([a-z]{2,})\s+([a-zA-Z() ]+)$/);
|
|
||||||
if (match)
|
|
||||||
root.kbMap.set(match[2], match[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const variantMatch = text().match(/! variant\n([\s\S]*?)\n\n/);
|
|
||||||
if (variantMatch) {
|
|
||||||
const lines = variantMatch[1].split("\n");
|
|
||||||
for (const line of lines) {
|
|
||||||
if (!line.trim() || line.trim().startsWith("!"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const match = line.match(/^\s*([a-zA-Z0-9_-]+)\s+([a-z]{2,}): (.+)$/);
|
|
||||||
if (match)
|
|
||||||
root.kbMap.set(match[3], match[2]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "hypr"
|
|
||||||
|
|
||||||
function refreshDevices(): void {
|
|
||||||
extras.refreshDevices();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "refreshDevices"
|
|
||||||
onPressed: extras.refreshDevices()
|
|
||||||
onReleased: extras.refreshDevices()
|
|
||||||
}
|
|
||||||
|
|
||||||
HyprExtras {
|
|
||||||
id: extras
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,187 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import qs.Config
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Services.Notifications
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
readonly property var weatherIcons: ({
|
|
||||||
"0": "clear_day",
|
|
||||||
"1": "clear_day",
|
|
||||||
"2": "partly_cloudy_day",
|
|
||||||
"3": "cloud",
|
|
||||||
"45": "foggy",
|
|
||||||
"48": "foggy",
|
|
||||||
"51": "rainy",
|
|
||||||
"53": "rainy",
|
|
||||||
"55": "rainy",
|
|
||||||
"56": "rainy",
|
|
||||||
"57": "rainy",
|
|
||||||
"61": "rainy",
|
|
||||||
"63": "rainy",
|
|
||||||
"65": "rainy",
|
|
||||||
"66": "rainy",
|
|
||||||
"67": "rainy",
|
|
||||||
"71": "cloudy_snowing",
|
|
||||||
"73": "cloudy_snowing",
|
|
||||||
"75": "snowing_heavy",
|
|
||||||
"77": "cloudy_snowing",
|
|
||||||
"80": "rainy",
|
|
||||||
"81": "rainy",
|
|
||||||
"82": "rainy",
|
|
||||||
"85": "cloudy_snowing",
|
|
||||||
"86": "snowing_heavy",
|
|
||||||
"95": "thunderstorm",
|
|
||||||
"96": "thunderstorm",
|
|
||||||
"99": "thunderstorm"
|
|
||||||
})
|
|
||||||
|
|
||||||
readonly property var categoryIcons: ({
|
|
||||||
WebBrowser: "web",
|
|
||||||
Printing: "print",
|
|
||||||
Security: "security",
|
|
||||||
Network: "chat",
|
|
||||||
Archiving: "archive",
|
|
||||||
Compression: "archive",
|
|
||||||
Development: "code",
|
|
||||||
IDE: "code",
|
|
||||||
TextEditor: "edit_note",
|
|
||||||
Audio: "music_note",
|
|
||||||
Music: "music_note",
|
|
||||||
Player: "music_note",
|
|
||||||
Recorder: "mic",
|
|
||||||
Game: "sports_esports",
|
|
||||||
FileTools: "files",
|
|
||||||
FileManager: "files",
|
|
||||||
Filesystem: "files",
|
|
||||||
FileTransfer: "files",
|
|
||||||
Settings: "settings",
|
|
||||||
DesktopSettings: "settings",
|
|
||||||
HardwareSettings: "settings",
|
|
||||||
TerminalEmulator: "terminal",
|
|
||||||
ConsoleOnly: "terminal",
|
|
||||||
Utility: "build",
|
|
||||||
Monitor: "monitor_heart",
|
|
||||||
Midi: "graphic_eq",
|
|
||||||
Mixer: "graphic_eq",
|
|
||||||
AudioVideoEditing: "video_settings",
|
|
||||||
AudioVideo: "music_video",
|
|
||||||
Video: "videocam",
|
|
||||||
Building: "construction",
|
|
||||||
Graphics: "photo_library",
|
|
||||||
"2DGraphics": "photo_library",
|
|
||||||
RasterGraphics: "photo_library",
|
|
||||||
TV: "tv",
|
|
||||||
System: "host",
|
|
||||||
Office: "content_paste"
|
|
||||||
})
|
|
||||||
|
|
||||||
function getAppIcon(name: string, fallback: string): string {
|
|
||||||
const icon = DesktopEntries.heuristicLookup(name)?.icon;
|
|
||||||
if (fallback !== "undefined")
|
|
||||||
return Quickshell.iconPath(icon, fallback);
|
|
||||||
return Quickshell.iconPath(icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getAppCategoryIcon(name: string, fallback: string): string {
|
|
||||||
const categories = DesktopEntries.heuristicLookup(name)?.categories;
|
|
||||||
|
|
||||||
if (categories)
|
|
||||||
for (const [key, value] of Object.entries(categoryIcons))
|
|
||||||
if (categories.includes(key))
|
|
||||||
return value;
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getNetworkIcon(strength: int, isSecure = false): string {
|
|
||||||
if (isSecure) {
|
|
||||||
if (strength >= 80)
|
|
||||||
return "network_wifi_locked";
|
|
||||||
if (strength >= 60)
|
|
||||||
return "network_wifi_3_bar_locked";
|
|
||||||
if (strength >= 40)
|
|
||||||
return "network_wifi_2_bar_locked";
|
|
||||||
if (strength >= 20)
|
|
||||||
return "network_wifi_1_bar_locked";
|
|
||||||
return "signal_wifi_0_bar";
|
|
||||||
} else {
|
|
||||||
if (strength >= 80)
|
|
||||||
return "network_wifi";
|
|
||||||
if (strength >= 60)
|
|
||||||
return "network_wifi_3_bar";
|
|
||||||
if (strength >= 40)
|
|
||||||
return "network_wifi_2_bar";
|
|
||||||
if (strength >= 20)
|
|
||||||
return "network_wifi_1_bar";
|
|
||||||
return "signal_wifi_0_bar";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBluetoothIcon(icon: string): string {
|
|
||||||
if (icon.includes("headset") || icon.includes("headphones"))
|
|
||||||
return "headphones";
|
|
||||||
if (icon.includes("audio"))
|
|
||||||
return "speaker";
|
|
||||||
if (icon.includes("phone"))
|
|
||||||
return "smartphone";
|
|
||||||
if (icon.includes("mouse"))
|
|
||||||
return "mouse";
|
|
||||||
if (icon.includes("keyboard"))
|
|
||||||
return "keyboard";
|
|
||||||
return "bluetooth";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWeatherIcon(code: string): string {
|
|
||||||
if (weatherIcons.hasOwnProperty(code))
|
|
||||||
return weatherIcons[code];
|
|
||||||
return "air";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getNotifIcon(summary: string, urgency: int): string {
|
|
||||||
summary = summary.toLowerCase();
|
|
||||||
if (summary.includes("reboot"))
|
|
||||||
return "restart_alt";
|
|
||||||
if (summary.includes("recording"))
|
|
||||||
return "screen_record";
|
|
||||||
if (summary.includes("battery"))
|
|
||||||
return "power";
|
|
||||||
if (summary.includes("screenshot"))
|
|
||||||
return "screenshot_monitor";
|
|
||||||
if (summary.includes("welcome"))
|
|
||||||
return "waving_hand";
|
|
||||||
if (summary.includes("time") || summary.includes("a break"))
|
|
||||||
return "schedule";
|
|
||||||
if (summary.includes("installed"))
|
|
||||||
return "download";
|
|
||||||
if (summary.includes("update"))
|
|
||||||
return "update";
|
|
||||||
if (summary.includes("unable to"))
|
|
||||||
return "deployed_code_alert";
|
|
||||||
if (summary.includes("profile"))
|
|
||||||
return "person";
|
|
||||||
if (summary.includes("file"))
|
|
||||||
return "folder_copy";
|
|
||||||
if (urgency === NotificationUrgency.Critical)
|
|
||||||
return "release_alert";
|
|
||||||
return "chat";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getVolumeIcon(volume: real, isMuted: bool): string {
|
|
||||||
if (isMuted)
|
|
||||||
return "no_sound";
|
|
||||||
if (volume >= 0.5)
|
|
||||||
return "volume_up";
|
|
||||||
if (volume > 0)
|
|
||||||
return "volume_down";
|
|
||||||
return "volume_mute";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMicVolumeIcon(volume: real, isMuted: bool): string {
|
|
||||||
if (!isMuted && volume > 0)
|
|
||||||
return "mic";
|
|
||||||
return "mic_off";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import Quickshell.Wayland
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property alias enabled: props.enabled
|
|
||||||
readonly property alias enabledSince: props.enabledSince
|
|
||||||
|
|
||||||
onEnabledChanged: {
|
|
||||||
if (enabled)
|
|
||||||
props.enabledSince = new Date();
|
|
||||||
}
|
|
||||||
|
|
||||||
PersistentProperties {
|
|
||||||
id: props
|
|
||||||
|
|
||||||
property bool enabled
|
|
||||||
property date enabledSince
|
|
||||||
|
|
||||||
reloadableId: "idleInhibitor"
|
|
||||||
}
|
|
||||||
|
|
||||||
IdleInhibitor {
|
|
||||||
enabled: props.enabled
|
|
||||||
window: PanelWindow {
|
|
||||||
implicitWidth: 0
|
|
||||||
implicitHeight: 0
|
|
||||||
color: "transparent"
|
|
||||||
mask: Region {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "idleInhibitor"
|
|
||||||
|
|
||||||
function isEnabled(): bool {
|
|
||||||
return props.enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggle(): void {
|
|
||||||
props.enabled = !props.enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
function enable(): void {
|
|
||||||
props.enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function disable(): void {
|
|
||||||
props.enabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Hyprland
|
|
||||||
import qs.Helpers
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
function getInitialTitle(callback) {
|
|
||||||
let activeWindow = Hypr.activeToplevel.title
|
|
||||||
let activeClass = Hypr.activeToplevel.lastIpcObject.class.toString()
|
|
||||||
let regex = new RegExp(activeClass, "i")
|
|
||||||
|
|
||||||
console.log("ActiveWindow", activeWindow, "ActiveClass", activeClass, "Regex", regex)
|
|
||||||
|
|
||||||
const evalTitle = activeWindow.match(regex)
|
|
||||||
callback(evalTitle)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
import qs.Modules
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Config
|
|
||||||
import qs.Paths
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
readonly property int darkStart: Config.general.color.scheduleDarkStart
|
|
||||||
readonly property int darkEnd: Config.general.color.scheduleDarkEnd
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: darkModeTimer
|
|
||||||
|
|
||||||
interval: 5000
|
|
||||||
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
onTriggered: {
|
|
||||||
if ( darkStart === darkEnd )
|
|
||||||
return;
|
|
||||||
var now = new Date();
|
|
||||||
if ( now.getHours() >= darkStart || now.getHours() < darkEnd ) {
|
|
||||||
if ( DynamicColors.light )
|
|
||||||
applyDarkMode();
|
|
||||||
} else {
|
|
||||||
if ( !DynamicColors.light )
|
|
||||||
applyLightMode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyDarkMode() {
|
|
||||||
if ( Config.general.color.schemeGeneration ) {
|
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${WallpaperPath.currentWallpaperPath}`, "--thumbnail-path", `${Paths.cache}/imagecache/thumbnail.jpg`, "--output", `${Paths.state}/scheme.json`, "--scheme", `${Config.colors.schemeType}`, "--mode", "dark"]);
|
|
||||||
} else {
|
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--preset", `${DynamicColors.scheme}:${DynamicColors.flavour}`, "--output", `${Paths.state}/scheme.json`, "--mode", "dark"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Config.general.color.mode = "dark";
|
|
||||||
|
|
||||||
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", "'prefer-dark'"])
|
|
||||||
|
|
||||||
Quickshell.execDetached(["sh", "-c", `sed -i 's/color_scheme_path=\\(.*\\)Light.colors/color_scheme_path=\\1Dark.colors/' ${Paths.home}/.config/qt6ct/qt6ct.conf`])
|
|
||||||
|
|
||||||
Quickshell.execDetached(["sed", "-i", "'s/\\(vim.cmd.colorscheme \\).*/\\1\"tokyodark\"/'", "~/.config/nvim/lua/config/load-colorscheme.lua"])
|
|
||||||
|
|
||||||
if( Config.general.color.wallust )
|
|
||||||
Wallust.generateColors(WallpaperPath.currentWallpaperPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyLightMode() {
|
|
||||||
if ( Config.general.color.neovimColors ) {
|
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${WallpaperPath.currentWallpaperPath}`, "--thumbnail-path", `${Paths.cache}/imagecache/thumbnail.jpg`, "--output", `${Paths.state}/scheme.json`, "--scheme", `${Config.colors.schemeType}`, "--mode", "light"]);
|
|
||||||
} else {
|
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--preset", `${DynamicColors.scheme}:${DynamicColors.flavour}`, "--output", `${Paths.state}/scheme.json`, "--mode", "light"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Config.general.color.mode = "light";
|
|
||||||
|
|
||||||
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", "'prefer-light'"])
|
|
||||||
|
|
||||||
Quickshell.execDetached(["sh", "-c", `sed -i 's/color_scheme_path=\\(.*\\)Dark.colors/color_scheme_path=\\1Light.colors/' ${Paths.home}/.config/qt6ct/qt6ct.conf`])
|
|
||||||
|
|
||||||
if ( Config.general.color.neovimColors )
|
|
||||||
Quickshell.execDetached(["sed", "-i", "'s/\\(vim.cmd.colorscheme \\).*/\\1\"onelight\"/'", "~/.config/nvim/lua/config/load-colorscheme.lua"])
|
|
||||||
|
|
||||||
if( Config.general.color.wallust )
|
|
||||||
Wallust.generateColors(WallpaperPath.currentWallpaperPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkStartup() {
|
|
||||||
if ( darkStart === darkEnd )
|
|
||||||
return;
|
|
||||||
var now = new Date();
|
|
||||||
if ( now.getHours() >= darkStart || now.getHours() < darkEnd ) {
|
|
||||||
applyDarkMode();
|
|
||||||
} else {
|
|
||||||
applyLightMode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Networking
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property list<NetworkDevice> devices: Networking.devices.values
|
|
||||||
property NetworkDevice activeDevice: devices.find(d => d.connected)
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property alias centerX: notifCenterSpacing.centerX
|
|
||||||
|
|
||||||
JsonAdapter {
|
|
||||||
id: notifCenterSpacing
|
|
||||||
|
|
||||||
property int centerX
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell.Io
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property alias notifPath: storage.notifPath
|
|
||||||
|
|
||||||
JsonAdapter {
|
|
||||||
id: storage
|
|
||||||
|
|
||||||
property string notifPath: Quickshell.statePath("notifications.json")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,295 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import ZShell
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Wayland
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Effects
|
|
||||||
import qs.Components
|
|
||||||
import qs.Config
|
|
||||||
import qs.Helpers
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property LazyLoader loader
|
|
||||||
required property ShellScreen screen
|
|
||||||
|
|
||||||
property bool onClient
|
|
||||||
|
|
||||||
property real realBorderWidth: onClient ? (Hypr.options["general:border_size"] ?? 1) : 2
|
|
||||||
property real realRounding: onClient ? (Hypr.options["decoration:rounding"] ?? 0) : 0
|
|
||||||
|
|
||||||
property real ssx
|
|
||||||
property real ssy
|
|
||||||
|
|
||||||
property real sx: 0
|
|
||||||
property real sy: 0
|
|
||||||
property real ex: screen.width
|
|
||||||
property real ey: screen.height
|
|
||||||
|
|
||||||
property real rsx: Math.min(sx, ex)
|
|
||||||
property real rsy: Math.min(sy, ey)
|
|
||||||
property real sw: Math.abs(sx - ex)
|
|
||||||
property real sh: Math.abs(sy - ey)
|
|
||||||
|
|
||||||
property list<var> clients: {
|
|
||||||
const mon = Hypr.monitorFor(screen);
|
|
||||||
if (!mon)
|
|
||||||
return [];
|
|
||||||
|
|
||||||
const special = mon.lastIpcObject.specialWorkspace;
|
|
||||||
const wsId = special.name ? special.id : mon.activeWorkspace.id;
|
|
||||||
|
|
||||||
return Hypr.toplevels.values.filter(c => c.workspace?.id === wsId).sort((a, b) => {
|
|
||||||
const ac = a.lastIpcObject;
|
|
||||||
const bc = b.lastIpcObject;
|
|
||||||
return (bc.pinned - ac.pinned) || ((bc.fullscreen !== 0) - (ac.fullscreen !== 0)) || (bc.floating - ac.floating);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkClientRects(x: real, y: real): void {
|
|
||||||
for (const client of clients) {
|
|
||||||
if (!client)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
let {
|
|
||||||
at: [cx, cy],
|
|
||||||
size: [cw, ch]
|
|
||||||
} = client.lastIpcObject;
|
|
||||||
cx -= screen.x;
|
|
||||||
cy -= screen.y;
|
|
||||||
if (cx <= x && cy <= y && cx + cw >= x && cy + ch >= y) {
|
|
||||||
onClient = true;
|
|
||||||
sx = cx;
|
|
||||||
sy = cy;
|
|
||||||
ex = cx + cw;
|
|
||||||
ey = cy + ch;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function save(): void {
|
|
||||||
const tmpfile = Qt.resolvedUrl(`/tmp/zshell-picker-${Quickshell.processId}-${Date.now()}.png`);
|
|
||||||
ZShellIo.saveItem(screencopy, tmpfile, Qt.rect(Math.ceil(rsx), Math.ceil(rsy), Math.floor(sw), Math.floor(sh)), path => Quickshell.execDetached(["swappy", "-f", path]));
|
|
||||||
closeAnim.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
onClientsChanged: checkClientRects(mouseX, mouseY)
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
opacity: 0
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.CrossCursor
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
Hypr.extras.refreshOptions();
|
|
||||||
if (loader.freeze)
|
|
||||||
clients = clients;
|
|
||||||
|
|
||||||
opacity = 1;
|
|
||||||
|
|
||||||
const c = clients[0];
|
|
||||||
if (c) {
|
|
||||||
const cx = c.lastIpcObject.at[0] - screen.x;
|
|
||||||
const cy = c.lastIpcObject.at[1] - screen.y;
|
|
||||||
onClient = true;
|
|
||||||
sx = cx;
|
|
||||||
sy = cy;
|
|
||||||
ex = cx + c.lastIpcObject.size[0];
|
|
||||||
ey = cy + c.lastIpcObject.size[1];
|
|
||||||
} else {
|
|
||||||
sx = screen.width / 2 - 100;
|
|
||||||
sy = screen.height / 2 - 100;
|
|
||||||
ex = screen.width / 2 + 100;
|
|
||||||
ey = screen.height / 2 + 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPressed: event => {
|
|
||||||
ssx = event.x;
|
|
||||||
ssy = event.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
onReleased: {
|
|
||||||
if (closeAnim.running)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (root.loader.freeze) {
|
|
||||||
save();
|
|
||||||
} else {
|
|
||||||
overlay.visible = border.visible = false;
|
|
||||||
screencopy.visible = false;
|
|
||||||
screencopy.active = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPositionChanged: event => {
|
|
||||||
const x = event.x;
|
|
||||||
const y = event.y;
|
|
||||||
|
|
||||||
if (pressed) {
|
|
||||||
onClient = false;
|
|
||||||
sx = ssx;
|
|
||||||
sy = ssy;
|
|
||||||
ex = x;
|
|
||||||
ey = y;
|
|
||||||
} else {
|
|
||||||
checkClientRects(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
focus: true
|
|
||||||
Keys.onEscapePressed: closeAnim.start()
|
|
||||||
|
|
||||||
SequentialAnimation {
|
|
||||||
id: closeAnim
|
|
||||||
|
|
||||||
PropertyAction {
|
|
||||||
target: root.loader
|
|
||||||
property: "closing"
|
|
||||||
value: true
|
|
||||||
}
|
|
||||||
ParallelAnimation {
|
|
||||||
Anim {
|
|
||||||
target: root
|
|
||||||
property: "opacity"
|
|
||||||
to: 0
|
|
||||||
duration: 300
|
|
||||||
}
|
|
||||||
ExAnim {
|
|
||||||
target: root
|
|
||||||
properties: "rsx,rsy"
|
|
||||||
to: 0
|
|
||||||
}
|
|
||||||
ExAnim {
|
|
||||||
target: root
|
|
||||||
property: "sw"
|
|
||||||
to: root.screen.width
|
|
||||||
}
|
|
||||||
ExAnim {
|
|
||||||
target: root
|
|
||||||
property: "sh"
|
|
||||||
to: root.screen.height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PropertyAction {
|
|
||||||
target: root.loader
|
|
||||||
property: "activeAsync"
|
|
||||||
value: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: screencopy
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
active: root.loader.freeze
|
|
||||||
asynchronous: true
|
|
||||||
|
|
||||||
sourceComponent: ScreencopyView {
|
|
||||||
captureSource: root.screen
|
|
||||||
|
|
||||||
paintCursor: false
|
|
||||||
|
|
||||||
onHasContentChanged: {
|
|
||||||
if (hasContent && !root.loader.freeze) {
|
|
||||||
overlay.visible = border.visible = true;
|
|
||||||
root.save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: overlay
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "white"
|
|
||||||
opacity: 0.3
|
|
||||||
|
|
||||||
radius: root.realRounding
|
|
||||||
|
|
||||||
layer.enabled: true
|
|
||||||
layer.effect: MultiEffect {
|
|
||||||
maskSource: selectionWrapper
|
|
||||||
maskEnabled: true
|
|
||||||
maskInverted: true
|
|
||||||
maskSpreadAtMin: 1
|
|
||||||
maskThresholdMin: 0.5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: selectionWrapper
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
layer.enabled: true
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: selectionRect
|
|
||||||
|
|
||||||
radius: root.realRounding
|
|
||||||
x: root.rsx
|
|
||||||
y: root.rsy
|
|
||||||
implicitWidth: root.sw
|
|
||||||
implicitHeight: root.sh
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: border
|
|
||||||
|
|
||||||
color: "transparent"
|
|
||||||
radius: root.realRounding > 0 ? root.realRounding + root.realBorderWidth : 0
|
|
||||||
border.width: root.realBorderWidth
|
|
||||||
border.color: DynamicColors.palette.m3primary
|
|
||||||
|
|
||||||
x: selectionRect.x - root.realBorderWidth
|
|
||||||
y: selectionRect.y - root.realBorderWidth
|
|
||||||
implicitWidth: selectionRect.implicitWidth + root.realBorderWidth * 2
|
|
||||||
implicitHeight: selectionRect.implicitHeight + root.realBorderWidth * 2
|
|
||||||
|
|
||||||
Behavior on border.color {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {
|
|
||||||
duration: 300
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on rsx {
|
|
||||||
enabled: !root.pressed
|
|
||||||
|
|
||||||
ExAnim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on rsy {
|
|
||||||
enabled: !root.pressed
|
|
||||||
|
|
||||||
ExAnim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on sw {
|
|
||||||
enabled: !root.pressed
|
|
||||||
|
|
||||||
ExAnim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on sh {
|
|
||||||
enabled: !root.pressed
|
|
||||||
|
|
||||||
ExAnim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
component ExAnim: Anim {
|
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
|
||||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import Quickshell.Services.Mpris
|
|
||||||
import QtQml
|
|
||||||
import ZShell
|
|
||||||
import qs.Config
|
|
||||||
import qs.Components
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
readonly property list<MprisPlayer> list: Mpris.players.values
|
|
||||||
readonly property MprisPlayer active: props.manualActive ?? list.find(p => getIdentity(p) === Config.services.defaultPlayer) ?? list[0] ?? null
|
|
||||||
property alias manualActive: props.manualActive
|
|
||||||
|
|
||||||
function getIdentity(player: MprisPlayer): string {
|
|
||||||
const alias = Config.services.playerAliases.find(a => a.from === player.identity);
|
|
||||||
return alias?.to ?? player.identity;
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: active
|
|
||||||
|
|
||||||
function onPostTrackChanged() {
|
|
||||||
if (!Config.utilities.toasts.nowPlaying) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PersistentProperties {
|
|
||||||
id: props
|
|
||||||
|
|
||||||
property MprisPlayer manualActive
|
|
||||||
|
|
||||||
reloadableId: "players"
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "mediaToggle"
|
|
||||||
description: "Toggle media playback"
|
|
||||||
onPressed: {
|
|
||||||
const active = root.active;
|
|
||||||
if (active && active.canTogglePlaying)
|
|
||||||
active.togglePlaying();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "mediaPrev"
|
|
||||||
description: "Previous track"
|
|
||||||
onPressed: {
|
|
||||||
const active = root.active;
|
|
||||||
if (active && active.canGoPrevious)
|
|
||||||
active.previous();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "mediaNext"
|
|
||||||
description: "Next track"
|
|
||||||
onPressed: {
|
|
||||||
const active = root.active;
|
|
||||||
if (active && active.canGoNext)
|
|
||||||
active.next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "mediaStop"
|
|
||||||
description: "Stop media playback"
|
|
||||||
onPressed: root.active?.stop()
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "mpris"
|
|
||||||
|
|
||||||
function getActive(prop: string): string {
|
|
||||||
const active = root.active;
|
|
||||||
return active ? active[prop] ?? "Invalid property" : "No active player";
|
|
||||||
}
|
|
||||||
|
|
||||||
function list(): string {
|
|
||||||
return root.list.map(p => root.getIdentity(p)).join("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
function play(): void {
|
|
||||||
const active = root.active;
|
|
||||||
if (active?.canPlay)
|
|
||||||
active.play();
|
|
||||||
}
|
|
||||||
|
|
||||||
function pause(): void {
|
|
||||||
const active = root.active;
|
|
||||||
if (active?.canPause)
|
|
||||||
active.pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
function playPause(): void {
|
|
||||||
const active = root.active;
|
|
||||||
if (active?.canTogglePlaying)
|
|
||||||
active.togglePlaying();
|
|
||||||
}
|
|
||||||
|
|
||||||
function previous(): void {
|
|
||||||
const active = root.active;
|
|
||||||
if (active?.canGoPrevious)
|
|
||||||
active.previous();
|
|
||||||
}
|
|
||||||
|
|
||||||
function next(): void {
|
|
||||||
const active = root.active;
|
|
||||||
if (active?.canGoNext)
|
|
||||||
active.next();
|
|
||||||
}
|
|
||||||
|
|
||||||
function stop(): void {
|
|
||||||
root.active?.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import ZShell.Models
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Paths
|
|
||||||
|
|
||||||
Searcher {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool showPreview: false
|
|
||||||
readonly property string current: showPreview ? previewPath : actualCurrent
|
|
||||||
property string previewPath
|
|
||||||
property string actualCurrent: WallpaperPath.currentWallpaperPath
|
|
||||||
|
|
||||||
function setWallpaper(path: string): void {
|
|
||||||
actualCurrent = path;
|
|
||||||
WallpaperPath.currentWallpaperPath = path;
|
|
||||||
Quickshell.execDetached(["sh", "-c", `python3 ${Quickshell.shellPath("scripts/LockScreenBg.py")} --input_image=${root.actualCurrent} --output_path=${Paths.state}/lockscreen_bg.png`]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function preview(path: string): void {
|
|
||||||
previewPath = path;
|
|
||||||
showPreview = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopPreview(): void {
|
|
||||||
showPreview = false;
|
|
||||||
Quickshell.execDetached(["sh", "-c", `python3 ${Quickshell.shellPath("scripts/SchemeColorGen.py")} --path=${root.actualCurrent} --thumbnail=${Paths.cache}/imagecache/thumbnail.jpg --output=${Paths.state}/scheme.json --scheme=${Config.colors.schemeType}`]);
|
|
||||||
}
|
|
||||||
|
|
||||||
list: wallpapers.entries
|
|
||||||
key: "relativePath"
|
|
||||||
useFuzzy: true
|
|
||||||
extraOpts: useFuzzy ? ({}) : ({
|
|
||||||
forward: false
|
|
||||||
})
|
|
||||||
|
|
||||||
FileSystemModel {
|
|
||||||
id: wallpapers
|
|
||||||
|
|
||||||
recursive: true
|
|
||||||
path: Config.general.wallpaperPath
|
|
||||||
filter: FileSystemModel.Images
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
import Quickshell
|
|
||||||
import "../scripts/fzf.js" as Fzf
|
|
||||||
import "../scripts/fuzzysort.js" as Fuzzy
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
required property list<QtObject> list
|
|
||||||
property string key: "name"
|
|
||||||
property bool useFuzzy: false
|
|
||||||
property var extraOpts: ({})
|
|
||||||
|
|
||||||
// Extra stuff for fuzzy
|
|
||||||
property list<string> keys: [key]
|
|
||||||
property list<real> weights: [1]
|
|
||||||
|
|
||||||
readonly property var fzf: useFuzzy ? [] : new Fzf.Finder(list, Object.assign({
|
|
||||||
selector
|
|
||||||
}, extraOpts))
|
|
||||||
readonly property list<var> fuzzyPrepped: useFuzzy ? list.map(e => {
|
|
||||||
const obj = {
|
|
||||||
_item: e
|
|
||||||
};
|
|
||||||
for (const k of keys)
|
|
||||||
obj[k] = Fuzzy.prepare(e[k]);
|
|
||||||
return obj;
|
|
||||||
}) : []
|
|
||||||
|
|
||||||
function transformSearch(search: string): string {
|
|
||||||
return search;
|
|
||||||
}
|
|
||||||
|
|
||||||
function selector(item: var): string {
|
|
||||||
// Only for fzf
|
|
||||||
return item[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
function query(search: string): list<var> {
|
|
||||||
search = transformSearch(search);
|
|
||||||
if (!search)
|
|
||||||
return [...list];
|
|
||||||
|
|
||||||
if (useFuzzy)
|
|
||||||
return Fuzzy.go(search, fuzzyPrepped, Object.assign({
|
|
||||||
all: true,
|
|
||||||
keys,
|
|
||||||
scoreFn: r => weights.reduce((a, w, i) => a + r[i].score * w, 0)
|
|
||||||
}, extraOpts)).map(r => r.obj._item);
|
|
||||||
|
|
||||||
return fzf.find(search).sort((a, b) => {
|
|
||||||
if (a.score === b.score)
|
|
||||||
return selector(a.item).trim().length - selector(b.item).trim().length;
|
|
||||||
return b.score - a.score;
|
|
||||||
}).map(r => r.item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import qs.Config
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property string osName
|
|
||||||
property string osPrettyName
|
|
||||||
property string osId
|
|
||||||
property list<string> osIdLike
|
|
||||||
property string osLogo
|
|
||||||
property bool isDefaultLogo: true
|
|
||||||
|
|
||||||
property string uptime
|
|
||||||
readonly property string user: Quickshell.env("USER")
|
|
||||||
readonly property string wm: Quickshell.env("XDG_CURRENT_DESKTOP") || Quickshell.env("XDG_SESSION_DESKTOP")
|
|
||||||
readonly property string shell: Quickshell.env("SHELL").split("/").pop()
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
id: osRelease
|
|
||||||
|
|
||||||
path: "/etc/os-release"
|
|
||||||
onLoaded: {
|
|
||||||
const lines = text().split("\n");
|
|
||||||
|
|
||||||
const fd = key => lines.find(l => l.startsWith(`${key}=`))?.split("=")[1].replace(/"/g, "") ?? "";
|
|
||||||
|
|
||||||
root.osName = fd("NAME");
|
|
||||||
root.osPrettyName = fd("PRETTY_NAME");
|
|
||||||
root.osId = fd("ID");
|
|
||||||
root.osIdLike = fd("ID_LIKE").split(" ");
|
|
||||||
|
|
||||||
const logo = Quickshell.iconPath(fd("LOGO"), true);
|
|
||||||
if (Config.general.logo) {
|
|
||||||
root.osLogo = Quickshell.iconPath(Config.general.logo, true) || "file://" + Paths.absolutePath(Config.general.logo);
|
|
||||||
root.isDefaultLogo = false;
|
|
||||||
} else if (logo) {
|
|
||||||
root.osLogo = logo;
|
|
||||||
root.isDefaultLogo = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: Config.general
|
|
||||||
|
|
||||||
function onLogoChanged(): void {
|
|
||||||
osRelease.reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
interval: 15000
|
|
||||||
onTriggered: fileUptime.reload()
|
|
||||||
}
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
id: fileUptime
|
|
||||||
|
|
||||||
path: "/proc/uptime"
|
|
||||||
onLoaded: {
|
|
||||||
const up = parseInt(text().split(" ")[0] ?? 0);
|
|
||||||
|
|
||||||
const days = Math.floor(up / 86400);
|
|
||||||
const hours = Math.floor((up % 86400) / 3600);
|
|
||||||
const minutes = Math.floor((up % 3600) / 60);
|
|
||||||
|
|
||||||
let str = "";
|
|
||||||
if (days > 0)
|
|
||||||
str += `${days} day${days === 1 ? "" : "s"}`;
|
|
||||||
if (hours > 0)
|
|
||||||
str += `${str ? ", " : ""}${hours} hour${hours === 1 ? "" : "s"}`;
|
|
||||||
if (minutes > 0 || !str)
|
|
||||||
str += `${str ? ", " : ""}${minutes} minute${minutes === 1 ? "" : "s"}`;
|
|
||||||
root.uptime = str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,237 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property real cpuPerc
|
|
||||||
property real cpuTemp
|
|
||||||
readonly property string gpuType: Config.services.gpuType.toUpperCase() || autoGpuType
|
|
||||||
property string autoGpuType: "NONE"
|
|
||||||
property real gpuPerc
|
|
||||||
property real gpuTemp
|
|
||||||
property real gpuMemUsed
|
|
||||||
property real gpuMemTotal: 0
|
|
||||||
property real memUsed
|
|
||||||
property real memTotal
|
|
||||||
readonly property real memPerc: memTotal > 0 ? memUsed / memTotal : 0
|
|
||||||
property real storageUsed
|
|
||||||
property real storageTotal
|
|
||||||
property real storagePerc: storageTotal > 0 ? storageUsed / storageTotal : 0
|
|
||||||
|
|
||||||
property real lastCpuIdle
|
|
||||||
property real lastCpuTotal
|
|
||||||
|
|
||||||
property int refCount
|
|
||||||
|
|
||||||
function formatKib(kib: real): var {
|
|
||||||
const mib = 1024;
|
|
||||||
const gib = 1024 ** 2;
|
|
||||||
const tib = 1024 ** 3;
|
|
||||||
|
|
||||||
if (kib >= tib)
|
|
||||||
return {
|
|
||||||
value: kib / tib,
|
|
||||||
unit: "TiB"
|
|
||||||
};
|
|
||||||
if (kib >= gib)
|
|
||||||
return {
|
|
||||||
value: kib / gib,
|
|
||||||
unit: "GiB"
|
|
||||||
};
|
|
||||||
if (kib >= mib)
|
|
||||||
return {
|
|
||||||
value: kib / mib,
|
|
||||||
unit: "MiB"
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
value: kib,
|
|
||||||
unit: "KiB"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
running: root.refCount > 0
|
|
||||||
interval: 3000
|
|
||||||
repeat: true
|
|
||||||
triggeredOnStart: true
|
|
||||||
onTriggered: {
|
|
||||||
stat.reload();
|
|
||||||
meminfo.reload();
|
|
||||||
storage.running = true;
|
|
||||||
gpuUsage.running = true;
|
|
||||||
sensors.running = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
id: stat
|
|
||||||
|
|
||||||
path: "/proc/stat"
|
|
||||||
onLoaded: {
|
|
||||||
const data = text().match(/^cpu\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/);
|
|
||||||
if (data) {
|
|
||||||
const stats = data.slice(1).map(n => parseInt(n, 10));
|
|
||||||
const total = stats.reduce((a, b) => a + b, 0);
|
|
||||||
const idle = stats[3] + (stats[4] ?? 0);
|
|
||||||
|
|
||||||
const totalDiff = total - root.lastCpuTotal;
|
|
||||||
const idleDiff = idle - root.lastCpuIdle;
|
|
||||||
root.cpuPerc = totalDiff > 0 ? (1 - idleDiff / totalDiff) : 0;
|
|
||||||
|
|
||||||
root.lastCpuTotal = total;
|
|
||||||
root.lastCpuIdle = idle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
id: meminfo
|
|
||||||
|
|
||||||
path: "/proc/meminfo"
|
|
||||||
onLoaded: {
|
|
||||||
const data = text();
|
|
||||||
root.memTotal = parseInt(data.match(/MemTotal: *(\d+)/)[1], 10) || 1;
|
|
||||||
root.memUsed = (root.memTotal - parseInt(data.match(/MemAvailable: *(\d+)/)[1], 10)) || 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: storage
|
|
||||||
|
|
||||||
command: ["sh", "-c", "df | grep '^/dev/' | awk '{print $1, $3, $4}'"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
const deviceMap = new Map();
|
|
||||||
|
|
||||||
for (const line of text.trim().split("\n")) {
|
|
||||||
if (line.trim() === "")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const parts = line.trim().split(/\s+/);
|
|
||||||
if (parts.length >= 3) {
|
|
||||||
const device = parts[0];
|
|
||||||
const used = parseInt(parts[1], 10) || 0;
|
|
||||||
const avail = parseInt(parts[2], 10) || 0;
|
|
||||||
|
|
||||||
// Only keep the entry with the largest total space for each device
|
|
||||||
if (!deviceMap.has(device) || (used + avail) > (deviceMap.get(device).used + deviceMap.get(device).avail)) {
|
|
||||||
deviceMap.set(device, {
|
|
||||||
used: used,
|
|
||||||
avail: avail
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let totalUsed = 0;
|
|
||||||
let totalAvail = 0;
|
|
||||||
|
|
||||||
for (const [device, stats] of deviceMap) {
|
|
||||||
totalUsed += stats.used;
|
|
||||||
totalAvail += stats.avail;
|
|
||||||
}
|
|
||||||
|
|
||||||
root.storageUsed = totalUsed;
|
|
||||||
root.storageTotal = totalUsed + totalAvail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: gpuTypeCheck
|
|
||||||
|
|
||||||
running: !Config.services.gpuType
|
|
||||||
command: ["sh", "-c", "if command -v nvidia-smi &>/dev/null && nvidia-smi -L &>/dev/null; then echo NVIDIA; elif ls /sys/class/drm/card*/device/gpu_busy_percent 2>/dev/null | grep -q .; then echo GENERIC; else echo NONE; fi"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: root.autoGpuType = text.trim()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: oneshotMem
|
|
||||||
command: ["nvidia-smi", "--query-gpu=memory.total", "--format=csv,noheader,nounits"]
|
|
||||||
running: root.gpuType === "NVIDIA" && root.gpuMemTotal === 0
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
root.gpuMemTotal = Number(this.text.trim())
|
|
||||||
oneshotMem.running = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: gpuUsage
|
|
||||||
|
|
||||||
command: root.gpuType === "GENERIC" ? ["sh", "-c", "cat /sys/class/drm/card*/device/gpu_busy_percent"] : root.gpuType === "NVIDIA" ? ["nvidia-smi", "--query-gpu=utilization.gpu,temperature.gpu,memory.used", "--format=csv,noheader,nounits"] : ["echo"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
if (root.gpuType === "GENERIC") {
|
|
||||||
const percs = text.trim().split("\n");
|
|
||||||
const sum = percs.reduce((acc, d) => acc + parseInt(d, 10), 0);
|
|
||||||
root.gpuPerc = sum / percs.length / 100;
|
|
||||||
} else if (root.gpuType === "NVIDIA") {
|
|
||||||
const [usage, temp, mem] = text.trim().split(",");
|
|
||||||
root.gpuPerc = parseInt(usage, 10) / 100;
|
|
||||||
root.gpuTemp = parseInt(temp, 10);
|
|
||||||
root.gpuMemUsed = parseInt(mem, 10) / root.gpuMemTotal;
|
|
||||||
} else {
|
|
||||||
root.gpuPerc = 0;
|
|
||||||
root.gpuTemp = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: sensors
|
|
||||||
|
|
||||||
command: ["sensors"]
|
|
||||||
environment: ({
|
|
||||||
LANG: "C.UTF-8",
|
|
||||||
LC_ALL: "C.UTF-8"
|
|
||||||
})
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
let cpuTemp = text.match(/(?:Package id [0-9]+|Tdie):\s+((\+|-)[0-9.]+)(°| )C/);
|
|
||||||
if (!cpuTemp)
|
|
||||||
// If AMD Tdie pattern failed, try fallback on Tctl
|
|
||||||
cpuTemp = text.match(/Tctl:\s+((\+|-)[0-9.]+)(°| )C/);
|
|
||||||
|
|
||||||
if (cpuTemp)
|
|
||||||
root.cpuTemp = parseFloat(cpuTemp[1]);
|
|
||||||
|
|
||||||
if (root.gpuType !== "GENERIC")
|
|
||||||
return;
|
|
||||||
|
|
||||||
let eligible = false;
|
|
||||||
let sum = 0;
|
|
||||||
let count = 0;
|
|
||||||
|
|
||||||
for (const line of text.trim().split("\n")) {
|
|
||||||
if (line === "Adapter: PCI adapter")
|
|
||||||
eligible = true;
|
|
||||||
else if (line === "")
|
|
||||||
eligible = false;
|
|
||||||
else if (eligible) {
|
|
||||||
let match = line.match(/^(temp[0-9]+|GPU core|edge)+:\s+\+([0-9]+\.[0-9]+)(°| )C/);
|
|
||||||
if (!match)
|
|
||||||
// Fall back to junction/mem if GPU doesn't have edge temp (for AMD GPUs)
|
|
||||||
match = line.match(/^(junction|mem)+:\s+\+([0-9]+\.[0-9]+)(°| )C/);
|
|
||||||
|
|
||||||
if (match) {
|
|
||||||
sum += parseFloat(match[2]);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
root.gpuTemp = count > 0 ? sum / count : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
|
|
||||||
Text {
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
textFormat: Text.PlainText
|
|
||||||
}
|
|
||||||
@@ -1,286 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property real scoreThreshold: 0.2
|
|
||||||
|
|
||||||
// Manual overrides for tricky apps
|
|
||||||
property var substitutions: ({
|
|
||||||
"code-url-handler": "visual-studio-code",
|
|
||||||
"Code": "visual-studio-code",
|
|
||||||
"gnome-tweaks": "org.gnome.tweaks",
|
|
||||||
"pavucontrol-qt": "pavucontrol",
|
|
||||||
"wps": "wps-office2019-kprometheus",
|
|
||||||
"wpsoffice": "wps-office2019-kprometheus",
|
|
||||||
"footclient": "foot"
|
|
||||||
})
|
|
||||||
|
|
||||||
// Dynamic fixups
|
|
||||||
property var regexSubstitutions: [
|
|
||||||
{
|
|
||||||
"regex": /^steam_app_(\d+)$/,
|
|
||||||
"replace": "steam_icon_$1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"regex": /Minecraft.*/,
|
|
||||||
"replace": "minecraft-launcher"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"regex": /.*polkit.*/,
|
|
||||||
"replace": "system-lock-screen"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"regex": /gcr.prompter/,
|
|
||||||
"replace": "system-lock-screen"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
property list<DesktopEntry> entryList: []
|
|
||||||
property var preppedNames: []
|
|
||||||
property var preppedIcons: []
|
|
||||||
property var preppedIds: []
|
|
||||||
|
|
||||||
Component.onCompleted: refreshEntries()
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: DesktopEntries.applications
|
|
||||||
function onValuesChanged() {
|
|
||||||
refreshEntries();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshEntries() {
|
|
||||||
if (typeof DesktopEntries === 'undefined')
|
|
||||||
return;
|
|
||||||
|
|
||||||
const values = Array.from(DesktopEntries.applications.values);
|
|
||||||
if (values) {
|
|
||||||
entryList = values.sort((a, b) => a.name.localeCompare(b.name));
|
|
||||||
updatePreppedData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updatePreppedData() {
|
|
||||||
if (typeof FuzzySort === 'undefined')
|
|
||||||
return;
|
|
||||||
|
|
||||||
const list = Array.from(entryList);
|
|
||||||
preppedNames = list.map(a => ({
|
|
||||||
name: FuzzySort.prepare(`${a.name} `), entry: a}));
|
|
||||||
preppedIcons = list.map(a => ({
|
|
||||||
name: FuzzySort.prepare(`${a.icon} `),
|
|
||||||
entry: a
|
|
||||||
}));
|
|
||||||
preppedIds = list.map(a => ({
|
|
||||||
name: FuzzySort.prepare(`${a.id} `),
|
|
||||||
entry: a
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
function iconForAppId(appId, fallbackName) {
|
|
||||||
const fallback = fallbackName || "application-x-executable";
|
|
||||||
if (!appId)
|
|
||||||
return iconFromName(fallback, fallback);
|
|
||||||
|
|
||||||
const entry = findAppEntry(appId);
|
|
||||||
if (entry) {
|
|
||||||
return iconFromName(entry.icon, fallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
return iconFromName(appId, fallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Robust lookup strategy
|
|
||||||
function findAppEntry(str) {
|
|
||||||
if (!str || str.length === 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
let result = null;
|
|
||||||
|
|
||||||
if (result = checkHeuristic(str))
|
|
||||||
return result;
|
|
||||||
if (result = checkSubstitutions(str))
|
|
||||||
return result;
|
|
||||||
if (result = checkRegex(str))
|
|
||||||
return result;
|
|
||||||
if (result = checkSimpleTransforms(str))
|
|
||||||
return result;
|
|
||||||
if (result = checkFuzzySearch(str))
|
|
||||||
return result;
|
|
||||||
if (result = checkCleanMatch(str))
|
|
||||||
return result;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function iconFromName(iconName, fallbackName) {
|
|
||||||
const fallback = fallbackName || "application-x-executable";
|
|
||||||
try {
|
|
||||||
if (iconName && typeof Quickshell !== 'undefined' && Quickshell.iconPath) {
|
|
||||||
const p = Quickshell.iconPath(iconName, fallback);
|
|
||||||
if (p && p !== "")
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return Quickshell.iconPath ? (Quickshell.iconPath(fallback, true) || "") : "";
|
|
||||||
} catch (e2) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function distroLogoPath() {
|
|
||||||
try {
|
|
||||||
return (typeof OSInfo !== 'undefined' && OSInfo.distroIconPath) ? OSInfo.distroIconPath : "";
|
|
||||||
} catch (e) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Lookup Helpers ---
|
|
||||||
|
|
||||||
function checkHeuristic(str) {
|
|
||||||
if (typeof DesktopEntries !== 'undefined' && DesktopEntries.heuristicLookup) {
|
|
||||||
const entry = DesktopEntries.heuristicLookup(str);
|
|
||||||
if (entry)
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkSubstitutions(str) {
|
|
||||||
let effectiveStr = substitutions[str];
|
|
||||||
if (!effectiveStr)
|
|
||||||
effectiveStr = substitutions[str.toLowerCase()];
|
|
||||||
|
|
||||||
if (effectiveStr && effectiveStr !== str) {
|
|
||||||
return findAppEntry(effectiveStr);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkRegex(str) {
|
|
||||||
for (let i = 0; i < regexSubstitutions.length; i++) {
|
|
||||||
const sub = regexSubstitutions[i];
|
|
||||||
const replaced = str.replace(sub.regex, sub.replace);
|
|
||||||
if (replaced !== str) {
|
|
||||||
return findAppEntry(replaced);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkSimpleTransforms(str) {
|
|
||||||
if (typeof DesktopEntries === 'undefined' || !DesktopEntries.byId)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
const lower = str.toLowerCase();
|
|
||||||
|
|
||||||
const variants = [str, lower, getFromReverseDomain(str), getFromReverseDomain(str)?.toLowerCase(), normalizeWithHyphens(str), str.replace(/_/g, '-').toLowerCase(), str.replace(/-/g, '_').toLowerCase()];
|
|
||||||
|
|
||||||
for (let i = 0; i < variants.length; i++) {
|
|
||||||
const variant = variants[i];
|
|
||||||
if (variant) {
|
|
||||||
const entry = DesktopEntries.byId(variant);
|
|
||||||
if (entry)
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkFuzzySearch(str) {
|
|
||||||
if (typeof FuzzySort === 'undefined')
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// Check filenames (IDs) first
|
|
||||||
if (preppedIds.length > 0) {
|
|
||||||
let results = fuzzyQuery(str, preppedIds);
|
|
||||||
if (results.length === 0) {
|
|
||||||
const underscored = str.replace(/-/g, '_').toLowerCase();
|
|
||||||
if (underscored !== str)
|
|
||||||
results = fuzzyQuery(underscored, preppedIds);
|
|
||||||
}
|
|
||||||
if (results.length > 0)
|
|
||||||
return results[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then icons
|
|
||||||
if (preppedIcons.length > 0) {
|
|
||||||
const results = fuzzyQuery(str, preppedIcons);
|
|
||||||
if (results.length > 0)
|
|
||||||
return results[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then names
|
|
||||||
if (preppedNames.length > 0) {
|
|
||||||
const results = fuzzyQuery(str, preppedNames);
|
|
||||||
if (results.length > 0)
|
|
||||||
return results[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkCleanMatch(str) {
|
|
||||||
if (!str || str.length <= 3)
|
|
||||||
return null;
|
|
||||||
if (typeof DesktopEntries === 'undefined' || !DesktopEntries.byId)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// Aggressive fallback: strip all separators
|
|
||||||
const cleanStr = str.toLowerCase().replace(/[\.\-_]/g, '');
|
|
||||||
const list = Array.from(entryList);
|
|
||||||
|
|
||||||
for (let i = 0; i < list.length; i++) {
|
|
||||||
const entry = list[i];
|
|
||||||
const cleanId = (entry.id || "").toLowerCase().replace(/[\.\-_]/g, '');
|
|
||||||
if (cleanId.includes(cleanStr) || cleanStr.includes(cleanId)) {
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fuzzyQuery(search, preppedData) {
|
|
||||||
if (!search || !preppedData || preppedData.length === 0)
|
|
||||||
return [];
|
|
||||||
return FuzzySort.go(search, preppedData, {
|
|
||||||
all: true,
|
|
||||||
key: "name"
|
|
||||||
}).map(r => r.obj.entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
function iconExists(iconName) {
|
|
||||||
if (!iconName || iconName.length === 0)
|
|
||||||
return false;
|
|
||||||
if (iconName.startsWith("/"))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
const path = Quickshell.iconPath(iconName, true);
|
|
||||||
return path && path.length > 0 && !path.includes("image-missing");
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFromReverseDomain(str) {
|
|
||||||
if (!str)
|
|
||||||
return "";
|
|
||||||
return str.split('.').slice(-1)[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeWithHyphens(str) {
|
|
||||||
if (!str)
|
|
||||||
return "";
|
|
||||||
return str.toLowerCase().replace(/\s+/g, "-");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated shim
|
|
||||||
function guessIcon(str) {
|
|
||||||
const entry = findAppEntry(str);
|
|
||||||
return entry ? entry.icon : "image-missing";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
property alias enabled: clock.enabled
|
|
||||||
readonly property date date: clock.date
|
|
||||||
readonly property int hours: clock.hours
|
|
||||||
readonly property int minutes: clock.minutes
|
|
||||||
readonly property int seconds: clock.seconds
|
|
||||||
|
|
||||||
readonly property string timeStr: format("hh:mm")
|
|
||||||
readonly property list<string> timeComponents: timeStr.split(":")
|
|
||||||
readonly property string hourStr: timeComponents[0] ?? ""
|
|
||||||
readonly property string minuteStr: timeComponents[1] ?? ""
|
|
||||||
readonly property string amPmStr: timeComponents[2] ?? ""
|
|
||||||
|
|
||||||
function format(fmt: string): string {
|
|
||||||
return Qt.formatDateTime(clock.date, fmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
SystemClock {
|
|
||||||
id: clock
|
|
||||||
precision: SystemClock.Seconds
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Services.UPower
|
|
||||||
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
readonly property list<UPowerDevice> devices: UPower.devices.values
|
|
||||||
readonly property bool onBattery: UPower.onBattery
|
|
||||||
readonly property UPowerDevice displayDevice: UPower.displayDevice
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
property var screens: new Map()
|
|
||||||
property var bars: new Map()
|
|
||||||
|
|
||||||
function load(screen: ShellScreen, visibilities: var): void {
|
|
||||||
screens.set(Hypr.monitorFor(screen), visibilities);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getForActive(): PersistentProperties {
|
|
||||||
return screens.get(Hypr.focusedMonitor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Paths
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property alias currentWallpaperPath: adapter.currentWallpaperPath
|
|
||||||
property alias lockscreenBg: adapter.lockscreenBg
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
id: fileView
|
|
||||||
path: `${Paths.state}/wallpaper_path.json`
|
|
||||||
|
|
||||||
watchChanges: true
|
|
||||||
onFileChanged: reload()
|
|
||||||
onAdapterUpdated: writeAdapter()
|
|
||||||
JsonAdapter {
|
|
||||||
id: adapter
|
|
||||||
property string currentWallpaperPath: ""
|
|
||||||
property string lockscreenBg: `${Paths.state}/lockscreen_bg.png`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import ZShell.Models
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Paths
|
|
||||||
|
|
||||||
Searcher {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool showPreview: false
|
|
||||||
readonly property string current: showPreview ? previewPath : actualCurrent
|
|
||||||
property string previewPath
|
|
||||||
property string actualCurrent: WallpaperPath.currentWallpaperPath
|
|
||||||
|
|
||||||
function setWallpaper(path: string): void {
|
|
||||||
actualCurrent = path;
|
|
||||||
WallpaperPath.currentWallpaperPath = path;
|
|
||||||
if ( Config.general.color.wallust )
|
|
||||||
Wallust.generateColors(WallpaperPath.currentWallpaperPath);
|
|
||||||
Quickshell.execDetached(["sh", "-c", `zshell-cli wallpaper lockscreen --input-image=${root.actualCurrent} --output-path=${Paths.state}/lockscreen_bg.png --blur-amount=${Config.lock.blurAmount}`]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function preview(path: string): void {
|
|
||||||
previewPath = path;
|
|
||||||
if ( Config.general.color.schemeGeneration )
|
|
||||||
Quickshell.execDetached(["sh", "-c", `zshell-cli scheme generate --image-path ${previewPath} --thumbnail-path ${Paths.cache}/imagecache/thumbnail.jpg --output ${Paths.state}/scheme.json --scheme ${Config.colors.schemeType} --mode ${Config.general.color.mode}`]);
|
|
||||||
showPreview = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopPreview(): void {
|
|
||||||
showPreview = false;
|
|
||||||
if ( Config.general.color.schemeGeneration )
|
|
||||||
Quickshell.execDetached(["sh", "-c", `zshell-cli scheme generate --image-path ${root.actualCurrent} --thumbnail-path ${Paths.cache}/imagecache/thumbnail.jpg --output ${Paths.state}/scheme.json --scheme ${Config.colors.schemeType} --mode ${Config.general.color.mode}`]);
|
|
||||||
}
|
|
||||||
|
|
||||||
list: wallpapers.entries
|
|
||||||
key: "relativePath"
|
|
||||||
useFuzzy: true
|
|
||||||
extraOpts: useFuzzy ? ({}) : ({
|
|
||||||
forward: false
|
|
||||||
})
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "wallpaper"
|
|
||||||
|
|
||||||
function set(path: string): void {
|
|
||||||
root.setWallpaper(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileSystemModel {
|
|
||||||
id: wallpapers
|
|
||||||
|
|
||||||
recursive: true
|
|
||||||
path: Config.general.wallpaperPath
|
|
||||||
filter: FileSystemModel.Images
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property var args
|
|
||||||
readonly property string mode: Config.general.color.mode
|
|
||||||
readonly property string threshold: mode === "dark" ? "--threshold=9" : "--dynamic-threshold"
|
|
||||||
|
|
||||||
function generateColors(wallpaperPath) {
|
|
||||||
root.args = wallpaperPath;
|
|
||||||
wallustProc.running = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: wallustProc
|
|
||||||
command: ["wallust", "run", root.args, `--palette=${root.mode}`, "--ignore-sequence=cursor", `${root.threshold}` ]
|
|
||||||
running: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
import ZShell
|
|
||||||
import qs.Config
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property string city
|
|
||||||
property string loc
|
|
||||||
property var cc
|
|
||||||
property list<var> forecast
|
|
||||||
property list<var> hourlyForecast
|
|
||||||
|
|
||||||
readonly property string icon: cc ? Icons.getWeatherIcon(cc.weatherCode) : "cloud_alert"
|
|
||||||
readonly property string description: cc?.weatherDesc ?? qsTr("No weather")
|
|
||||||
readonly property string temp: `${cc?.tempC ?? 0}°C`
|
|
||||||
readonly property string feelsLike: `${cc?.feelsLikeC ?? 0}°C`
|
|
||||||
readonly property int humidity: cc?.humidity ?? 0
|
|
||||||
readonly property real windSpeed: cc?.windSpeed ?? 0
|
|
||||||
readonly property string sunrise: cc ? Qt.formatDateTime(new Date(cc.sunrise), "h:mm") : "--:--"
|
|
||||||
readonly property string sunset: cc ? Qt.formatDateTime(new Date(cc.sunset), "h:mm") : "--:--"
|
|
||||||
|
|
||||||
readonly property var cachedCities: new Map()
|
|
||||||
|
|
||||||
function reload(): void {
|
|
||||||
const configLocation = Config.services.weatherLocation;
|
|
||||||
|
|
||||||
if (configLocation) {
|
|
||||||
if (configLocation.indexOf(",") !== -1 && !isNaN(parseFloat(configLocation.split(",")[0]))) {
|
|
||||||
loc = configLocation;
|
|
||||||
fetchCityFromCoords(configLocation);
|
|
||||||
} else {
|
|
||||||
fetchCoordsFromCity(configLocation);
|
|
||||||
}
|
|
||||||
} else if (!loc || timer.elapsed() > 900) {
|
|
||||||
Requests.get("https://ipinfo.io/json", text => {
|
|
||||||
const response = JSON.parse(text);
|
|
||||||
if (response.loc) {
|
|
||||||
loc = response.loc;
|
|
||||||
city = response.city ?? "";
|
|
||||||
timer.restart();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetchCityFromCoords(coords: string): void {
|
|
||||||
if (cachedCities.has(coords)) {
|
|
||||||
city = cachedCities.get(coords);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const [lat, lon] = coords.split(",");
|
|
||||||
const url = `https://nominatim.openstreetmap.org/reverse?lat=${lat}&lon=${lon}&format=geocodejson`;
|
|
||||||
Requests.get(url, text => {
|
|
||||||
const geo = JSON.parse(text).features?.[0]?.properties.geocoding;
|
|
||||||
if (geo) {
|
|
||||||
const geoCity = geo.type === "city" ? geo.name : geo.city;
|
|
||||||
city = geoCity;
|
|
||||||
cachedCities.set(coords, geoCity);
|
|
||||||
} else {
|
|
||||||
city = "Unknown City";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetchCoordsFromCity(cityName: string): void {
|
|
||||||
const url = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(cityName)}&count=1&language=en&format=json`;
|
|
||||||
|
|
||||||
Requests.get(url, text => {
|
|
||||||
const json = JSON.parse(text);
|
|
||||||
if (json.results && json.results.length > 0) {
|
|
||||||
const result = json.results[0];
|
|
||||||
loc = result.latitude + "," + result.longitude;
|
|
||||||
city = result.name;
|
|
||||||
} else {
|
|
||||||
loc = "";
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetchWeatherData(): void {
|
|
||||||
const url = getWeatherUrl();
|
|
||||||
if (url === "")
|
|
||||||
return;
|
|
||||||
|
|
||||||
Requests.get(url, text => {
|
|
||||||
const json = JSON.parse(text);
|
|
||||||
if (!json.current || !json.daily)
|
|
||||||
return;
|
|
||||||
|
|
||||||
cc = {
|
|
||||||
weatherCode: json.current.weather_code,
|
|
||||||
weatherDesc: getWeatherCondition(json.current.weather_code),
|
|
||||||
tempC: Math.round(json.current.temperature_2m),
|
|
||||||
tempF: Math.round(toFahrenheit(json.current.temperature_2m)),
|
|
||||||
feelsLikeC: Math.round(json.current.apparent_temperature),
|
|
||||||
feelsLikeF: Math.round(toFahrenheit(json.current.apparent_temperature)),
|
|
||||||
humidity: json.current.relative_humidity_2m,
|
|
||||||
windSpeed: json.current.wind_speed_10m,
|
|
||||||
isDay: json.current.is_day,
|
|
||||||
sunrise: json.daily.sunrise[0],
|
|
||||||
sunset: json.daily.sunset[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
const forecastList = [];
|
|
||||||
for (let i = 0; i < json.daily.time.length; i++)
|
|
||||||
forecastList.push({
|
|
||||||
date: json.daily.time[i],
|
|
||||||
maxTempC: Math.round(json.daily.temperature_2m_max[i]),
|
|
||||||
maxTempF: Math.round(toFahrenheit(json.daily.temperature_2m_max[i])),
|
|
||||||
minTempC: Math.round(json.daily.temperature_2m_min[i]),
|
|
||||||
minTempF: Math.round(toFahrenheit(json.daily.temperature_2m_min[i])),
|
|
||||||
weatherCode: json.daily.weather_code[i],
|
|
||||||
icon: Icons.getWeatherIcon(json.daily.weather_code[i])
|
|
||||||
});
|
|
||||||
forecast = forecastList;
|
|
||||||
|
|
||||||
const hourlyList = [];
|
|
||||||
const now = new Date();
|
|
||||||
for (let i = 0; i < json.hourly.time.length; i++) {
|
|
||||||
const time = new Date(json.hourly.time[i]);
|
|
||||||
if (time < now)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
hourlyList.push({
|
|
||||||
timestamp: json.hourly.time[i],
|
|
||||||
hour: time.getHours(),
|
|
||||||
tempC: Math.round(json.hourly.temperature_2m[i]),
|
|
||||||
tempF: Math.round(toFahrenheit(json.hourly.temperature_2m[i])),
|
|
||||||
weatherCode: json.hourly.weather_code[i],
|
|
||||||
icon: Icons.getWeatherIcon(json.hourly.weather_code[i])
|
|
||||||
});
|
|
||||||
}
|
|
||||||
hourlyForecast = hourlyList;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function toFahrenheit(celcius: real): real {
|
|
||||||
return celcius * 9 / 5 + 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWeatherUrl(): string {
|
|
||||||
if (!loc || loc.indexOf(",") === -1)
|
|
||||||
return "";
|
|
||||||
|
|
||||||
const [lat, lon] = loc.split(",");
|
|
||||||
const baseUrl = "https://api.open-meteo.com/v1/forecast";
|
|
||||||
const params = ["latitude=" + lat, "longitude=" + lon, "hourly=weather_code,temperature_2m", "daily=weather_code,temperature_2m_max,temperature_2m_min,sunrise,sunset", "current=temperature_2m,relative_humidity_2m,apparent_temperature,is_day,weather_code,wind_speed_10m", "timezone=auto", "forecast_days=7"];
|
|
||||||
|
|
||||||
return baseUrl + "?" + params.join("&");
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWeatherCondition(code: string): string {
|
|
||||||
const conditions = {
|
|
||||||
"0": "Clear",
|
|
||||||
"1": "Clear",
|
|
||||||
"2": "Partly cloudy",
|
|
||||||
"3": "Overcast",
|
|
||||||
"45": "Fog",
|
|
||||||
"48": "Fog",
|
|
||||||
"51": "Drizzle",
|
|
||||||
"53": "Drizzle",
|
|
||||||
"55": "Drizzle",
|
|
||||||
"56": "Freezing drizzle",
|
|
||||||
"57": "Freezing drizzle",
|
|
||||||
"61": "Light rain",
|
|
||||||
"63": "Rain",
|
|
||||||
"65": "Heavy rain",
|
|
||||||
"66": "Light rain",
|
|
||||||
"67": "Heavy rain",
|
|
||||||
"71": "Light snow",
|
|
||||||
"73": "Snow",
|
|
||||||
"75": "Heavy snow",
|
|
||||||
"77": "Snow",
|
|
||||||
"80": "Light rain",
|
|
||||||
"81": "Rain",
|
|
||||||
"82": "Heavy rain",
|
|
||||||
"85": "Light snow showers",
|
|
||||||
"86": "Heavy snow showers",
|
|
||||||
"95": "Thunderstorm",
|
|
||||||
"96": "Thunderstorm with hail",
|
|
||||||
"99": "Thunderstorm with hail"
|
|
||||||
};
|
|
||||||
return conditions[code] || "Unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
onLocChanged: fetchWeatherData()
|
|
||||||
|
|
||||||
// Refresh current location hourly
|
|
||||||
Timer {
|
|
||||||
interval: 3600000 // 1 hour
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
onTriggered: fetchWeatherData()
|
|
||||||
}
|
|
||||||
|
|
||||||
ElapsedTimer {
|
|
||||||
id: timer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,420 +0,0 @@
|
|||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonObject {
|
|
||||||
property list<var> week_0: [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_1: [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_2: [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_3: [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_4: [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_5: [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_6: [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_7: [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_8: [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_9: [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_10:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_11:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_12:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_13:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_14:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_15:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_16:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_17:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_18:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_19:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_20:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_21:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_22:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_23:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_24:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_25:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_26:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_27:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_28:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_29:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_30:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_31:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_32:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_33:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_34:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_35:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_36:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_37:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_38:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_39:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_40:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_41:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_42:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_43:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_44:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_45:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_46:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_47:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_48:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_49:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_50:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
property list<var> week_51:[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,417 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Services.Pipewire
|
|
||||||
import Quickshell.Widgets
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Controls
|
|
||||||
import qs.Config
|
|
||||||
import qs.Components
|
|
||||||
import qs.Daemons
|
|
||||||
import qs.Helpers
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
implicitWidth: layout.implicitWidth + 5 * 2
|
|
||||||
implicitHeight: layout.implicitHeight + 5 * 2
|
|
||||||
|
|
||||||
readonly property int topMargin: 0
|
|
||||||
readonly property int rounding: 6
|
|
||||||
|
|
||||||
required property var wrapper
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
id: layout
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
implicitWidth: stack.currentItem ? stack.currentItem.childrenRect.height : 0
|
|
||||||
spacing: 12
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: tabBar
|
|
||||||
spacing: 6
|
|
||||||
Layout.fillWidth: true
|
|
||||||
property int tabHeight: 36
|
|
||||||
|
|
||||||
CustomClippingRect {
|
|
||||||
radius: 6
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: tabBar.tabHeight
|
|
||||||
|
|
||||||
color: stack.currentIndex === 0 ? DynamicColors.palette.m3primary : DynamicColors.tPalette.m3surfaceContainer
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
|
|
||||||
function onClicked(): void {
|
|
||||||
stack.currentIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: qsTr("Volumes")
|
|
||||||
anchors.centerIn: parent
|
|
||||||
color: stack.currentIndex === 0 ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3primary
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomClippingRect {
|
|
||||||
radius: 6
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: tabBar.tabHeight
|
|
||||||
|
|
||||||
color: stack.currentIndex === 1 ? DynamicColors.palette.m3primary : DynamicColors.tPalette.m3surfaceContainer
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
|
|
||||||
function onClicked(): void {
|
|
||||||
stack.currentIndex = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: qsTr("Devices")
|
|
||||||
anchors.centerIn: parent
|
|
||||||
color: stack.currentIndex === 1 ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3primary
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StackLayout {
|
|
||||||
id: stack
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: currentIndex === 0 ? vol.childrenRect.height : dev.childrenRect.height
|
|
||||||
currentIndex: 0
|
|
||||||
|
|
||||||
VolumesTab { id: vol }
|
|
||||||
DevicesTab { id: dev }
|
|
||||||
|
|
||||||
Behavior on currentIndex {
|
|
||||||
SequentialAnimation {
|
|
||||||
ParallelAnimation {
|
|
||||||
Anim {
|
|
||||||
target: stack
|
|
||||||
property: "opacity"
|
|
||||||
to: 0
|
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
|
||||||
}
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
target: stack
|
|
||||||
property: "scale"
|
|
||||||
to: 0.9
|
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyAction {}
|
|
||||||
|
|
||||||
ParallelAnimation {
|
|
||||||
Anim {
|
|
||||||
target: stack
|
|
||||||
property: "opacity"
|
|
||||||
to: 1
|
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
|
||||||
}
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
target: stack
|
|
||||||
property: "scale"
|
|
||||||
to: 1
|
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component VolumesTab: ColumnLayout {
|
|
||||||
spacing: 12
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
Layout.topMargin: root.topMargin
|
|
||||||
Layout.preferredHeight: 42 + Appearance.spacing.smaller * 2
|
|
||||||
Layout.fillWidth: true
|
|
||||||
color: DynamicColors.tPalette.m3surfaceContainer
|
|
||||||
|
|
||||||
radius: root.rounding
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: outputVolume
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.margins: Appearance.spacing.smaller
|
|
||||||
spacing: 15
|
|
||||||
CustomRect {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
Layout.preferredHeight: 40
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
color: DynamicColors.palette.m3primary
|
|
||||||
radius: 1000
|
|
||||||
MaterialIcon {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
color: DynamicColors.palette.m3onPrimary
|
|
||||||
text: "speaker"
|
|
||||||
font.pointSize: 22
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: "Output Volume"
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: qsTr("%1").arg(Audio.muted ? qsTr("Muted") : `${Math.round(Audio.volume * 100)}%`);
|
|
||||||
font.bold: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomMouseArea {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 10
|
|
||||||
Layout.bottomMargin: 5
|
|
||||||
|
|
||||||
CustomSlider {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
implicitHeight: 10
|
|
||||||
value: Audio.volume
|
|
||||||
onMoved: Audio.setVolume(value)
|
|
||||||
|
|
||||||
Behavior on value { Anim {} }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
Layout.topMargin: root.topMargin
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 42 + Appearance.spacing.smaller * 2
|
|
||||||
color: DynamicColors.tPalette.m3surfaceContainer
|
|
||||||
|
|
||||||
radius: root.rounding
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: inputVolume
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.margins: Appearance.spacing.smaller
|
|
||||||
spacing: 15
|
|
||||||
Rectangle {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
Layout.preferredHeight: 40
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
color: DynamicColors.palette.m3primary
|
|
||||||
radius: 1000
|
|
||||||
MaterialIcon {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
anchors.alignWhenCentered: false
|
|
||||||
color: DynamicColors.palette.m3onPrimary
|
|
||||||
text: "mic"
|
|
||||||
font.pointSize: 22
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: "Input Volume"
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: qsTr("%1").arg(Audio.sourceMuted ? qsTr("Muted") : `${Math.round(Audio.sourceVolume * 100)}%`);
|
|
||||||
font.bold: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomMouseArea {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.bottomMargin: 5
|
|
||||||
implicitHeight: 10
|
|
||||||
|
|
||||||
CustomSlider {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
implicitHeight: 10
|
|
||||||
value: Audio.sourceVolume
|
|
||||||
onMoved: Audio.setSourceVolume(value)
|
|
||||||
|
|
||||||
Behavior on value { Anim {} }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
Layout.topMargin: root.topMargin
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 1
|
|
||||||
|
|
||||||
color: DynamicColors.tPalette.m3outline
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: Audio.streams.filter(s => s.isSink)
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
id: appBox
|
|
||||||
|
|
||||||
Layout.topMargin: root.topMargin
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 42 + Appearance.spacing.smaller * 2
|
|
||||||
color: DynamicColors.tPalette.m3surfaceContainer
|
|
||||||
|
|
||||||
radius: root.rounding
|
|
||||||
|
|
||||||
|
|
||||||
required property var modelData
|
|
||||||
required property int index
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: layoutVolume
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Appearance.spacing.smaller
|
|
||||||
spacing: 15
|
|
||||||
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
Layout.preferredHeight: 40
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
color: DynamicColors.palette.m3primary
|
|
||||||
radius: 1000
|
|
||||||
MaterialIcon {
|
|
||||||
id: icon
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "volume_up"
|
|
||||||
font.pointSize: 22
|
|
||||||
color: DynamicColors.palette.m3onPrimary
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
radius: 1000
|
|
||||||
onClicked: {
|
|
||||||
appBox.modelData.audio.muted = !appBox.modelData.audio.muted;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
||||||
Layout.fillHeight: true
|
|
||||||
|
|
||||||
TextMetrics {
|
|
||||||
id: metrics
|
|
||||||
text: Audio.getStreamName(appBox.modelData)
|
|
||||||
elide: Text.ElideRight
|
|
||||||
elideWidth: root.width - 50
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
CustomText {
|
|
||||||
text: metrics.elidedText
|
|
||||||
elide: Text.ElideRight
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: qsTr("%1").arg(appBox.modelData.audio.muted ? qsTr("Muted") : `${Math.round(appBox.modelData.audio.volume * 100)}%`);
|
|
||||||
font.bold: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomMouseArea {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
||||||
implicitHeight: 10
|
|
||||||
CustomSlider {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
implicitHeight: 10
|
|
||||||
value: appBox.modelData.audio.volume
|
|
||||||
onMoved: {
|
|
||||||
Audio.setStreamVolume(appBox.modelData, value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component DevicesTab: ColumnLayout {
|
|
||||||
spacing: 12
|
|
||||||
|
|
||||||
ButtonGroup { id: sinks }
|
|
||||||
ButtonGroup { id: sources }
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: qsTr("Output device")
|
|
||||||
font.weight: 500
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: Audio.sinks
|
|
||||||
|
|
||||||
CustomRadioButton {
|
|
||||||
required property PwNode modelData
|
|
||||||
|
|
||||||
ButtonGroup.group: sinks
|
|
||||||
checked: Audio.sink?.id === modelData.id
|
|
||||||
onClicked: Audio.setAudioSink(modelData)
|
|
||||||
text: modelData.description
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
Layout.topMargin: 10
|
|
||||||
text: qsTr("Input device")
|
|
||||||
font.weight: 500
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: Audio.sources
|
|
||||||
|
|
||||||
CustomRadioButton {
|
|
||||||
required property PwNode modelData
|
|
||||||
|
|
||||||
ButtonGroup.group: sources
|
|
||||||
checked: Audio.source?.id === modelData.id
|
|
||||||
onClicked: Audio.setAudioSource(modelData)
|
|
||||||
text: modelData.description
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user