#!/usr/bin/env bash
# 
# SCRIPT NAME:
# .config/X11/xsetup
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# This file setups things that should by started by the x-server like the
# ibus-daemon and the keyboard layout.
#
# USAGE:
# This script is sourced by both .xinitrc and .xprofile
xset s off
xset s noblank
xset -dpms

# Set keyboard layout
setxkbmap -model pc105 -layout ch

# Start applications
nm-applet &
redshift-gtk &
sxhkd &

# Merge .Xresources on boot
xrdb -merge "${XDG_CONFIG_HOME}/X11/xresources"

# Add local configuration for taskwarrior
if [ "${IS_WORK}" = "1" ]; then
    echo "recurrence=off" > "${XDG_CONFIG_HOME}/task/localrc"
else 
    echo "" > "${XDG_CONFIG_HOME}/task/localrc"
fi

dbus-update-activation-environment --systemd DISPLAY
eval "$(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)"
export SSH_AUTH_SOCK
