- Per-app volume slider and a system volume card (slider + mute) - Default output device picker; per-app output device picker (Windows via IPolicyConfig / IAudioPolicyConfigFactory, Linux via sink moves; macOS has no per-app routing API) - Slider commands are coalesced on the audio thread - Fix the Windows title-bar and taskbar icon (set via winit attributes) - About: "by X4Lo" and a GitHub link - README: app icon above the title - --list prints output devices and system volume - CI: run on master and on manual dispatch
765 lines
30 KiB
Plaintext
765 lines
30 KiB
Plaintext
import { ListView, ScrollView, Palette } from "std-widgets.slint";
|
|
import { Theme } from "theme.slint";
|
|
import {
|
|
SpeakerIcon, ThemeIcon, IconButton, Tabs, Switch, ShortcutChip, SettingRow, Card, SectionLabel,
|
|
VolumeSlider, DevicePicker
|
|
} from "widgets.slint";
|
|
|
|
export { Toast } from "toast.slint";
|
|
|
|
export struct AppRow {
|
|
key: string,
|
|
name: string,
|
|
subtitle: string,
|
|
icon: image,
|
|
has-icon: bool,
|
|
initial: string,
|
|
tint: color,
|
|
running: bool,
|
|
muted: bool,
|
|
volume: float, // 0..1, < 0 when unknown
|
|
shortcut: string, // display label, "" when unbound
|
|
routable: bool, // output device can be changed
|
|
device-index: int, // index into MainWindow.app-device-options (0 = system default)
|
|
}
|
|
|
|
component Avatar inherits Rectangle {
|
|
in property <AppRow> app;
|
|
width: 36px;
|
|
height: 36px;
|
|
border-radius: 10px;
|
|
background: app.has-icon ? transparent : app.tint;
|
|
if app.has-icon: Image {
|
|
source: root.app.icon;
|
|
width: 32px;
|
|
height: 32px;
|
|
image-fit: contain;
|
|
}
|
|
if !app.has-icon: Text {
|
|
text: root.app.initial;
|
|
color: white;
|
|
font-size: 15px;
|
|
font-weight: 700;
|
|
horizontal-alignment: center;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
|
|
component MuteButton inherits Rectangle {
|
|
in property <bool> muted;
|
|
in property <bool> enabled: true;
|
|
in property <string> label;
|
|
callback clicked;
|
|
width: 34px;
|
|
height: 34px;
|
|
border-radius: 17px;
|
|
background: muted ? Theme.danger-soft : (touch.has-hover ? Theme.surface-sunken : transparent);
|
|
opacity: enabled ? 1 : 0.4;
|
|
animate background { duration: Theme.fast; }
|
|
accessible-role: button;
|
|
accessible-label: (muted ? "Unmute " : "Mute ") + label;
|
|
accessible-action-default => { if (root.enabled) { root.clicked(); } }
|
|
SpeakerIcon {
|
|
muted: root.muted;
|
|
color: root.muted ? Theme.danger : Theme.text-muted;
|
|
}
|
|
touch := TouchArea {
|
|
enabled: root.enabled;
|
|
mouse-cursor: pointer;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
}
|
|
|
|
component AppRowView inherits Rectangle {
|
|
in property <AppRow> app;
|
|
in property <bool> capturing;
|
|
in property <bool> show-volume;
|
|
in property <bool> show-device;
|
|
in property <[string]> device-options;
|
|
callback toggle();
|
|
callback capture();
|
|
callback clear();
|
|
callback volume-moved(float);
|
|
callback device-picked(int);
|
|
|
|
property <bool> has-volume: show-volume && app.running && app.volume >= 0;
|
|
property <bool> has-device: show-device && app.running && app.routable;
|
|
|
|
border-radius: 12px;
|
|
background: hover.has-hover ? Theme.surface-hover : Theme.surface;
|
|
border-width: 1px;
|
|
border-color: capturing ? Theme.accent : Theme.border;
|
|
animate background, border-color { duration: Theme.fast; }
|
|
|
|
hover := TouchArea { }
|
|
|
|
VerticalLayout {
|
|
padding-left: 12px;
|
|
padding-right: 10px;
|
|
padding-top: 12px;
|
|
padding-bottom: 12px;
|
|
spacing: 8px;
|
|
|
|
HorizontalLayout {
|
|
spacing: 12px;
|
|
alignment: stretch;
|
|
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Avatar { app: root.app; opacity: root.app.running ? 1 : 0.45; }
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
spacing: 3px;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: root.app.name;
|
|
font-size: 13.5px;
|
|
font-weight: 600;
|
|
color: root.app.running ? Theme.text : Theme.text-muted;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.app.subtitle;
|
|
font-size: 11.5px;
|
|
color: root.app.muted ? Theme.danger : Theme.text-faint;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
ShortcutChip {
|
|
width: 132px;
|
|
shortcut: root.app.shortcut;
|
|
capturing: root.capturing;
|
|
label: root.app.name + " shortcut";
|
|
clicked => { root.capture(); }
|
|
cleared => { root.clear(); }
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
MuteButton {
|
|
muted: root.app.muted;
|
|
enabled: root.app.running;
|
|
label: root.app.name;
|
|
clicked => { root.toggle(); }
|
|
}
|
|
}
|
|
}
|
|
|
|
if root.has-volume || root.has-device: HorizontalLayout {
|
|
padding-left: 48px; // line up with the name, past the avatar
|
|
padding-right: 2px;
|
|
spacing: 10px;
|
|
if root.has-volume: VolumeSlider {
|
|
horizontal-stretch: 1;
|
|
value: root.app.volume;
|
|
dimmed: root.app.muted;
|
|
label: root.app.name + " volume";
|
|
moved(v) => { root.volume-moved(v); }
|
|
}
|
|
if root.has-volume: Text {
|
|
width: 34px;
|
|
text: round(root.app.volume * 100) + "%";
|
|
font-size: 11.5px;
|
|
color: Theme.text-muted;
|
|
horizontal-alignment: right;
|
|
vertical-alignment: center;
|
|
}
|
|
if !root.has-volume: Rectangle { horizontal-stretch: 1; }
|
|
if root.has-device: DevicePicker {
|
|
width: 150px;
|
|
options: root.device-options;
|
|
selected: root.app.device-index;
|
|
label: root.app.name + " output device";
|
|
picked(i) => { root.device-picked(i); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// System volume + default output device.
|
|
component OutputCard inherits Rectangle {
|
|
in property <float> volume; // 0..1, < 0 when the device has no volume control
|
|
in property <bool> muted;
|
|
in property <bool> show-volume;
|
|
in property <bool> show-device;
|
|
in property <[string]> devices;
|
|
in property <int> device-index;
|
|
callback toggle-mute();
|
|
callback volume-moved(float);
|
|
callback device-picked(int);
|
|
|
|
property <bool> has-volume: show-volume && volume >= 0;
|
|
|
|
border-radius: 12px;
|
|
background: Theme.surface;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
|
|
HorizontalLayout {
|
|
padding-left: 12px;
|
|
padding-right: 12px;
|
|
padding-top: 10px;
|
|
padding-bottom: 10px;
|
|
spacing: 12px;
|
|
|
|
if root.show-volume: VerticalLayout {
|
|
alignment: center;
|
|
MuteButton {
|
|
muted: root.muted;
|
|
label: "system volume";
|
|
clicked => { root.toggle-mute(); }
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
spacing: 4px;
|
|
horizontal-stretch: 1;
|
|
HorizontalLayout {
|
|
Text {
|
|
text: "System volume";
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: Theme.text;
|
|
horizontal-stretch: 1;
|
|
}
|
|
Text {
|
|
text: root.muted ? "Muted" : (root.has-volume ? round(root.volume * 100) + "%" : "");
|
|
font-size: 11.5px;
|
|
color: root.muted ? Theme.danger : Theme.text-muted;
|
|
}
|
|
}
|
|
if root.has-volume: VolumeSlider {
|
|
value: root.volume;
|
|
dimmed: root.muted;
|
|
label: "System volume";
|
|
moved(v) => { root.volume-moved(v); }
|
|
}
|
|
if !root.has-volume && root.show-volume: Text {
|
|
text: "This device has no volume control";
|
|
font-size: 11.5px;
|
|
color: Theme.text-faint;
|
|
}
|
|
}
|
|
if root.show-device: VerticalLayout {
|
|
alignment: center;
|
|
DevicePicker {
|
|
width: 160px;
|
|
options: root.devices;
|
|
selected: root.device-index;
|
|
label: "Output device";
|
|
picked(i) => { root.device-picked(i); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
component MuteAllCard inherits Rectangle {
|
|
in property <bool> all-muted;
|
|
in property <int> app-count;
|
|
in property <string> shortcut;
|
|
in property <string> restore-shortcut;
|
|
in property <string> capturing;
|
|
callback toggle();
|
|
callback capture(string);
|
|
callback clear(string);
|
|
|
|
border-radius: 18px;
|
|
background: all-muted
|
|
? @linear-gradient(135deg, #ff6b78 0%, #e0405a 100%)
|
|
: @linear-gradient(135deg, #8a7bff 0%, #5b49f2 100%);
|
|
drop-shadow-blur: 18px;
|
|
drop-shadow-offset-y: 6px;
|
|
drop-shadow-color: all-muted ? #e0405a40 : #5b49f240;
|
|
|
|
VerticalLayout {
|
|
padding: 16px;
|
|
spacing: 14px;
|
|
HorizontalLayout {
|
|
spacing: 12px;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
spacing: 2px;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: root.all-muted ? "Everything is muted" : "Mute everything";
|
|
color: white;
|
|
font-size: 16px;
|
|
font-weight: 700;
|
|
}
|
|
Text {
|
|
text: root.all-muted
|
|
? "Press again to restore exactly what was playing"
|
|
: root.app-count == 1 ? "Instantly silence 1 app" : "Instantly silence " + root.app-count + " apps";
|
|
color: #ffffffcc;
|
|
font-size: 12px;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Rectangle {
|
|
width: 46px;
|
|
height: 46px;
|
|
border-radius: 23px;
|
|
background: big.has-hover ? #ffffff : #fffffff0;
|
|
drop-shadow-blur: 8px;
|
|
drop-shadow-color: #00000033;
|
|
accessible-role: button;
|
|
accessible-label: root.all-muted ? "Restore all apps" : "Mute all apps";
|
|
accessible-action-default => { root.toggle(); }
|
|
SpeakerIcon {
|
|
width: 22px;
|
|
height: 22px;
|
|
muted: root.all-muted;
|
|
color: root.all-muted ? #e0405a : #5b49f2;
|
|
}
|
|
big := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { root.toggle(); }
|
|
}
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
spacing: 8px;
|
|
VerticalLayout {
|
|
spacing: 4px;
|
|
horizontal-stretch: 1;
|
|
Text { text: "TOGGLE"; color: #ffffffa6; font-size: 10px; font-weight: 700; letter-spacing: 0.8px; }
|
|
ShortcutChip {
|
|
on-accent: true;
|
|
shortcut: root.shortcut;
|
|
capturing: root.capturing == "@all";
|
|
label: "Mute all shortcut";
|
|
clicked => { root.capture("@all"); }
|
|
cleared => { root.clear("@all"); }
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
spacing: 4px;
|
|
horizontal-stretch: 1;
|
|
Text { text: "RESTORE (OPTIONAL)"; color: #ffffffa6; font-size: 10px; font-weight: 700; letter-spacing: 0.8px; }
|
|
ShortcutChip {
|
|
on-accent: true;
|
|
shortcut: root.restore-shortcut;
|
|
placeholder: "Same as toggle";
|
|
capturing: root.capturing == "@restore";
|
|
label: "Restore all shortcut";
|
|
clicked => { root.capture("@restore"); }
|
|
cleared => { root.clear("@restore"); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export component MainWindow inherits Window {
|
|
title: "HushKey";
|
|
icon: root.app-icon;
|
|
preferred-width: 480px;
|
|
preferred-height: 720px;
|
|
min-width: 400px;
|
|
min-height: 480px;
|
|
background: Theme.bg;
|
|
default-font-size: 13px;
|
|
|
|
in property <bool> dark: true;
|
|
in property <image> app-icon;
|
|
in property <[AppRow]> apps;
|
|
in property <bool> all-muted;
|
|
in property <int> running-count;
|
|
in property <string> mute-all-shortcut;
|
|
in property <string> restore-shortcut;
|
|
in property <string> capturing; // "" | "@all" | "@restore" | app key
|
|
in property <string> status;
|
|
in property <bool> status-is-error;
|
|
in property <string> backend;
|
|
in property <string> platform-note;
|
|
in property <bool> show-volume: true;
|
|
in property <bool> show-app-device;
|
|
in property <bool> show-master-volume;
|
|
in property <bool> show-output-devices;
|
|
in property <[string]> output-devices; // names, for the system picker
|
|
in property <[string]> app-device-options; // "System default" + names
|
|
in property <int> default-device-index;
|
|
in property <float> master-volume: -1;
|
|
in property <bool> master-muted;
|
|
in property <string> config-path;
|
|
in property <string> version;
|
|
in property <string> hotkey-hint;
|
|
in property <bool> launch-on-startup;
|
|
in property <bool> start-minimized;
|
|
in property <bool> show-toast: true;
|
|
in-out property <int> page;
|
|
|
|
callback start-capture(string);
|
|
callback key-captured(string, bool, bool, bool, bool);
|
|
callback cancel-capture();
|
|
callback clear-shortcut(string);
|
|
callback toggle-app(string);
|
|
callback toggle-all();
|
|
callback set-launch-on-startup(bool);
|
|
callback set-start-minimized(bool);
|
|
callback set-show-toast(bool);
|
|
callback set-dark(bool);
|
|
callback open-config-dir();
|
|
callback refresh();
|
|
callback dismiss-status();
|
|
callback set-app-volume(string, float);
|
|
callback pick-app-device(string, int);
|
|
callback set-master-volume(float);
|
|
callback toggle-master-mute();
|
|
callback pick-default-device(int);
|
|
callback open-url(string);
|
|
|
|
init => {
|
|
Theme.dark = root.dark;
|
|
Palette.color-scheme = root.dark ? ColorScheme.dark : ColorScheme.light;
|
|
}
|
|
changed dark => {
|
|
Theme.dark = root.dark;
|
|
Palette.color-scheme = root.dark ? ColorScheme.dark : ColorScheme.light;
|
|
}
|
|
|
|
function begin-capture(target: string) {
|
|
root.start-capture(target);
|
|
key-sink.focus();
|
|
}
|
|
|
|
// Receives the key combo while a shortcut chip is recording.
|
|
key-sink := FocusScope {
|
|
key-pressed(event) => {
|
|
if (root.capturing != "") {
|
|
root.key-captured(event.text, event.modifiers.control, event.modifiers.alt, event.modifiers.shift, event.modifiers.meta);
|
|
return accept;
|
|
}
|
|
return reject;
|
|
}
|
|
|
|
VerticalLayout {
|
|
// ── Header ──────────────────────────────────────────────
|
|
HorizontalLayout {
|
|
padding-left: 18px;
|
|
padding-right: 14px;
|
|
padding-top: 14px;
|
|
padding-bottom: 10px;
|
|
spacing: 10px;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Image { source: root.app-icon; width: 26px; height: 26px; }
|
|
}
|
|
Text {
|
|
text: "HushKey";
|
|
font-size: 17px;
|
|
font-weight: 750;
|
|
color: Theme.text;
|
|
vertical-alignment: center;
|
|
}
|
|
Rectangle { horizontal-stretch: 1; }
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Tabs {
|
|
items: ["Apps", "Settings"];
|
|
selected <=> root.page;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
IconButton {
|
|
tooltip: root.dark ? "Switch to light mode" : "Switch to dark mode";
|
|
clicked => { root.set-dark(!root.dark); }
|
|
ThemeIcon { dark: root.dark; }
|
|
}
|
|
}
|
|
}
|
|
|
|
// ── Apps page ───────────────────────────────────────────
|
|
if root.page == 0: VerticalLayout {
|
|
padding-left: 16px;
|
|
padding-right: 16px;
|
|
padding-top: 4px;
|
|
spacing: 12px;
|
|
vertical-stretch: 1;
|
|
|
|
MuteAllCard {
|
|
all-muted: root.all-muted;
|
|
app-count: root.running-count;
|
|
shortcut: root.mute-all-shortcut;
|
|
restore-shortcut: root.restore-shortcut;
|
|
capturing: root.capturing;
|
|
toggle => { root.toggle-all(); }
|
|
capture(t) => { root.begin-capture(t); }
|
|
clear(t) => { root.clear-shortcut(t); }
|
|
}
|
|
|
|
if root.show-master-volume || root.show-output-devices: OutputCard {
|
|
volume: root.master-volume;
|
|
muted: root.master-muted;
|
|
show-volume: root.show-master-volume;
|
|
show-device: root.show-output-devices;
|
|
devices: root.output-devices;
|
|
device-index: root.default-device-index;
|
|
toggle-mute => { root.toggle-master-mute(); }
|
|
volume-moved(v) => { root.set-master-volume(v); }
|
|
device-picked(i) => { root.pick-default-device(i); }
|
|
}
|
|
|
|
if root.platform-note != "": Rectangle {
|
|
border-radius: 10px;
|
|
background: Theme.accent-soft;
|
|
HorizontalLayout {
|
|
padding: 10px;
|
|
Text {
|
|
text: root.platform-note;
|
|
font-size: 12px;
|
|
color: Theme.text;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
}
|
|
|
|
HorizontalLayout {
|
|
padding-top: 2px;
|
|
SectionLabel { text: "APPLICATIONS"; vertical-alignment: center; }
|
|
Rectangle { horizontal-stretch: 1; }
|
|
Text {
|
|
text: root.capturing != "" ? root.hotkey-hint : (root.running-count + " with audio");
|
|
font-size: 11.5px;
|
|
color: root.capturing != "" ? Theme.accent : Theme.text-faint;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
|
|
if root.apps.length == 0: Rectangle {
|
|
vertical-stretch: 1;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
spacing: 6px;
|
|
SpeakerIcon { width: 30px; height: 30px; color: Theme.text-faint; }
|
|
Text {
|
|
text: "No apps with audio yet";
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: Theme.text-muted;
|
|
horizontal-alignment: center;
|
|
}
|
|
Text {
|
|
text: "Start playing something — it will show up here.";
|
|
font-size: 12px;
|
|
color: Theme.text-faint;
|
|
horizontal-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
|
|
if root.apps.length > 0: ListView {
|
|
vertical-stretch: 1;
|
|
for row in root.apps: VerticalLayout {
|
|
padding-bottom: 8px;
|
|
padding-right: 12px; // keep clear of the overlay scrollbar
|
|
AppRowView {
|
|
app: row;
|
|
capturing: root.capturing == row.key;
|
|
show-volume: root.show-volume;
|
|
show-device: root.show-app-device;
|
|
device-options: root.app-device-options;
|
|
toggle => { root.toggle-app(row.key); }
|
|
volume-moved(v) => { root.set-app-volume(row.key, v); }
|
|
device-picked(i) => { root.pick-app-device(row.key, i); }
|
|
capture => { root.begin-capture(row.key); }
|
|
clear => { root.clear-shortcut(row.key); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// ── Settings page ───────────────────────────────────────
|
|
if root.page == 1: ScrollView {
|
|
vertical-stretch: 1;
|
|
VerticalLayout {
|
|
padding-left: 16px;
|
|
padding-right: 16px;
|
|
padding-top: 4px;
|
|
padding-bottom: 16px;
|
|
spacing: 10px;
|
|
alignment: start;
|
|
|
|
SectionLabel { text: "GENERAL"; }
|
|
Card {
|
|
VerticalLayout {
|
|
SettingRow {
|
|
title: "Launch at login";
|
|
subtitle: "Start HushKey in the tray when you sign in.";
|
|
Switch {
|
|
label: "Launch at login";
|
|
checked: root.launch-on-startup;
|
|
toggled(v) => { root.set-launch-on-startup(v); }
|
|
}
|
|
}
|
|
Rectangle { height: 1px; background: Theme.border; }
|
|
SettingRow {
|
|
title: "Start minimized";
|
|
subtitle: "Open straight to the tray instead of showing this window.";
|
|
Switch {
|
|
label: "Start minimized";
|
|
checked: root.start-minimized;
|
|
toggled(v) => { root.set-start-minimized(v); }
|
|
}
|
|
}
|
|
Rectangle { height: 1px; background: Theme.border; }
|
|
SettingRow {
|
|
title: "On-screen confirmation";
|
|
subtitle: "Show a small popup when a shortcut mutes or unmutes something.";
|
|
Switch {
|
|
label: "On-screen confirmation";
|
|
checked: root.show-toast;
|
|
toggled(v) => { root.set-show-toast(v); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
SectionLabel { text: "APPEARANCE"; }
|
|
Card {
|
|
SettingRow {
|
|
title: "Theme";
|
|
Tabs {
|
|
items: ["Dark", "Light"];
|
|
selected: root.dark ? 0 : 1;
|
|
changed selected => { root.set-dark(self.selected == 0); }
|
|
}
|
|
}
|
|
}
|
|
|
|
SectionLabel { text: "ABOUT"; }
|
|
Card {
|
|
VerticalLayout {
|
|
padding: 16px;
|
|
spacing: 6px;
|
|
HorizontalLayout {
|
|
spacing: 6px;
|
|
alignment: start;
|
|
Text {
|
|
text: "HushKey " + root.version;
|
|
font-size: 14px;
|
|
font-weight: 700;
|
|
color: Theme.text;
|
|
vertical-alignment: center;
|
|
}
|
|
Text {
|
|
text: "by X4Lo";
|
|
font-size: 12.5px;
|
|
color: Theme.text-muted;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
Text {
|
|
text: "Audio backend: " + root.backend;
|
|
font-size: 12px;
|
|
color: Theme.text-muted;
|
|
wrap: word-wrap;
|
|
}
|
|
Text {
|
|
text: "Settings file: " + root.config-path;
|
|
font-size: 12px;
|
|
color: Theme.text-muted;
|
|
wrap: word-wrap;
|
|
}
|
|
HorizontalLayout {
|
|
alignment: start;
|
|
padding-top: 4px;
|
|
spacing: 8px;
|
|
Rectangle {
|
|
height: 30px;
|
|
border-radius: 8px;
|
|
background: gh.has-hover ? Theme.surface-hover : Theme.surface-sunken;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
accessible-role: button;
|
|
accessible-label: "Open HushKey on GitHub";
|
|
accessible-action-default => { root.open-url("https://github.com/X4Lo/HushKey"); }
|
|
HorizontalLayout {
|
|
padding-left: 12px;
|
|
padding-right: 12px;
|
|
Text { text: "GitHub ↗"; font-size: 12px; font-weight: 600; color: Theme.accent; vertical-alignment: center; }
|
|
}
|
|
gh := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { root.open-url("https://github.com/X4Lo/HushKey"); }
|
|
}
|
|
}
|
|
Rectangle {
|
|
height: 30px;
|
|
border-radius: 8px;
|
|
background: open.has-hover ? Theme.surface-hover : Theme.surface-sunken;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
accessible-role: button;
|
|
accessible-label: "Open settings folder";
|
|
accessible-action-default => { root.open-config-dir(); }
|
|
HorizontalLayout {
|
|
padding-left: 12px;
|
|
padding-right: 12px;
|
|
Text { text: "Open settings folder"; font-size: 12px; font-weight: 600; color: Theme.text; vertical-alignment: center; }
|
|
}
|
|
open := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { root.open-config-dir(); }
|
|
}
|
|
}
|
|
}
|
|
Text {
|
|
text: "github.com/X4Lo/HushKey · MIT License · Built with Slint (slint.dev)";
|
|
font-size: 11px;
|
|
color: Theme.text-faint;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// ── Status banner ───────────────────────────────────────
|
|
if root.status != "": HorizontalLayout {
|
|
padding-left: 16px;
|
|
padding-right: 16px;
|
|
padding-bottom: 12px;
|
|
Rectangle {
|
|
border-radius: 10px;
|
|
background: root.status-is-error ? Theme.danger-soft : Theme.accent-soft;
|
|
HorizontalLayout {
|
|
padding-left: 12px;
|
|
padding-right: 6px;
|
|
padding-top: 6px;
|
|
padding-bottom: 6px;
|
|
spacing: 8px;
|
|
Text {
|
|
text: root.status;
|
|
font-size: 12px;
|
|
color: Theme.text;
|
|
wrap: word-wrap;
|
|
vertical-alignment: center;
|
|
horizontal-stretch: 1;
|
|
}
|
|
IconButton {
|
|
width: 26px;
|
|
height: 26px;
|
|
tooltip: "Dismiss";
|
|
clicked => { root.dismiss-status(); }
|
|
Path {
|
|
width: 10px;
|
|
height: 10px;
|
|
viewbox-width: 10;
|
|
viewbox-height: 10;
|
|
commands: "M1 1l8 8 M9 1l-8 8";
|
|
stroke: Theme.text-muted;
|
|
stroke-width: 1.5px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|