💥 ags(notifications): fix some history size when there's a single notification

This commit is contained in:
retrozinndev
2025-03-23 12:39:35 -03:00
parent b10aa363b2
commit 1a8a54c30a
6 changed files with 31 additions and 43 deletions
+1
View File
@@ -8,6 +8,7 @@ const i18nKeys = {
"en_US": en_US, "en_US": en_US,
"pt_BR": pt_BR "pt_BR": pt_BR
}; };
const languages: Array<string> = Object.keys(i18nKeys); const languages: Array<string> = Object.keys(i18nKeys);
let language: string = getSystemLanguage(); let language: string = getSystemLanguage();
+1 -1
View File
@@ -193,7 +193,7 @@ scrollbar trough {
& slider { & slider {
@include mixins.reset-props; @include mixins.reset-props;
min-width: .85em; min-width: .45em;
background: colors.$bg-tertiary; background: colors.$bg-tertiary;
border-radius: 12px; border-radius: 12px;
} }
+1 -18
View File
@@ -72,25 +72,8 @@ box.history {
border-radius: 24px; border-radius: 24px;
padding: 20px 14px; padding: 20px 14px;
& scrollable viewport .notifications > eventbox {
& > box {
margin: 4px 0;
}
&:first-child {
& > box {
margin-top: 0;
}
}
&:last-child {
& > box {
margin-bottom: 0;
}
}
}
& > .button-row { & > .button-row {
margin-top: 12px;
& button { & button {
& label.nf { & label.nf {
font-size: 16px; font-size: 16px;
+20 -20
View File
@@ -1,26 +1,26 @@
// SCSS Variables // SCSS Variables
// Generated by 'wal' // Generated by 'wal'
$wallpaper: "/home/joaov/wallpapers/Gumi VOCALOID.png"; $wallpaper: "/home/joaov/wallpapers/Balcony Girl.png";
// Special // Special
$background: #201002; $background: #191c24;
$foreground: #c7c3bf; $foreground: #c5c6c8;
$cursor: #c7c3bf; $cursor: #c5c6c8;
// Colors // Colors
$color0: #201002; $color0: #191c24;
$color1: #DDA65D; $color1: #6F7587;
$color2: #F0BE55; $color2: #798C8F;
$color3: #789B8A; $color3: #9E9A99;
$color4: #A5B397; $color4: #C9B196;
$color5: #CEAD95; $color5: #D1BAAA;
$color6: #E7D3A7; $color6: #DBC7A5;
$color7: #98938e; $color7: #94969e;
$color8: #6e635a; $color8: #616777;
$color9: #d2b997; $color9: #7486c3;
$color10: #d4c39d; $color10: #7dbac7;
$color11: #83c9a7; $color11: #d2a495;
$color12: #bad6a0; $color12: #dac4ab;
$color13: #dbc0ad; $color13: #e1cab9;
$color14: #e5dbc4; $color14: #e2d4bc;
$color15: #c7c3bf; $color15: #c5c6c8;
-2
View File
@@ -1,7 +1,6 @@
import { Astal, Gtk, Widget } from "astal/gtk3"; import { Astal, Gtk, Widget } from "astal/gtk3";
import AstalNotifd from "gi://AstalNotifd"; import AstalNotifd from "gi://AstalNotifd";
import { Separator } from "./Separator"; import { Separator } from "./Separator";
import Pango from "gi://Pango";
import { HistoryNotification } from "../scripts/notifications"; import { HistoryNotification } from "../scripts/notifications";
import { GLib } from "astal"; import { GLib } from "astal";
@@ -119,7 +118,6 @@ export function NotificationWidget(notification: AstalNotifd.Notification|number
xalign: 0, xalign: 0,
truncate: false, truncate: false,
wrap: true, wrap: true,
wrapMode: Pango.WrapMode.WORD,
label: notification.body.replace(/\&/g, "&amp;") label: notification.body.replace(/\&/g, "&amp;")
} as Widget.LabelProps) } as Widget.LabelProps)
] ]
+8 -2
View File
@@ -7,20 +7,26 @@ import { NotificationWidget } from "../Notification";
export const NotifHistory: Gtk.Widget = new Widget.Box({ export const NotifHistory: Gtk.Widget = new Widget.Box({
orientation: Gtk.Orientation.VERTICAL, orientation: Gtk.Orientation.VERTICAL,
className: "history", className: "history",
expand: true,
visible: bind(Notifications.getDefault(), "history").as(history => history.length > 0), visible: bind(Notifications.getDefault(), "history").as(history => history.length > 0),
children: [ children: [
new Widget.Scrollable({ new Widget.Scrollable({
className: "history", className: "history",
hscroll: Gtk.PolicyType.NEVER, hscroll: Gtk.PolicyType.NEVER,
vscroll: Gtk.PolicyType.AUTOMATIC, vscroll: Gtk.PolicyType.AUTOMATIC,
expand: true,
visible: bind(Notifications.getDefault(), "history").as(history => history.length > 0), visible: bind(Notifications.getDefault(), "history").as(history => history.length > 0),
propagateNaturalHeight: true,
propagateNaturalWidth: false,
onDraw: (scrollable) => {
scrollable.minContentHeight =
((scrollable.get_child()! as Gtk.Viewport).get_child() as Widget.Box).get_children()?.[0].get_allocation().height || 0;
},
child: new Widget.Box({ child: new Widget.Box({
className: "notifications", className: "notifications",
hexpand: true, hexpand: true,
orientation: Gtk.Orientation.VERTICAL, orientation: Gtk.Orientation.VERTICAL,
homogeneous: false, homogeneous: false,
spacing: 4,
valign: Gtk.Align.START,
children: bind(Notifications.getDefault(), "history").as((history: Array<HistoryNotification>) => children: bind(Notifications.getDefault(), "history").as((history: Array<HistoryNotification>) =>
history.map((notification: HistoryNotification) => NotificationWidget(notification, history.map((notification: HistoryNotification) => NotificationWidget(notification,
() => Notifications.getDefault().removeHistory(notification.id)) () => Notifications.getDefault().removeHistory(notification.id))