diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-11 16:23:36 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-11 16:23:36 +0200 |
| commit | 1ffc9c8e8fd3b97f343d6e2360f030cb08b42a18 (patch) | |
| tree | 59d59bda8197a43009395b991dbc18fc93fe8a88 /vm-manager/Theme.qml | |
| parent | 18fd64134f51ec99b123c91f79790c12ad5e1bb4 (diff) | |
| download | quickshell-1ffc9c8e8fd3b97f343d6e2360f030cb08b42a18.tar.gz quickshell-1ffc9c8e8fd3b97f343d6e2360f030cb08b42a18.zip | |
feat(vm-manager): libvirt VM drawer
A top drawer on the secondary monitor showing every libvirt machine: its
state, live statistics while it runs, the actions that make sense in that
state, and the snapshot list. SUPER+v toggles it over IPC.
This replaces the menu half of rofi-qemu.sh, which is still in ~/bin but
no longer bound. A dmenu row can only ever be a string, so the script
could not show what a machine is actually doing, and the snapshots it
could create were never listed anywhere.
Everything shells out to virsh, the same commands the script used, so
there is no libvirt binding and no new dependency. State changes arrive
by `virsh event --all --loop` rather than polling, which means a machine
started from virt-manager or the CLI updates the drawer too. Statistics
do need a 2 second timer, but it only runs while the drawer is open.
Memory, filesystem usage and the address come from qemu-guest-agent, so
they are absent for the first seconds after boot and on any machine
without the agent. Those rows show a dash rather than falling back to
libvirt's own figures: balloon.current is memory allocated rather than
used and reads full forever, and block.allocation is qcow2 growth on the
host rather than usage inside the guest. Either would be quietly wrong.
Destructive actions are gated, which the rofi version did not do at all:
Delete VM requires the name typed, since it runs undefine with
--remove-all-storage and erases the disk image, and reset, force stop,
snapshot revert and snapshot delete each take a confirmation click.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7NRsGyF9jGfPYS4zPqpN7
Diffstat (limited to 'vm-manager/Theme.qml')
| -rw-r--r-- | vm-manager/Theme.qml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/vm-manager/Theme.qml b/vm-manager/Theme.qml new file mode 100644 index 0000000..714e289 --- /dev/null +++ b/vm-manager/Theme.qml @@ -0,0 +1,47 @@ +// Copyright (C) 2026 Danilo M. <danix@danix.xyz> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +pragma Singleton + +import Quickshell +import Quickshell.Io +import QtQuick + +Singleton { + id: root + + // Catppuccin Macchiato. Fixed, same base as unified-desktop-theme. + readonly property color base: "#24273a" + readonly property color surface: "#363a4f" + readonly property color text: "#cad3f5" + readonly property color subtext: "#a5adcb" + readonly property color red: "#ed8796" + readonly property color green: "#a6da95" + readonly property color yellow: "#eed49f" + readonly property color overlay: "#6e738d" + + // Tracks the wallpaper, like rofi and dunst do. Lavender until read. + property color accent: "#b7bdf8" + + readonly property string fontFamily: "Noto Sans" + readonly property int fontSize: 16 + + // udt-accent writes one line: `* { accent: #rrggbbaa; }` + FileView { + path: `${Quickshell.env("HOME")}/.cache/wal/udt-accent.rasi` + watchChanges: true + onFileChanged: reload() + onLoaded: { + const m = text().match(/accent:\s*(#[0-9a-fA-F]{6})/); + if (m) root.accent = m[1]; + } + } +} |
