Merge branch 'main' into feat/peripheral-integration
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 18s
JS/TS / lint (pull_request) Successful in 20s
Python / static (pull_request) Failing after 59s
Rust / fmt (pull_request) Successful in 1m4s
Rust / build (pull_request) Successful in 1m56s
C++ / build (pull_request) Successful in 2m31s
Python / verify (pull_request) Failing after 2m26s
Rust / clippy (pull_request) Successful in 1m22s
C++ / clang-tidy (pull_request) Successful in 3m53s
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 18s
JS/TS / lint (pull_request) Successful in 20s
Python / static (pull_request) Failing after 59s
Rust / fmt (pull_request) Successful in 1m4s
Rust / build (pull_request) Successful in 1m56s
C++ / build (pull_request) Successful in 2m31s
Python / verify (pull_request) Failing after 2m26s
Rust / clippy (pull_request) Successful in 1m22s
C++ / clang-tidy (pull_request) Successful in 3m53s
This commit is contained in:
+51
-2
@@ -1,9 +1,8 @@
|
||||
pragma Singleton
|
||||
|
||||
import ZShell.Config
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Notifications
|
||||
import QtQuick
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
@@ -95,6 +94,15 @@ Singleton {
|
||||
return Quickshell.iconPath(icon);
|
||||
}
|
||||
|
||||
function getBatteryIcon(percentage: real, charging = false): string {
|
||||
if (percentage === 1)
|
||||
return charging ? "battery_charging_full" : "battery_full";
|
||||
let level = Math.floor(percentage * 7);
|
||||
if (charging && (level === 4 || level === 1))
|
||||
level--;
|
||||
return charging ? `battery_charging_${(level + 3) * 10}` : `battery_${level}_bar`;
|
||||
}
|
||||
|
||||
function getBluetoothIcon(icon: string): string {
|
||||
if (icon.includes("headset") || icon.includes("headphones"))
|
||||
return "headphones";
|
||||
@@ -168,6 +176,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";
|
||||
@@ -183,4 +217,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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user