bar text: truncate instead of having horiz scroll (#320)

This commit is contained in:
end-4
2024-03-10 23:05:41 +07:00
parent 3f05d77664
commit 0b979d9903
2 changed files with 15 additions and 11 deletions
+3 -3
View File
@@ -133,10 +133,11 @@ export default () => {
] ]
})] })]
}); });
const trackTitle = Scrollable({ const trackTitle = Label({
hexpand: true, hexpand: true,
child: Label({
className: 'txt-smallie txt-onSurfaceVariant', className: 'txt-smallie txt-onSurfaceVariant',
truncate: 'end',
maxWidthChars: 10, // Doesn't matter, just needs to be non negative
setup: (self) => self.hook(Mpris, label => { setup: (self) => self.hook(Mpris, label => {
const mpris = Mpris.getPlayer(''); const mpris = Mpris.getPlayer('');
if (mpris) if (mpris)
@@ -145,7 +146,6 @@ export default () => {
label.label = 'No media'; label.label = 'No media';
}), }),
}) })
})
const musicStuff = Box({ const musicStuff = Box({
className: 'spacing-h-10', className: 'spacing-h-10',
hexpand: true, hexpand: true,
@@ -14,6 +14,8 @@ const WindowTitle = async () => {
children: [ children: [
Widget.Label({ Widget.Label({
xalign: 0, xalign: 0,
truncate: 'end',
maxWidthChars: 10, // Doesn't matter, just needs to be non negative
className: 'txt-smaller bar-topdesc txt', className: 'txt-smaller bar-topdesc txt',
setup: (self) => self.hook(Hyprland.active.client, label => { // Hyprland.active.client setup: (self) => self.hook(Hyprland.active.client, label => { // Hyprland.active.client
label.label = Hyprland.active.client.class.length === 0 ? 'Desktop' : Hyprland.active.client.class; label.label = Hyprland.active.client.class.length === 0 ? 'Desktop' : Hyprland.active.client.class;
@@ -21,6 +23,8 @@ const WindowTitle = async () => {
}), }),
Widget.Label({ Widget.Label({
xalign: 0, xalign: 0,
truncate: 'end',
maxWidthChars: 10, // Doesn't matter, just needs to be non negative
className: 'txt txt-smallie', className: 'txt txt-smallie',
setup: (self) => self.hook(Hyprland.active.client, label => { // Hyprland.active.client setup: (self) => self.hook(Hyprland.active.client, label => { // Hyprland.active.client
label.label = Hyprland.active.client.title.length === 0 ? `Workspace ${Hyprland.active.workspace.id}` : Hyprland.active.client.title; label.label = Hyprland.active.client.title.length === 0 ? `Workspace ${Hyprland.active.workspace.id}` : Hyprland.active.client.title;