#!/bin/sh

# audio and xdp
if command -v systemctl > /dev/null; then
	# https://git.sinanmohd.com/nixos/tree/features/wayland.nix
	dbus-xdp-enviroment &
else
	xdg-desktop-portal &
	xdg-desktop-portal-wlr &
	pipewire &
	pipewire-pulse &
	sleep 1 && wireplumber &
fi

# gtk
configure-gtk & # https://git.sinanmohd.com/nixos/tree/features/wayland.nix

# background
swaybg -m fill -i "${XDG_DATA_HOME:-$HOME/.local/share}/wallpaper" &
echo $! > "${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/swaybg.pid" &

# notification deamon
mako &

# wob
wobpipe="${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/wobpipe" &&
mkfifo "$wobpipe" &&
tail -f "$wobpipe" | wob &

# screen lock
caffeine -st 1 &