Add quickshell
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
pragma Singleton
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
readonly property string barBg: "#1a1b26"
|
||||||
|
readonly property int barWidth: 20
|
||||||
|
readonly property int infoBoxHeight: 20
|
||||||
|
|
||||||
|
readonly property int fontSize: 10
|
||||||
|
|
||||||
|
readonly property string infoBoxBg: "#1a1b26"
|
||||||
|
readonly property string infoBoxActive: "#7a1b26"
|
||||||
|
readonly property string infoBoxUrgent: "#4a1b26"
|
||||||
|
|
||||||
|
readonly property string infoTextActiveFg: "#ffffff"
|
||||||
|
readonly property string infoTextFg: "#7aa2f7"
|
||||||
|
|
||||||
|
readonly property string separatorFg: "#aaaaaa"
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.preferredWidth: BarSettings.barWidth
|
||||||
|
Layout.preferredHeight: BarSettings.infoBoxHeight
|
||||||
|
color: BarSettings.infoBoxBg
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: BarSettings.infoTextFg
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: BarSettings.fontSize
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: Quickshell.execDetached(["kitty", "-e", "nmtui"])
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
color: BarSettings.separatorFg
|
||||||
|
text: "〰"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Networking
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
PanelWindow {
|
||||||
|
anchors.top: true
|
||||||
|
anchors.left: true
|
||||||
|
anchors.bottom: true
|
||||||
|
width: BarSettings.barWidth
|
||||||
|
color: BarSettings.barBg
|
||||||
|
|
||||||
|
SystemClock {
|
||||||
|
id: clock
|
||||||
|
precision: SystemClock.Seconds
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 5000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
onTriggered: {
|
||||||
|
cpu_proc.running = true;
|
||||||
|
gpu_proc.running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: cpu_proc
|
||||||
|
command: ["hmon", "cpu"]
|
||||||
|
running: true
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: cpu_text.text = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: gpu_proc
|
||||||
|
command: ["hmon", "gpu"]
|
||||||
|
running: true
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: gpu_text.text = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: workspaces
|
||||||
|
width: parent.width
|
||||||
|
anchors {
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
height: 130
|
||||||
|
spacing: 1
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: 6
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
property var ws: Hyprland.workspaces.values.find(w => w.id === index + 1)
|
||||||
|
property var isActive: Hyprland.focusedWorkspace?.id === (index + 1)
|
||||||
|
property var isUrgent: ws?.urgent ?? false
|
||||||
|
|
||||||
|
color: isActive ? BarSettings.infoBoxActive : isUrgent ? BarSettings.infoBoxUrgent : BarSettings.infoBoxBg
|
||||||
|
|
||||||
|
InfoText {
|
||||||
|
id: seconds_text
|
||||||
|
text: index + 1
|
||||||
|
color: parent.isActive ? BarSettings.infoTextActiveFg : BarSettings.infoTextFg
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: Hyprland.dispatch("workspace " + (index + 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Separator {}
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
text: "c"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
id: cpu_text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
text: "g"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
id: gpu_text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Separator {}
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
text: "ᛒ"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: Quickshell.execDetached("blueberry")
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
text: "🕪"
|
||||||
|
font.pixelSize: 13
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: Quickshell.execDetached("pavucontrol")
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Separator {}
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
text: Networking.connectivity == 4 ? "🌍" : "🚫"
|
||||||
|
NetworkClick {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
text: Networking.devices.values.find(n => n.type == 2).connected ? "🖧" : "🚫"
|
||||||
|
NetworkClick {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
text: Networking.devices.values.find(n => n.type == 1).connected ? "ᯤ" : "🚫"
|
||||||
|
NetworkClick {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors {
|
||||||
|
bottom: parent.bottom
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
bottomMargin: 8
|
||||||
|
}
|
||||||
|
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: Qt.formatDateTime(clock.date, "hh:mm").split(":")
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
text: modelData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoBox {
|
||||||
|
InfoText {
|
||||||
|
property var ss: Qt.formatDateTime(clock.date, "ss")
|
||||||
|
|
||||||
|
text: ss
|
||||||
|
font.bold: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user