#!/usr/bin/env bash

set -e

# Disable beeping
xset b off

setxkbmap -layout us -variant altgr-intl

xrdb ~/.Xresources

# xmodmap .Xmodmap
#xcape -e "Control_R=Escape"

nm-applet &

# set wallpaper
setwall --config $WALLCONFIG

dunst &
play ~/Winsounds/login.wav -q &

bash ~/remember_forever.sh

# Cursor thing
xsetroot -cursor_name left_ptr

# Set dbus display variable
# dbus-update-activation-environment --systemd DISPLAY

args="$LOPTS"
for arg in $args
do
    echo $arg
    case $arg in
        jpinput)
          export GTK_IM_MODULE=fcitx
          export QT_IM_MODULE=fcitx
          export XMODIFIERS=@im=fcitx
          fcitx5 --replace -d &
          ;;
        panel)
            echo starting panel
            polybar main &
            ;;
        composer)
            echo starting comp
            xcompmgr &
            ;;
        gnome-keyring)
            dbus-update-activation-environment --systemd DISPLAY &
            eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets) &
            ;;
        screensaver)
            xss-lock -- $HOME/Scripts/lock.sh &
            ;;
        autorandr)
            autorandr -c
            ;;
        autorun)
            ~/.xautorun
            ;;
    esac
done


# Please do not block