summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/surf-display85
1 files changed, 36 insertions, 49 deletions
diff --git a/bin/surf-display b/bin/surf-display
index b4e278c..47ddc6e 100755
--- a/bin/surf-display
+++ b/bin/surf-display
@@ -8,12 +8,12 @@
# 2016, Daniel Teichmann <daniel.letsplay007@gmail.com>
# 2017, Benjamin Schlüter <bschlueter@posteo.de>
-# Midori Display is free software; you can redistribute it and/or modify
+# Surf Kiosk Display is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# Midori Display is distributed in the hope that it will be useful,
+# Surf Kiosk Display is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
@@ -24,6 +24,7 @@
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# dependencies:
+# surf
# wmctrl
# matchbox-window-manager
# pulseaudio-utils
@@ -39,8 +40,10 @@
VERSION="0.0.2"
-# Can be configured at "/etc/default/surf-display"
-DEFAULT_WWW_URI="file:///usr/share/surf-display/empty-page.html"
+BROWSER=surf
+
+# Can be configured at "/etc/default/${BROWSER}-display"
+DEFAULT_WWW_URI="file:///usr/share/${BROWSER}-display/empty-page.html"
DEFAULT_RESOLUTION=""
# all displays that need to be changed
@@ -52,7 +55,7 @@ WITH_PULSEAUDIO="yes"
# hide idle mouse pointer
HIDE_IDLE_POINTER="yes"
-# disable right and middle pointer device click in Midori sessions while keeping
+# disable right and middle pointer device click in browser sessions while keeping
# scrolling wheels' functionality intact... (consider "pointer" subcommand on
# xmodmap man page for details).
POINTER_BUTTON_MAP="1 0 0 4 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
@@ -76,27 +79,27 @@ if type -p xrandr 1>/dev/null; then
currentOutput=`echo "$(xrandr)" | grep -w 'connected' | sed -r -e 's/connected.*//' | head -n 1`
fi
-if [ -r /etc/default/surf-display ] && [ ! -d /etc/default/surf-display ]; then
- . /etc/default/surf-display
+if [ -r /etc/default/${BROWSER}-display ] && [ ! -d /etc/default/${BROWSER}-display ]; then
+ . /etc/default/${BROWSER}-display
fi
-if [ -r $HOME/.surf-display/config ] && [ ! -d $HOME/.surf-display/config ]; then
- . $HOME/.surf-display/config
+if [ -r $HOME/.${BROWSER}-display/config ] && [ ! -d $HOME/.${BROWSER}-display/config ]; then
+ . $HOME/.${BROWSER}-display/config
fi
if [ "x$LOG_TO_SYSLOG" = "xyes" ]; then
- OUTPUT="logger -t surf-display"
+ OUTPUT="logger -t ${BROWSER}-display"
else
OUTPUT="echo"
fi
-workdir="$HOME/.surf-display"
+workdir="$HOME/.${BROWSER}-display"
mkdir -p "$workdir"
session_lock="$workdir/.session-lock.$$"
-browser_lock="$workdir/.midori-lock"
+browser_lock="$workdir/.surf-lock"
-browser_config_dir=`mktemp -d -p "$workdir" surf-display-profile-XXXXXX`
+browser_config_dir=`mktemp -d -p "$workdir" ${BROWSER}-display-profile-XXXXXX`
# provide pulseaudio support in the browser session, if not
# already available...
@@ -124,7 +127,7 @@ if [ "x$HIDE_IDLE_POINTER" = "xyes" ]; then
fi
fi
-# hack mouse pointer functionality to e.g. disable "right-click" in Midori session
+# hack mouse pointer functionality to e.g. disable "right-click" in browser session
sanitized_pointer_button_map=$(echo ${POINTER_BUTTON_MAP//[^0-9\ ]/} | sed -e 's/^\s*//' -e 's/\s*$//')
count_buttons_pointer_button_map=$(echo -n "${sanitized_pointer_button_map//[0-9]/}"| wc -m)
@@ -133,10 +136,6 @@ if which xmodmap 1>/dev/null; then
[ $count_buttons_pointer_button_map -lt 32 ]; then
xmodmap -e "pointer = $POINTER_BUTTON_MAP"
fi
-
- # furthermore... let's deactivate the "Control" modifier key to disable most hotkeys in Midori
- xmodmap -e "clear Control"
-
else
$OUTPUT "WARNING: Cannot strip down mouse/pointer button functionality. Make sure 'xmodmap' is installed."
fi
@@ -257,36 +256,24 @@ function browser_loop {
function browser_session {
- if which midori 1>/dev/null; then
+ if which "${BROWSER}" 1>/dev/null; then
while [ -e "$session_lock" ]; do
- $OUTPUT "INFO: Starting a new instance of the midori application."
- midori \
- -e Fullscreen \
- -e enable-plugins=false \
- -e enable-page-cache=false \
- -e open-new-pages-in=MIDORI_NEW_PAGE_CURRENT \
- -e close-buttons-on-tabs=false \
- -e show-menubar=false \
- -e show-statusbar=false \
- -e show-bookmarkbar=false \
- -e show-panel=false \
- -e show-crash-dialog=false \
- -e open-tabs-in-the-background=false \
- -e open-tabs-next-to-current=false \
- -e open-popups-in-tabs=false \
- -e enable-xss-auditor=false \
- -e enable-javascript=true \
- -e enable-developer-extras=false \
- -e enable-html5-database=true \
- -e enable-running-of-insecure-content=false \
- -e enable-display-of-insecure-content=false \
- -e javascript-can-access-clipboard=false \
- -e print-without-dialog=true \
- -c "${browser_config_dir}" \
- ${URI_BLOCKLIST} \
- -a "${WWW_URI}" 1>/dev/null 2>/dev/null &
+ LANG=C ${BROWSER} \
+ -a "A" \
+ -B \
+ -c "${browser_config_dir}/cookies" \
+ -D \
+ -F \
+ -g \
+ -I \
+ -K \
+ -m \
+ -n \
+ -P \
+ -S \
+ "${WWW_URI}" 1>/dev/null 2>/dev/null &
browser_pid=$!
@@ -303,18 +290,18 @@ function browser_session {
fi
break
- browser_config_dir=`mktemp -d -p "$workdir" surf-display-profile-XXXXXX`
+ browser_config_dir=`mktemp -d -p "$workdir" ${BROWSER}-display-profile-XXXXXX`
fi
done
kill -0 "$browser_pid" 2>/dev/null && kill "$browser_pid"
- $OUTPUT "INFO: The midori application has terminated."
+ $OUTPUT "INFO: The surf application has terminated."
done
else
- $OUTPUT "ERROR: The midori application is not installed."
+ $OUTPUT "ERROR: The surf application is not installed."
fi
}
@@ -328,7 +315,7 @@ function create_lock {
### MAIN ###
-$OUTPUT "INFO: midori Display (version $VERSION)"
+$OUTPUT "INFO: Surf Kiosk Display (version $VERSION)"
$OUTPUT "INFO: HOSTNAME set to: $THIS_HOSTNAME"
if [ -n "$WWW_URI" ]; then