gtk-ng add border to bell features
parent
a843929d5a
commit
22fc90fd55
|
|
@ -523,6 +523,22 @@ pub const Surface = extern struct {
|
|||
priv.gl_area.queueRender();
|
||||
}
|
||||
|
||||
/// Callback used to determine whether border should be shown around the
|
||||
/// surface.
|
||||
fn closureShouldBorderBeShown(
|
||||
_: *Self,
|
||||
config_: ?*Config,
|
||||
bell_ringing_: c_int,
|
||||
) callconv(.c) c_int {
|
||||
const config = if (config_) |v| v.get() else {
|
||||
log.warn("config unavailable for computing whether border should be shown , likely bug", .{});
|
||||
return @intFromBool(false);
|
||||
};
|
||||
|
||||
const bell_ringing = bell_ringing_ != 0;
|
||||
return @intFromBool(config.@"bell-features".border and bell_ringing);
|
||||
}
|
||||
|
||||
pub fn toggleFullscreen(self: *Self) void {
|
||||
signals.@"toggle-fullscreen".impl.emit(
|
||||
self,
|
||||
|
|
@ -2478,6 +2494,7 @@ pub const Surface = extern struct {
|
|||
class.bindTemplateCallback("notify_mouse_hidden", &propMouseHidden);
|
||||
class.bindTemplateCallback("notify_mouse_shape", &propMouseShape);
|
||||
class.bindTemplateCallback("notify_bell_ringing", &propBellRinging);
|
||||
class.bindTemplateCallback("should_border_be_shown", &closureShouldBorderBeShown);
|
||||
|
||||
// Properties
|
||||
gobject.ext.registerProperties(class, &.{
|
||||
|
|
|
|||
|
|
@ -102,6 +102,12 @@ label.resize-overlay {
|
|||
/* background-color: color-mix(in srgb, var(--error-bg-color), transparent); */
|
||||
}
|
||||
|
||||
.surface .bell-overlay {
|
||||
border-color: color-mix(in srgb, var(--accent-color), transparent 50%);
|
||||
border-width: 3px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
/*
|
||||
* Command Palette
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -54,6 +54,27 @@ template $GhosttySurface: Adw.Bin {
|
|||
valign: start;
|
||||
}
|
||||
|
||||
[overlay]
|
||||
// The "border" bell feature is implemented here as an overlay rather than
|
||||
// just adding a border to the GLArea or other widget for two reasons.
|
||||
// First, adding a border to an existing widget causes a resize of the
|
||||
// widget which undesirable side effects. Second, we can make it reactive
|
||||
// here in the blueprint with relatively little code.
|
||||
Revealer {
|
||||
reveal-child: bind $should_border_be_shown(template.config, template.bell-ringing) as <bool>;
|
||||
transition-type: crossfade;
|
||||
transition-duration: 500;
|
||||
|
||||
Box bell_overlay {
|
||||
styles [
|
||||
"bell-overlay",
|
||||
]
|
||||
|
||||
halign: fill;
|
||||
valign: fill;
|
||||
}
|
||||
}
|
||||
|
||||
[overlay]
|
||||
$GhosttySurfaceChildExited child_exited_overlay {
|
||||
visible: bind template.child-exited;
|
||||
|
|
|
|||
|
|
@ -2433,7 +2433,12 @@ keybind: Keybinds = .{},
|
|||
/// Prepend a bell emoji (🔔) to the title of the alerted surface until the
|
||||
/// terminal is re-focused or interacted with (such as on keyboard input).
|
||||
///
|
||||
/// Only implemented on macOS.
|
||||
/// * `border`
|
||||
///
|
||||
/// Display a border around the alerted surface until the terminal is
|
||||
/// re-focused or interacted with (such as on keyboard input).
|
||||
///
|
||||
/// GTK only.
|
||||
///
|
||||
/// Example: `audio`, `no-audio`, `system`, `no-system`
|
||||
///
|
||||
|
|
@ -6988,6 +6993,7 @@ pub const BellFeatures = packed struct {
|
|||
audio: bool = false,
|
||||
attention: bool = true,
|
||||
title: bool = true,
|
||||
border: bool = false,
|
||||
};
|
||||
|
||||
/// See mouse-shift-capture
|
||||
|
|
|
|||
Loading…
Reference in New Issue