Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Services do not emit signals on app start #4

Open
PoSayDone opened this issue Mar 30, 2024 · 0 comments
Open

Services do not emit signals on app start #4

PoSayDone opened this issue Mar 30, 2024 · 0 comments

Comments

@PoSayDone
Copy link

I'm trying to connect to a service with a hook, but icons, sliders values and classes are not set when the application starts.
Maybe services don't emit signals during initialization?

const NetworkIndicator = () =>
	Widget.Icon().hook(network, (self) => {
		const icon = network[network.primary || 'wifi']?.icon_name;
		self.icon = icon || '';
		self.visible = !!icon;
	});
type ControlCenterButtonProps = {
	label: LabelProps['label'];
	connection: [GObject.Object, () => boolean];
	icon: IconProps['icon'];
} & ButtonProps;
export default ({
	icon,
	label,
	connection: [service, condition],
	...props
}: ControlCenterButtonProps) =>
	Widget.Button({
		cssClasses: ['control-center__button'],
		child: Widget.Box({
			hexpand: true,
			hpack: 'start',
			spacing: 12,
			children: [Widget.Icon({ icon }), Widget.Label({ label })],
		}),
		setup: (self) => {
			self.hook(service, () => {
				self.toggleCssClass('active', condition());
			});
		},
		...props,
	});

image
image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant