add fuzzel, hyprland, qmlls to lspconfig, blur to quickshell bar
This commit is contained in:
+67
-39
@@ -7,14 +7,15 @@ import QtQuick.Layouts
|
||||
|
||||
import Quickshell.Services.SystemTray
|
||||
import Quickshell.DBusMenu
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
property string time
|
||||
|
||||
|
||||
property int cpuUsage: 0
|
||||
property int memUsage: 0
|
||||
property var lastCpuIdle: 0
|
||||
property var lastCpuTotal: 0
|
||||
property var lastCpuTotal: 0
|
||||
|
||||
SystemClock {
|
||||
id: sysClock
|
||||
@@ -26,15 +27,16 @@ Scope {
|
||||
command: ["sh", "-c", "head -1 /proc/stat"]
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
if (!data) return
|
||||
var p = data.trim().split(/\s+/)
|
||||
var idle = parseInt(p[4]) + parseInt(p[5])
|
||||
var total = p.slice(1, 8).reduce((a, b) => a + parseInt(b), 0)
|
||||
if (!data)
|
||||
return;
|
||||
var p = data.trim().split(/\s+/);
|
||||
var idle = parseInt(p[4]) + parseInt(p[5]);
|
||||
var total = p.slice(1, 8).reduce((a, b) => a + parseInt(b), 0);
|
||||
if (lastCpuTotal > 0) {
|
||||
cpuUsage = Math.round(100 * (1 - (idle - lastCpuIdle) / (total - lastCpuTotal)))
|
||||
cpuUsage = Math.round(100 * (1 - (idle - lastCpuIdle) / (total - lastCpuTotal)));
|
||||
}
|
||||
lastCpuTotal = total
|
||||
lastCpuIdle = idle
|
||||
lastCpuTotal = total;
|
||||
lastCpuIdle = idle;
|
||||
}
|
||||
}
|
||||
Component.onCompleted: running = true
|
||||
@@ -48,36 +50,36 @@ Scope {
|
||||
command: ["sh", "-c", "free | grep Mem"]
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
if (!data) return
|
||||
var parts = data.trim().split(/\s+/)
|
||||
var total = parseInt(parts[1]) || 1
|
||||
var used = parseInt(parts[2]) || 0
|
||||
memUsage = Math.round(100 * used / total)
|
||||
if (!data)
|
||||
return;
|
||||
var parts = data.trim().split(/\s+/);
|
||||
var total = parseInt(parts[1]) || 1;
|
||||
var used = parseInt(parts[2]) || 0;
|
||||
memUsage = Math.round(100 * used / total);
|
||||
}
|
||||
}
|
||||
Component.onCompleted: running = true
|
||||
}
|
||||
|
||||
|
||||
Timer {
|
||||
interval: 1000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
cpuProc.running = true
|
||||
memProc.running = true
|
||||
cpuProc.running = true;
|
||||
memProc.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
|
||||
PanelWindow {
|
||||
id: barRoot
|
||||
required property var modelData
|
||||
screen: modelData
|
||||
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(screen)
|
||||
|
||||
id: barRoot
|
||||
|
||||
// Theme
|
||||
property color colBg: "#150d16"
|
||||
property color colFg: "#f5dbc4"
|
||||
@@ -90,6 +92,10 @@ Scope {
|
||||
property string fontFamily: "Inter"
|
||||
property int fontSize: 16
|
||||
|
||||
BackgroundEffect.blurRegion: Region {
|
||||
item: barRoot.contentItem
|
||||
}
|
||||
|
||||
anchors.bottom: true
|
||||
anchors.left: true
|
||||
anchors.right: true
|
||||
@@ -107,17 +113,21 @@ Scope {
|
||||
|
||||
delegate: Loader {
|
||||
active: modelData.monitor && modelData.monitor.name === monitor.name && modelData.id != -98
|
||||
|
||||
|
||||
sourceComponent: Text {
|
||||
property bool isActive: Hyprland.focusedWorkspace?.id === modelData.id
|
||||
text: modelData.id
|
||||
|
||||
property bool isActive: Hyprland.focusedWorkspace?.id === modelData.id
|
||||
text: modelData.id
|
||||
|
||||
color: isActive ? barRoot.colRed : barRoot.colFg
|
||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||
|
||||
font {
|
||||
family: root.fontFamily
|
||||
pixelSize: root.fontSize
|
||||
bold: true
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: ws.activate()
|
||||
onClicked: ws.activate()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,37 +137,56 @@ Scope {
|
||||
id: clock
|
||||
anchors.centerIn: parent
|
||||
property var timeFmt: "h:mm:ss AP"
|
||||
property var timeStr: Qt.formatDateTime(sysClock.date, timeFmt)
|
||||
|
||||
property var timeStr: Qt.formatDateTime(sysClock.date, timeFmt)
|
||||
|
||||
color: barRoot.colFg
|
||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||
text: timeStr
|
||||
font {
|
||||
family: root.fontFamily
|
||||
pixelSize: root.fontSize
|
||||
bold: true
|
||||
}
|
||||
text: timeStr
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: { clock.timeFmt = (clock.timeFmt === "h:mm:ss AP") ? "ddd, MMM d - h:mm:ss AP" : "h:mm:ss AP" }
|
||||
onClicked: {
|
||||
clock.timeFmt = (clock.timeFmt === "h:mm:ss AP") ? "ddd, MMM d - h:mm:ss AP" : "h:mm:ss AP";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true }
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// CPU
|
||||
Text {
|
||||
text: "CPU: " + cpuUsage + "%"
|
||||
color: barRoot.colFg
|
||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||
font {
|
||||
family: root.fontFamily
|
||||
pixelSize: root.fontSize
|
||||
bold: true
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { width: 1; height: 16; color: root.colMuted }
|
||||
Rectangle {
|
||||
width: 1
|
||||
height: 16
|
||||
color: root.colMuted
|
||||
}
|
||||
|
||||
// Memory
|
||||
Text {
|
||||
text: "Mem: " + memUsage + "%"
|
||||
color: barRoot.colFg
|
||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||
font {
|
||||
family: root.fontFamily
|
||||
pixelSize: root.fontSize
|
||||
bold: true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row {
|
||||
spacing: 5
|
||||
Repeater {
|
||||
@@ -166,7 +195,7 @@ Scope {
|
||||
source: modelData.icon
|
||||
width: 16
|
||||
height: 16
|
||||
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: modelData.activate()
|
||||
@@ -174,7 +203,6 @@ Scope {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user