merge main into module/wifi
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 9s
Python / lint-format (pull_request) Successful in 16s
Python / test (pull_request) Successful in 49s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m42s
C++ / build (pull_request) Successful in 2m28s
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 9s
Python / lint-format (pull_request) Successful in 16s
Python / test (pull_request) Successful in 49s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m42s
C++ / build (pull_request) Successful in 2m28s
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property alias hasNotifications: adapter.hasNotifications
|
||||
|
||||
JsonObject {
|
||||
id: adapter
|
||||
|
||||
property bool hasNotifications: false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
property var _regexCache: ({})
|
||||
|
||||
function testRegexList(filterList: list<string>, target: string): bool {
|
||||
const regexChecker = /^\^.*\$$/;
|
||||
for (const filter of filterList) {
|
||||
if (regexChecker.test(filter)) {
|
||||
let re = _regexCache[filter];
|
||||
if (!re) {
|
||||
re = new RegExp(filter);
|
||||
_regexCache[filter] = re;
|
||||
}
|
||||
if (re.test(target))
|
||||
return true;
|
||||
} else {
|
||||
if (filter === target)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+64
-6
@@ -1,17 +1,30 @@
|
||||
pragma Singleton
|
||||
|
||||
import qs.Config
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import qs.Config
|
||||
import qs.Paths
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property string boardName
|
||||
property string boardVendor
|
||||
readonly property string device: {
|
||||
if (!boardName)
|
||||
return boardVendor;
|
||||
if (!boardVendor || boardName.toLowerCase().startsWith(boardVendor.toLowerCase()))
|
||||
return boardName;
|
||||
return `${boardVendor} ${boardName}`;
|
||||
}
|
||||
property string firmware
|
||||
property string hostname
|
||||
property bool isDefaultLogo: true
|
||||
property string kernel
|
||||
property string osId
|
||||
property list<string> osIdLike
|
||||
property string osLogo
|
||||
property string osLogo: Qt.resolvedUrl(`${Quickshell.shellDir}/assets/logo.svg`)
|
||||
property string osName
|
||||
property string osPrettyName
|
||||
readonly property string shell: Quickshell.env("SHELL").split("/").pop()
|
||||
@@ -19,6 +32,12 @@ Singleton {
|
||||
readonly property string user: Quickshell.env("USER")
|
||||
readonly property string wm: Quickshell.env("XDG_CURRENT_DESKTOP") || Quickshell.env("XDG_SESSION_DESKTOP")
|
||||
|
||||
function sanitiseDmi(s: string): string {
|
||||
const t = s.trim();
|
||||
const junk = ["to be filled by o.e.m.", "system product name", "system manufacturer", "system version", "default string", "o.e.m.", "not specified", "not applicable", "unknown", "none", ""];
|
||||
return junk.includes(t.toLowerCase()) ? "" : t;
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: osRelease
|
||||
|
||||
@@ -35,7 +54,10 @@ Singleton {
|
||||
root.osIdLike = fd("ID_LIKE").split(" ");
|
||||
|
||||
const logo = Quickshell.iconPath(fd("LOGO"), true);
|
||||
if (Config.general.logo) {
|
||||
if (Config.general.logo === "zshell") {
|
||||
root.osLogo = Qt.resolvedUrl(`${Quickshell.shellDir}/assets/logo.svg`);
|
||||
root.isDefaultLogo = true;
|
||||
} else if (Config.general.logo) {
|
||||
root.osLogo = Quickshell.iconPath(Config.general.logo, true) || "file://" + Paths.absolutePath(Config.general.logo);
|
||||
root.isDefaultLogo = false;
|
||||
} else if (logo) {
|
||||
@@ -53,6 +75,39 @@ Singleton {
|
||||
target: Config.general
|
||||
}
|
||||
|
||||
FileView {
|
||||
path: "/proc/sys/kernel/osrelease"
|
||||
|
||||
onLoaded: root.kernel = text().trim()
|
||||
}
|
||||
|
||||
FileView {
|
||||
path: "/proc/sys/kernel/hostname"
|
||||
|
||||
onLoaded: root.hostname = text().trim()
|
||||
}
|
||||
|
||||
FileView {
|
||||
path: "/sys/class/dmi/id/sys_vendor"
|
||||
printErrors: false
|
||||
|
||||
onLoaded: root.boardVendor = root.sanitiseDmi(text())
|
||||
}
|
||||
|
||||
FileView {
|
||||
path: "/sys/class/dmi/id/product_name"
|
||||
printErrors: false
|
||||
|
||||
onLoaded: root.boardName = root.sanitiseDmi(text())
|
||||
}
|
||||
|
||||
FileView {
|
||||
path: "/sys/class/dmi/id/bios_version"
|
||||
printErrors: false
|
||||
|
||||
onLoaded: root.firmware = root.sanitiseDmi(text())
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 15000
|
||||
repeat: true
|
||||
@@ -69,12 +124,15 @@ Singleton {
|
||||
onLoaded: {
|
||||
const up = parseInt(text().split(" ")[0] ?? 0);
|
||||
|
||||
const hours = Math.floor(up / 3600);
|
||||
const days = Math.floor(up / 86400);
|
||||
const hours = Math.floor((up % 86400) / 3600);
|
||||
const minutes = Math.floor((up % 3600) / 60);
|
||||
|
||||
let str = "";
|
||||
if (days > 0)
|
||||
str += `${days} day${days === 1 ? "" : "s"}`;
|
||||
if (hours > 0)
|
||||
str += `${hours} hour${hours === 1 ? "" : "s"}`;
|
||||
str += `${str ? ", " : ""}${hours} hour${hours === 1 ? "" : "s"}`;
|
||||
if (minutes > 0 || !str)
|
||||
str += `${str ? ", " : ""}${minutes} minute${minutes === 1 ? "" : "s"}`;
|
||||
root.uptime = str;
|
||||
|
||||
@@ -21,6 +21,13 @@ Searcher {
|
||||
property bool recentlyChanged
|
||||
property bool showPreview: false
|
||||
|
||||
function getCategoryFor(w: FileSystemEntry): string {
|
||||
let category = w.parentDir.slice(Paths.wallsdir.length + 1);
|
||||
if (category.includes("/"))
|
||||
category = category.slice(0, category.indexOf("/"));
|
||||
return category;
|
||||
}
|
||||
|
||||
function getCrop(screen: string): var {
|
||||
return root.crops[screen];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user