Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 14 additions & 29 deletions src/components/background/background.vala
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ namespace Singularity {
attribution_label.visible = false;
attribution_label.can_focus = false;
attribution_label.can_target = false;
attribution_label.wrap = true;
attribution_label.wrap_mode = Pango.WrapMode.WORD_CHAR;
attribution_label.lines = 2;
attribution_label.ellipsize = Pango.EllipsizeMode.END;
attribution_label.max_width_chars = 40;
wp_overlay = new Gtk.Overlay();
wp_motion = new Singularity.Animation.MotionBin(wp_stack);
wp_overlay.set_child(wp_motion);
Expand Down Expand Up @@ -205,43 +210,18 @@ namespace Singularity {
Singularity.Motion.Duration.SCENE, Singularity.Motion.Curve.EMPHASIZED);
}

// Wallpaper attribution overlay (Background.vala).
//
// as a single Gtk.Label over the wallpaper cross-fade. The scrim
// is a semi-transparent rounded rectangle so the text reads
// against both bright and dark wallpapers without an aggressive
// box, and the light-bg / non-light-bg pair matches the
// convention panel.vala already uses for the top band -- same
// colour tokens, same threshold (ATTRIBUTION_LUM_THRESHOLD = 0.72,
// defined above).
//
// The luminance class selects an opposing scrim/text pair
// independently of the active application theme, since wallpaper
// contrast cannot be inferred from the theme's text colour.
//
// Moved here from libsingularity's style.css (review on
// libsingularity#13: that stylesheet should stay limited to
// reusable widget styling, and this rule only exists for the
// wallpaper attribution overlay singularity-shell owns) -- rules
// and rationale unchanged, just relocated to the actual consumer.
private const string ATTRIBUTION_CSS = """
.background-window .attribution-label {
border-radius: 8px;
padding: 6px 12px;
font-size: 13px;
font-weight: 400;
}
.background-window.light-bg .attribution-label {
/* Bright wallpaper: dark scrim with light foreground. */
background-color: alpha(black, 0.65);
color: white;
text-shadow: 0 1px 2px alpha(black, 0.45);
color: black;
text-shadow: 0 1px 3px alpha(white, 0.55), 0 1px 1px alpha(white, 0.75);
}
.background-window:not(.light-bg) .attribution-label {
/* Dark wallpaper: light scrim with dark foreground. */
background-color: alpha(white, 0.72);
color: black;
text-shadow: 0 1px 2px alpha(white, 0.35);
color: white;
text-shadow: 0 1px 3px alpha(black, 0.55), 0 1px 1px alpha(black, 0.75);
}
""";

Expand Down Expand Up @@ -347,27 +327,32 @@ namespace Singularity {
attribution_label.valign = Align.START;
attribution_label.xalign = 0.0f;
attribution_label.yalign = 0.0f;
attribution_label.justify = Justification.LEFT;
break;
case "top-right":
attribution_label.halign = Align.END;
attribution_label.valign = Align.START;
attribution_label.xalign = 1.0f;
attribution_label.yalign = 0.0f;
attribution_label.justify = Justification.RIGHT;
break;
case "bottom-right":
attribution_label.halign = Align.END;
attribution_label.valign = Align.END;
attribution_label.xalign = 1.0f;
attribution_label.yalign = 1.0f;
attribution_label.justify = Justification.RIGHT;
break;
default:
attribution_label.halign = Align.START;
attribution_label.valign = Align.END;
attribution_label.xalign = 0.0f;
attribution_label.yalign = 1.0f;
attribution_label.justify = Justification.LEFT;
break;
}
attribution_label.queue_allocate();
if (wp_overlay != null) wp_overlay.queue_allocate();
}

private void update_wallpaper(WallpaperManager manager) {
Expand Down
Loading