brightess and volume control
This commit is contained in:
@@ -9,11 +9,13 @@ Item {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
width: children[1].width + 20
|
||||
width: children[1].width + 16
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
anchors.rightMargin: 2
|
||||
color: hover.hovered ? "#11ffffff" : "#00ffffff"
|
||||
Behavior on color {ColorAnimation {duration: 150}}
|
||||
radius: 8
|
||||
bottomLeftRadius: 12
|
||||
}
|
||||
|
||||
40
Widgets/Brightness.qml
Normal file
40
Widgets/Brightness.qml
Normal file
@@ -0,0 +1,40 @@
|
||||
import Quickshell
|
||||
import QtQuick.Shapes
|
||||
import qs.Services
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
width: children[1].width + 16
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
anchors.leftMargin: 2
|
||||
anchors.rightMargin: 2
|
||||
color: hover.hovered ? "#11ffffff" : "#00ffffff"
|
||||
Behavior on color {ColorAnimation {duration: 150}}
|
||||
radius: 8
|
||||
}
|
||||
PercentIndicator {
|
||||
x: 8
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 26
|
||||
height: width
|
||||
percent: Brightness.monitors[0].value / Brightness.monitors[0].max
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
width: 20
|
||||
height: width
|
||||
sourceSize {width: width; height: height}
|
||||
source: Quickshell.iconPath("brightnesssettings")
|
||||
}
|
||||
}
|
||||
HoverHandler {id: hover}
|
||||
TapHandler {onTapped: {
|
||||
background.index = 6
|
||||
}}
|
||||
}
|
||||
40
Widgets/PercentIndicator.qml
Normal file
40
Widgets/PercentIndicator.qml
Normal file
@@ -0,0 +1,40 @@
|
||||
import Quickshell
|
||||
import QtQuick.Shapes
|
||||
import Quickshell.Services.Pipewire
|
||||
import QtQuick
|
||||
|
||||
Shape {
|
||||
id: root
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
property var percent
|
||||
ShapePath {
|
||||
capStyle: ShapePath.RoundCap
|
||||
fillColor: "transparent"
|
||||
strokeColor: "#333"
|
||||
strokeWidth: 2
|
||||
PathAngleArc {
|
||||
moveToStart: true
|
||||
centerX: root.width/2
|
||||
centerY: root.height/2
|
||||
radiusX: root.width/2
|
||||
radiusY: root.height/2
|
||||
startAngle: 90 + 40
|
||||
sweepAngle: 360 - 80
|
||||
}
|
||||
}
|
||||
ShapePath {
|
||||
capStyle: ShapePath.RoundCap
|
||||
fillColor: "transparent"
|
||||
strokeColor: "white"
|
||||
strokeWidth: 2
|
||||
PathAngleArc {
|
||||
moveToStart: true
|
||||
centerX: root.width/2
|
||||
centerY: root.height/2
|
||||
radiusX: root.width/2 - 1
|
||||
radiusY: root.height/2 - 1
|
||||
startAngle: 90 + 40
|
||||
sweepAngle: root.percent * (360 - 80)
|
||||
}
|
||||
}
|
||||
}
|
||||
42
Widgets/Slider.qml
Normal file
42
Widgets/Slider.qml
Normal file
@@ -0,0 +1,42 @@
|
||||
import QtQuick.Controls as QQC
|
||||
import QtQuick
|
||||
|
||||
QQC.Slider {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
height: 24
|
||||
orientation: Qt.Horizontal
|
||||
handle: Rectangle {
|
||||
x: parent.visualPosition * (parent.availableWidth - width)
|
||||
y: parent.availableHeight / 2 - height / 2
|
||||
height: 16
|
||||
width: 4
|
||||
radius: width/2
|
||||
}
|
||||
background: Rectangle {
|
||||
height: 6
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.handle.right
|
||||
right: parent.right
|
||||
leftMargin: 4
|
||||
}
|
||||
color: "#333"
|
||||
topRightRadius: height/2
|
||||
bottomRightRadius: topRightRadius
|
||||
}
|
||||
Rectangle {
|
||||
height: 6
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
right: parent.handle.left
|
||||
rightMargin: 4
|
||||
}
|
||||
color: "white"
|
||||
topLeftRadius: height/2
|
||||
bottomLeftRadius: topLeftRadius
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ Item {
|
||||
radius: 8
|
||||
bottomRightRadius: 12
|
||||
color: hover.hovered ? "#11ffffff" : "#00ffffff"
|
||||
Behavior on color {ColorAnimation {duration: 100}}
|
||||
Behavior on color {ColorAnimation {duration: 150}}
|
||||
}
|
||||
Row {
|
||||
spacing: 12
|
||||
|
||||
7
Widgets/Uptime.qml
Normal file
7
Widgets/Uptime.qml
Normal file
@@ -0,0 +1,7 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
anchors {
|
||||
}
|
||||
}
|
||||
44
Widgets/Volume.qml
Normal file
44
Widgets/Volume.qml
Normal file
@@ -0,0 +1,44 @@
|
||||
import Quickshell
|
||||
import QtQuick.Shapes
|
||||
import Quickshell.Services.Pipewire
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
width: children[1].width + 16
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [Pipewire.defaultAudioSink]
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
anchors.leftMargin: 2
|
||||
anchors.rightMargin: 2
|
||||
color: hover.hovered ? "#11ffffff" : "#00ffffff"
|
||||
Behavior on color {ColorAnimation {duration: 150}}
|
||||
radius: 8
|
||||
}
|
||||
PercentIndicator {
|
||||
x: 8
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 26
|
||||
height: width
|
||||
percent: Pipewire.defaultAudioSink.audio.volume
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
width: 20
|
||||
height: width
|
||||
sourceSize {width: width; height: height}
|
||||
source: Quickshell.iconPath("volume-level-high")
|
||||
}
|
||||
}
|
||||
HoverHandler {id: hover}
|
||||
TapHandler {onTapped: {
|
||||
background.index = 5
|
||||
}}
|
||||
}
|
||||
@@ -18,9 +18,11 @@ Item {
|
||||
width: 24
|
||||
property var workspace: Hyprland.workspaces.values.find(ws => ws.id === modelData+1)
|
||||
property var icon: {
|
||||
const appId = workspace ? Array.from(workspace.toplevels.values).sort(
|
||||
(a, b) => b.lastIpcObject.focusHistoryId - a.lastIpcObject.focusHistoryId
|
||||
)[0]?.wayland?.appId : undefined
|
||||
let appId
|
||||
if (workspace) {
|
||||
let toplevel = Array.from(workspace.toplevels.values).reduce((prev, curr) => (prev.lastIpcObject.focusHistoryID < curr.lastIpcObject.focusHistoryID) ? prev : curr)
|
||||
appId = toplevel.wayland?.appId
|
||||
}
|
||||
return DesktopEntries.applications.values.find(
|
||||
app => app.startupClass === appId || app.id === appId
|
||||
)?.icon;
|
||||
@@ -59,4 +61,8 @@ Item {
|
||||
height: 4
|
||||
radius: height/2
|
||||
}
|
||||
Connections {
|
||||
target: Hyprland
|
||||
function onActiveToplevelChanged() {Hyprland.refreshToplevels()}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user