[Bar] Ellipsize too large text

This commit is contained in:
Admin 2025-05-15 17:07:06 +02:00
parent 73ca687358
commit 7a97d7425e

View File

@ -2,6 +2,7 @@ import AstalTray from "gi://AstalTray";
import { bind, GObject } from "astal"; import { bind, GObject } from "astal";
import AstalHyprland from "gi://AstalHyprland"; import AstalHyprland from "gi://AstalHyprland";
import { Gtk } from "astal/gtk4"; import { Gtk } from "astal/gtk4";
import Pango from "gi://Pango?version=1.0";
const hypr = AstalHyprland.get_default(); const hypr = AstalHyprland.get_default();
const SYNC = GObject.BindingFlags.SYNC_CREATE; const SYNC = GObject.BindingFlags.SYNC_CREATE;
@ -105,7 +106,10 @@ const ActiveWindow = () => {
focused.as( focused.as(
client => client =>
client && ( client && (
<label label={bind(client, "title").as(String)} /> <label
maxWidthChars={40}
ellipsize={Pango.EllipsizeMode.END}
label={bind(client, "title").as(String)} />
), ),
) )
}></button> }></button>
@ -128,7 +132,7 @@ const WindowPopoverBox = () => {
<label label={bind(client, 'title')}></label> <label label={bind(client, 'title')}></label>
</box> </box>
} }
onClicked={() => client.focus()} onClicked={() => client.focus()}
></button> ></button>
}) })
})} })}