A shell that comes back, a recording you can hear, a layout you can see
Quickshell segfaulted mid-session -- a Qt image-teardown bug, three cores in the journal -- and the desktop stayed bar-less until a person noticed and knew what to type, because the shell ran as a bare compositor child and panama-crash-watch's report had no notification server left to arrive on. The shell is now panama-quickshell.service, started per-session by autostart.lua like every other Panama unit and never enabled globally: Restart=on-failure turns the same crash into a two-second flicker, verified by sending the running shell a real SIGSEGV and watching it return, and the crash report now lands because the restarted shell is serving the bus by the time the watcher looks. The two contracts that restart the shell learned to do it through the unit, or the unit's own restart races them with a second shell. Recordings can hear: a recorderAudio preference -- none by default, GNOME's default too, because a screencast that silently captured the microphone is an incident -- adds system audio or the microphone through PulseAudio's @DEFAULT_*@ aliases, so the capture follows whatever device Sound settings has chosen. The bar shows the active keyboard layout whenever more than one is configured, mapped from xkb's own registry (evdev.lst) because deriving a code from a description guesses wrong immediately -- "German" is de, not ge -- and updated live from Hyprland's activelayout event. One layout, no indicator, which is GNOME's behavior too. And presentation mode: Caffeine plus Do Not Disturb as one quick-settings tile, restoring both exactly as found -- the half you forget to arm before plugging into a projector is the one that fires a message preview onto the big screen. Claude-Session: https://claude.ai/code/session_01Epx9ZC1gwm81K3jm9x9CKh
This commit is contained in:
@@ -226,6 +226,13 @@ Singleton {
|
||||
const args = Settings.recorderArgs.split(" ").filter(a => a !== "")
|
||||
.map(a => a === "auto" ? (root.renderNode || "/dev/dri/renderD128") : a);
|
||||
cmd = cmd.concat(args);
|
||||
// Audio rides along per the recorderAudio preference. The tokens are
|
||||
// resolved by the pulse layer at record time, so the capture follows
|
||||
// whatever device is currently the default.
|
||||
if (Settings.recorderAudio === "system")
|
||||
cmd.push("--audio=@DEFAULT_MONITOR@");
|
||||
else if (Settings.recorderAudio === "microphone")
|
||||
cmd.push("--audio=@DEFAULT_SOURCE@");
|
||||
if (geom !== "")
|
||||
cmd.push("-g", geom);
|
||||
else if (root._outputName !== "")
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
pragma Singleton
|
||||
|
||||
// The active keyboard layout, for the bar.
|
||||
//
|
||||
// Only interesting on a machine with more than one layout configured -- a
|
||||
// single-layout machine gets no indicator at all, which is GNOME's behavior
|
||||
// too. "More than one" is read straight from the keyboardLayout preference,
|
||||
// the same value input.lua feeds the compositor, so no probe can disagree
|
||||
// with the config.
|
||||
//
|
||||
// Hyprland reports the active keymap by DESCRIPTION ("English (US)"), and
|
||||
// the bar wants the short code ("us"). Deriving one from the other by
|
||||
// truncation gives wrong answers immediately -- "German" is de, not "ge" --
|
||||
// so the mapping comes from xkb's own registry (evdev.lst), the file every
|
||||
// layout chooser is built from. Parsed once; it changes when xkeyboard-config
|
||||
// updates, which is to say between logins.
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick
|
||||
import qs.config
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
readonly property var configured: String(DesktopPreferences.get("keyboardLayout"))
|
||||
.split(",").map(code => code.trim()).filter(code => code !== "")
|
||||
readonly property bool multiple: root.configured.length > 1
|
||||
|
||||
// "English (US)", as Hyprland reports it.
|
||||
property string activeKeymap: ""
|
||||
|
||||
// description -> code, from evdev.lst's layout and variant sections.
|
||||
property var codeByDescription: ({})
|
||||
|
||||
readonly property string shortLabel: {
|
||||
const mapped = root.codeByDescription[root.activeKeymap];
|
||||
if (mapped)
|
||||
return mapped;
|
||||
// Registry miss (a custom keymap): fall back to the first configured
|
||||
// code, which at least names something real on this machine.
|
||||
return root.configured[0] ?? "";
|
||||
}
|
||||
|
||||
function refresh(): void {
|
||||
if (!query.running)
|
||||
query.running = true;
|
||||
}
|
||||
|
||||
Process {
|
||||
id: query
|
||||
command: ["hyprctl", "-j", "devices"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
try {
|
||||
const keyboards = JSON.parse(this.text).keyboards ?? [];
|
||||
const main = keyboards.find(keyboard => keyboard.main) ?? keyboards[0];
|
||||
root.activeKeymap = String(main?.active_keymap ?? "");
|
||||
} catch (error) {
|
||||
console.warn("KeyboardLayout: could not parse hyprctl devices:", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileView {
|
||||
path: "/usr/share/X11/xkb/rules/evdev.lst"
|
||||
blockLoading: false
|
||||
printErrors: false
|
||||
onLoaded: {
|
||||
const map = {};
|
||||
let section = "";
|
||||
for (const line of this.text().split("\n")) {
|
||||
if (line.startsWith("!")) {
|
||||
section = line.slice(1).trim();
|
||||
continue;
|
||||
}
|
||||
const trimmed = line.trim();
|
||||
if (trimmed === "")
|
||||
continue;
|
||||
if (section === "layout") {
|
||||
// " us English (US)"
|
||||
const m = /^(\S+)\s+(.+)$/.exec(trimmed);
|
||||
if (m)
|
||||
map[m[2].trim()] = m[1];
|
||||
} else if (section === "variant") {
|
||||
// " dvorak us: English (Dvorak)"
|
||||
const m = /^\S+\s+(\S+):\s+(.+)$/.exec(trimmed);
|
||||
if (m)
|
||||
map[m[2].trim()] = m[1];
|
||||
}
|
||||
}
|
||||
root.codeByDescription = map;
|
||||
}
|
||||
}
|
||||
|
||||
// activelayout fires on every switch; configreloaded catches a layout
|
||||
// list changed from Settings.
|
||||
Connections {
|
||||
target: Hyprland
|
||||
function onRawEvent(event: var): void {
|
||||
if (event.name === "activelayout" || event.name === "configreloaded")
|
||||
root.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: root.refresh()
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
pragma Singleton
|
||||
|
||||
// Presentation mode: the screen stays on and notifications hold, as one
|
||||
// switch.
|
||||
//
|
||||
// Both halves already exist -- Caffeine inhibits idle, Do Not Disturb quiets
|
||||
// the toasts -- but a person plugging into a projector had to remember to arm
|
||||
// both, every time, and the one they forgot was the one that fired a message
|
||||
// preview onto the big screen. Same record-and-restore idiom as FocusSession:
|
||||
// turning presentation off puts each half back exactly the way it was found,
|
||||
// so a caffeine you had on for your own reasons survives the meeting.
|
||||
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property bool active: false
|
||||
property bool previousCaffeine: false
|
||||
property bool previousDnd: false
|
||||
|
||||
function toggle(): void {
|
||||
if (root.active)
|
||||
root.stop();
|
||||
else
|
||||
root.start();
|
||||
}
|
||||
|
||||
function start(): void {
|
||||
if (root.active)
|
||||
return;
|
||||
root.previousCaffeine = Caffeine.enabled;
|
||||
root.previousDnd = Notifs.doNotDisturb;
|
||||
Caffeine.enabled = true;
|
||||
Notifs.doNotDisturb = true;
|
||||
root.active = true;
|
||||
}
|
||||
|
||||
function stop(): void {
|
||||
if (!root.active)
|
||||
return;
|
||||
Caffeine.enabled = root.previousCaffeine;
|
||||
Notifs.doNotDisturb = root.previousDnd;
|
||||
root.active = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user