Redesign Display Settings, Wallpapers, Booru; add System Monitor, Weather

Display Settings: drag-to-arrange multi-monitor canvas with edge
snapping (locked when only one screen is connected), 8/10-bit depth,
color management presets (sRGB/Wide/EDID/HDR+EDID), SDR
brightness/saturation, ICC profile path, VRR toggle. display-set now
takes a single pre-built descriptor instead of a fixed positional arg
list, since Hyprland's monitor keyword grew well past that.

Wallpapers: fixed the current-wallpaper highlight never loading on
open, added real first-frame thumbnails for animated wallpapers
(wallpaper-thumbs + ffmpeg), bigger 2-column grid, filename filter.

Booru: separate downloads folder from Wallpapers so browsing doesn't
clutter the wallpaper picker, bigger grid, Safe/Moderate/Explicit
rating tiers replacing the old binary toggle, sort order (Newest/
Score/Random). Fixed pagination being completely broken (a Flow
anchor violation was silently disabling the whole layout) and
Danbooru's Random sort (order:random tag times out server-side --
switched to their random=true endpoint for that case).

Wi-Fi panel: added a "Scanning.../No networks found" state and a
manual rescan button -- previously showed nothing either way, making
"still scanning" indistinguishable from a real failure.

Bluetooth: auto-scans on open like Wi-Fi now, instead of requiring a
manual click every time.

New: System Monitor panel (CPU/RAM/GPU/VRAM/disk usage, NVIDIA or AMD
detected automatically) and Weather panel (IP-geolocated or a typed
city, current + hourly forecast, Open-Meteo, no API key) with a
compact taskbar badge.
This commit is contained in:
Nexoniarz 2026-08-30 20:55:06 +02:00
commit aa89dd729c
10 changed files with 1729 additions and 114 deletions

View file

