#!/usr/bin/env bash
xset r rate 180 40
##emacs -fs &
rm -rf ~/.cache/fontconfig

# dbus-launch sxhkd &

#gpg-agent --server &
#feh --bg-fill ~/Pictures/monochrome.jpg

#single monitor wallpaper
source ~/.fehbg
#feh --randomize --bg-fill Pictures/wallpapers


# dual monitor 
#feh --bg-scale ~/Pictures/wallpapers/morning-wallpaper-cut1.jpg ~/Pictures/wallpapers/morning-wallpaper.-cut2.jpg # dual monitor 
#Pictures/wander1.png

#dbus-launch emacs --daemon &
#other
(sleep 1 && picom --config "$HOME/.config/picom.conf" )&
#(sleep 1 && keynav)&
# warped > keynav
(sleep 1 && warpd)&
killall wired
(sleep 1 && wired ) &
(sleep 3 && greenclip daemon) &
(sleep 3 && optimus-manager-qt) &
(sleep 3 && flameshot) &

(sleep 4 && keepassxc) &
(sleep 6 && bspc rule -r KeePassXC ) &

(sleep 5 && syncthing -no-browser) &
(sleep 5 && kdeconnect-indicator) &
(sleep 4 && kdeconnectd) &
#(sleep 100 && nextcloud --background) &

#(sleep 5 && thunderbird ) &
#(sleep 7 && bspc rule -r Thunderbird ) &

# Kill all davail instances before launching a single one
kill $(pgrep --full "davmail")
(sleep 5 && davmail ) &

# kill current session and if there is ones waiting to start lol
killall goimapnotify
(sleep 55 && killall goimapnotify) &

(sleep 6 && notify-send "STARTUP MSG" "Don't Forget to unlock keepassXC!") &

# start watching all mail dirs
# moved to file
  #for imapnotify_config in ~/Documents/passwords/*_imapnotify.json; do
  #  LOG_FILE=$(sed 's#/#_#g' <<< "$imapnotify_config" )
  #  (sleep 60 && goimapnotify -conf "$imapnotify_config" &> ~/.cache/"$LOG_FILE") &
  #done
~/bin/run_goimapnotify.sh &

## Keyboard
# ibus-daemon &
# uim-toolbar-gtk3-systray & #uim Japanses Input
# Japanses Input
#(sleep 1 && fcitx -d ) &
(sleep 0 && ~/bin/keyboard ) &
#(sleep 4 && ~/bin/battery-alert ) &

(sleep 1 && udiskie --tray) &
(sleep 1 && nm-applet) &

(sleep 2 && blueberry-tray) &

## Audio
(sleep 0 && dbus-run-session pipewire ) &
(sleep 2 && dbus-run-session pipewire-pulse ) &
(sleep 2 && dbus-run-session wireplumber ) &

#(sleep 2 && polkit-dumb-agent) &


#if bspwm


#thunderbird &
#ibus-daemon -drx &
#syncthing-gtk -m &
#qbittorrent &

#~/bin/wm/download-wallpaper 
