Files
HushKey/ui/toast.slint
T
X4Lo 8f476dbe52 feat: HushKey 1.0.0 — per-app mute hotkeys for Windows, macOS and Linux
Native Rust tray app that binds global shortcuts to mute/unmute
individual applications' audio, plus a Mute All / Restore All shortcut.

- AudioController trait with per-OS backends: WASAPI sessions (Windows),
  Core Audio process taps (macOS 14.2+, mute only), PulseAudio/PipeWire
  sink inputs (Linux)
- Dedicated audio thread; hotkey presses go straight to it
- Snapshot-based Mute All that restores exactly the previous state
- Slint UI with software renderer; window destroyed on close
- Non-activating on-screen confirmation and tray icon flash
- TOML config, launch at login, start minimized, dark/light theme
- Procedurally drawn icon embedded into the Windows executable
- Docs, AGENTS.md, CLAUDE.md, contributing guide and CI for all three OSes
2026-11-14 04:26:05 +00:00

78 lines
2.5 KiB
Plaintext

// On-screen confirmation shown when a shortcut fires. Created as a non-activating,
// click-through, always-on-top window (see src/ui/toast.rs) so it never steals focus
// from a game or fullscreen app.
import { Theme } from "theme.slint";
import { SpeakerIcon } from "widgets.slint";
export component Toast inherits Window {
title: "HushKey notification";
no-frame: true;
always-on-top: true;
background: transparent;
width: 300px;
height: 76px;
in property <bool> dark: true;
in property <string> headline;
in property <string> detail;
in property <bool> muted;
in property <bool> error;
in-out property <bool> shown;
init => { Theme.dark = root.dark; }
changed dark => { Theme.dark = root.dark; }
panel := Rectangle {
x: 10px;
y: root.shown ? 8px : 14px;
width: parent.width - 20px;
height: parent.height - 20px;
border-radius: 16px;
background: Theme.dark ? #1a1d25f5 : #fffffff7;
border-width: 1px;
border-color: Theme.border;
drop-shadow-blur: 10px;
drop-shadow-color: #00000059;
drop-shadow-offset-y: 3px;
opacity: root.shown ? 1 : 0;
animate opacity { duration: 170ms; easing: ease-out; }
animate y { duration: 220ms; easing: ease-out; }
HorizontalLayout {
padding-left: 12px;
padding-right: 16px;
spacing: 12px;
alignment: start;
Rectangle {
width: 36px;
height: 36px;
y: (parent.height - self.height) / 2;
border-radius: 18px;
background: root.error ? Theme.surface-sunken : (root.muted ? Theme.danger-soft : #34c98a2e);
SpeakerIcon {
muted: root.muted || root.error;
color: root.error ? Theme.text-muted : (root.muted ? Theme.danger : Theme.success);
}
}
VerticalLayout {
alignment: center;
spacing: 1px;
Text {
text: root.headline;
font-size: 14px;
font-weight: 650;
color: Theme.text;
overflow: elide;
}
Text {
text: root.detail;
font-size: 12px;
color: Theme.text-muted;
overflow: elide;
}
}
}
}
}