@ -1,6 +1,7 @@
import QtQuick
import Quickshell
import Quickshell.Hyprland
import Quickshell.Io
import Quickshell.Wayland
import Quickshell.Widgets
@ -168,6 +169,100 @@ PanelWindow {
color: Theme.border
}
// --- Weather badge ---------------------------------------------------
// Independent of RightFlyout's own weatherPanel (which only exists
// while the Loader has it active) — this needs to keep showing a
// temperature even when the panel's closed, so it fetches on its own
// timer rather than reading state from a panel instance that mostly
// doesn't exist. Reads the same city override (if any) so the badge
// and the full panel never disagree about which location they're
// showing.
Item {
id: wxBadgeState
property var data: ({})
property bool haveData: !!data.current
property string city: ""
function describeIcon(code) {
if (code === 0) return "☀";
if (code === 1) return "🌤";
if (code === 2) return "⛅";
if (code === 3) return "☁";
if (code === 45 || code === 48) return "🌫";
if (code >= 51 && code <= 57) return "🌦";
if (code >= 61 && code <= 67) return "🌧";
if (code >= 71 && code <= 77) return "❄";
if (code >= 80 && code <= 82) return "🌧";
if (code === 85 || code === 86) return "🌨";
if (code >= 95) return "⛈";
return "?";
}
Process {
id: wxBadgeCityLoadProc
command: ["cat", Quickshell.stateDir + "/weather-settings.json"]
stdout: StdioCollector {
onStreamFinished: {
try {
var d = JSON.parse(text);
if (d.city) wxBadgeState.city = d.city;
} catch (e) { /* no override saved — auto-detect stands */ }
wxBadgeFetchProc.command = wxBadgeState.city.length > 0
? ["weather-fetch", wxBadgeState.city] : ["weather-fetch"];
wxBadgeFetchProc.running = true;
}
}
}
Process {
id: wxBadgeFetchProc
stdout: StdioCollector {
onStreamFinished: {
try { wxBadgeState.data = JSON.parse(text); } catch (e) { /* keep last good reading */ }
}
}
}
Timer {
interval: 900000
running: true
repeat: true
onTriggered: wxBadgeCityLoadProc.running = true
}
Component.onCompleted: wxBadgeCityLoadProc.running = true
}
Rectangle {
id: weatherBadge
visible: wxBadgeState.haveData
anchors.right: rightToggle.left
anchors.rightMargin: 8
anchors.verticalCenter: parent.verticalCenter
width: wxBadgeLabel.implicitWidth + 16
height: 32
color: wxBadgeMa.containsMouse ? Theme.bgAlt : "transparent"
border.width: 1
border.color: Theme.border
Text {
id: wxBadgeLabel
anchors.centerIn: parent
text: wxBadgeState.haveData
? (wxBadgeState.describeIcon(wxBadgeState.data.current.weather_code) + " " + Math.round(wxBadgeState.data.current.temperature_2m) + "°C")
: ""
color: Theme.fg
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
}
MouseArea {
id: wxBadgeMa
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
root.rightBar.expanded = true;
root.rightBar.toggle("weather");
}
}
}
// --- Right bar toggle ---------------------------------------------
Rectangle {
id: rightToggle
@ -202,7 +297,7 @@ PanelWindow {
Row {
anchors.left: parent.left
anchors.leftMargin: 8 + 32 + 8 + (root.workspacePills.length * 36) + 16
anchors.right: rightToggle.left
anchors.right: weatherBadge.left
anchors.rightMargin: 8
anchors.verticalCenter: parent.verticalCenter
spacing: 4

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
import QtQuick
// Read-only horizontal usage bar — CPU/RAM/GPU/VRAM/disk meters in the
// System Monitor panel all need the same "filled fraction of a track"
// visual, just with a different value/color each time.
Item {
id: root
property real value: 0 // 0..1
property color barColor: Theme.accent
implicitHeight: 8
Rectangle {
anchors.fill: parent
color: Theme.bgAlt
border.width: 1
border.color: Theme.borderDim
}
Rectangle {
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.margins: 1
width: Math.max(0, (parent.width - 2) * Math.min(1, Math.max(0, root.value)))
color: root.barColor
}
}

View file

@ -173,6 +173,16 @@ PanelWindow {
active: root.activePanel === "devices"
onClicked: root.toggle("devices")
}
SidebarRow {
label: "System Monitor"
active: root.activePanel === "system"
onClicked: root.toggle("system")
}
SidebarRow {
label: "Weather"
active: root.activePanel === "weather"
onClicked: root.toggle("weather")
}
}
}

View file

@ -24,6 +24,8 @@ Rectangle {
volume: "Volume",
brightness: "Brightness",
devices: "Devices",
system: "System Monitor",
weather: "Weather",
power: "Power"
})
@ -87,6 +89,8 @@ Rectangle {
case "volume": return volumePanel;
case "brightness": return brightnessPanel;
case "devices": return devicesPanel;
case "system": return systemPanel;
case "weather": return weatherPanel;
case "power": return powerPanel;
default: return emptyPanel;
}
@ -142,6 +146,19 @@ Rectangle {
font.pixelSize: 11
}
// Hardware/rfkill state isn't reflected by wifiEnabled at all — without
// this, a soft- or hardware-killed adapter just looks identical to "no
// networks in range" with no way to tell the two apart.
Text {
visible: !Networking.wifiHardwareEnabled
text: "Wi-Fi is disabled in hardware (check airplane mode / rfkill switch)"
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
wrapMode: Text.WordWrap
width: parent.width
}
Repeater {
model: Networking.devices
delegate: Column {
@ -149,11 +166,43 @@ Rectangle {
spacing: 4
property var device: modelData
// Wired devices report a single phantom "network" entry with no
// signal strength, so detect Wi-Fi by scannerEnabled (only WifiDevice
// has that property) instead of by networks-list emptiness.
property bool isWifi: device.scannerEnabled !== undefined
// The plugin exposes no "scan in progress" signal, just the
// scannerEnabled bool — so this is a grace-period guess, not a
// real status readout. Good enough to stop "no networks yet"
// from looking identical to "scan came back empty", which is
// what made this look like a silent bug before.
property bool scanning: false
Timer {
id: scanGrace
interval: 4000
onTriggered: scanning = false
}
// Turn on active scanning while this panel is open so
// the network list shows more than just whatever we're
// already connected to.
Component.onCompleted: if (device.scannerEnabled !== undefined) device.scannerEnabled = true;
Component.onDestruction: if (device.scannerEnabled !== undefined) device.scannerEnabled = false;
Component.onCompleted: if (isWifi) { device.scannerEnabled = true; scanning = true; scanGrace.restart(); }
Component.onDestruction: if (isWifi) device.scannerEnabled = false;
// NetworkManager throttles RequestScan, so a bare re-toggle right
// after the last one can be silently ignored — this is still just
// a best-effort nudge, not a guaranteed fresh scan.
function rescan() {
device.scannerEnabled = false;
scanning = true;
scanGrace.restart();
rescanRestart.start();
}
Timer {
id: rescanRestart
interval: 150
onTriggered: device.scannerEnabled = true
}
Text {
text: device.name
@ -162,10 +211,27 @@ Rectangle {
font.pixelSize: 10
}
// Wired devices report a single phantom "network" entry with no
// signal strength, so detect Wi-Fi by scannerEnabled (only WifiDevice
// has that property) instead of by networks-list emptiness.
property bool isWifi: device.scannerEnabled !== undefined
Rectangle {
visible: isWifi
width: loader.width
height: 26
color: rescanMa.containsMouse ? Theme.bgAlt : "transparent"
border.width: 1
border.color: Theme.borderDim
Text {
anchors.centerIn: parent
text: scanning ? "Scanning…" : "Rescan"
color: scanning ? Theme.accent : Theme.fg
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
}
MouseArea {
id: rescanMa
anchors.fill: parent
hoverEnabled: true
onClicked: rescan()
}
}
// Non-Wi-Fi devices — show link state directly instead of a list.
Rectangle {
@ -192,6 +258,14 @@ Rectangle {
}
}
Text {
visible: isWifi && (!device.networks || device.networks.values.length === 0)
text: scanning ? "Scanning…" : "No networks found"
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
}
Repeater {
model: (isWifi && device.networks) ? device.networks : []
delegate: Rectangle {
@ -633,6 +707,22 @@ Rectangle {
width: loader.width
property var selected: null
// Same reasoning as the Wi-Fi panel's per-device scannerEnabled
// toggle — auto-start scanning while the panel is open instead
// of requiring a manual click every time, then stop when it
// closes so the adapter isn't left discovering in the background.
// Qt.callLater, not a direct write: writing `discovering` in the
// same tick this Column is constructed was silently dropped
// (verified against BlueZ directly over D-Bus — Discovering
// stayed false) even though the identical write from the
// manual "Scan for devices" button works fine; deferring one
// event-loop tick gives Quickshell's Bluetooth adapter wrapper
// time to finish attaching before the write goes out.
Component.onCompleted: Qt.callLater(function () {
if (Bluetooth.defaultAdapter && Bluetooth.defaultAdapter.enabled) Bluetooth.defaultAdapter.discovering = true;
});
Component.onDestruction: if (Bluetooth.defaultAdapter) Bluetooth.defaultAdapter.discovering = false;
// --- List view ---------------------------------------------
Column {
visible: btCol.selected === null
@ -1441,6 +1531,491 @@ Rectangle {
}
}
// --- System Monitor -------------------------------------------------------
// One process invocation per poll (system-telemetry, modules/scripts/
// system-telemetry.sh) instead of separate Process objects per metric —
// it reads /proc/stat twice 200ms apart internally to compute CPU%,
// /proc/meminfo for RAM, nvidia-smi or the AMD sysfs counters for GPU/
// VRAM (whichever's actually present), and `df -h` for / and /home —
// and returns it all as one JSON line.
Component {
id: systemPanel
Column {
id: sysCol
width: loader.width
spacing: 14
property var stats: ({})
property bool haveData: Object.keys(sysCol.stats).length > 0
Timer {
interval: 2000
running: true
repeat: true
triggeredOnStart: true
onTriggered: if (!telemetryProc.running) telemetryProc.running = true
}
Process {
id: telemetryProc
command: ["system-telemetry"]
stdout: StdioCollector {
onStreamFinished: {
try { sysCol.stats = JSON.parse(text); } catch (e) { /* keep last good reading */ }
}
}
}
Text {
visible: !sysCol.haveData
text: "Reading system stats..."
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
}
// -- CPU --
Column {
visible: sysCol.haveData
width: sysCol.width
spacing: 4
Item {
width: parent.width
height: 16
Text {
anchors.left: parent.left
text: "CPU"
color: Theme.fg
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
font.bold: true
}
Text {
anchors.right: parent.right
text: (sysCol.stats.cpuPct !== undefined ? sysCol.stats.cpuPct : 0) + "%"
color: Theme.accent
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
}
}
Meter { width: parent.width; value: (sysCol.stats.cpuPct || 0) / 100 }
}
// -- RAM --
Column {
visible: sysCol.haveData
width: sysCol.width
spacing: 4
Item {
width: parent.width
height: 16
Text {
anchors.left: parent.left
text: "Memory"
color: Theme.fg
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
font.bold: true
}
Text {
anchors.right: parent.right
text: ((sysCol.stats.memUsedKb || 0) / 1048576).toFixed(1) + " / "
+ ((sysCol.stats.memTotalKb || 0) / 1048576).toFixed(1) + " GB"
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
}
}
Meter {
width: parent.width
value: sysCol.stats.memTotalKb > 0 ? sysCol.stats.memUsedKb / sysCol.stats.memTotalKb : 0
}
}
// -- GPU / VRAM --
Text {
visible: sysCol.haveData && (sysCol.stats.gpuPct === undefined || sysCol.stats.gpuPct < 0)
text: "No GPU metrics available"
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
}
Column {
visible: sysCol.haveData && sysCol.stats.gpuPct >= 0
width: sysCol.width
spacing: 4
Item {
width: parent.width
height: 16
Text {
anchors.left: parent.left
text: "GPU"
color: Theme.fg
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
font.bold: true
}
Text {
anchors.right: parent.right
text: (sysCol.stats.gpuPct !== undefined ? sysCol.stats.gpuPct : 0) + "%"
color: Theme.accent
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
}
}
Meter { width: parent.width; value: (sysCol.stats.gpuPct || 0) / 100 }
}
Column {
visible: sysCol.haveData && sysCol.stats.vramTotalMb > 0
width: sysCol.width
spacing: 4
Item {
width: parent.width
height: 16
Text {
anchors.left: parent.left
text: "VRAM"
color: Theme.fg
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
font.bold: true
}
Text {
anchors.right: parent.right
text: (sysCol.stats.vramUsedMb || 0) + " / " + (sysCol.stats.vramTotalMb || 0) + " MB"
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
}
}
Meter {
width: parent.width
value: sysCol.stats.vramTotalMb > 0 ? sysCol.stats.vramUsedMb / sysCol.stats.vramTotalMb : 0
}
}
// -- Disks --
Column {
visible: sysCol.haveData && sysCol.stats.disks && sysCol.stats.disks.length > 0
width: sysCol.width
spacing: 8
Text {
text: "STORAGE"
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 9
font.bold: true
}
Repeater {
model: sysCol.stats.disks || []
delegate: Column {
width: parent.width
spacing: 4
property var disk: modelData
Item {
width: parent.width
height: 16
Text {
anchors.left: parent.left
text: disk.mount
color: Theme.fg
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
}
Text {
anchors.right: parent.right
text: disk.used + " / " + disk.size
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
}
}
Meter { width: parent.width; value: (parseFloat(disk.pct) || 0) / 100 }
}
}
}
}
}
// --- Weather ---------------------------------------------------------
// weather-fetch (modules/scripts/weather-fetch.sh) does the actual
// network work — IP-geolocates via ip-api.com by default (or geocodes
// an explicitly typed city via Open-Meteo's own geocoding endpoint),
// then pulls current + hourly conditions from Open-Meteo. Both are
// free and keyless, matching curl everywhere else in this file rather
// than QML's own networking (Image loads already had to route around
// 403s from a CDN that didn't like Qt's request fingerprint — curl
// has been the reliable path for every other external fetch here).
Component {
id: weatherPanel
Column {
id: wxCol
width: loader.width
spacing: 12
property var forecast: ({})
property bool haveData: !!wxCol.forecast.current
property bool hasError: !!wxCol.forecast.error
Item {
id: wxSettings
property string city: ""
property string stateFile: Quickshell.stateDir + "/weather-settings.json"
function save() {
wxSaveProc.command = ["sh", "-c",
"mkdir -p \"$(dirname \"$2\")\" && printf '%s' \"$1\" > \"$2\"",
"--", JSON.stringify({ city: wxSettings.city }), wxSettings.stateFile];
wxSaveProc.running = true;
}
Process { id: wxSaveProc }
Process {
id: wxLoadProc
command: ["cat", wxSettings.stateFile]
stdout: StdioCollector {
onStreamFinished: {
try {
var d = JSON.parse(text);
if (d.city !== undefined) wxSettings.city = d.city;
} catch (e) { /* no state file yet — defaults stand */ }
wxCol.refresh();
}
}
}
Component.onCompleted: wxLoadProc.running = true
}
function refresh() {
fetchProc.command = wxSettings.city.length > 0
? ["weather-fetch", wxSettings.city] : ["weather-fetch"];
fetchProc.running = true;
}
Process {
id: fetchProc
stdout: StdioCollector {
onStreamFinished: {
try { wxCol.forecast = JSON.parse(text); } catch (e) { wxCol.forecast = { error: "bad response" }; }
}
}
}
// Open-Meteo's current reading updates roughly every 15
// minutes on their end — polling faster would just repeat the
// same numbers.
Timer { interval: 900000; running: true; repeat: true; onTriggered: wxCol.refresh() }
// WMO weather codes -> a short label + a plain Unicode symbol
// (not a Nerd Font glyph — those need exact codepoints from
// the specific icon set and guessing wrong renders as a
// tofu box; these are plain emoji, safe under any font with
// emoji fallback, which every font on this system has).
function describeCode(code) {
if (code === 0) return { label: "Clear sky", icon: "☀" };
if (code === 1) return { label: "Mostly clear", icon: "🌤" };
if (code === 2) return { label: "Partly cloudy", icon: "⛅" };
if (code === 3) return { label: "Overcast", icon: "☁" };
if (code === 45 || code === 48) return { label: "Fog", icon: "🌫" };
if (code >= 51 && code <= 57) return { label: "Drizzle", icon: "🌦" };
if (code >= 61 && code <= 67) return { label: "Rain", icon: "🌧" };
if (code >= 71 && code <= 77) return { label: "Snow", icon: "❄" };
if (code >= 80 && code <= 82) return { label: "Showers", icon: "🌧" };
if (code === 85 || code === 86) return { label: "Snow showers", icon: "🌨" };
if (code >= 95) return { label: "Thunderstorm", icon: "⛈" };
return { label: "Unknown", icon: "?" };
}
// -- City search (blank = auto IP-geolocate) --
Row {
width: wxCol.width
spacing: 6
Rectangle {
width: parent.width - 66
height: 30
color: Theme.bgAlt
border.width: 1
border.color: Theme.border
TextInput {
id: cityInput
anchors.fill: parent
anchors.margins: 8
text: wxSettings.city
onTextEdited: wxSettings.city = text
color: Theme.fg
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
clip: true
Keys.onReturnPressed: { wxSettings.save(); wxCol.forecast = {}; wxCol.refresh(); }
Text {
visible: cityInput.text.length === 0
text: "City (blank = auto-detect)"
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
}
}
}
Rectangle {
width: 60
height: 30
color: wxSearchMa.containsMouse ? Theme.bgAlt : "transparent"
border.width: 1
border.color: Theme.accent
Text {
anchors.centerIn: parent
text: "Set"
color: Theme.accent
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
}
MouseArea {
id: wxSearchMa
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: { wxSettings.save(); wxCol.forecast = {}; wxCol.refresh(); }
}
}
}
Text {
visible: !wxCol.haveData && !wxCol.hasError
text: "Loading weather..."
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
}
Text {
visible: wxCol.hasError
text: "Couldn't load weather — check the city name or try again later."
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
wrapMode: Text.WordWrap
width: wxCol.width
}
// -- Current conditions --
Column {
visible: wxCol.haveData
width: wxCol.width
spacing: 4
Text {
text: [wxCol.forecast.place, wxCol.forecast.country].filter((s) => s && s.length > 0).join(", ")
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 10
}
Row {
spacing: 12
Text {
text: wxCol.haveData ? wxCol.describeCode(wxCol.forecast.current.weather_code).icon : ""
font.pixelSize: 40
}
Column {
anchors.verticalCenter: parent.verticalCenter
spacing: 2
Text {
text: wxCol.haveData ? Math.round(wxCol.forecast.current.temperature_2m) + "°C" : ""
color: Theme.fg
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 24
font.bold: true
}
Text {
text: wxCol.haveData ? wxCol.describeCode(wxCol.forecast.current.weather_code).label : ""
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
}
}
}
Row {
spacing: 16
Text {
text: wxCol.haveData ? ("Wind: " + wxCol.forecast.current.wind_speed_10m + " km/h") : ""
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 10
}
Text {
text: wxCol.haveData ? ("Precip: " + wxCol.forecast.current.precipitation + " mm") : ""
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 10
}
}
}
Rectangle { visible: wxCol.haveData; width: wxCol.width; height: 1; color: Theme.borderDim }
// -- Hourly forecast timeline --
Column {
visible: wxCol.haveData && !!wxCol.forecast.hourly
width: wxCol.width
spacing: 8
Text {
text: "NEXT HOURS"
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 9
font.bold: true
}
Flow {
width: wxCol.width
spacing: 6
Repeater {
// Only future hours from "now" — Open-Meteo's hourly
// array starts at local midnight, not the current
// hour, so without this the timeline would open
// showing most of a day that's already passed.
model: {
if (!wxCol.haveData || !wxCol.forecast.hourly) return [];
var nowIso = wxCol.forecast.current.time.substring(0, 13);
var times = wxCol.forecast.hourly.time;
var startIdx = 0;
for (var i = 0; i < times.length; i++) {
if (times[i].substring(0, 13) >= nowIso) { startIdx = i; break; }
}
var out = [];
for (var j = startIdx; j < Math.min(startIdx + 8, times.length); j++) out.push(j);
return out;
}
delegate: Rectangle {
property int idx: modelData
width: (wxCol.width - 30) / 4
height: 64
color: Theme.bgAlt
border.width: 1
border.color: Theme.borderDim
Column {
anchors.centerIn: parent
spacing: 2
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: wxCol.forecast.hourly.time[idx].substring(11, 16)
color: Theme.fgDim
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 9
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: wxCol.describeCode(wxCol.forecast.hourly.weather_code[idx]).icon
font.pixelSize: 16
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: Math.round(wxCol.forecast.hourly.temperature_2m[idx]) + "°"
color: Theme.fg
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
font.bold: true
}
}
}
}
}
}
}
}
// --- Power -------------------------------------------------------
Component {
id: powerPanel

View file

@ -9,6 +9,7 @@ let
wallpaperSet = pkgs.writeShellScriptBin "wallpaper-set" (builtins.readFile ./scripts/wallpaper-set.sh);
wallpaperDelete = pkgs.writeShellScriptBin "wallpaper-delete" (builtins.readFile ./scripts/wallpaper-delete.sh);
wallpaperRestore = pkgs.writeShellScriptBin "wallpaper-restore" (builtins.readFile ./scripts/wallpaper-restore.sh);
wallpaperThumbs = pkgs.writeShellScriptBin "wallpaper-thumbs" (builtins.readFile ./scripts/wallpaper-thumbs.sh);
displaySet = pkgs.writeShellScriptBin "display-set" (builtins.readFile ./scripts/display-set.sh);
hyprThemeSet = pkgs.writeShellScriptBin "hypr-theme-set" (builtins.readFile ./scripts/hypr-theme-set.sh);
gtkThemeSet = pkgs.writeShellScriptBin "gtk-theme-set" (builtins.readFile ./scripts/gtk-theme-set.sh);
@ -20,6 +21,8 @@ let
cursorSet = pkgs.writeShellScriptBin "cursor-set" (builtins.readFile ./scripts/cursor-set.sh);
screenshot = pkgs.writeShellScriptBin "screenshot" (builtins.readFile ./scripts/screenshot.sh);
hotspotStart = pkgs.writeShellScriptBin "hotspot-start" (builtins.readFile ./scripts/hotspot-start.sh);
systemTelemetry = pkgs.writeShellScriptBin "system-telemetry" (builtins.readFile ./scripts/system-telemetry.sh);
weatherFetch = pkgs.writeShellScriptBin "weather-fetch" (builtins.readFile ./scripts/weather-fetch.sh);
in
{
# Install CLI dependencies required by the scripts
@ -34,6 +37,7 @@ in
wallpaperSet
wallpaperDelete
wallpaperRestore
wallpaperThumbs
displaySet
hyprThemeSet
gtkThemeSet
@ -45,5 +49,7 @@ in
cursorSet
screenshot
hotspotStart
systemTelemetry
weatherFetch
];
}

View file

@ -1,23 +1,27 @@
#!/usr/bin/env bash
# Applies a monitor mode/position/scale/transform immediately (hyprctl)
# AND persists it into ~/.config/hypr/display.conf, which hyprland.conf
# sources — without that file, hyprland.conf's generic fallback rule
# Applies a full monitor descriptor immediately (hyprctl) AND persists it
# into ~/.config/hypr/display.conf, which hyprland.conf sources — without
# that file, hyprland.conf's generic fallback rule
# ("monitor = , preferred, auto, 1") is the only thing on record, and
# ANYTHING that makes Hyprland re-evaluate monitor state (observed: even
# changing the cursor theme via `hyprctl setcursor` does this) reapplies
# that fallback, silently dropping back to "preferred" refresh rate
# instead of whatever the user actually picked.
#
# Takes the monitor name and everything after it as one pre-built
# descriptor string (mode,position,scale + optional transform/bitdepth/
# cm/sdrbrightness/sdrsaturation/vrr/icc keyword,value pairs) rather than
# fixed positional args — Hyprland's own `monitor` keyword syntax grew
# past "mode/x/y/scale/transform" (color management, HDR, VRR, ICC), and
# the caller (LeftFlyout.qml's Displays panel) already has all of that as
# structured state, so it's simpler for it to build the one string than
# for this script to accept a growing positional argument list.
set -euo pipefail
mon="${1:?usage: display-set <monitor> <mode> <x> <y> <scale> [transform]}"
mode="${2:?mode required}"
x="${3:?x required}"
y="${4:?y required}"
scale="${5:?scale required}"
transform="${6:-0}"
mon="${1:?usage: display-set <monitor> <descriptor-tail>}"
descriptor_tail="${2:?descriptor required}"
descriptor="$mon,$mode,${x}x${y},$scale"
[ "$transform" != "0" ] && descriptor="$descriptor,transform,$transform"
descriptor="$mon,$descriptor_tail"
conf="$HOME/.config/hypr/display.conf"
mkdir -p "$(dirname "$conf")"

View file

@ -0,0 +1,62 @@
#!/usr/bin/env bash
# Single-shot system telemetry snapshot — CPU/RAM/GPU/VRAM/disk usage — as
# one JSON object, so the Quickshell System panel can poll this on a Timer
# instead of spawning half a dozen separate processes every tick.
set -euo pipefail
# --- CPU ---
# /proc/stat's first line ("cpu ...") is cumulative jiffies since boot —
# computing instantaneous usage needs two samples across a short gap, so
# both reads happen inside this one invocation rather than needing
# cross-poll state kept on the QML side.
read_cpu() {
read -r _ user nice system idle iowait irq softirq steal _ < /proc/stat
echo "$((user + nice + system + irq + softirq + steal)) $((user + nice + system + idle + iowait + irq + softirq + steal))"
}
read -r cpu_busy1 cpu_total1 <<< "$(read_cpu)"
sleep 0.2
read -r cpu_busy2 cpu_total2 <<< "$(read_cpu)"
cpu_busy_delta=$((cpu_busy2 - cpu_busy1))
cpu_total_delta=$((cpu_total2 - cpu_total1))
cpu_pct=0
[ "$cpu_total_delta" -gt 0 ] && cpu_pct=$((100 * cpu_busy_delta / cpu_total_delta))
# --- RAM ---
mem_total_kb=$(awk '/^MemTotal:/{print $2}' /proc/meminfo)
mem_avail_kb=$(awk '/^MemAvailable:/{print $2}' /proc/meminfo)
mem_used_kb=$((mem_total_kb - mem_avail_kb))
# --- GPU / VRAM ---
# NVIDIA checked first via nvidia-smi (works regardless of which DRM card
# index the driver landed on); AMD falls back to the card0 sysfs counters
# directly — whichever's actually present decides which branch fires, so
# this works unmodified on either machine.
gpu_pct=-1
vram_used_mb=-1
vram_total_mb=-1
if command -v nvidia-smi > /dev/null 2>&1 && nvidia-smi -L > /dev/null 2>&1; then
nv_out="$(nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total --format=csv,noheader,nounits -i 0 2>/dev/null | tr -d ' ')"
IFS=',' read -r gpu_pct vram_used_mb vram_total_mb <<< "$nv_out"
elif [ -e /sys/class/drm/card0/device/gpu_busy_percent ]; then
gpu_pct="$(cat /sys/class/drm/card0/device/gpu_busy_percent 2>/dev/null || echo -1)"
if [ -e /sys/class/drm/card0/device/mem_info_vram_used ]; then
vram_used_mb=$(($(cat /sys/class/drm/card0/device/mem_info_vram_used) / 1024 / 1024))
vram_total_mb=$(($(cat /sys/class/drm/card0/device/mem_info_vram_total) / 1024 / 1024))
fi
fi
# --- Disks (root + home) ---
# Positional ($NF for mountpoint), not header-text matching — `df -h`'s
# header is locale-translated (verified live: "System plików"/"%uż." under
# this machine's pl_PL locale, not "Filesystem"/"Use%"), so matching on
# English header text would silently find nothing.
disks_json="$(df -h 2>/dev/null | awk '
NR == 1 { next }
$NF == "/" || $NF == "/home" {
gsub(/%/, "", $5)
printf "%s{\"mount\":\"%s\",\"size\":\"%s\",\"used\":\"%s\",\"avail\":\"%s\",\"pct\":\"%s\"}", (n++ ? "," : ""), $NF, $2, $3, $4, $5
}
')"
printf '{"cpuPct":%s,"memUsedKb":%s,"memTotalKb":%s,"gpuPct":%s,"vramUsedMb":%s,"vramTotalMb":%s,"disks":[%s]}\n' \
"$cpu_pct" "$mem_used_kb" "$mem_total_kb" "$gpu_pct" "$vram_used_mb" "$vram_total_mb" "$disks_json"

View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Generates (or reuses) a cached preview JPEG for each animated wallpaper
# — first frame ~1s in, to skip a common black/fade intro on most clips —
# so the Wallpapers panel can show a real thumbnail instead of a generic
# play icon. Prints "<source path>\t<thumbnail path>" per file on stdout
# once it's ready, so the caller (LeftFlyout.qml) never has to
# independently reconstruct the cache filename — it's a hash of the
# source path, chosen only to keep filenames short/safe, not something
# QML needs to know how to derive.
set -euo pipefail
cache_dir="${1:?usage: wallpaper-thumbs <cache-dir> <file...>}"
shift
mkdir -p "$cache_dir"
for file in "$@"; do
[ -f "$file" ] || continue
name="$(printf '%s' "$file" | sha1sum | cut -d' ' -f1)"
thumb="$cache_dir/$name.jpg"
if [ ! -f "$thumb" ] || [ "$file" -nt "$thumb" ]; then
ffmpeg -y -ss 00:00:01 -i "$file" -frames:v 1 -vf "scale=320:-1" "$thumb" \
> /dev/null 2>&1 || true
fi
[ -f "$thumb" ] && printf '%s\t%s\n' "$file" "$thumb"
done

View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Fetches current weather + a short hourly forecast from Open-Meteo (free,
# no API key/account needed) for either the machine's IP-geolocated
# position (default, via ip-api.com — also free/keyless) or an explicitly
# named city, and prints one combined JSON object.
set -euo pipefail
city="${1:-}"
if [ -n "$city" ]; then
encoded="$(jq -sRr @uri <<< "$city")"
geo="$(curl -s "https://geocoding-api.open-meteo.com/v1/search?count=1&name=$encoded")"
lat="$(jq -r '.results[0].latitude // empty' <<< "$geo")"
lon="$(jq -r '.results[0].longitude // empty' <<< "$geo")"
place="$(jq -r '.results[0].name // empty' <<< "$geo")"
country="$(jq -r '.results[0].country // empty' <<< "$geo")"
else
ipgeo="$(curl -s "http://ip-api.com/json/")"
lat="$(jq -r '.lat // empty' <<< "$ipgeo")"
lon="$(jq -r '.lon // empty' <<< "$ipgeo")"
place="$(jq -r '.city // empty' <<< "$ipgeo")"
country="$(jq -r '.country // empty' <<< "$ipgeo")"
fi
if [ -z "$lat" ] || [ -z "$lon" ]; then
echo '{"error":"location lookup failed"}'
exit 0
fi
weather="$(curl -s "https://api.open-meteo.com/v1/forecast?latitude=$lat&longitude=$lon&current=temperature_2m,weather_code,wind_speed_10m,precipitation&hourly=temperature_2m,weather_code,precipitation_probability&timezone=auto&forecast_days=2")"
jq --arg place "$place" --arg country "$country" '. + {place: $place, country: $country}' <<< "$weather"