#!/bin/sh
#PATH="$HOME/.local/bin:$PATH"
export BROWSER="firefox-esr"
export FREETYPE_PROPERTIES="truetype:interpreter-version=35"
#export LC_ALL="C"
#export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"
#export LD_LIBRARY_PATH="/usr/local/lib"
#export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=off -Dswing.aatext=false -Dswing.defaultlaf=com.sun.java.swing.plaf.motif.MotifLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.motif.MotifLookAndFeel -Dswing.systemlaf=com.sun.java.swing.plaf.motif.MotifLookAndFeel"
#export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=off -Dswing.aatext=false -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel -Dswing.crossplatformlaf=javax.swing.plaf.metal.MetalLookAndFeel -Dswing.systemlaf=javax.swing.plaf.metal.MetalLookAndFeel -Dswing.metalTheme=steel"
#export NO_AT_BRIDGE=1
#export LC_TIME="nl_NL.UTF-8"
#export DO_NOT_TRACK=1
export ICE2KSYS_SOUND_LOGON="$HOME/.icewm/sounds/logon.wav"
export ICE2KSYS_SOUND_LOGOFF="$HOME/.icewm/sounds/logoff.wav"
export ICE2KSYS_SOUND_ERROR="$HOME/.icewm/sounds/error.wav"
export ICE2KSYS_SOUND_DING="$HOME/.icewm/sounds/ding.wav"
export ICE2KSYS_SOUND_CHIMES="$HOME/.icewm/sounds/chimes.wav"
#export QT_ACCESSIBILITY=0
#export XDG_RUNTIME_DIR="/run/user/$(id -u)"
#ffmpeg -async 30 -video_size 1920x1080 -r 30 -framerate 30 -f x11grab -i :0.0 -f alsa -ac 2 -i plughw:1,1 /tmp/screenrec.mkv &
sleep 1
~/.icewm/programs/firstrun/firstrun
xrdb -merge "$HOME/.Xresources"
#timidity -iA -B2,8 -OO -EFreverb=0&
icewm-session -n
#exec /usr/local/bin/startkde

gettree() {
	local parent_pid="$1"
	echo -n "$1 "
	local children=$(pgrep -P "$parent_pid")  # Get children PIDs
	for child_pid in $children; do
		gettree "$child_pid"
	done
}

kill -9 $(gettree $(cat /tmp/kbswitch/pid))

#exec icewm -r


#exec /opt/trinity/bin/starttde

#kill -9 -- -"$(ps -o pgid= -p $(cat /tmp/kbswitch/pid) | tr -d ' ' )"
