Fixes the window title label option (#272)
* fix window title label option not being respected * add window title icon and label side effects * add new line to SideEffects.ts * fix window title children type
This commit is contained in:
@@ -13,3 +13,17 @@ showTime.connect('changed', () => {
|
|||||||
showIcon.value = true;
|
showIcon.value = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { label, icon } = options.bar.windowtitle;
|
||||||
|
|
||||||
|
label.connect('changed', () => {
|
||||||
|
if (!label.value && !icon.value) {
|
||||||
|
icon.value = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
icon.connect('changed', () => {
|
||||||
|
if (!label.value && !icon.value) {
|
||||||
|
label.value = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
const hyprland = await Service.import('hyprland');
|
const hyprland = await Service.import('hyprland');
|
||||||
import { BarBoxChild } from 'lib/types/bar';
|
import { BarBoxChild } from 'lib/types/bar';
|
||||||
import options from 'options';
|
import options from 'options';
|
||||||
|
import { Child } from 'lib/types/widget';
|
||||||
import { ActiveClient } from 'types/service/hyprland';
|
import { ActiveClient } from 'types/service/hyprland';
|
||||||
|
import Label from 'types/widgets/label';
|
||||||
|
|
||||||
const filterTitle = (windowtitle: ActiveClient): Record<string, string> => {
|
const filterTitle = (windowtitle: ActiveClient): Record<string, string> => {
|
||||||
const windowTitleMap = [
|
const windowTitleMap = [
|
||||||
@@ -177,24 +179,18 @@ const ClientTitle = (): BarBoxChild => {
|
|||||||
truncation_size.bind('value'),
|
truncation_size.bind('value'),
|
||||||
],
|
],
|
||||||
(client, useCustomTitle, useClassName, showLabel, showIcon, truncate, truncationSize) => {
|
(client, useCustomTitle, useClassName, showLabel, showIcon, truncate, truncationSize) => {
|
||||||
|
const children: Label<Child>[] = [];
|
||||||
if (showIcon) {
|
if (showIcon) {
|
||||||
return [
|
children.push(
|
||||||
Widget.Label({
|
Widget.Label({
|
||||||
class_name: 'bar-button-icon windowtitle txt-icon bar',
|
class_name: 'bar-button-icon windowtitle txt-icon bar',
|
||||||
label: filterTitle(client).icon,
|
label: filterTitle(client).icon,
|
||||||
}),
|
}),
|
||||||
Widget.Label({
|
);
|
||||||
class_name: `bar-button-label windowtitle ${showIcon ? '' : 'no-icon'}`,
|
|
||||||
label: truncateTitle(
|
|
||||||
getTitle(client, useCustomTitle, useClassName),
|
|
||||||
truncate ? truncationSize : -1,
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showLabel) {
|
if (showLabel) {
|
||||||
return [
|
children.push(
|
||||||
Widget.Label({
|
Widget.Label({
|
||||||
class_name: `bar-button-label windowtitle ${showIcon ? '' : 'no-icon'}`,
|
class_name: `bar-button-label windowtitle ${showIcon ? '' : 'no-icon'}`,
|
||||||
label: truncateTitle(
|
label: truncateTitle(
|
||||||
@@ -202,10 +198,10 @@ const ClientTitle = (): BarBoxChild => {
|
|||||||
truncate ? truncationSize : -1,
|
truncate ? truncationSize : -1,
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
];
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return children;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user