Port over some preinit stuff from dsk, add xdg autostarter
This commit is contained in:
parent
aa99bf2fef
commit
c82053c53f
65
firestarter
65
firestarter
@ -115,6 +115,15 @@ command -v mate-settings-daemon
|
|||||||
mate-settings-daemon
|
mate-settings-daemon
|
||||||
command -v gnome-settings-daemon
|
command -v gnome-settings-daemon
|
||||||
gnome-settings-daemon
|
gnome-settings-daemon
|
||||||
|
EOF
|
||||||
|
# XDG autostarter
|
||||||
|
cat << EOF > "$g_configdir/xdg-autostart"
|
||||||
|
command -v dex
|
||||||
|
dex -a
|
||||||
|
command -v fbautostart
|
||||||
|
fbautostart
|
||||||
|
command -v xdg-autostart
|
||||||
|
xdg-autostart "\${XDG_CURRENT_DESKTOP:-firestarter}"
|
||||||
EOF
|
EOF
|
||||||
# X compositor
|
# X compositor
|
||||||
cat << EOF > "$g_configdir/x-compositor"
|
cat << EOF > "$g_configdir/x-compositor"
|
||||||
@ -226,13 +235,13 @@ EOF
|
|||||||
}
|
}
|
||||||
step_preexecute() {
|
step_preexecute() {
|
||||||
# Special things that can't use simple configuration files
|
# Special things that can't use simple configuration files
|
||||||
[ "$dryrun" == "1" ] && return 0
|
[ "$dryrun" = "1" ] && return 0
|
||||||
|
|
||||||
# dbus
|
# dbus
|
||||||
if \
|
if \
|
||||||
[ -z "$DBUS_SESSION_BUS_ADDRESS" ] && \
|
[ -z "$DBUS_SESSION_BUS_ADDRESS" ] && \
|
||||||
[ -n "$XDG_RUNTIME_DIR" ] && \
|
[ -n "$XDG_RUNTIME_DIR" ] && \
|
||||||
[ "$XDG_RUNTIME_DIR" == "/run/user/$(id -u)" ] && \
|
[ "$XDG_RUNTIME_DIR" = "/run/user/$(id -u)" ] && \
|
||||||
[ -S "$XDG_RUNTIME_DIR/bus" ]; then
|
[ -S "$XDG_RUNTIME_DIR/bus" ]; then
|
||||||
# We already have a bus started, use it
|
# We already have a bus started, use it
|
||||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
||||||
@ -252,6 +261,41 @@ step_preexecute() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
unset hasdbus
|
unset hasdbus
|
||||||
|
|
||||||
|
# kcminit/Qt settings
|
||||||
|
if command -v kcminit > /dev/null 2>&1; then
|
||||||
|
log "Initializing KDE Control Module settings"
|
||||||
|
kcminit > /dev/null 2>&1
|
||||||
|
elif command -v qt5ct > /dev/null 2>&1; then
|
||||||
|
log "Integrating qt5ct"
|
||||||
|
if [ -z "$QT_QPA_PLATFORMTHEME" ]; then
|
||||||
|
export QT_QPA_PLATFORMTHEME="qt5ct"
|
||||||
|
log "Exporting QT_QPA_PLATFORMTHEME as \"$QT_QPA_PLATFORMTHEME\""
|
||||||
|
else
|
||||||
|
log "Using existing theme setting \"$QT_QPA_PLATFORMTHEME\""
|
||||||
|
fi
|
||||||
|
if [ -z "$QT_AUTO_SCREEN_SCALE_FACTOR" ]; then
|
||||||
|
export QT_AUTO_SCREEN_SCALE_FACTOR="0"
|
||||||
|
log "Exporting QT_AUTO_SCREEN_SCALE_FACTOR as $QT_AUTO_SCREEN_SCALE_FACTOR"
|
||||||
|
else
|
||||||
|
log "Using existing scale setting \"$QT_AUTO_SCREEN_SCALE_FACTOR\""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# xhost
|
||||||
|
if command -v xhost > /dev/null 2>&1; then
|
||||||
|
if xhost +si:localuser:"$(id -un)" > /dev/null 2>&1; then
|
||||||
|
log "Session can be accessed in other sessions by this user"
|
||||||
|
else
|
||||||
|
log "Failed to open session up via xhost"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# xset
|
||||||
|
if command -v xset > /dev/null 2>&1; then
|
||||||
|
log "Disabling bell"
|
||||||
|
xset -b
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
step_execute() {
|
step_execute() {
|
||||||
if ! [ -d "$g_configdir" ]; then
|
if ! [ -d "$g_configdir" ]; then
|
||||||
@ -264,6 +308,17 @@ step_execute() {
|
|||||||
err "Failed to create log directory \"$g_logdir\"" 53
|
err "Failed to create log directory \"$g_logdir\"" 53
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [ -f "$HOME/.xsessionrc" ]; then
|
||||||
|
if [ -r "$HOME/.xsessionrc" ]; then
|
||||||
|
if ! [ "$dryrun" = "1" ]; then
|
||||||
|
source "$HOME/.xsessionrc"
|
||||||
|
else
|
||||||
|
log "Would have sourced in .xsessionrc"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "Could not read .xsessionrc"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
for file in "$g_configdir"/*; do
|
for file in "$g_configdir"/*; do
|
||||||
if ! [ -f "$file" ]; then
|
if ! [ -f "$file" ]; then
|
||||||
log "No configuration files found; generating defaults"
|
log "No configuration files found; generating defaults"
|
||||||
@ -283,7 +338,7 @@ step_execute() {
|
|||||||
[ -f "$logfile.old" ] && rm "$logfile.old"
|
[ -f "$logfile.old" ] && rm "$logfile.old"
|
||||||
mv "$logfile" "$logfile.old"
|
mv "$logfile" "$logfile.old"
|
||||||
fi
|
fi
|
||||||
if ! [ "$dryrun" == "1" ]; then
|
if ! [ "$dryrun" = "1" ]; then
|
||||||
bash -c "$execline" > "$logfile" &
|
bash -c "$execline" > "$logfile" &
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
@ -294,7 +349,7 @@ step_execute() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
step_wait() {
|
step_wait() {
|
||||||
[ "$dryrun" == "1" ] && exit 0
|
[ "$dryrun" = "1" ] && exit 0
|
||||||
log "Waiting for programs to exit"
|
log "Waiting for programs to exit"
|
||||||
wait
|
wait
|
||||||
exit 0
|
exit 0
|
||||||
@ -305,7 +360,7 @@ main() {
|
|||||||
while getopts ":dgh" opt; do
|
while getopts ":dgh" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
d)
|
d)
|
||||||
if ! [ "$dryrun" == "1" ]; then
|
if ! [ "$dryrun" = "1" ]; then
|
||||||
log "Performing a dry run"
|
log "Performing a dry run"
|
||||||
dryrun=1
|
dryrun=1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user