100 lines
3.1 KiB
Bash
100 lines
3.1 KiB
Bash
#!/bin/bash
|
|
|
|
# Compatibilidad con los argumentos usados con el browser original: browser -qws http://google.com
|
|
while getopts ":qwsDWX" opt ; do
|
|
case $opt in
|
|
q) echo "Ignoring option: -q" ;;
|
|
w) echo "Ignoring option: -w" ;;
|
|
s) echo "Ignoring option: -s" ;;
|
|
D) BROWSER_DEBUG=1 ;;
|
|
W) DISABLE_WAYLAND=1 ;;
|
|
X) DISABLE_X11=1 ;;
|
|
esac
|
|
done
|
|
|
|
shift $(expr $OPTIND - 1)
|
|
|
|
browser_args="$@"
|
|
|
|
echo "Browser args: $browser_args"
|
|
|
|
[ -n "$DISABLE_WAYLAND" ] && echo "WAYLAND DISABLED"
|
|
[ -n "$DISABLE_X11" ] && echo "X11 DISABLED"
|
|
|
|
if [ -n "BROWSER_DEBUG" ] ; then
|
|
echo "DEBUG MODE ENABLED"
|
|
echo "* Terminal available via Win+Enter"
|
|
echo "* Session may be killed with Ctrl+Alt+Backspace"
|
|
echo ""
|
|
fi
|
|
|
|
[ -x "/usr/bin/kitty" ] && wl_terminal=/usr/bin/kitty
|
|
[ -x "/usr/bin/foot" ] && wl_terminal=/usr/bin/foot
|
|
#[ -x "/usr/bin/xterm" ] && x11_terminal=/usr/bin/kitty
|
|
#[ -x "/usr/bin/i3-sensible-terminal" ] && x11_terminal=/usr/bin/i3-sensible-terminal
|
|
|
|
# The admin page is hosted remotely but executes things on localhost
|
|
QTWEBENGINE_CHROMIUM_FLAGS="--disable-web-security"
|
|
|
|
[ "$UID" -eq "0" ] && QTWEBENGINE_CHROMIUM_FLAGS="${QTWEBENGINE_CHROMIUM_FLAGS} --no-sandbox"
|
|
export QTWEBENGINE_CHROMIUM_FLAGS
|
|
|
|
|
|
|
|
## sway
|
|
mkdir -p $HOME/.config/sway
|
|
echo "exec /usr/bin/OGBrowser --ignore-ssl-errors \"$browser_args\"" > $HOME/.config/sway/config
|
|
if [ -n "BROWSER_DEBUG" ] ; then
|
|
echo "bindsym Mod4+Return exec $wl_terminal" >> $HOME/.config/sway/config
|
|
echo "bindsym Control+Alt+Backspace exit" >> $HOME/.config/sway/config
|
|
fi
|
|
echo "exec touch /run/sway.started" >> $HOME/.config/sway/config
|
|
|
|
## i3
|
|
mkdir -p $HOME/.config/i3
|
|
echo "exec /usr/bin/OGBrowser --ignore-ssl-errors \"$browser_args\"" > $HOME/.config/i3/config
|
|
if [ -n "BROWSER_DEBUG" ] ; then
|
|
echo "bindsym Mod4+Return exec i3-sensible-terminal" >> $HOME/.config/i3/config
|
|
echo "bindsym Control+Mod1+BackSpace exit" >> $HOME/.config/i3/config
|
|
fi
|
|
echo "exec touch /run/x11.started" >> $HOME/.config/i3/config
|
|
|
|
## xinitrc
|
|
if [[ -z $DBUS_SESSION_BUS_ADDRESS ]]; then eval $(cat /proc/$(pidof OGAgent)/environ |sed -e 's/\x00/\x0a/g' |grep DBUS_SESSION_BUS_ADDRESS); fi
|
|
echo "export DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" > $HOME/.xinitrc
|
|
echo "exec /usr/bin/i3" >> $HOME/.xinitrc
|
|
echo "exec /usr/bin/xterm" >> $HOME/.xinitrc
|
|
|
|
|
|
# Make sure libinput works
|
|
/usr/bin/udevadm trigger
|
|
|
|
|
|
## go
|
|
rm -rf "/run/sway.started" "/run/x11.started"
|
|
|
|
if [ -x "/usr/bin/sway" -a -z "$DISABLE_WAYLAND" ] ; then
|
|
echo "*** Trying to launch Sway ***"
|
|
/usr/bin/sway
|
|
else
|
|
echo Sway not installed in this image, skipping.
|
|
fi
|
|
|
|
if [ ! -f "/run/sway.started" -a -z "$DISABLE_X11" ] ; then
|
|
if [ -x "/usr/bin/startx" ] ; then
|
|
echo "*** Trying to launch X11 ***"
|
|
/usr/bin/startx
|
|
else
|
|
echo X11 not installed in this image, skipping.
|
|
fi
|
|
else
|
|
echo "Sway was run before, not starting X11".
|
|
fi
|
|
|
|
if [ ! -f "/run/sway.started" -a ! -f "/run/x11.started" ] ; then
|
|
echo "Everything failed, dropping into a shell."
|
|
exec /usr/bin/bash
|
|
else
|
|
echo "All done."
|
|
fi
|