#!/usr/bin/env bash
# Picom - https://manpages.debian.org/stable/picom/picom.1.en.html
pgrep -x picom >/dev/null || picom --backend xrender --vsync --no-fading-openclose --no-fading-destroyed-argb &
# Picom use... --backend glx or xrender, --vsync --no-vsync --no-fading-openclose --no-fading-destroyed-argb etc.

exec /usr/bin/lxpolkit & # Graphical authentication agent

# Run "ARandr" to set the desired screens with resolution and refresh rate and save it as a profile using.
# Terminal command.: autorandr --save PROFILENAME
#
# See more https://man.archlinux.org/man/extra/autorandr/autorandr.1.en
#
autorandr --change &

# This here if statement sets your background image, with feh...
# and is also used for the auto-generation of the background image and colors.
if [ -f ~/.fehbg ]; then
  . ~/.fehbg
else
  auto-new-wallpaper-and-colors
  #feh --bg-scale $(find ~/Wallpapers -type f | shuf -n 1)
fi

wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 &
wpctl set-volume @DEFAULT_AUDIO_SINK@ 25% &
dunst &
#numlockx on &
#mpd &

if [ -f ~/.Xresources ]; then
  xrdb ~/.Xresources &
fi

#keynav &
#kdeconnectd &
#
# Turn off the Screen after X time in seconds
xset dpms 2700 2700 2700 &

# Run & Remove .user-setup / .first-login-user-setup files --------------------------------------------------------------
if [ -f ~/.first-login-user-setup ]; then
  . ~/.first-login-user-setup
  sleep 0.69
  rm -f ~/.first-login-user-setup
fi
if [ -f ~/.user-setup ]; then
  . ~/.user-setup
  sleep 0.69
  rm -f ~/.user-setup
fi
