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 = {
|
treefmt-config = {
|
||||||
projectRootFile = "flake.nix";
|
projectRootFile = "flake.nix";
|
||||||
programs.nixfmt.enable = true;
|
programs.nixfmt.enable = true;
|
||||||
|
programs.qmlformat.enable = true;
|
||||||
};
|
};
|
||||||
forAllSystems =
|
forAllSystems =
|
||||||
fn:
|
fn:
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ Row {
|
||||||
function _update() {
|
function _update() {
|
||||||
const c = parseInt(current.text());
|
const c = parseInt(current.text());
|
||||||
const m = parseInt(max.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 {
|
Text {
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,12 @@ PanelWindow {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
M.Workspaces {}
|
M.Tray {
|
||||||
M.Tray { bar: bar }
|
bar: bar
|
||||||
M.WindowTitle { Layout.maximumWidth: 400 }
|
}
|
||||||
|
M.WindowTitle {
|
||||||
|
Layout.maximumWidth: 400
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- right ----
|
// ---- right ----
|
||||||
|
|
@ -62,7 +65,9 @@ PanelWindow {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
spacing: 12
|
spacing: 12
|
||||||
|
|
||||||
Item { Layout.fillWidth: true }
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
M.Mpris {}
|
M.Mpris {}
|
||||||
M.Volume {}
|
M.Volume {}
|
||||||
M.Bluetooth {}
|
M.Bluetooth {}
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,9 @@ Row {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: {
|
text: {
|
||||||
if (root.charging) return "";
|
if (root.charging)
|
||||||
const icons = ["","","","","","","","","","",""];
|
return "";
|
||||||
|
const icons = ["", "", "", "", "", "", "", "", "", "", ""];
|
||||||
return icons[Math.min(10, Math.floor(root.pct / 10))];
|
return icons[Math.min(10, Math.floor(root.pct / 10))];
|
||||||
}
|
}
|
||||||
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
|
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,13 @@ Text {
|
||||||
if (root._prev) {
|
if (root._prev) {
|
||||||
const dIdle = idle - root._prev.idle;
|
const dIdle = idle - root._prev.idle;
|
||||||
const dTotal = total - root._prev.total;
|
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 {
|
FileView {
|
||||||
|
|
@ -31,7 +35,8 @@ Text {
|
||||||
path: "/proc/cpuinfo"
|
path: "/proc/cpuinfo"
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
const lines = text().split("\n").filter(l => l.startsWith("cpu MHz"));
|
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);
|
const sum = lines.reduce((a, l) => a + parseFloat(l.split(":")[1]), 0);
|
||||||
root.freqGhz = sum / lines.length / 1000;
|
root.freqGhz = sum / lines.length / 1000;
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +45,10 @@ Text {
|
||||||
interval: 1000
|
interval: 1000
|
||||||
running: true
|
running: true
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: { stat.reload(); cpuinfo.reload(); }
|
onTriggered: {
|
||||||
|
stat.reload();
|
||||||
|
cpuinfo.reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
text: " " + root.usage.toString().padStart(2) + "%@" + root.freqGhz.toFixed(2)
|
text: " " + root.usage.toString().padStart(2) + "%@" + root.freqGhz.toFixed(2)
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,7 @@ Text {
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: toggle
|
id: toggle
|
||||||
command: ["sh", "-c", root.active
|
command: ["sh", "-c", root.active ? "pkill -x systemd-inhibit || true" : "systemd-inhibit --what=idle --who=nova-shell --why=user sleep infinity &"]
|
||||||
? "pkill -x systemd-inhibit || true"
|
|
||||||
: "systemd-inhibit --what=idle --who=nova-shell --why=user sleep infinity &"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,13 @@ Text {
|
||||||
const m = {};
|
const m = {};
|
||||||
text().split("\n").forEach(l => {
|
text().split("\n").forEach(l => {
|
||||||
const [k, v] = l.split(":");
|
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 total = m.MemTotal;
|
||||||
const avail = m.MemAvailable;
|
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 {
|
Timer {
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,7 @@ Row {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
TapHandler {
|
||||||
anchors.fill: parent
|
onTapped: root.player?.togglePlaying()
|
||||||
onClicked: root.player?.togglePlaying()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,12 @@ Row {
|
||||||
const parts = line.split(":");
|
const parts = line.split(":");
|
||||||
root.essid = parts[0] || "";
|
root.essid = parts[0] || "";
|
||||||
root.ifname = parts[2] || "";
|
root.ifname = parts[2] || "";
|
||||||
if ((parts[1] || "").includes("wireless")) root.state = "wifi";
|
if ((parts[1] || "").includes("wireless"))
|
||||||
else if (parts[0] === "linked") root.state = "linked";
|
root.state = "wifi";
|
||||||
else root.state = "eth";
|
else if (parts[0] === "linked")
|
||||||
|
root.state = "linked";
|
||||||
|
else
|
||||||
|
root.state = "eth";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -41,9 +44,12 @@ Row {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: {
|
text: {
|
||||||
if (root.state === "wifi") return " " + root.essid;
|
if (root.state === "wifi")
|
||||||
if (root.state === "eth") return "";
|
return " " + root.essid;
|
||||||
if (root.state === "linked") return "";
|
if (root.state === "eth")
|
||||||
|
return "";
|
||||||
|
if (root.state === "linked")
|
||||||
|
return "";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
color: M.Theme.base05
|
color: M.Theme.base05
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ Row {
|
||||||
command: ["swaync-client", "--subscribe-waybar"]
|
command: ["swaync-client", "--subscribe-waybar"]
|
||||||
stdout: SplitParser {
|
stdout: SplitParser {
|
||||||
splitMarker: "\n"
|
splitMarker: "\n"
|
||||||
onRead: (line) => {
|
onRead: line => {
|
||||||
try {
|
try {
|
||||||
const d = JSON.parse(line);
|
const d = JSON.parse(line);
|
||||||
const cls = d.class ?? "";
|
const cls = d.class ?? "";
|
||||||
|
|
@ -30,8 +30,10 @@ Row {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: {
|
text: {
|
||||||
if (root.inhibited) return root.count > 0 ? "" : "";
|
if (root.inhibited)
|
||||||
if (root.dnd) return root.count > 0 ? "" : "";
|
return root.count > 0 ? "" : "";
|
||||||
|
if (root.dnd)
|
||||||
|
return root.count > 0 ? "" : "";
|
||||||
return root.count > 0 ? "" : "";
|
return root.count > 0 ? "" : "";
|
||||||
}
|
}
|
||||||
color: M.Theme.base05
|
color: M.Theme.base05
|
||||||
|
|
@ -47,16 +49,21 @@ Row {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
TapHandler {
|
||||||
anchors.fill: parent
|
acceptedButtons: Qt.LeftButton
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
onTapped: {
|
||||||
onClicked: (m) => {
|
clicker.command = ["swaync-client", "--toggle-panel", "--skip-wait"];
|
||||||
const cmd = m.button === Qt.RightButton
|
|
||||||
? ["swaync-client", "--toggle-dnd", "--skip-wait"]
|
|
||||||
: ["swaync-client", "--toggle-panel", "--skip-wait"];
|
|
||||||
clicker.command = cmd;
|
|
||||||
clicker.running = true;
|
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: {
|
text: {
|
||||||
if (root.profile === "performance") return "";
|
if (root.profile === "performance")
|
||||||
if (root.profile === "power-saver") return "";
|
return "";
|
||||||
if (root.profile === "balanced") return "";
|
if (root.profile === "power-saver")
|
||||||
|
return "";
|
||||||
|
if (root.profile === "balanced")
|
||||||
|
return "";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
color: M.Theme.base05
|
color: M.Theme.base05
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,7 @@ QtObject {
|
||||||
property int barHeight: 32
|
property int barHeight: 32
|
||||||
|
|
||||||
property FileView _themeFile: FileView {
|
property FileView _themeFile: FileView {
|
||||||
path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config"))
|
path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/theme.json"
|
||||||
+ "/nova-shell/theme.json"
|
|
||||||
watchChanges: true
|
watchChanges: true
|
||||||
onFileChanged: reload()
|
onFileChanged: reload()
|
||||||
onLoaded: root._apply(text())
|
onLoaded: root._apply(text())
|
||||||
|
|
@ -40,14 +39,23 @@ QtObject {
|
||||||
|
|
||||||
function _apply(raw) {
|
function _apply(raw) {
|
||||||
let data;
|
let data;
|
||||||
try { data = JSON.parse(raw); } catch (e) { return; }
|
try {
|
||||||
|
data = JSON.parse(raw);
|
||||||
|
} catch (e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const c = data.colors || {};
|
const c = data.colors || {};
|
||||||
for (const k of Object.keys(c)) {
|
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.fontFamily)
|
||||||
if (data.fontSize) root.fontSize = data.fontSize;
|
root.fontFamily = data.fontFamily;
|
||||||
if (data.barOpacity !== undefined) root.barOpacity = data.barOpacity;
|
if (data.fontSize)
|
||||||
if (data.barHeight !== undefined) root.barHeight = data.barHeight;
|
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 {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onClicked: (mouse) => {
|
onClicked: mouse => {
|
||||||
if (mouse.button === Qt.LeftButton) {
|
if (mouse.button === Qt.LeftButton) {
|
||||||
iconItem.modelData.activate();
|
iconItem.modelData.activate();
|
||||||
} else if (mouse.button === Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ Row {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
TapHandler {
|
||||||
anchors.fill: parent
|
onTapped: if (root.sink?.audio)
|
||||||
onClicked: if (root.sink?.audio) root.sink.audio.muted = !root.sink.audio.muted
|
root.sink.audio.muted = !root.sink.audio.muted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,10 @@ Text {
|
||||||
font.family: M.Theme.fontFamily
|
font.family: M.Theme.fontFamily
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
||||||
Process { id: proc; command: ["wlogout"] }
|
Process {
|
||||||
|
id: proc
|
||||||
|
command: ["wlogout"]
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,7 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
// Placeholder — Quickshell.Services.Niri not yet available
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: 4
|
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