mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-27 07:58:01 +01:00
* make the labs card copy plain Rewrite the Labs card titles and lines in words a regular user understands: YOLO mode says the message sends itself, Live text and Failure notices name the small recording indicator, Vocabulary help says which speech models it affects, and the key-side cards name Option, Command, Shift, and Control. Audit every other card, updating the CLI descriptions, all nine translated languages, the website lab catalog, the feature docs, and the render goldens. * fix labs copy review findings Restore the ISO qualifier on the section-key card, spell out that double-tap and hold-through shortcuts contain no letter or number key, cover all Global mode stages in the API text card, and name the print command in the print-start copy. Restore the developer API card titles, fix the Annotate capture wording, and retranslate the affected strings. Remove every replaced translation key and stale lab-name reference. * fix second labs copy review Update the live typing test and YOLO goldens. Add a Windows variant of the hold-through-keys copy naming Ctrl, Alt, Shift, and the Windows key. Remove the last unused rewrite-by-voice translation key, keep Annotate untranslated in the replay title, and clean the remaining old lab-name comments. * use the Polish Annotate pane name in its replay title Polish calls the Annotate pane Adnotacje, so the Annotate last 15 seconds title says Ostatnie 15 sekund w Adnotacjach again. Other languages keep Annotate because their pane name is Annotate.
73 lines
2.6 KiB
Rust
73 lines
2.6 KiB
Rust
//! Labs › Call recording controls on GNOME (#1274). A Wayland compositor
|
||
//! without layer-shell (GNOME) has no surface for an overlay that takes
|
||
//! clicks, so the recording offer and recording capsule can't float there and
|
||
//! Hex opens the Meetings pane instead (#1271). With this explicit opt-in, Rune
|
||
//! opens them on XWayland as override-redirect windows that take clicks only
|
||
//! on their buttons and never keyboard focus, and only while this user's
|
||
//! XWayland already runs: Hex never starts it.
|
||
|
||
/// Whether the meeting capsules may float on XWayland, read as each capsule
|
||
/// shows.
|
||
pub(crate) fn on_xwayland() -> bool {
|
||
on_xwayland_for(crate::labs::gnome_meeting_capsules())
|
||
}
|
||
|
||
/// Whether a Labs overlay this user opted into may float on XWayland: only on
|
||
/// a Wayland compositor without layer-shell (GNOME), and only while this
|
||
/// user's XWayland already runs. Each check runs only when the ones before
|
||
/// pass, so with the lab off Hex never looks for layer-shell or XWayland.
|
||
pub(super) fn on_xwayland_for(opted_in: bool) -> bool {
|
||
floats_on_xwayland(
|
||
opted_in,
|
||
without_layer_shell,
|
||
crate::linux::clipboard::xwayland_running,
|
||
)
|
||
}
|
||
|
||
/// Whether this session is Wayland on a compositor without layer-shell
|
||
/// (GNOME), where an overlay that takes clicks can only show on XWayland.
|
||
pub(super) fn without_layer_shell() -> bool {
|
||
crate::linux::session::LinuxSession::detect().is_wayland()
|
||
&& !crate::linux::paste::wayland_offers(crate::linux::rune_hud::LAYER_SHELL)
|
||
}
|
||
|
||
fn floats_on_xwayland(
|
||
opted_in: bool,
|
||
without_layer_shell: impl FnOnce() -> bool,
|
||
running: impl FnOnce() -> bool,
|
||
) -> bool {
|
||
opted_in && without_layer_shell() && running()
|
||
}
|
||
|
||
#[cfg(test)]
|
||
mod tests {
|
||
use super::floats_on_xwayland;
|
||
|
||
#[test]
|
||
fn floats_only_by_opt_in_without_layer_shell_while_xwayland_runs() {
|
||
assert!(floats_on_xwayland(true, || true, || true));
|
||
assert!(
|
||
!floats_on_xwayland(false, || true, || true),
|
||
"off by default"
|
||
);
|
||
assert!(
|
||
!floats_on_xwayland(true, || false, || true),
|
||
"layer-shell (or X11) keeps its own overlays"
|
||
);
|
||
assert!(
|
||
!floats_on_xwayland(true, || true, || false),
|
||
"never starts XWayland"
|
||
);
|
||
}
|
||
|
||
#[test]
|
||
fn looks_for_nothing_while_the_lab_is_off() {
|
||
let looked = std::cell::Cell::new(false);
|
||
let look = || {
|
||
looked.set(true);
|
||
true
|
||
};
|
||
assert!(!floats_on_xwayland(false, look, look));
|
||
assert!(!looked.get());
|
||
}
|
||
}
|