diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 8c46647..33c110c 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -57,7 +57,6 @@ $mainMod = SUPER # Autostart # ---------------------------------------------------------- -exec-once = waybar exec-once = quickshell -c default exec-once = dunst exec-once = nm-applet --indicator diff --git a/quickshell/default/Bar.qml b/quickshell/default/Bar.qml new file mode 100644 index 0000000..1976b63 --- /dev/null +++ b/quickshell/default/Bar.qml @@ -0,0 +1,1074 @@ +import QtQuick +import QtQuick.Layouts +import Quickshell +import Quickshell.Io +import Quickshell.Wayland +import Quickshell.Hyprland +import Quickshell.Services.SystemTray + +Variants { + id: root + model: Quickshell.screens + + readonly property bool isGerman: Qt.locale().name.startsWith("de") + readonly property string logoutLabel: isGerman ? "Abmelden" : "Logout" + readonly property string restartLabel: isGerman ? "Neustart" : "Restart" + readonly property string shutdownLabel: isGerman ? "Herunterfahren" : "Shutdown" + + function isoWeek(d) { + let date = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())); + let day = (date.getUTCDay() + 6) % 7; + date.setUTCDate(date.getUTCDate() - day + 3); + let firstThursday = date.getTime(); + date.setUTCMonth(0, 1); + if (date.getUTCDay() !== 4) { + date.setUTCMonth(0, 1 + ((4 - date.getUTCDay()) + 7) % 7); + } + return 1 + Math.round((firstThursday - date.getTime()) / (7 * 86400000)); + } + + function buildCalendar(year, month, today) { + const firstOfMonth = new Date(year, month, 1); + const daysInMonth = new Date(year, month + 1, 0).getDate(); + const leading = (firstOfMonth.getDay() + 6) % 7; + + let cells = []; + for (let i = 0; i < leading; i++) cells.push(null); + for (let d = 1; d <= daysInMonth; d++) cells.push(d); + while (cells.length % 7 !== 0) cells.push(null); + + let weeksArr = []; + for (let i = 0; i < cells.length; i += 7) { + let weekCells = cells.slice(i, i + 7); + let refDay = weekCells.find(c => c !== null) || 1; + let refDate = new Date(year, month, refDay); + weeksArr.push({ + weekNum: root.isoWeek(refDate), + days: weekCells.map(c => ({ + day: c, + isToday: c !== null && year === today.getFullYear() && month === today.getMonth() && c === today.getDate() + })) + }); + } + return weeksArr; + } + + PanelWindow { + id: bar + required property var modelData + screen: modelData + + anchors { top: true; left: true; right: true } + implicitHeight: 34 + exclusionMode: ExclusionMode.Auto + color: "transparent" + WlrLayershell.namespace: "bar" + WlrLayershell.layer: WlrLayer.Top + + readonly property var workspaceIds: modelData.name === "DP-1" ? [1, 2, 3, 4, 9] : [5, 6, 7, 8] + readonly property var activeToplevel: Hyprland.activeToplevel + readonly property string titleText: (activeToplevel && activeToplevel.monitor && activeToplevel.monitor.name === modelData.name) ? activeToplevel.title : "" + + property string hovered: "" + property bool menuOpen: false + property bool calendarOpen: false + property bool clockHovering: false + property bool netHovering: false + property bool showCpuTemp: false + property bool showPublicIp: false + + // ---- stats ---- + property int cpuPct: 0 + property int memPct: 0 + property real memUsed: 0 + property real memTotal: 0 + property int diskPct: 0 + property real diskTotal: 0 + property real diskUsed: 0 + property real diskAvail: 0 + property string load1: "0.00" + property string load5: "0.00" + property string load15: "0.00" + property string tempC: "NA" + readonly property bool tempAvailable: tempC !== "NA" + readonly property bool tempCritical: tempAvailable && parseInt(tempC) >= 80 + property var perCore: [] + property string gpuUtil: "NA" + property string gpuTemp: "NA" + property string gpuMemUsed: "NA" + property string gpuMemTotal: "NA" + readonly property bool gpuAvailable: gpuUtil !== "NA" + + // ---- network ---- + property string connType: "" + property string connName: "" + property string localIp: "" + property string publicIp: "" + property bool publicIpLoading: false + + // ---- volume ---- + property int volumePct: 0 + property bool volumeMuted: false + + // ---- clock ---- + property var now: new Date() + property int viewYear: now.getFullYear() + property int viewMonth: now.getMonth() + property var weeks: root.buildCalendar(viewYear, viewMonth, now) + + Timer { + interval: 1000 + running: true + repeat: true + onTriggered: bar.now = new Date() + } + + Process { + id: statsProc + command: ["bash", "/home/nico/.config/quickshell/default/scripts/stats.sh"] + stdout: StdioCollector { id: statsCollector } + onExited: { + var p = statsCollector.text.trim().split("|") + if (p.length < 12) return + bar.cpuPct = parseInt(p[0]) || 0 + bar.memPct = parseInt(p[1]) || 0 + bar.memUsed = parseFloat(p[2]) || 0 + bar.memTotal = parseFloat(p[3]) || 0 + bar.diskPct = parseInt(p[4]) || 0 + bar.diskTotal = parseFloat(p[5]) || 0 + bar.diskUsed = parseFloat(p[6]) || 0 + bar.diskAvail = parseFloat(p[7]) || 0 + bar.load1 = p[8] + bar.load5 = p[9] + bar.load15 = p[10] + bar.tempC = p[11] + bar.perCore = p.length > 12 && p[12] !== "" ? p[12].split(",").map(Number) : [] + if (p.length > 16) { + bar.gpuUtil = p[13] + bar.gpuTemp = p[14] + bar.gpuMemUsed = p[15] + bar.gpuMemTotal = p[16] + } + } + } + + Timer { interval: 100; running: true; repeat: false; onTriggered: statsProc.running = true } + Timer { interval: 2000; running: true; repeat: true; onTriggered: statsProc.running = true } + + Process { + id: netProc + command: ["bash", "-c", "conn=$(nmcli -t -f TYPE,STATE,CONNECTION device status 2>/dev/null | awk -F: '$2==\"connected\"{print $1; exit}'); if [ \"$conn\" = \"wifi\" ]; then name=$(nmcli -t -f active,ssid dev wifi 2>/dev/null | awk -F: '$1==\"yes\"{print $2; exit}'); else name=\"LAN\"; fi; ip=$(ip route get 1.1.1.1 2>/dev/null | awk '{for(i=1;i<=NF;i++) if ($i==\"src\") print $(i+1)}'); echo \"${conn}|${name}|${ip}\""] + stdout: StdioCollector { id: netCollector } + onExited: { + var parts = netCollector.text.trim().split("|") + bar.connType = parts[0] || "" + bar.connName = parts[1] || "" + bar.localIp = parts[2] || "" + } + } + + Timer { interval: 300; running: true; repeat: false; onTriggered: netProc.running = true } + Timer { interval: 8000; running: true; repeat: true; onTriggered: netProc.running = true } + + Process { + id: publicIpProc + command: ["bash", "-c", "curl -s -m 3 https://api.ipify.org"] + stdout: StdioCollector { id: publicIpCollector } + onExited: { + var text = publicIpCollector.text.trim() + bar.publicIp = text !== "" ? text : (root.isGerman ? "nicht verfügbar" : "unavailable") + bar.publicIpLoading = false + } + } + + Process { + id: volumeProc + command: ["bash", "/home/nico/.config/quickshell/default/scripts/volume.sh"] + stdout: StdioCollector { id: volumeCollector } + onExited: { + var parts = volumeCollector.text.trim().split("|") + bar.volumePct = parseInt(parts[0]) || 0 + bar.volumeMuted = parts[1] === "1" + } + } + + Timer { interval: 500; running: true; repeat: false; onTriggered: volumeProc.running = true } + Timer { interval: 3000; running: true; repeat: true; onTriggered: volumeProc.running = true } + + Process { id: pavucontrolProc; command: ["pavucontrol"] } + Process { id: volUpProc; command: ["wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%+"] } + Process { id: volDownProc; command: ["wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%-"] } + Process { id: volMuteProc; command: ["wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle"] } + + Process { id: logoutProc; command: ["hyprctl", "dispatch", "exit"] } + Process { id: rebootProc; command: ["systemctl", "reboot"] } + Process { id: shutdownProc; command: ["systemctl", "poweroff"] } + + FontMetrics { + id: valueFont + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + } + + Rectangle { + anchors.fill: parent + color: Qt.rgba(0.071, 0.075, 0.106, 0.18) + } + + Rectangle { + anchors { left: parent.left; right: parent.right; bottom: parent.bottom } + height: 1 + color: Qt.rgba(0.090, 0.576, 0.820, 0.45) + } + + // ================= LEFT ================= + RowLayout { + anchors { left: parent.left; leftMargin: 8; verticalCenter: parent.verticalCenter } + spacing: 6 + + Rectangle { + Layout.preferredWidth: logoText.implicitWidth + 28 + Layout.preferredHeight: 26 + radius: 10 + color: Qt.rgba(0.090, 0.576, 0.820, 0.12) + + Text { + id: logoText + anchors.centerIn: parent + text: "" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 18 + color: "#1793d1" + } + } + + Rectangle { + Layout.preferredWidth: wsRow.implicitWidth + 8 + Layout.preferredHeight: 26 + radius: 10 + color: Qt.rgba(0.102, 0.106, 0.149, 0.85) + + RowLayout { + id: wsRow + anchors.centerIn: parent + spacing: 2 + + Repeater { + model: bar.workspaceIds + + Rectangle { + id: wsBtn + required property int modelData + readonly property var hyprWs: { + for (let i = 0; i < Hyprland.workspaces.values.length; i++) { + if (Hyprland.workspaces.values[i].id === modelData) return Hyprland.workspaces.values[i] + } + return null + } + readonly property bool active: hyprWs !== null && hyprWs.active + + Layout.preferredWidth: 22 + Layout.preferredHeight: 20 + radius: 8 + color: active ? "#1793d1" : (wsArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.22) : "transparent") + + Text { + anchors.centerIn: parent + text: { + if (wsBtn.active) return "" + if (wsBtn.modelData === 5) return "" + if (wsBtn.modelData === 6) return "" + if (wsBtn.modelData === 7) return "" + if (wsBtn.modelData === 8) return "" + return wsBtn.modelData.toString() + } + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + color: wsBtn.active ? "#0f111a" : "#565f89" + } + + MouseArea { + id: wsArea + anchors.fill: parent + hoverEnabled: true + onClicked: Hyprland.dispatch("workspace " + wsBtn.modelData) + } + } + } + } + } + } + + // ================= CENTER ================= + Text { + anchors.centerIn: parent + width: Math.min(implicitWidth, 500) + elide: Text.ElideRight + text: bar.titleText + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + color: "#c0caf5" + } + + // ================= RIGHT ================= + RowLayout { + id: rightRow + anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter } + spacing: 10 + + RowLayout { + id: trayRow + spacing: 8 + visible: count > 0 + readonly property int count: SystemTray.items.values.length + + Repeater { + model: SystemTray.items + + Item { + required property var modelData + Layout.preferredWidth: 18 + Layout.preferredHeight: 18 + + Image { + anchors.fill: parent + source: modelData.icon + sourceSize: Qt.size(18, 18) + smooth: true + } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: mouse => { + if (mouse.button === Qt.RightButton && modelData.hasMenu) { + modelData.display(bar, mouse.x, mouse.y) + } else { + modelData.activate() + } + } + } + } + } + } + + Rectangle { + id: cpuPill + Layout.preferredWidth: cpuRow.implicitWidth + 14 + Layout.preferredHeight: 26 + radius: 10 + color: bar.hovered === "cpu" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) + + Row { + id: cpuRow + anchors.centerIn: parent + spacing: 4 + Text { + text: bar.showCpuTemp ? "" : "" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + color: bar.hovered === "cpu" ? "#0f111a" : (bar.showCpuTemp ? (bar.tempCritical ? "#f7768e" : "#f9e2af") : "#7aa2f7") + } + Text { + text: bar.showCpuTemp ? (bar.tempC + "°C") : (bar.cpuPct + "%") + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + width: valueFont.advanceWidth("100%") + horizontalAlignment: Text.AlignRight + color: bar.hovered === "cpu" ? "#0f111a" : "#c0caf5" + } + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: bar.hovered = "cpu" + onExited: bar.hovered = "" + onClicked: if (bar.tempAvailable) bar.showCpuTemp = !bar.showCpuTemp + } + } + + Rectangle { + id: memPill + Layout.preferredWidth: memRow.implicitWidth + 20 + Layout.preferredHeight: 26 + radius: 10 + color: bar.hovered === "mem" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) + + Row { + id: memRow + anchors.centerIn: parent + spacing: 5 + Text { + text: "" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + color: bar.hovered === "mem" ? "#0f111a" : "#89dceb" + } + Text { + text: bar.memPct + "%" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + width: valueFont.advanceWidth("100%") + horizontalAlignment: Text.AlignRight + color: bar.hovered === "mem" ? "#0f111a" : "#c0caf5" + } + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: bar.hovered = "mem" + onExited: bar.hovered = "" + } + } + + Rectangle { + id: diskPill + Layout.preferredWidth: diskRow.implicitWidth + 20 + Layout.preferredHeight: 26 + radius: 10 + color: bar.hovered === "disk" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) + + Row { + id: diskRow + anchors.centerIn: parent + spacing: 5 + Text { + text: "" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + color: bar.hovered === "disk" ? "#0f111a" : "#c0caf5" + } + Text { + text: bar.diskPct + "%" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + width: valueFont.advanceWidth("100%") + horizontalAlignment: Text.AlignRight + color: bar.hovered === "disk" ? "#0f111a" : "#c0caf5" + } + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: bar.hovered = "disk" + onExited: bar.hovered = "" + } + } + + Rectangle { + id: gpuPill + visible: bar.gpuAvailable + Layout.preferredWidth: visible ? gpuRow.implicitWidth + 14 : 0 + Layout.preferredHeight: 26 + radius: 10 + color: bar.hovered === "gpu" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) + + Row { + id: gpuRow + anchors.centerIn: parent + spacing: 4 + Text { + text: "󰢮" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + color: bar.hovered === "gpu" ? "#0f111a" : "#a6e3a1" + } + Text { + text: bar.gpuUtil + "%" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + width: valueFont.advanceWidth("100%") + horizontalAlignment: Text.AlignRight + color: bar.hovered === "gpu" ? "#0f111a" : "#c0caf5" + } + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: bar.hovered = "gpu" + onExited: bar.hovered = "" + } + } + + Rectangle { + id: volumePill + Layout.preferredWidth: volRow.implicitWidth + 20 + Layout.preferredHeight: 26 + radius: 10 + color: bar.hovered === "vol" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) + + Row { + id: volRow + anchors.centerIn: parent + spacing: 5 + Text { + text: bar.volumeMuted ? "" : "" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + color: bar.hovered === "vol" ? "#0f111a" : (bar.volumeMuted ? "#565f89" : "#cba6f7") + } + Text { + text: (bar.volumeMuted ? (root.isGerman ? "muted" : "muted") : bar.volumePct + "%") + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + color: bar.hovered === "vol" ? "#0f111a" : "#c0caf5" + } + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + onEntered: bar.hovered = "vol" + onExited: bar.hovered = "" + onClicked: mouse => { + if (mouse.button === Qt.RightButton) { + volMuteProc.running = true + } else { + pavucontrolProc.startDetached() + } + } + onWheel: wheel => { + if (wheel.angleDelta.y > 0) volUpProc.running = true + else volDownProc.running = true + } + } + } + + Rectangle { + id: networkPill + Layout.preferredWidth: netRow.implicitWidth + 20 + Layout.preferredHeight: 26 + radius: 10 + color: bar.hovered === "net" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) + + readonly property string icon: bar.connType === "wifi" ? "" : bar.connType === "ethernet" ? "󰈀" : "󰤭" + readonly property string statusText: bar.connType === "wifi" ? (bar.connName || "WLAN") : bar.connType === "ethernet" ? "LAN" : "offline" + readonly property color statusColor: bar.connType === "" ? "#565f89" : "#a6e3a1" + + Row { + id: netRow + anchors.centerIn: parent + spacing: 6 + Text { + text: networkPill.icon + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 14 + color: bar.hovered === "net" ? "#0f111a" : networkPill.statusColor + } + Text { + text: networkPill.statusText + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + elide: Text.ElideRight + width: Math.min(implicitWidth, 90) + color: bar.hovered === "net" ? "#0f111a" : "#c0caf5" + } + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: bar.hovered = "net" + onExited: bar.hovered = "" + onClicked: { + bar.showPublicIp = !bar.showPublicIp + if (bar.showPublicIp) { + bar.publicIpLoading = true + publicIpProc.running = true + } + } + } + } + + Rectangle { + id: clockPill + Layout.preferredWidth: 100 + Layout.preferredHeight: 26 + radius: 10 + color: (clockArea.containsMouse || bar.calendarOpen) ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) + + Text { + anchors.centerIn: parent + text: Qt.formatDateTime(bar.now, "dd.MM. hh:mm") + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + color: (clockArea.containsMouse || bar.calendarOpen) ? "#0f111a" : "#c0caf5" + } + + MouseArea { + id: clockArea + anchors.fill: parent + hoverEnabled: true + onEntered: bar.clockHovering = true + onExited: bar.clockHovering = false + onClicked: bar.calendarOpen = !bar.calendarOpen + } + } + + Rectangle { + id: powerBtn + Layout.preferredWidth: 32 + Layout.preferredHeight: 26 + radius: 10 + color: (powerArea.containsMouse || bar.menuOpen) ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) + + Text { + anchors.centerIn: parent + text: "" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 15 + color: (powerArea.containsMouse || bar.menuOpen) ? "#0f111a" : "#1793d1" + } + + MouseArea { + id: powerArea + anchors.fill: parent + hoverEnabled: true + onClicked: bar.menuOpen = !bar.menuOpen + } + } + } + + // ================= POPUPS ================= + + LazyLoader { + active: bar.hovered !== "" && bar.hovered !== "net" + + PanelWindow { + screen: bar.modelData + anchors { top: true; right: true } + margins { top: 34; right: bar.width - (rightRow.x + statsPopupAnchor.x + statsPopupAnchor.width) } + implicitWidth: (bar.hovered === "cpu" && bar.perCore.length > 0) ? 320 : (bar.hovered === "vol" ? 300 : 220) + implicitHeight: tooltipCol.implicitHeight + 20 + color: "transparent" + WlrLayershell.namespace: "stats-tooltip" + WlrLayershell.layer: WlrLayer.Top + + readonly property var statsPopupAnchor: bar.hovered === "cpu" ? cpuPill : bar.hovered === "mem" ? memPill : bar.hovered === "disk" ? diskPill : bar.hovered === "gpu" ? gpuPill : bar.hovered === "vol" ? volumePill : cpuPill + + Rectangle { + anchors.fill: parent + radius: 10 + color: "#e61a1b26" + border.width: 1 + border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35) + + ColumnLayout { + id: tooltipCol + anchors.fill: parent + anchors.margins: 10 + spacing: 4 + + Text { + visible: bar.hovered === "cpu" + text: (root.isGerman ? "Last (1/5/15 Min): " : "Load (1/5/15 min): ") + bar.load1 + " / " + bar.load5 + " / " + bar.load15 + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#c0caf5" + } + Text { + visible: bar.hovered === "cpu" && bar.tempAvailable + text: (root.isGerman ? "Temperatur (Tctl): " : "Temperature (Tctl): ") + bar.tempC + "°C" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#7aa2f7" + } + GridLayout { + visible: bar.hovered === "cpu" && bar.perCore.length > 0 + columns: 4 + columnSpacing: 10 + rowSpacing: 2 + + Repeater { + model: bar.perCore + Text { + required property int index + required property var modelData + text: "C" + index + ": " + modelData + "%" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 11 + color: "#565f89" + } + } + } + Text { + visible: bar.hovered === "cpu" + text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 11 + color: "#565f89" + } + Text { + visible: bar.hovered === "mem" + text: (root.isGerman ? "Belegt: " : "Used: ") + bar.memUsed.toFixed(1) + " / " + bar.memTotal.toFixed(1) + " GiB" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#c0caf5" + } + Text { + visible: bar.hovered === "disk" + text: "/" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + font.bold: true + color: "#c0caf5" + } + Text { + visible: bar.hovered === "disk" + text: (root.isGerman ? "Belegt: " : "Used: ") + bar.diskUsed.toFixed(0) + " GiB" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#7aa2f7" + } + Text { + visible: bar.hovered === "disk" + text: (root.isGerman ? "Frei: " : "Free: ") + bar.diskAvail.toFixed(0) + " GiB" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#565f89" + } + Text { + visible: bar.hovered === "disk" + text: (root.isGerman ? "Gesamt: " : "Total: ") + bar.diskTotal.toFixed(0) + " GiB" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#565f89" + } + Text { + visible: bar.hovered === "gpu" + text: (root.isGerman ? "Temperatur: " : "Temperature: ") + bar.gpuTemp + "°C" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#7aa2f7" + } + Text { + visible: bar.hovered === "gpu" + text: "VRAM: " + bar.gpuMemUsed + " / " + bar.gpuMemTotal + " MiB" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#565f89" + } + Text { + visible: bar.hovered === "vol" + Layout.preferredWidth: 280 + wrapMode: Text.WordWrap + text: root.isGerman ? "Klick: Mixer · Rechtsklick: Stumm · Scroll: Lautstärke" : "Click: Mixer · Right-click: Mute · Scroll: Volume" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 11 + color: "#565f89" + } + } + } + } + } + + LazyLoader { + active: bar.hovered === "net" + + PanelWindow { + screen: bar.modelData + anchors { top: true; right: true } + margins { top: 34; right: bar.width - (rightRow.x + networkPill.x + networkPill.width) } + implicitWidth: 220 + implicitHeight: netTooltipCol.implicitHeight + 20 + color: "transparent" + WlrLayershell.namespace: "net-tooltip" + WlrLayershell.layer: WlrLayer.Top + + Rectangle { + anchors.fill: parent + radius: 10 + color: "#e61a1b26" + border.width: 1 + border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35) + + ColumnLayout { + id: netTooltipCol + anchors.fill: parent + anchors.margins: 10 + spacing: 4 + + Text { + text: bar.connType === "" ? (root.isGerman ? "Nicht verbunden" : "Not connected") : (bar.connType === "wifi" ? (root.isGerman ? "WLAN: " : "Wi-Fi: ") + bar.connName : (root.isGerman ? "Kabelgebunden" : "Wired")) + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + font.bold: true + color: "#c0caf5" + } + Text { + text: (bar.showPublicIp ? (root.isGerman ? "Öffentliche IP: " : "Public IP: ") + (bar.publicIpLoading ? "…" : (bar.publicIp || "n/a")) : (root.isGerman ? "Lokale IP: " : "Local IP: ") + (bar.localIp || "n/a")) + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#7aa2f7" + } + Text { + text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle" + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 11 + color: "#565f89" + } + } + } + } + } + + LazyLoader { + active: bar.clockHovering && !bar.calendarOpen + + PanelWindow { + screen: bar.modelData + anchors { top: true; right: true } + margins { top: 34; right: bar.width - (rightRow.x + clockPill.x + clockPill.width) } + implicitWidth: 230 + implicitHeight: clockTooltipCol.implicitHeight + 20 + color: "transparent" + WlrLayershell.namespace: "clock-tooltip" + WlrLayershell.layer: WlrLayer.Top + + Rectangle { + anchors.fill: parent + radius: 10 + color: "#e61a1b26" + border.width: 1 + border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35) + + ColumnLayout { + id: clockTooltipCol + anchors.fill: parent + anchors.margins: 10 + spacing: 4 + + Text { + text: Qt.formatDateTime(bar.now, "dddd, dd. MMMM yyyy") + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 13 + font.bold: true + color: "#c0caf5" + } + Text { + text: (root.isGerman ? "KW " : "Week ") + root.isoWeek(bar.now) + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#7aa2f7" + } + Text { + text: Qt.formatDateTime(bar.now, "hh:mm:ss") + font.family: "JetBrainsMono Nerd Font" + font.pixelSize: 12 + color: "#565f89" + } + } + } + } + } + + LazyLoader { + active: bar.calendarOpen + + PanelWindow { + id: calendarWindow + screen: bar.modelData + anchors { top: true; right: true } + margins { top: 34; right: bar.width - (rightRow.x + clockPill.x + clockPill.width) } + implicitWidth: 250 + implicitHeight: calCol.implicitHeight + 20 + color: "transparent" + WlrLayershell.namespace: "clock-calendar" + WlrLayershell.layer: WlrLayer.Top + + HyprlandFocusGrab { + windows: [ calendarWindow ] + active: true + onCleared: bar.calendarOpen = false + } + + Rectangle { + anchors.fill: parent + radius: 10 + color: "#e61a1b26" + border.width: 1 + border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35) + + ColumnLayout { + id: calCol + anchors.fill: parent + anchors.margins: 10 + spacing: 6 + + RowLayout { + Layout.fillWidth: true + + Text { + text: "‹" + font.pixelSize: 16 + color: "#7aa2f7" + MouseArea { + anchors.fill: parent + anchors.margins: -6 + onClicked: { + if (bar.viewMonth === 0) { + bar.viewMonth = 11 + bar.viewYear -= 1 + } else { + bar.viewMonth -= 1 + } + } + } + } + + Text { + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + text: Qt.formatDateTime(new Date(bar.viewYear, bar.viewMonth, 1), "MMMM yyyy") + font.bold: true + font.pixelSize: 13 + color: "#c0caf5" + } + + Text { + text: "›" + font.pixelSize: 16 + color: "#7aa2f7" + MouseArea { + anchors.fill: parent + anchors.margins: -6 + onClicked: { + if (bar.viewMonth === 11) { + bar.viewMonth = 0 + bar.viewYear += 1 + } else { + bar.viewMonth += 1 + } + } + } + } + } + + RowLayout { + Layout.fillWidth: true + spacing: 2 + + Text { Layout.preferredWidth: 22; text: "" } + + Repeater { + model: 7 + Text { + Layout.preferredWidth: 24 + horizontalAlignment: Text.AlignHCenter + text: Qt.locale().dayName(index + 1, Locale.ShortFormat) + font.pixelSize: 11 + color: "#565f89" + } + } + } + + Repeater { + model: root.buildCalendar(bar.viewYear, bar.viewMonth, bar.now) + + RowLayout { + required property var modelData + Layout.fillWidth: true + spacing: 2 + + Text { + Layout.preferredWidth: 22 + horizontalAlignment: Text.AlignHCenter + text: modelData.weekNum + font.pixelSize: 10 + color: "#565f89" + } + + Repeater { + model: modelData.days + + Rectangle { + required property var modelData + Layout.preferredWidth: 24 + Layout.preferredHeight: 22 + radius: 6 + color: modelData.isToday ? "#1793d1" : "transparent" + Text { + anchors.centerIn: parent + text: modelData.day ?? "" + font.pixelSize: 11 + color: modelData.isToday ? "#0f111a" : (modelData.day ? "#c0caf5" : "transparent") + } + } + } + } + } + } + } + } + } + + LazyLoader { + active: bar.menuOpen + + PanelWindow { + id: menu + screen: bar.modelData + anchors { top: true; right: true } + margins { top: 34; right: bar.width - (rightRow.x + powerBtn.x + powerBtn.width) } + implicitWidth: 170 + implicitHeight: col.implicitHeight + 16 + color: "transparent" + WlrLayershell.namespace: "power-menu" + WlrLayershell.layer: WlrLayer.Top + + HyprlandFocusGrab { + windows: [ menu ] + active: true + onCleared: bar.menuOpen = false + } + + Rectangle { + anchors.fill: parent + radius: 10 + color: "#e61a1b26" + border.width: 1 + border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35) + + ColumnLayout { + id: col + anchors.fill: parent + anchors.margins: 8 + spacing: 4 + + MenuEntry { + label: root.logoutLabel + icon: "" + onTriggered: { + bar.menuOpen = false + logoutProc.startDetached() + } + } + + MenuEntry { + label: root.restartLabel + icon: "" + onTriggered: { + bar.menuOpen = false + rebootProc.startDetached() + } + } + + MenuEntry { + label: root.shutdownLabel + icon: "" + onTriggered: { + bar.menuOpen = false + shutdownProc.startDetached() + } + } + } + } + } + } + } +} diff --git a/quickshell/default/ClockWidget.qml b/quickshell/default/ClockWidget.qml deleted file mode 100644 index 07d4d87..0000000 --- a/quickshell/default/ClockWidget.qml +++ /dev/null @@ -1,307 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Wayland -import Quickshell.Hyprland - -Variants { - id: root - model: Quickshell.screens - - readonly property bool isGerman: Qt.locale().name.startsWith("de") - - function isoWeek(d) { - let date = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())); - let day = (date.getUTCDay() + 6) % 7; - date.setUTCDate(date.getUTCDate() - day + 3); - let firstThursday = date.getTime(); - date.setUTCMonth(0, 1); - if (date.getUTCDay() !== 4) { - date.setUTCMonth(0, 1 + ((4 - date.getUTCDay()) + 7) % 7); - } - return 1 + Math.round((firstThursday - date.getTime()) / (7 * 86400000)); - } - - function buildCalendar(year, month, today) { - const firstOfMonth = new Date(year, month, 1); - const daysInMonth = new Date(year, month + 1, 0).getDate(); - const leading = (firstOfMonth.getDay() + 6) % 7; - - let cells = []; - for (let i = 0; i < leading; i++) cells.push(null); - for (let d = 1; d <= daysInMonth; d++) cells.push(d); - while (cells.length % 7 !== 0) cells.push(null); - - let weeksArr = []; - for (let i = 0; i < cells.length; i += 7) { - let weekCells = cells.slice(i, i + 7); - let refDay = weekCells.find(c => c !== null) || 1; - let refDate = new Date(year, month, refDay); - weeksArr.push({ - weekNum: root.isoWeek(refDate), - days: weekCells.map(c => ({ - day: c, - isToday: c !== null && year === today.getFullYear() && month === today.getMonth() && c === today.getDate() - })) - }); - } - return weeksArr; - } - - PanelWindow { - id: panel - required property var modelData - screen: modelData - - anchors { top: true; right: true } - implicitWidth: 130 - implicitHeight: 34 - margins.right: 54 - exclusionMode: ExclusionMode.Ignore - color: "transparent" - WlrLayershell.namespace: "clock-widget" - WlrLayershell.layer: WlrLayer.Overlay - - property bool calendarOpen: false - property bool hovering: false - property var now: new Date() - - Timer { - interval: 1000 - running: true - repeat: true - onTriggered: panel.now = new Date() - } - - // Matches window#waybar's own backdrop tint so the widget blends into the bar. - Rectangle { - anchors.fill: parent - color: Qt.rgba(0.071, 0.075, 0.106, 0.18) - } - - Rectangle { - anchors.fill: parent - anchors.topMargin: 4 - anchors.bottomMargin: 4 - anchors.rightMargin: 4 - anchors.leftMargin: 2 - radius: 10 - color: clockArea.containsMouse ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) - - Text { - anchors.centerIn: parent - text: Qt.formatDateTime(panel.now, "dd.MM. hh:mm") - font.family: "JetBrainsMono Nerd Font" - font.pixelSize: 13 - color: clockArea.containsMouse ? "#0f111a" : "#c0caf5" - } - - MouseArea { - id: clockArea - anchors.fill: parent - hoverEnabled: true - onEntered: panel.hovering = true - onExited: panel.hovering = false - onClicked: panel.calendarOpen = !panel.calendarOpen - } - } - - LazyLoader { - active: panel.hovering && !panel.calendarOpen - - PanelWindow { - screen: panel.modelData - anchors { top: true; right: true } - margins { top: 34; right: 54 } - implicitWidth: 230 - implicitHeight: tooltipCol.implicitHeight + 20 - color: "transparent" - WlrLayershell.namespace: "clock-tooltip" - WlrLayershell.layer: WlrLayer.Overlay - - Rectangle { - anchors.fill: parent - radius: 10 - color: "#e61a1b26" - border.width: 1 - border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35) - - ColumnLayout { - id: tooltipCol - anchors.fill: parent - anchors.margins: 10 - spacing: 4 - - Text { - text: Qt.formatDateTime(panel.now, "dddd, dd. MMMM yyyy") - font.family: "JetBrainsMono Nerd Font" - font.pixelSize: 13 - font.bold: true - color: "#c0caf5" - } - Text { - text: (root.isGerman ? "KW " : "Week ") + root.isoWeek(panel.now) - font.family: "JetBrainsMono Nerd Font" - font.pixelSize: 12 - color: "#7aa2f7" - } - Text { - text: Qt.formatDateTime(panel.now, "hh:mm:ss") - font.family: "JetBrainsMono Nerd Font" - font.pixelSize: 12 - color: "#565f89" - } - } - } - } - } - - LazyLoader { - active: panel.calendarOpen - - PanelWindow { - id: calendarWindow - screen: panel.modelData - anchors { top: true; right: true } - margins { top: 34; right: 54 } - implicitWidth: 250 - implicitHeight: calCol.implicitHeight + 20 - color: "transparent" - WlrLayershell.namespace: "clock-calendar" - WlrLayershell.layer: WlrLayer.Overlay - - property int viewYear: panel.now.getFullYear() - property int viewMonth: panel.now.getMonth() - property var weeks: root.buildCalendar(viewYear, viewMonth, panel.now) - - HyprlandFocusGrab { - windows: [ calendarWindow ] - active: true - onCleared: panel.calendarOpen = false - } - - Rectangle { - anchors.fill: parent - radius: 10 - color: "#e61a1b26" - border.width: 1 - border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35) - - ColumnLayout { - id: calCol - anchors.fill: parent - anchors.margins: 10 - spacing: 6 - - RowLayout { - Layout.fillWidth: true - - Text { - text: "‹" - font.pixelSize: 16 - color: "#7aa2f7" - MouseArea { - anchors.fill: parent - anchors.margins: -6 - onClicked: { - if (calendarWindow.viewMonth === 0) { - calendarWindow.viewMonth = 11 - calendarWindow.viewYear -= 1 - } else { - calendarWindow.viewMonth -= 1 - } - } - } - } - - Text { - Layout.fillWidth: true - horizontalAlignment: Text.AlignHCenter - text: Qt.formatDateTime(new Date(calendarWindow.viewYear, calendarWindow.viewMonth, 1), "MMMM yyyy") - font.bold: true - font.pixelSize: 13 - color: "#c0caf5" - } - - Text { - text: "›" - font.pixelSize: 16 - color: "#7aa2f7" - MouseArea { - anchors.fill: parent - anchors.margins: -6 - onClicked: { - if (calendarWindow.viewMonth === 11) { - calendarWindow.viewMonth = 0 - calendarWindow.viewYear += 1 - } else { - calendarWindow.viewMonth += 1 - } - } - } - } - } - - RowLayout { - Layout.fillWidth: true - spacing: 2 - - Text { - Layout.preferredWidth: 22 - text: "" - } - - Repeater { - model: 7 - Text { - Layout.preferredWidth: 24 - horizontalAlignment: Text.AlignHCenter - text: Qt.locale().dayName(index + 1, Locale.ShortFormat) - font.pixelSize: 11 - color: "#565f89" - } - } - } - - Repeater { - model: calendarWindow.weeks - - RowLayout { - required property var modelData - Layout.fillWidth: true - spacing: 2 - - Text { - Layout.preferredWidth: 22 - horizontalAlignment: Text.AlignHCenter - text: modelData.weekNum - font.pixelSize: 10 - color: "#565f89" - } - - Repeater { - model: modelData.days - - Rectangle { - required property var modelData - Layout.preferredWidth: 24 - Layout.preferredHeight: 22 - radius: 6 - color: modelData.isToday ? "#1793d1" : "transparent" - - Text { - anchors.centerIn: parent - text: modelData.day ?? "" - font.pixelSize: 11 - color: modelData.isToday ? "#0f111a" : (modelData.day ? "#c0caf5" : "transparent") - } - } - } - } - } - } - } - } - } - } -} diff --git a/quickshell/default/NetworkWidget.qml b/quickshell/default/NetworkWidget.qml deleted file mode 100644 index 5d73db4..0000000 --- a/quickshell/default/NetworkWidget.qml +++ /dev/null @@ -1,180 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Io -import Quickshell.Wayland -import Quickshell.Hyprland - -Variants { - id: root - model: Quickshell.screens - - readonly property bool isGerman: Qt.locale().name.startsWith("de") - - PanelWindow { - id: panel - required property var modelData - screen: modelData - - anchors { top: true; right: true } - implicitWidth: Math.max(72, content.implicitWidth + 28) - implicitHeight: 34 - margins.right: 190 - exclusionMode: ExclusionMode.Ignore - color: "transparent" - WlrLayershell.namespace: "network-widget" - WlrLayershell.layer: WlrLayer.Overlay - - property string connType: "" - property string connName: "" - property string localIp: "" - property string publicIp: "" - property bool publicIpLoading: false - property bool showPublicIp: false - property bool hovering: false - - readonly property string icon: connType === "wifi" ? "" : connType === "ethernet" ? "󰈀" : "󰤭" - readonly property string statusText: connType === "wifi" ? (connName || "WLAN") : connType === "ethernet" ? "LAN" : "offline" - readonly property color statusColor: connType === "" ? "#565f89" : "#a6e3a1" - - Process { - id: refreshProc - command: ["bash", "-c", "conn=$(nmcli -t -f TYPE,STATE,CONNECTION device status 2>/dev/null | awk -F: '$2==\"connected\"{print $1; exit}'); if [ \"$conn\" = \"wifi\" ]; then name=$(nmcli -t -f active,ssid dev wifi 2>/dev/null | awk -F: '$1==\"yes\"{print $2; exit}'); else name=\"LAN\"; fi; ip=$(ip route get 1.1.1.1 2>/dev/null | awk '{for(i=1;i<=NF;i++) if ($i==\"src\") print $(i+1)}'); echo \"${conn}|${name}|${ip}\""] - stdout: StdioCollector { id: refreshCollector } - onExited: { - var parts = refreshCollector.text.trim().split("|") - panel.connType = parts[0] || "" - panel.connName = parts[1] || "" - panel.localIp = parts[2] || "" - } - } - - Timer { - interval: 100 - running: true - repeat: false - onTriggered: refreshProc.running = true - } - - Timer { - interval: 8000 - running: true - repeat: true - onTriggered: refreshProc.running = true - } - - Process { - id: publicIpProc - command: ["bash", "-c", "curl -s -m 3 https://api.ipify.org"] - stdout: StdioCollector { id: publicIpCollector } - onExited: { - var text = publicIpCollector.text.trim() - panel.publicIp = text !== "" ? text : (root.isGerman ? "nicht verfügbar" : "unavailable") - panel.publicIpLoading = false - } - } - - // Matches window#waybar's own backdrop tint so the widget blends into the bar. - Rectangle { - anchors.fill: parent - color: Qt.rgba(0.071, 0.075, 0.106, 0.18) - } - - Rectangle { - anchors.fill: parent - anchors.topMargin: 4 - anchors.bottomMargin: 4 - anchors.leftMargin: 4 - anchors.rightMargin: 2 - radius: 10 - color: netArea.containsMouse ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) - - Row { - id: content - anchors.centerIn: parent - spacing: 6 - - Text { - text: panel.icon - font.family: "JetBrainsMono Nerd Font" - font.pixelSize: 14 - color: netArea.containsMouse ? "#0f111a" : panel.statusColor - } - - Text { - text: panel.statusText - font.family: "JetBrainsMono Nerd Font" - font.pixelSize: 13 - color: netArea.containsMouse ? "#0f111a" : "#c0caf5" - } - } - - MouseArea { - id: netArea - anchors.fill: parent - hoverEnabled: true - onEntered: panel.hovering = true - onExited: panel.hovering = false - onClicked: { - panel.showPublicIp = !panel.showPublicIp - if (panel.showPublicIp) { - panel.publicIpLoading = true - publicIpProc.running = true - } - } - } - } - - LazyLoader { - active: panel.hovering - - PanelWindow { - screen: panel.modelData - anchors { top: true; right: true } - margins { top: 34; right: 190 } - implicitWidth: 220 - implicitHeight: tooltipCol.implicitHeight + 20 - color: "transparent" - WlrLayershell.namespace: "network-tooltip" - WlrLayershell.layer: WlrLayer.Overlay - - Rectangle { - anchors.fill: parent - radius: 10 - color: "#e61a1b26" - border.width: 1 - border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35) - - ColumnLayout { - id: tooltipCol - anchors.fill: parent - anchors.margins: 10 - spacing: 4 - - Text { - text: panel.connType === "" ? (root.isGerman ? "Nicht verbunden" : "Not connected") : (panel.connType === "wifi" ? (root.isGerman ? "WLAN: " : "Wi-Fi: ") + panel.connName : (root.isGerman ? "Kabelgebunden" : "Wired")) - font.family: "JetBrainsMono Nerd Font" - font.pixelSize: 13 - font.bold: true - color: "#c0caf5" - } - - Text { - text: (panel.showPublicIp ? (root.isGerman ? "Öffentliche IP: " : "Public IP: ") + (panel.publicIpLoading ? "…" : (panel.publicIp || "n/a")) : (root.isGerman ? "Lokale IP: " : "Local IP: ") + (panel.localIp || "n/a")) - font.family: "JetBrainsMono Nerd Font" - font.pixelSize: 12 - color: "#7aa2f7" - } - - Text { - text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle" - font.family: "JetBrainsMono Nerd Font" - font.pixelSize: 11 - color: "#565f89" - } - } - } - } - } - } -} diff --git a/quickshell/default/PowerMenu.qml b/quickshell/default/PowerMenu.qml deleted file mode 100644 index c5e86b8..0000000 --- a/quickshell/default/PowerMenu.qml +++ /dev/null @@ -1,132 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Io -import Quickshell.Wayland -import Quickshell.Hyprland - -Variants { - id: root - model: Quickshell.screens - - readonly property bool isGerman: Qt.locale().name.startsWith("de") - readonly property string logoutLabel: isGerman ? "Abmelden" : "Logout" - readonly property string restartLabel: isGerman ? "Neustart" : "Restart" - readonly property string shutdownLabel: isGerman ? "Herunterfahren" : "Shutdown" - - PanelWindow { - id: panel - required property var modelData - screen: modelData - - anchors { top: true; right: true } - implicitWidth: 40 - implicitHeight: 34 - margins.right: 8 - exclusionMode: ExclusionMode.Ignore - color: "transparent" - WlrLayershell.namespace: "power-button" - WlrLayershell.layer: WlrLayer.Overlay - - property bool menuOpen: false - - Process { id: logoutProc; command: ["hyprctl", "dispatch", "exit"] } - Process { id: rebootProc; command: ["systemctl", "reboot"] } - Process { id: shutdownProc; command: ["systemctl", "poweroff"] } - - // Matches window#waybar's own backdrop tint so the button blends into the bar - // instead of floating over the wallpaper on its own transparent surface. - Rectangle { - anchors.fill: parent - color: Qt.rgba(0.071, 0.075, 0.106, 0.18) - } - - Rectangle { - anchors.fill: parent - anchors.margins: 4 - radius: 10 - color: btnArea.containsMouse ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85) - - Text { - anchors.centerIn: parent - text: "" - font.family: "JetBrainsMono Nerd Font" - font.pixelSize: 15 - color: btnArea.containsMouse ? "#0f111a" : "#1793d1" - } - - MouseArea { - id: btnArea - anchors.fill: parent - hoverEnabled: true - onClicked: panel.menuOpen = !panel.menuOpen - } - } - - LazyLoader { - active: panel.menuOpen - - PanelWindow { - id: menu - screen: panel.modelData - - anchors { top: true; right: true } - margins { top: 34; right: 8 } - - implicitWidth: 170 - implicitHeight: col.implicitHeight + 16 - color: "transparent" - WlrLayershell.namespace: "power-menu" - WlrLayershell.layer: WlrLayer.Overlay - - HyprlandFocusGrab { - windows: [ menu ] - active: true - onCleared: panel.menuOpen = false - } - - Rectangle { - anchors.fill: parent - radius: 10 - color: "#e61a1b26" - border.width: 1 - border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35) - - ColumnLayout { - id: col - anchors.fill: parent - anchors.margins: 8 - spacing: 4 - - MenuEntry { - label: root.logoutLabel - icon: "" - onTriggered: { - panel.menuOpen = false - logoutProc.startDetached() - } - } - - MenuEntry { - label: root.restartLabel - icon: "" - onTriggered: { - panel.menuOpen = false - rebootProc.startDetached() - } - } - - MenuEntry { - label: root.shutdownLabel - icon: "" - onTriggered: { - panel.menuOpen = false - shutdownProc.startDetached() - } - } - } - } - } - } - } -} diff --git a/quickshell/default/scripts/stats.sh b/quickshell/default/scripts/stats.sh new file mode 100755 index 0000000..2c87fc3 --- /dev/null +++ b/quickshell/default/scripts/stats.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Emits pipe-separated system stats for the Quickshell StatsWidget: +# cpu|memPct|memUsedGB|memTotalGB|diskPct|diskTotalGB|diskUsedGB|diskAvailGB|load1|load5|load15|tempC|core0,core1,...|gpuUtil|gpuTemp|gpuMemUsed|gpuMemTotal + +snap1=$(mktemp) +snap2=$(mktemp) +grep '^cpu' /proc/stat > "$snap1" +sleep 0.2 +grep '^cpu' /proc/stat > "$snap2" + +cpu_result=$(awk ' +NR==FNR { + idle1[$1] = $5+$6 + total1[$1] = $2+$3+$4+$5+$6+$7+$8+$9 + next +} +{ + idle2 = $5+$6 + total2 = $2+$3+$4+$5+$6+$7+$8+$9 + dt = total2 - total1[$1] + di = idle2 - idle1[$1] + pct = (dt > 0) ? int((dt-di)*100/dt) : 0 + print $1, pct +}' "$snap1" "$snap2") +rm -f "$snap1" "$snap2" + +cpu=$(echo "$cpu_result" | awk '$1=="cpu"{print $2}') +percore=$(echo "$cpu_result" | awk '$1!="cpu"{printf "%s,", $2}' | sed 's/,$//') + +mem_line=$(awk '/MemTotal/{t=$2} /MemAvailable/{a=$2} END{printf "%d|%.1f|%.1f", (t-a)*100/t, (t-a)/1024/1024, t/1024/1024}' /proc/meminfo) + +disk_line=$(df -P / | awk 'NR==2{gsub("%","",$5); printf "%s|%.0f|%.0f|%.0f", $5, $2/1024/1024, $3/1024/1024, $4/1024/1024}') + +load=$(awk '{printf "%s|%s|%s", $1, $2, $3}' /proc/loadavg) + +temp=$(sensors -j 2>/dev/null | python3 -c " +import json, sys +try: + d = json.load(sys.stdin) + print(round(d['k10temp-pci-00c3']['Tctl']['temp1_input'])) +except Exception: + print('NA') +" 2>/dev/null) +[ -z "$temp" ] && temp="NA" + +gpu_line=$(nvidia-smi --query-gpu=utilization.gpu,temperature.gpu,memory.used,memory.total --format=csv,noheader,nounits 2>/dev/null | tr -d ' ' | tr ',' '|') +[ -z "$gpu_line" ] && gpu_line="NA|NA|NA|NA" + +echo "${cpu}|${mem_line}|${disk_line}|${load}|${temp}|${percore}|${gpu_line}" diff --git a/quickshell/default/scripts/volume.sh b/quickshell/default/scripts/volume.sh new file mode 100755 index 0000000..afdcf87 --- /dev/null +++ b/quickshell/default/scripts/volume.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Emits "pct|muted" for the default audio sink, e.g. "72|0" or "72|1" +out=$(wpctl get-volume @DEFAULT_AUDIO_SINK@) +pct=$(echo "$out" | awk '{printf "%d", $2*100}') +muted=0 +echo "$out" | grep -q MUTED && muted=1 +echo "${pct}|${muted}" diff --git a/quickshell/default/shell.qml b/quickshell/default/shell.qml index 46c78c3..c1f86ef 100644 --- a/quickshell/default/shell.qml +++ b/quickshell/default/shell.qml @@ -2,7 +2,5 @@ import QtQuick import Quickshell ShellRoot { - PowerMenu {} - ClockWidget {} - NetworkWidget {} + Bar {} } diff --git a/waybar/config.jsonc b/waybar/config.jsonc deleted file mode 100644 index 49a665f..0000000 --- a/waybar/config.jsonc +++ /dev/null @@ -1,114 +0,0 @@ -{ - "layer": "top", - "position": "top", - "height": 34, - "spacing": 6, - "modules-left": [ - "custom/arch", - "hyprland/workspaces" - ], - "modules-center": [ - "hyprland/window" - ], - "modules-right": [ - "tray", - "cpu", - "memory", - "disk", - "temperature", - "custom/gpu", - "pulseaudio", - "custom/network-spacer", - "custom/clock-spacer", - "custom/power-spacer" - ], - "custom/arch": { - "format": "", - "tooltip": false - }, - "hyprland/workspaces": { - "format": "{icon}", - "format-icons": { - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "", - "6": "", - "7": "", - "8": "", - "9": "9", - "active": "", - "default": "" - }, - "persistent-workspaces": { - "1": [], - "2": [], - "3": [], - "4": [], - "5": [], - "6": [], - "7": [], - "8": [], - "9": [] - } - }, - "hyprland/window": { - "format": "{}", - "max-length": 70, - "separate-outputs": true - }, - "tray": { - "icon-size": 16, - "spacing": 8 - }, - "cpu": { - "format": " {usage}%", - "tooltip": true, - "interval": 2 - }, - "memory": { - "format": " {}%", - "tooltip": true, - "interval": 2 - }, - "temperature": { - "format": " {temperatureC}°C", - "critical-threshold": 80, - "tooltip": false - }, - "custom/network-spacer": { - "format": " ", - "tooltip": false, - "interval": "once" - }, - "pulseaudio": { - "format": " {volume}%", - "format-muted": " muted", - "scroll-step": 5, - "on-click": "pavucontrol" - }, - "disk": { - "interval": 30, - "path": "/", - "format": " {percentage_used}%", - "tooltip": true, - "tooltip-format": "Disk /\\nUsed: {used}\\nFree: {free}\\nTotal: {total}" - }, - "custom/gpu": { - "exec": "nvidia-smi --query-gpu=utilization.gpu,temperature.gpu,memory.used,memory.total --format=csv,noheader,nounits | awk -F ', ' '{printf \"󰢮 %s%% %s°C %s/%sMiB\", $1, $2, $3, $4}'", - "interval": 3, - "return-type": "text", - "tooltip": true - }, - "custom/power-spacer": { - "format": " ", - "tooltip": false, - "interval": "once" - }, - "custom/clock-spacer": { - "format": " ", - "tooltip": false, - "interval": "once" - } -} \ No newline at end of file diff --git a/waybar/style.css b/waybar/style.css deleted file mode 100644 index e3b90d1..0000000 --- a/waybar/style.css +++ /dev/null @@ -1,102 +0,0 @@ -@import url("file:///home/nico/.config/waybar/aether-colors.css"); - -* { - border: none; - border-radius: 0; - font-family: "JetBrainsMono Nerd Font", "Noto Sans", sans-serif; - font-size: 13px; - min-height: 0; -} - -window#waybar { - background: alpha(shade(@background, 0.7), 0.18); - color: @foreground; - border-bottom: 1px solid alpha(@accent, 0.45); -} - -#custom-arch { - color: @accent; - font-size: 18px; - padding: 0 14px; - margin: 4px 0 4px 8px; - border-radius: 10px; - background: alpha(@accent, 0.12); -} - -#workspaces { - margin: 4px 0; - padding: 0 4px; - border-radius: 10px; - background: alpha(@background, 0.85); -} - -#workspaces button { - color: @muted; - padding: 0 9px; - margin: 3px 2px; - border-radius: 8px; - background: transparent; -} - -#workspaces button.active { - color: shade(@background, 0.7); - background: @accent; -} - -#workspaces button:hover { - color: @foreground; - background: alpha(@blue, 0.22); -} - -#window { - color: @foreground; - padding: 0 14px; - margin: 4px 0; - border-radius: 10px; - background: alpha(@background, 0.65); -} - -#tray, -#cpu, -#memory, -#disk, -#custom-gpu, -#temperature, -#pulseaudio { - color: @foreground; - padding: 0 10px; - margin: 4px 2px; - border-radius: 10px; - background: alpha(@background, 0.85); -} - -#cpu { color: @blue; } -#memory { color: @cyan; } -#temperature { color: @yellow; } -#temperature.critical { color: @red; } -#pulseaudio { color: @magenta; } -#pulseaudio.muted { color: @muted; } - -/* Reserved blank space where the Quickshell power button/menu renders on top. */ -#custom-power-spacer { - min-width: 48px; - padding: 0; - margin: 0; - background: transparent; -} - -/* Reserved blank space where the Quickshell clock/calendar widget renders on top. */ -#custom-clock-spacer { - min-width: 130px; - padding: 0; - margin: 0; - background: transparent; -} - -/* Reserved blank space where the Quickshell network widget renders on top. */ -#custom-network-spacer { - min-width: 72px; - padding: 0; - margin: 0; - background: transparent; -}