source: ogLive-Builder-Git/includes/usr/bin/launch_browser

main 3.13.0
Last change on this file was bf756f2, checked in by Natalia Serrano <natalia.serrano@…>, 6 weeks ago

refs #2325 include DBUS env var in .xinitrc

  • Property mode set to 100755
File size: 3.1 KB
Line 
1#!/bin/bash
2
3# Compatibilidad con los argumentos usados con el browser original: browser -qws http://google.com
4while getopts ":qwsDWX" opt ; do
5case $opt in
6    q) echo "Ignoring option: -q" ;;
7    w) echo "Ignoring option: -w" ;;
8    s) echo "Ignoring option: -s" ;;
9    D) BROWSER_DEBUG=1 ;;
10    W) DISABLE_WAYLAND=1 ;;
11    X) DISABLE_X11=1 ;;
12    esac
13done
14
15shift $(expr $OPTIND - 1)
16
17browser_args="$@"
18
19echo "Browser args: $browser_args"
20
21[ -n "$DISABLE_WAYLAND" ] && echo "WAYLAND DISABLED"
22[ -n "$DISABLE_X11"     ] && echo "X11 DISABLED"
23
24if [ -n "BROWSER_DEBUG" ] ; then
25    echo "DEBUG MODE ENABLED"
26    echo "* Terminal available via Win+Enter"
27    echo "* Session may be killed with Ctrl+Alt+Backspace"
28    echo ""
29fi
30
31[ -x "/usr/bin/kitty" ] && wl_terminal=/usr/bin/kitty
32[ -x "/usr/bin/foot" ]  && wl_terminal=/usr/bin/foot
33#[ -x "/usr/bin/xterm" ]                 && x11_terminal=/usr/bin/kitty
34#[ -x "/usr/bin/i3-sensible-terminal" ]  && x11_terminal=/usr/bin/i3-sensible-terminal
35
36# The admin page is hosted remotely but executes things on localhost
37QTWEBENGINE_CHROMIUM_FLAGS="--disable-web-security"
38
39[ "$UID" -eq "0" ] && QTWEBENGINE_CHROMIUM_FLAGS="${QTWEBENGINE_CHROMIUM_FLAGS} --no-sandbox"
40export QTWEBENGINE_CHROMIUM_FLAGS
41
42
43
44## sway
45mkdir -p $HOME/.config/sway
46echo "exec /usr/bin/OGBrowser --ignore-ssl-errors \"$browser_args\"" > $HOME/.config/sway/config
47if [ -n "BROWSER_DEBUG" ] ; then
48    echo "bindsym Mod4+Return exec $wl_terminal"  >> $HOME/.config/sway/config
49    echo "bindsym Control+Alt+Backspace exit"     >> $HOME/.config/sway/config
50fi
51echo "exec touch /run/sway.started"     >> $HOME/.config/sway/config
52
53## i3
54mkdir -p $HOME/.config/i3
55echo "exec /usr/bin/OGBrowser --ignore-ssl-errors \"$browser_args\"" > $HOME/.config/i3/config
56if [ -n "BROWSER_DEBUG" ] ; then
57    echo "bindsym Mod4+Return exec i3-sensible-terminal"  >> $HOME/.config/i3/config
58    echo "bindsym Control+Mod1+BackSpace exit"            >> $HOME/.config/i3/config
59fi
60echo "exec touch /run/x11.started"                    >> $HOME/.config/i3/config
61
62## xinitrc
63if [[ -z $DBUS_SESSION_BUS_ADDRESS ]]; then eval $(cat /proc/$(pidof OGAgent)/environ |sed -e 's/\x00/\x0a/g' |grep DBUS_SESSION_BUS_ADDRESS); fi
64echo "export DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" > $HOME/.xinitrc
65echo "exec /usr/bin/i3"                                          >> $HOME/.xinitrc
66echo "exec /usr/bin/xterm"                                       >> $HOME/.xinitrc
67
68
69# Make sure libinput works
70/usr/bin/udevadm trigger
71
72
73## go
74rm -rf "/run/sway.started" "/run/x11.started"
75
76if [ -x "/usr/bin/sway" -a -z "$DISABLE_WAYLAND" ] ; then
77    echo "*** Trying to launch Sway ***"
78    /usr/bin/sway
79else
80    echo Sway not installed in this image, skipping.
81fi
82
83if [ ! -f "/run/sway.started" -a -z "$DISABLE_X11" ] ; then
84    if [ -x "/usr/bin/startx" ] ; then
85        echo "*** Trying to launch X11 ***"
86        /usr/bin/startx
87    else
88        echo X11 not installed in this image, skipping.
89    fi
90else
91    echo "Sway was run before, not starting X11".
92fi
93
94if [ ! -f "/run/sway.started" -a ! -f "/run/x11.started" ] ; then
95    echo "Everything failed, dropping into a shell."
96    exec /usr/bin/bash
97else
98    echo "All done."
99fi
Note: See TracBrowser for help on using the repository browser.