#!/bin/bash

# Wallpaper
swaybg -o '*' -i ~/.wall.jpg -m fill &

# Fonts
fc-cache -fv &

# Fix for xdg-desktop-portal failing,
# causing slow GTK application start ups
# <https://github.com/swaywm/sway/issues/5732>
systemctl --user import-environment

# Other daemons
batt mon &
agenda remind 5 &
gammastep &

swayidle -w \
    timeout 300 '~/.bin/lock' \
    timeout 900 'systemctl suspend' &

# Prevent sleep when audio is playing
bash -c 'while true; do sway-audio-idle-inhibit; sleep 1; done' &

# For screensharing, etc.
# See <https://github.com/YaLTeR/niri/wiki/Screencasting
/usr/libexec/xdg-desktop-portal-gnome &

# Lock screen to require login.
sleep 0.2 && bash -c ~/.bin/lock &
