remove ws, fmt
This commit is contained in:
parent
5316f40967
commit
cd45c2d9cf
17 changed files with 96 additions and 97 deletions
|
|
@ -31,6 +31,7 @@
|
|||
treefmt-config = {
|
||||
projectRootFile = "flake.nix";
|
||||
programs.nixfmt.enable = true;
|
||||
programs.qmlformat.enable = true;
|
||||
};
|
||||
forAllSystems =
|
||||
fn:
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ Row {
|
|||
function _update() {
|
||||
const c = parseInt(current.text());
|
||||
const m = parseInt(max.text());
|
||||
if (m > 0) root.percent = Math.round((c / m) * 100);
|
||||
if (m > 0)
|
||||
root.percent = Math.round((c / m) * 100);
|
||||
}
|
||||
|
||||
Text {
|
||||
|
|
|
|||
|
|
@ -50,9 +50,12 @@ PanelWindow {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 8
|
||||
|
||||
M.Workspaces {}
|
||||
M.Tray { bar: bar }
|
||||
M.WindowTitle { Layout.maximumWidth: 400 }
|
||||
M.Tray {
|
||||
bar: bar
|
||||
}
|
||||
M.WindowTitle {
|
||||
Layout.maximumWidth: 400
|
||||
}
|
||||
}
|
||||
|
||||
// ---- right ----
|
||||
|
|
@ -62,7 +65,9 @@ PanelWindow {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 12
|
||||
|
||||
Item { Layout.fillWidth: true }
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
M.Mpris {}
|
||||
M.Volume {}
|
||||
M.Bluetooth {}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@ Row {
|
|||
|
||||
Text {
|
||||
text: {
|
||||
if (root.charging) return "";
|
||||
const icons = ["","","","","","","","","","",""];
|
||||
if (root.charging)
|
||||
return "";
|
||||
const icons = ["", "", "", "", "", "", "", "", "", "", ""];
|
||||
return icons[Math.min(10, Math.floor(root.pct / 10))];
|
||||
}
|
||||
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
|
||||
|
|
|
|||
|
|
@ -21,9 +21,13 @@ Text {
|
|||
if (root._prev) {
|
||||
const dIdle = idle - root._prev.idle;
|
||||
const dTotal = total - root._prev.total;
|
||||
if (dTotal > 0) root.usage = Math.round((1 - dIdle / dTotal) * 100);
|
||||
if (dTotal > 0)
|
||||
root.usage = Math.round((1 - dIdle / dTotal) * 100);
|
||||
}
|
||||
root._prev = { idle, total };
|
||||
root._prev = {
|
||||
idle,
|
||||
total
|
||||
};
|
||||
}
|
||||
}
|
||||
FileView {
|
||||
|
|
@ -31,7 +35,8 @@ Text {
|
|||
path: "/proc/cpuinfo"
|
||||
onLoaded: {
|
||||
const lines = text().split("\n").filter(l => l.startsWith("cpu MHz"));
|
||||
if (lines.length === 0) return;
|
||||
if (lines.length === 0)
|
||||
return;
|
||||
const sum = lines.reduce((a, l) => a + parseFloat(l.split(":")[1]), 0);
|
||||
root.freqGhz = sum / lines.length / 1000;
|
||||
}
|
||||
|
|
@ -40,7 +45,10 @@ Text {
|
|||
interval: 1000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: { stat.reload(); cpuinfo.reload(); }
|
||||
onTriggered: {
|
||||
stat.reload();
|
||||
cpuinfo.reload();
|
||||
}
|
||||
}
|
||||
|
||||
text: " " + root.usage.toString().padStart(2) + "%@" + root.freqGhz.toFixed(2)
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ Text {
|
|||
|
||||
Process {
|
||||
id: toggle
|
||||
command: ["sh", "-c", root.active
|
||||
? "pkill -x systemd-inhibit || true"
|
||||
: "systemd-inhibit --what=idle --who=nova-shell --why=user sleep infinity &"]
|
||||
command: ["sh", "-c", root.active ? "pkill -x systemd-inhibit || true" : "systemd-inhibit --what=idle --who=nova-shell --why=user sleep infinity &"]
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
|
|
|||
|
|
@ -14,11 +14,13 @@ Text {
|
|||
const m = {};
|
||||
text().split("\n").forEach(l => {
|
||||
const [k, v] = l.split(":");
|
||||
if (v) m[k.trim()] = parseInt(v.trim());
|
||||
if (v)
|
||||
m[k.trim()] = parseInt(v.trim());
|
||||
});
|
||||
const total = m.MemTotal;
|
||||
const avail = m.MemAvailable;
|
||||
if (total > 0) root.percent = Math.round(((total - avail) / total) * 100);
|
||||
if (total > 0)
|
||||
root.percent = Math.round(((total - avail) / total) * 100);
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ Row {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.player?.togglePlaying()
|
||||
TapHandler {
|
||||
onTapped: root.player?.togglePlaying()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,12 @@ Row {
|
|||
const parts = line.split(":");
|
||||
root.essid = parts[0] || "";
|
||||
root.ifname = parts[2] || "";
|
||||
if ((parts[1] || "").includes("wireless")) root.state = "wifi";
|
||||
else if (parts[0] === "linked") root.state = "linked";
|
||||
else root.state = "eth";
|
||||
if ((parts[1] || "").includes("wireless"))
|
||||
root.state = "wifi";
|
||||
else if (parts[0] === "linked")
|
||||
root.state = "linked";
|
||||
else
|
||||
root.state = "eth";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41,9 +44,12 @@ Row {
|
|||
|
||||
Text {
|
||||
text: {
|
||||
if (root.state === "wifi") return " " + root.essid;
|
||||
if (root.state === "eth") return "";
|
||||
if (root.state === "linked") return "";
|
||||
if (root.state === "wifi")
|
||||
return " " + root.essid;
|
||||
if (root.state === "eth")
|
||||
return "";
|
||||
if (root.state === "linked")
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
color: M.Theme.base05
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Row {
|
|||
command: ["swaync-client", "--subscribe-waybar"]
|
||||
stdout: SplitParser {
|
||||
splitMarker: "\n"
|
||||
onRead: (line) => {
|
||||
onRead: line => {
|
||||
try {
|
||||
const d = JSON.parse(line);
|
||||
const cls = d.class ?? "";
|
||||
|
|
@ -30,8 +30,10 @@ Row {
|
|||
|
||||
Text {
|
||||
text: {
|
||||
if (root.inhibited) return root.count > 0 ? "" : "";
|
||||
if (root.dnd) return root.count > 0 ? "" : "";
|
||||
if (root.inhibited)
|
||||
return root.count > 0 ? "" : "";
|
||||
if (root.dnd)
|
||||
return root.count > 0 ? "" : "";
|
||||
return root.count > 0 ? "" : "";
|
||||
}
|
||||
color: M.Theme.base05
|
||||
|
|
@ -47,16 +49,21 @@ Row {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onClicked: (m) => {
|
||||
const cmd = m.button === Qt.RightButton
|
||||
? ["swaync-client", "--toggle-dnd", "--skip-wait"]
|
||||
: ["swaync-client", "--toggle-panel", "--skip-wait"];
|
||||
clicker.command = cmd;
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onTapped: {
|
||||
clicker.command = ["swaync-client", "--toggle-panel", "--skip-wait"];
|
||||
clicker.running = true;
|
||||
}
|
||||
}
|
||||
Process { id: clicker }
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
onTapped: {
|
||||
clicker.command = ["swaync-client", "--toggle-dnd", "--skip-wait"];
|
||||
clicker.running = true;
|
||||
}
|
||||
}
|
||||
Process {
|
||||
id: clicker
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,12 @@ Text {
|
|||
}
|
||||
|
||||
text: {
|
||||
if (root.profile === "performance") return "";
|
||||
if (root.profile === "power-saver") return "";
|
||||
if (root.profile === "balanced") return "";
|
||||
if (root.profile === "performance")
|
||||
return "";
|
||||
if (root.profile === "power-saver")
|
||||
return "";
|
||||
if (root.profile === "balanced")
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
color: M.Theme.base05
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ QtObject {
|
|||
property int barHeight: 32
|
||||
|
||||
property FileView _themeFile: FileView {
|
||||
path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config"))
|
||||
+ "/nova-shell/theme.json"
|
||||
path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/theme.json"
|
||||
watchChanges: true
|
||||
onFileChanged: reload()
|
||||
onLoaded: root._apply(text())
|
||||
|
|
@ -40,14 +39,23 @@ QtObject {
|
|||
|
||||
function _apply(raw) {
|
||||
let data;
|
||||
try { data = JSON.parse(raw); } catch (e) { return; }
|
||||
try {
|
||||
data = JSON.parse(raw);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
const c = data.colors || {};
|
||||
for (const k of Object.keys(c)) {
|
||||
if (k in root) root[k] = c[k];
|
||||
if (k in root)
|
||||
root[k] = c[k];
|
||||
}
|
||||
if (data.fontFamily) root.fontFamily = data.fontFamily;
|
||||
if (data.fontSize) root.fontSize = data.fontSize;
|
||||
if (data.barOpacity !== undefined) root.barOpacity = data.barOpacity;
|
||||
if (data.barHeight !== undefined) root.barHeight = data.barHeight;
|
||||
if (data.fontFamily)
|
||||
root.fontFamily = data.fontFamily;
|
||||
if (data.fontSize)
|
||||
root.fontSize = data.fontSize;
|
||||
if (data.barOpacity !== undefined)
|
||||
root.barOpacity = data.barOpacity;
|
||||
if (data.barHeight !== undefined)
|
||||
root.barHeight = data.barHeight;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ RowLayout {
|
|||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onClicked: (mouse) => {
|
||||
onClicked: mouse => {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
iconItem.modelData.activate();
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ Row {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: if (root.sink?.audio) root.sink.audio.muted = !root.sink.audio.muted
|
||||
TapHandler {
|
||||
onTapped: if (root.sink?.audio)
|
||||
root.sink.audio.muted = !root.sink.audio.muted
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@ Text {
|
|||
font.family: M.Theme.fontFamily
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
Process { id: proc; command: ["wlogout"] }
|
||||
Process {
|
||||
id: proc
|
||||
command: ["wlogout"]
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
|
|
@ -1,14 +1,7 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
// Placeholder — Quickshell.Services.Niri not yet available
|
||||
RowLayout {
|
||||
spacing: 4
|
||||
|
||||
Loader {
|
||||
source: "WorkspacesInner.qml"
|
||||
onStatusChanged: {
|
||||
if (status === Loader.Error)
|
||||
source = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Services.Niri
|
||||
import "." as M
|
||||
|
||||
RowLayout {
|
||||
spacing: 4
|
||||
|
||||
Repeater {
|
||||
model: Niri.workspaces
|
||||
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
|
||||
implicitWidth: 24
|
||||
implicitHeight: 20
|
||||
radius: 4
|
||||
color: modelData.isFocused
|
||||
? M.Theme.base0D
|
||||
: (modelData.isActive ? M.Theme.base03 : M.Theme.base02)
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: modelData.idx ?? modelData.id
|
||||
color: modelData.isFocused ? M.Theme.base00 : M.Theme.base05
|
||||
font.pixelSize: M.Theme.fontSize
|
||||
font.family: M.Theme.fontFamily
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: Niri.dispatch(["action", "focus-workspace", String(modelData.id)])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue