Merge branch 'main' into feat/llm-chat-tab
C++ / fmt (pull_request) Failing after 3s
C++ / build (pull_request) Failing after 9s
C++ / clang-tidy (pull_request) Failing after 9s
JS/TS / fmt (pull_request) Successful in 9s
JS/TS / lint (pull_request) Successful in 10s
Python / static (pull_request) Successful in 28s
Rust / build (pull_request) Successful in 49s
Python / verify (pull_request) Successful in 1m40s
Rust / fmt (pull_request) Successful in 27s
Rust / clippy (pull_request) Successful in 46s
C++ / fmt (pull_request) Failing after 3s
C++ / build (pull_request) Failing after 9s
C++ / clang-tidy (pull_request) Failing after 9s
JS/TS / fmt (pull_request) Successful in 9s
JS/TS / lint (pull_request) Successful in 10s
Python / static (pull_request) Successful in 28s
Rust / build (pull_request) Successful in 49s
Python / verify (pull_request) Successful in 1m40s
Rust / fmt (pull_request) Successful in 27s
Rust / clippy (pull_request) Successful in 46s
This commit is contained in:
@@ -11,14 +11,14 @@ import qs.Services
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
readonly property int darkEnd: Config.general.color.scheduleDarkEnd
|
||||
readonly property int darkStart: Config.general.color.scheduleDarkStart
|
||||
readonly property bool enabled: Config.general.color.scheduleDark && Config.general.color.schemeGeneration
|
||||
readonly property int darkEnd: Config.colors.scheduleDarkEnd
|
||||
readonly property int darkStart: Config.colors.scheduleDarkStart
|
||||
readonly property bool enabled: Config.colors.scheduleDark && Config.colors.schemeGen
|
||||
|
||||
function applyDarkMode() {
|
||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--mode", "dark"]);
|
||||
|
||||
Config.general.color.mode = "dark";
|
||||
Config.colors.mode = "dark";
|
||||
|
||||
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", "'prefer-dark'"]);
|
||||
|
||||
@@ -30,13 +30,13 @@ Singleton {
|
||||
function applyLightMode() {
|
||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--mode", "light"]);
|
||||
|
||||
Config.general.color.mode = "light";
|
||||
Config.colors.mode = "light";
|
||||
|
||||
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", "'prefer-light'"]);
|
||||
|
||||
Quickshell.execDetached(["sh", "-c", `sed -i 's/color_scheme_path=\\(.*\\)Dark.colors/color_scheme_path=\\1Light.colors/' ${Paths.home}/.config/qt6ct/qt6ct.conf`]);
|
||||
|
||||
if (Config.general.color.neovimColors)
|
||||
if (Config.colors.neovimColors)
|
||||
Quickshell.execDetached(["sed", "-i", "'s/\\(vim.cmd.colorscheme \\).*/\\1\"onelight\"/'", "~/.config/nvim/lua/config/load-colorscheme.lua"]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import ZShell.Internal
|
||||
import ZShell.Config
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property real _downloadSpeed: 0
|
||||
property real _downloadTotal: 0
|
||||
|
||||
property real _initialRxBytes: 0
|
||||
property real _initialTxBytes: 0
|
||||
property bool _initialized: false
|
||||
|
||||
property real _prevRxBytes: 0
|
||||
property real _prevTimestamp: 0
|
||||
property real _prevTxBytes: 0
|
||||
property real _uploadSpeed: 0
|
||||
property real _uploadTotal: 0
|
||||
|
||||
readonly property CircularBuffer downloadBuffer: _downloadBuffer
|
||||
|
||||
readonly property real downloadSpeed: _downloadSpeed
|
||||
|
||||
readonly property real downloadTotal: _downloadTotal
|
||||
readonly property int historyLength: Config.dashboard.performance.showVram ? 70 : 30
|
||||
property int refCount: 0
|
||||
readonly property CircularBuffer uploadBuffer: _uploadBuffer
|
||||
readonly property real uploadSpeed: _uploadSpeed
|
||||
readonly property real uploadTotal: _uploadTotal
|
||||
|
||||
function resetSampling(): void {
|
||||
netDevFile.reload();
|
||||
|
||||
const content = netDevFile.text();
|
||||
if (!content)
|
||||
return;
|
||||
|
||||
const data = root.parseNetDev(content);
|
||||
const now = Date.now();
|
||||
|
||||
root._prevRxBytes = data.rx;
|
||||
root._prevTxBytes = data.tx;
|
||||
root._prevTimestamp = now;
|
||||
}
|
||||
|
||||
function formatBytes(bytes: real): var {
|
||||
// Handle negative or invalid values
|
||||
if (bytes < 0 || isNaN(bytes) || !isFinite(bytes)) {
|
||||
return {
|
||||
value: 0,
|
||||
unit: "B/s"
|
||||
};
|
||||
}
|
||||
|
||||
if (bytes < 1024) {
|
||||
return {
|
||||
value: bytes,
|
||||
unit: "B/s"
|
||||
};
|
||||
} else if (bytes < 1024 * 1024) {
|
||||
return {
|
||||
value: bytes / 1024,
|
||||
unit: "KB/s"
|
||||
};
|
||||
} else if (bytes < 1024 * 1024 * 1024) {
|
||||
return {
|
||||
value: bytes / (1024 * 1024),
|
||||
unit: "MB/s"
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
value: bytes / (1024 * 1024 * 1024),
|
||||
unit: "GB/s"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function formatBytesTotal(bytes: real): var {
|
||||
// Handle negative or invalid values
|
||||
if (bytes < 0 || isNaN(bytes) || !isFinite(bytes)) {
|
||||
return {
|
||||
value: 0,
|
||||
unit: "B"
|
||||
};
|
||||
}
|
||||
|
||||
if (bytes < 1024) {
|
||||
return {
|
||||
value: bytes,
|
||||
unit: "B"
|
||||
};
|
||||
} else if (bytes < 1024 * 1024) {
|
||||
return {
|
||||
value: bytes / 1024,
|
||||
unit: "KB"
|
||||
};
|
||||
} else if (bytes < 1024 * 1024 * 1024) {
|
||||
return {
|
||||
value: bytes / (1024 * 1024),
|
||||
unit: "MB"
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
value: bytes / (1024 * 1024 * 1024),
|
||||
unit: "GB"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function parseNetDev(content: string): var {
|
||||
const lines = content.split("\n");
|
||||
let totalRx = 0;
|
||||
let totalTx = 0;
|
||||
|
||||
for (let i = 2; i < lines.length; i++) {
|
||||
const line = lines[i].trim();
|
||||
if (!line)
|
||||
continue;
|
||||
|
||||
const parts = line.split(/\s+/);
|
||||
if (parts.length < 10)
|
||||
continue;
|
||||
|
||||
const iface = parts[0].replace(":", "");
|
||||
// Skip loopback interface
|
||||
if (iface === "lo")
|
||||
continue;
|
||||
|
||||
const rxBytes = parseFloat(parts[1]) || 0;
|
||||
const txBytes = parseFloat(parts[9]) || 0;
|
||||
|
||||
totalRx += rxBytes;
|
||||
totalTx += txBytes;
|
||||
}
|
||||
|
||||
return {
|
||||
rx: totalRx,
|
||||
tx: totalTx
|
||||
};
|
||||
}
|
||||
|
||||
CircularBuffer {
|
||||
id: _downloadBuffer
|
||||
|
||||
capacity: root.historyLength + 1
|
||||
}
|
||||
|
||||
CircularBuffer {
|
||||
id: _uploadBuffer
|
||||
|
||||
capacity: root.historyLength + 1
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: netDevFile
|
||||
|
||||
path: "/proc/net/dev"
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: Config.dashboard.resourceUpdateInterval
|
||||
repeat: true
|
||||
running: true
|
||||
triggeredOnStart: true
|
||||
|
||||
onTriggered: {
|
||||
if (root.refCount <= 0) {
|
||||
root.resetSampling();
|
||||
return;
|
||||
}
|
||||
|
||||
netDevFile.reload();
|
||||
const content = netDevFile.text();
|
||||
if (!content)
|
||||
return;
|
||||
|
||||
const data = root.parseNetDev(content);
|
||||
const now = Date.now();
|
||||
|
||||
if (!root._initialized) {
|
||||
root._initialRxBytes = data.rx;
|
||||
root._initialTxBytes = data.tx;
|
||||
root._prevRxBytes = data.rx;
|
||||
root._prevTxBytes = data.tx;
|
||||
root._prevTimestamp = now;
|
||||
root._initialized = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const timeDelta = (now - root._prevTimestamp) / 1000; // seconds
|
||||
if (timeDelta > 0) {
|
||||
// Calculate byte deltas
|
||||
let rxDelta = data.rx - root._prevRxBytes;
|
||||
let txDelta = data.tx - root._prevTxBytes;
|
||||
|
||||
// Handle counter overflow (when counters wrap around from max to 0)
|
||||
// This happens when counters exceed 32-bit or 64-bit limits
|
||||
if (rxDelta < 0) {
|
||||
// Counter wrapped around - assume 64-bit counter
|
||||
rxDelta += Math.pow(2, 64);
|
||||
}
|
||||
if (txDelta < 0) {
|
||||
txDelta += Math.pow(2, 64);
|
||||
}
|
||||
|
||||
// Calculate speeds
|
||||
root._downloadSpeed = rxDelta / timeDelta;
|
||||
root._uploadSpeed = txDelta / timeDelta;
|
||||
|
||||
if (root._downloadSpeed >= 0 && isFinite(root._downloadSpeed))
|
||||
_downloadBuffer.push(root._downloadSpeed);
|
||||
|
||||
if (root._uploadSpeed >= 0 && isFinite(root._uploadSpeed))
|
||||
_uploadBuffer.push(root._uploadSpeed);
|
||||
}
|
||||
|
||||
// Calculate totals with overflow handling
|
||||
let downTotal = data.rx - root._initialRxBytes;
|
||||
let upTotal = data.tx - root._initialTxBytes;
|
||||
|
||||
// Handle counter overflow for totals
|
||||
if (downTotal < 0) {
|
||||
downTotal += Math.pow(2, 64);
|
||||
}
|
||||
if (upTotal < 0) {
|
||||
upTotal += Math.pow(2, 64);
|
||||
}
|
||||
|
||||
root._downloadTotal = downTotal;
|
||||
root._uploadTotal = upTotal;
|
||||
|
||||
root._prevRxBytes = data.rx;
|
||||
root._prevTxBytes = data.tx;
|
||||
root._prevTimestamp = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,13 @@ Singleton {
|
||||
id: root
|
||||
|
||||
readonly property bool enabled: service.enabled
|
||||
readonly property int end: Config.general.color.scheduleHyprsunsetEnd
|
||||
readonly property int end: Config.display.nightlight.scheduleEnd
|
||||
property bool manualToggle: false
|
||||
readonly property int start: Config.general.color.scheduleHyprsunsetStart
|
||||
readonly property int temp: Config.general.color.hyprsunsetTemp
|
||||
readonly property int start: Config.display.nightlight.scheduleStart
|
||||
readonly property int temp: Config.display.nightlight.temp
|
||||
|
||||
function checkStartup(): void {
|
||||
if (!Config.general.color.scheduleHyprsunset)
|
||||
if (!Config.display.nightlight.schedule)
|
||||
return;
|
||||
|
||||
service.apply();
|
||||
@@ -26,12 +26,14 @@ Singleton {
|
||||
service.toggle();
|
||||
}
|
||||
|
||||
HyprsunsetManager {
|
||||
NightlightManager {
|
||||
id: service
|
||||
|
||||
activeAuto: Config.general.color.scheduleHyprsunset
|
||||
activeAuto: Config.display.nightlight.schedule
|
||||
endTime: root.end
|
||||
startTime: root.start
|
||||
temp: root.temp
|
||||
fadeDuration: Config.display.nightlight.fadeDuration / 1000
|
||||
useNativeNightlight: Config.display.nightlight.useNative
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -42,7 +42,7 @@ Item {
|
||||
readonly property real scaleRatio: Hypr.monitorFor(screen).scale
|
||||
required property ShellScreen screen
|
||||
property real sh: Math.abs(sy - ey)
|
||||
readonly property color shadowColor: Hypr.options.decoration.shadow.color
|
||||
readonly property color shadowColor: Hypr.options.decoration.shadow?.color ?? "black"
|
||||
readonly property bool shadowEnabled: Hypr.options.decoration.shadow.enabled
|
||||
readonly property var shadowOffset: Hypr.options.decoration.shadow.offset
|
||||
readonly property int shadowRange: Hypr.options.decoration.shadow.range
|
||||
|
||||
@@ -73,7 +73,7 @@ CustomRect {
|
||||
required property var modelData
|
||||
|
||||
color: root.tool === modelData.id ? "#3584e4" : "transparent"
|
||||
font.pointSize: Tokens.font.size.large
|
||||
font: Tokens.font.icon.medium
|
||||
icon: tool.modelData.glyph
|
||||
inactiveColor: root.tool === modelData.id ? Colors.palette.m3primary : "transparent"
|
||||
inactiveOnColor: root.tool === modelData.id ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
@@ -103,7 +103,7 @@ CustomRect {
|
||||
required property color modelData
|
||||
|
||||
fillWidth: false
|
||||
font.pointSize: Tokens.font.size.large
|
||||
font: Tokens.font.icon.medium
|
||||
icon: ""
|
||||
implicitHeight: buttonSize
|
||||
implicitWidth: buttonSize
|
||||
@@ -128,7 +128,7 @@ CustomRect {
|
||||
spacing: Tokens.spacing.extraSmall
|
||||
|
||||
IconButton {
|
||||
font.pointSize: Tokens.font.size.large
|
||||
font: Tokens.font.icon.medium
|
||||
icon: "undo"
|
||||
inactiveColor: "transparent"
|
||||
inactiveOnColor: Colors.palette.m3onSurface
|
||||
@@ -140,7 +140,7 @@ CustomRect {
|
||||
}
|
||||
|
||||
IconButton {
|
||||
font.pointSize: Tokens.font.size.large
|
||||
font: Tokens.font.icon.medium
|
||||
icon: "delete_history"
|
||||
inactiveColor: "transparent"
|
||||
inactiveOnColor: Colors.palette.m3onSurface
|
||||
@@ -152,7 +152,7 @@ CustomRect {
|
||||
}
|
||||
|
||||
IconButton {
|
||||
font.pointSize: Tokens.font.size.large
|
||||
font: Tokens.font.icon.medium
|
||||
icon: "content_copy"
|
||||
inactiveColor: "transparent"
|
||||
inactiveOnColor: Colors.palette.m3onSurface
|
||||
@@ -164,7 +164,7 @@ CustomRect {
|
||||
}
|
||||
|
||||
IconButton {
|
||||
font.pointSize: Tokens.font.size.large
|
||||
font: Tokens.font.icon.medium
|
||||
icon: "delete_forever"
|
||||
inactiveColor: "transparent"
|
||||
inactiveOnColor: Colors.palette.m3onSurface
|
||||
@@ -176,7 +176,7 @@ CustomRect {
|
||||
}
|
||||
|
||||
IconButton {
|
||||
font.pointSize: Tokens.font.size.large
|
||||
font: Tokens.font.icon.medium
|
||||
icon: "check"
|
||||
inactiveColor: "transparent"
|
||||
inactiveOnColor: Colors.palette.m3onSurface
|
||||
|
||||
@@ -5,6 +5,15 @@ import Quickshell
|
||||
Singleton {
|
||||
property var _regexCache: ({})
|
||||
|
||||
function percent(value: int): string {
|
||||
// TRANSLATORS: %1 = a number
|
||||
return qsTr("%1%").arg(value);
|
||||
}
|
||||
|
||||
function percentOne(value: real): string {
|
||||
return percent(Math.round(value * 100));
|
||||
}
|
||||
|
||||
function testRegexList(filterList: list<string>, target: string): bool {
|
||||
const regexChecker = /^\^.*\$$/;
|
||||
for (const filter of filterList) {
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
property var bars: new Map()
|
||||
property var screens: new Map()
|
||||
|
||||
function getForActive(): PersistentProperties {
|
||||
return screens.get(Hypr.focusedMonitor);
|
||||
}
|
||||
|
||||
function load(screen: ShellScreen, visibilities: var): void {
|
||||
screens.set(Hypr.monitorFor(screen), visibilities);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ Searcher {
|
||||
previewPath = path;
|
||||
showPreview = true;
|
||||
|
||||
if (Config.general.color.schemeGeneration)
|
||||
if (Config.colors.schemeGen)
|
||||
previewColorsProc.running = true;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ Searcher {
|
||||
WallpaperPath.currentWallpaperPath = path;
|
||||
Quickshell.screens.forEach(n => setCrop(n.name, Qt.rect(0, 0, 1, 1), 1.0));
|
||||
Quickshell.execDetached(["zshell-cli", "wallpaper", "lockscreen", "--input-image", `${root.actualCurrent}`, "--output-path", `${Paths.state}/lockscreen_bg.png`, "--blur-amount", `${Config.lock.blurAmount}`]);
|
||||
if (Config.general.color.schemeGeneration)
|
||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${root.actualCurrent}`, "--scheme", `${Config.colors.schemeType}`, "--mode", `${Config.general.color.mode}`]);
|
||||
if (Config.colors.schemeGen)
|
||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${root.actualCurrent}`, "--scheme", `${Config.colors.schemeType}`, "--mode", `${Config.colors.mode}`]);
|
||||
}
|
||||
|
||||
function stopPreview(): void {
|
||||
|
||||
+28
-7
@@ -3,25 +3,36 @@ pragma Singleton
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import ZShell
|
||||
import ZShell.Internal
|
||||
import ZShell.Config
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
readonly property var cachedCities: new Map()
|
||||
property var cc
|
||||
property string city
|
||||
readonly property string description: cc?.weatherDesc ?? qsTr("No weather")
|
||||
readonly property string feelsLike: formatTemp(cc?.feelsLikeC)
|
||||
property list<var> forecast
|
||||
property list<var> hourlyForecast
|
||||
readonly property int humidity: cc?.humidity ?? 0
|
||||
readonly property string icon: cc ? Icons.getWeatherIcon(cc.weatherCode) : "cloud_alert"
|
||||
property string loc
|
||||
readonly property string sunrise: cc ? Qt.formatDateTime(new Date(cc.sunrise), Config.services.useTwelveHourClock ? "h:mm A" : "h:mm") : "--:--"
|
||||
readonly property string sunset: cc ? Qt.formatDateTime(new Date(cc.sunset), Config.services.useTwelveHourClock ? "h:mm A" : "h:mm") : "--:--"
|
||||
readonly property string temp: formatTemp(cc?.tempC)
|
||||
readonly property real windSpeed: cc?.windSpeed ?? 0
|
||||
readonly property CircularBuffer precipitationForecast: precipitationBuffer
|
||||
|
||||
property var cc
|
||||
property string city
|
||||
property list<var> forecast
|
||||
property list<var> hourlyForecast
|
||||
readonly property int currentHourIndex: {
|
||||
const now = new Date();
|
||||
for (let i = 0; i < hourlyForecast.length; i++) {
|
||||
if (new Date(hourlyForecast[i].timestamp.replace("T", " ")) >= now)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
property string loc
|
||||
|
||||
function fetchCityFromCoords(coords: string): void {
|
||||
if (cachedCities.has(coords)) {
|
||||
@@ -112,11 +123,12 @@ Singleton {
|
||||
forecast = forecastList;
|
||||
|
||||
const hourlyList = [];
|
||||
const now = new Date();
|
||||
const startOfToday = new Date();
|
||||
startOfToday.setHours(0, 0, 0, 0);
|
||||
for (let i = 0; i < json.hourly.time.length; i++) {
|
||||
const time = new Date(json.hourly.time[i].replace("T", " "));
|
||||
|
||||
if (time < now)
|
||||
if (time < startOfToday)
|
||||
continue;
|
||||
|
||||
hourlyList.push({
|
||||
@@ -129,6 +141,10 @@ Singleton {
|
||||
});
|
||||
}
|
||||
hourlyForecast = hourlyList;
|
||||
precipitationBuffer.clear();
|
||||
|
||||
for (const hour of hourlyList)
|
||||
precipitationBuffer.push(hour.precipChance);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -258,6 +274,11 @@ Singleton {
|
||||
|
||||
onLocChanged: fetchWeatherData()
|
||||
|
||||
CircularBuffer {
|
||||
id: precipitationBuffer
|
||||
capacity: 24
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onWeatherLocationChanged(): void {
|
||||
root.reload();
|
||||
|
||||
Reference in New Issue
Block a user