Merge branch 'main' into module/wifi
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 15s
JS/TS / lint (pull_request) Successful in 19s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m9s
Rust / build (pull_request) Successful in 2m11s
C++ / build (pull_request) Successful in 2m34s
Rust / clippy (pull_request) Successful in 1m30s
Python / verify (pull_request) Successful in 2m55s
C++ / clang-tidy (pull_request) Successful in 3m59s
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 15s
JS/TS / lint (pull_request) Successful in 19s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m9s
Rust / build (pull_request) Successful in 2m11s
C++ / build (pull_request) Successful in 2m34s
Rust / clippy (pull_request) Successful in 1m30s
Python / verify (pull_request) Successful in 2m55s
C++ / clang-tidy (pull_request) Successful in 3m59s
This commit is contained in:
+40
-12
@@ -1,35 +1,63 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.UPower
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
import qs.Paths
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
readonly property var colors: {
|
||||
if (deviceState === UPowerDeviceState.Charging || deviceState === UPowerDeviceState.FullyCharged)
|
||||
readonly property list<var> allPeripherals: [...logiDevices, ...upowerDevices.filter(d => !Battery.logiDevices.some(l => l.nativePath === d.nativePath))]
|
||||
readonly property real currentPerc: UPower.displayDevice.percentage
|
||||
readonly property var deviceState: UPower.displayDevice.state
|
||||
readonly property string deviceStateString: UPowerDeviceState.toString(deviceState)
|
||||
readonly property bool isLaptop: UPower.displayDevice.isLaptopBattery
|
||||
readonly property alias logiDevices: adapter.devices
|
||||
readonly property var lowestPeripheral: allPeripherals.reduce((lowest, current) => current.percentage < lowest.percentage ? current : lowest)
|
||||
readonly property bool onBattery: UPower.onBattery
|
||||
readonly property bool ready: UPower.displayDevice.ready
|
||||
readonly property real timeToEmpty: UPower.displayDevice.timeToEmpty
|
||||
readonly property real timeToFull: UPower.displayDevice.timeToFull
|
||||
readonly property list<UPowerDevice> upowerDevices: UPower.devices.values.filter(d => d.state !== UPowerDeviceState.Unknown)
|
||||
|
||||
function getColors(percentage: real, state: string): var {
|
||||
if (state === "charging" || state === "full" || state === "recharging")
|
||||
return {
|
||||
fg: Colors.swapRG(Colors.palette.m3error),
|
||||
bg: Colors.swapRG(Colors.palette.m3onError)
|
||||
};
|
||||
else if (currentPerc <= 0.2)
|
||||
else if (percentage <= 0.2)
|
||||
return {
|
||||
fg: Colors.palette.m3error,
|
||||
bg: Colors.palette.m3onError
|
||||
};
|
||||
else
|
||||
return {
|
||||
fg: Colors.palette.m3onSurface,
|
||||
bg: Colors.palette.m3surface
|
||||
fg: Colors.palette.m3tertiary,
|
||||
bg: Colors.palette.m3onTertiary
|
||||
};
|
||||
}
|
||||
readonly property real currentPerc: UPower.displayDevice.percentage
|
||||
readonly property var deviceState: UPower.displayDevice.state
|
||||
readonly property bool isLaptop: UPower.displayDevice.isLaptopBattery
|
||||
readonly property bool onBattery: UPower.onBattery
|
||||
readonly property bool ready: UPower.displayDevice.ready
|
||||
readonly property real timeToEmpty: UPower.displayDevice.timeToEmpty
|
||||
readonly property real timeToFull: UPower.displayDevice.timeToFull
|
||||
|
||||
function startDaemon(): void {
|
||||
Quickshell.execDetached(["zshell-cli", "battery", "daemon"]);
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: fileView
|
||||
|
||||
path: `${Paths.cache}/battery.json`
|
||||
watchChanges: true
|
||||
|
||||
onFileChanged: reload()
|
||||
|
||||
JsonAdapter {
|
||||
id: adapter
|
||||
|
||||
property list<var> devices: []
|
||||
property real updated: 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+42
-1
@@ -1,6 +1,6 @@
|
||||
pragma Singleton
|
||||
|
||||
import ZShell.Config
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Notifications
|
||||
|
||||
@@ -166,6 +166,32 @@ Singleton {
|
||||
return "chat";
|
||||
}
|
||||
|
||||
function getSpecialWsIcon(name: string): string {
|
||||
name = name.toLowerCase().slice("special:".length);
|
||||
|
||||
if (name === "special")
|
||||
return "star";
|
||||
if (name === "communication")
|
||||
return "forum";
|
||||
if (name === "music")
|
||||
return "music_cast";
|
||||
if (name === "todo")
|
||||
return "checklist";
|
||||
if (name === "sysmon")
|
||||
return "monitor_heart";
|
||||
return name[0].toUpperCase();
|
||||
}
|
||||
|
||||
function getTrayIcon(id: string, icon: string): string {
|
||||
if (icon.includes("?path=")) {
|
||||
const [name, path] = icon.split("?path=");
|
||||
const file = name.slice(name.lastIndexOf("/") + 1);
|
||||
const themed = Quickshell.iconPath(file, true);
|
||||
icon = themed ? themed : Qt.resolvedUrl(`${path}/${file}`);
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
function getVolumeIcon(volume: real, isMuted: bool): string {
|
||||
if (isMuted)
|
||||
return "no_sound";
|
||||
@@ -181,4 +207,19 @@ Singleton {
|
||||
return weatherIcons[code];
|
||||
return "air";
|
||||
}
|
||||
|
||||
function matchIconConfig(name: string, iconConfig: var): bool {
|
||||
if (!iconConfig.icon)
|
||||
return false;
|
||||
|
||||
if (iconConfig.regex) {
|
||||
const re = new RegExp(iconConfig.regex, iconConfig.flags ?? "");
|
||||
if (re.test(name))
|
||||
return true;
|
||||
} else if (iconConfig.name === name) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ Singleton {
|
||||
|
||||
Config.dock.pinnedApps = pinnedApps;
|
||||
root.unpinnedOrder = visibleUnpinned.concat(root.unpinnedOrder.map(normalizeId).filter(id => !pinnedApps.includes(id) && !visibleUnpinned.includes(id)));
|
||||
Config.saveNoToast();
|
||||
}
|
||||
|
||||
function isPinned(appId) {
|
||||
|
||||
+8
-41
@@ -11,8 +11,8 @@ Singleton {
|
||||
id: root
|
||||
|
||||
property int availableUpdates: 0
|
||||
property string cmd: ""
|
||||
property bool commandReady
|
||||
property bool hasHelper
|
||||
property bool loaded
|
||||
property double now: Date.now()
|
||||
property var updates: ({})
|
||||
@@ -38,18 +38,12 @@ Singleton {
|
||||
}
|
||||
|
||||
function performPackageUpdate(pkg: string): void {
|
||||
if (root.cmd === "pacman")
|
||||
pkgUpdateProc.command = ["pkexec", root.cmd, "--noconfirm", "-Sy", pkg];
|
||||
else
|
||||
pkgUpdateProc.command = [root.cmd, "--noconfirm", "--sudo", "pkexec", "-Sy", pkg];
|
||||
pkgUpdateProc.command = ["pkexec", "pacman", "--noconfirm", "-Sy", pkg];
|
||||
pkgUpdateProc.running = true;
|
||||
}
|
||||
|
||||
function performSystemUpdate(): void {
|
||||
if (root.cmd === "pacman")
|
||||
sysUpdateProc.command = ["pkexec", root.cmd, "--noconfirm", "-Syu"];
|
||||
else
|
||||
sysUpdateProc.command = [root.cmd, "--noconfirm", "--sudo", "pkexec", "-Syu"];
|
||||
sysUpdateProc.command = ["pkexec", "pacman", "--noconfirm", "-Syu"];
|
||||
sysUpdateProc.running = true;
|
||||
}
|
||||
|
||||
@@ -87,7 +81,7 @@ Singleton {
|
||||
Process {
|
||||
id: cmdDetect
|
||||
|
||||
command: ["sh", "-c", "command -v checkupdates || command -v yay || command -v paru"]
|
||||
command: ["sh", "-c", "command -v checkupdates"]
|
||||
running: true
|
||||
|
||||
stdout: StdioCollector {
|
||||
@@ -96,47 +90,20 @@ Singleton {
|
||||
let helper;
|
||||
|
||||
if (cmd.length > 0) {
|
||||
helper = cmd.split("/").pop();
|
||||
helper = true;
|
||||
} else {
|
||||
helper = "pacman";
|
||||
}
|
||||
|
||||
if (helper === "checkupdates") {
|
||||
updatesProc.command = [helper];
|
||||
} else {
|
||||
updatesProc.command = [helper, "-Qu"];
|
||||
helper = false;
|
||||
}
|
||||
root.hasHelper = helper;
|
||||
root.commandReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: updateCmdDetect
|
||||
|
||||
command: ["sh", "-c", "command -v yay || command -v paru"]
|
||||
running: true
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const cmd = this.text.trim();
|
||||
let helper;
|
||||
|
||||
if (cmd.length > 0) {
|
||||
helper = cmd.split("/").pop();
|
||||
} else {
|
||||
helper = "pacman";
|
||||
}
|
||||
|
||||
root.cmd = helper;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: updatesProc
|
||||
|
||||
command: []
|
||||
command: root.hasHelper ? ["checkupdates"] : []
|
||||
running: false
|
||||
|
||||
stdout: StdioCollector {
|
||||
|
||||
Reference in New Issue
Block a user