repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

enable_user_services.nu

Raw

if ($nu.os-info.name != linux) {
	return
}

const services = [
	[profile-sync-daemon psd psd.service]
	[pueued pueued pueued.service]
	[hypridle hypridle hypridle.service]
	[hyprsunset hyprsunset hyprsunset.service]
	[hyprpolkitagent /usr/lib/hyprpolkitagent/hyprpolkitagent hyprpolkitagent.service]
	[mako mako mako.service]
	[cliphist cliphist cliphist.service]
	[wl-clip-persist wl-clip-persist wl-clip-persist.service]
	[nugu-theme nu nugu-theme.service]
	[ironbar ironbar ironbar.service]
]

$services | each { | service |
	let name = $service.0
	let binary = $service.1
	let service_name = $service.2
	let found = if ($binary | str starts-with "/") { $binary | path exists } else { which $binary | is-not-empty }
	if $found {
		print $"Found program ($name). Enabling service now."
		systemctl --user enable --now $service_name
		null
	}
}

null