From faebb898f76cac802cfc247e5544a6138e24cf95 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Fri, 25 Nov 2011 11:47:19 -0600 Subject: linhes-session: add the ability to switch windowmangers using the set_windowmanger.sh script. "set_windowmanger.sh enlightenment" will set the default windowmanger to our sepecial instance of enlightenment Current valid values for the windowmanager are: default enlightement windowmaker $any_thing_else if /etc/X11/WINDOWMANGER is not present, or the script is never run then fluxbox is used by default. This script will also set the style of startup. Normally the startup is set so that the windowmanager is the last thing to keep X running. When the optional style of mythvantage is given, then the windowmanger is started in the BG and mythfrontend is put in a looping state. Exiting the windowmanger will not restart the session. to restart the session "sv restart frontend" must be issued. Current state of style is functional but incomplete. --- abs/core/LinHES-system/LinHES-session | 335 +++++++++++++++++++++++++++- abs/core/LinHES-system/PKGBUILD | 9 +- abs/core/LinHES-system/set_windowmanager.sh | 100 +++++++++ 3 files changed, 438 insertions(+), 6 deletions(-) create mode 100644 abs/core/LinHES-system/set_windowmanager.sh diff --git a/abs/core/LinHES-system/LinHES-session b/abs/core/LinHES-system/LinHES-session index 815c3d5..f33ebeb 100755 --- a/abs/core/LinHES-system/LinHES-session +++ b/abs/core/LinHES-system/LinHES-session @@ -2,17 +2,348 @@ . /etc/profile . /etc/systemconfig +if [ -e /etc/X11/WINDOWMANAGER ] +then + . /etc/X11/WINDOWMANAGER +fi + xhost +local: xhost +127.0.0.1 xset -dpms s off + export MALLOC_CHECK_=0 -#start fluxbox + + + +# # Run any scripting that applies to special hardware. These brand-specific commands that run +# # after Tweaker will, of course, override generic or hardware-specific settings. +# SpecialHardwareCommands() { +# special_hardware_file=/myth/.special_hardware_type +# special_hardware=`cat $special_hardware_file` +# +# case $special_hardware in +# dragon*) +# sudo -E twk_audio.pl --implement digital +# sudo -E twk_dragon.pl --implement all +# ;; +# ausdragon*) +# ;; +# *) +# # there are no brand-specific commands for configuring whatever +# # special hardware the user chose +# ;; +# esac +# } + + + +. /etc/osd_cat.cfg || { + color=yellow + outline=2 + outlinecolour=black + shadow=0 + shadowcolour=black + font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" +} + +function msg(){ + echo -e "$1" | osd_cat --pos=middle --align=center --offset=200 --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & + #use fancy ghost + #bash -c "sleep 6;osdClient.pl localhost 5000 'ALT+h for shortcuts:::SYS' "& + + +} + + +function unclutter(){ + if [ -e /etc/unclutter ] + then + . /etc/unclutter.cfg + else + idle=1 + jitter=200 + fi + + /usr/X11R6/bin/unclutter -root -idle $idle -jitter $jitter -noevents & +} + +function keylaunch(){ + if [ -f /usr/bin/keylaunch ] + then +# MHOME=`cat /etc/passwd | grep "mythtv" | cut -d":" -f6` + if [ ! -e $HOME/.keylaunchrc ] + then + echo "setting symlink for keylaunch" + ln -s /etc/keylaunchrc $HOME/.keylaunchrc + fi + /usr/bin/keylaunch & + fi + +} + + +function load_nvidia_settings(){ + lsmod |cut -f1 -d" " |grep -q nvidia + if [ $? = 0 ] + then + /usr/bin/nvidia-settings --load-config-only + fi +} + +function run_tilda(){ + + + if [ -f /usr/bin/tilda ] + then + if [ ! -e ~/.tilda/config_0 ] + then + mkdir -p ~/.tilda/ + fi + + width=`/usr/bin/xwininfo -root|grep Width | awk '{ print $2}'` + height=`/usr/bin/xwininfo -root|grep Height | awk '{ print $2}'` + center=$[width/2] + sixtypercent=`echo "scale=0; ( $width*.6) / 1" |bc` + quarter_height=`echo "scale=0; ($height*.35) /1" |bc` + + + if [ $sixtypercent -lt 700 ] + then + sixtypercent=700 + fi + + if [ $quarter_height -lt 350 ] + then + quarter_height=350 + fi + startloc=`echo "scale=0 ; (${center}-(${sixtypercent})/2) / 1" |bc` + + + sed -e "s/^max_width.*$/max_width = $sixtypercent/" \ + -e "s/^max_height.*$/max_height = $quarter_height/" \ + -e "s/^x_pos.*$/x_pos = $startloc/g" /etc/tilda_config > ~/.tilda/config_0 + + /usr/bin/tilda -h & + + fi +} + + +function mouse_move(){ + #move mouse to corner + xdotool mousemove 0 0 +} + + +function start_screensaver(){ + + if [ x"$Screensavertype" = "xgscreensaver" ] + then + gnome-screensaver & + elif [ x"$Screensavertype" = "xxscreensaver" ] + then + xscreensaver -no-splash & + fi +} + +function show_help_tip(){ + + if [ x$ShowTips = "x1" ] + then + msg "Alt+h for help" & + fi +} + +function update_apple_trailers(){ + #update apple trailers + if [[ x$RunFrontend = x1 && -f ~/.configure ]] + then + /usr/bin/php -q /usr/bin/myth_trailers_grabber > /home/mythtv/appletrailer.xml && /usr/bin/fix_aple_url.sh 2>/dev/null & + fi +} + + +function first_configure(){ + if [ x$STARTUP_STYLE = xmythvantage ] + then + first_configure_mv + else + first_configure_default + fi +} + + +function first_configure_default(){ + if [ ! $SystemType = "Frontend_only" ] + then + if [ -f ~/.configure ] + then + # Run Tweaker, which applies generic and hardware-specific settings + if [ ! -f ~/.no_meth ] + then + #remove tweaker cause it's broken and duplicates entries + #sudo -E tweaker.pl + #/bin/rm /tmp/fps # ??? clean up a temp file that will eventually be obsolete anyway + # Run any brand-specific commands, if necessary. + SpecialHardwareCommands + else + rm -f ~/.no_meth + fi + + sudo sv stop mythbackend + /usr/LH/bin/dtheme.sh + xterm -fn *18* -e sudo taskset -c 0 /usr/bin/mythtv-setup + sudo sv start mythbackend + sudo chown -R mythtv.mythtv /home/mythtv + nice -n 19 mythfilldatabase --quiet & + msg "Guide data is being loaded. \n Until this completes\n some shows will appear as unknown \n in the program guide." + rm ~/.configure + fi + fi +} + + +function first_configure_mv(){ + if [ ! $SystemType = "Frontend_only" ] + then + if [ ! -f ~/.configured ] + then + autocard.py -g & + MythVantage -b + #/root/autocard.py -g & + #/usr/local/bin/mythinstall -b + + #0 yes + #1 yes/autodetech + #2 no + STATUS=$? + if [ ! $STATUS = 2 ] + then + /usr/bin/backend_control.sh stop BE 127.0.0.1 + /usr/local/bin/mythtv-setup + /usr/bin/backend_control.sh start BE 127.0.0.1 + fi + touch ~/.configured + fi + fi +} + +function start_myth() { + if [ x"$UseMythWelcome" = "x1" ] + then + STARTCMD="/usr/bin/mythwelcome" + else + STARTCMD="/usr/bin/mythfrontend -d -l /var/log/mythtv/mythfrontend.log" + fi + + echo "=====================================================================" + echo "Starting $STARTCMD" + firstboot.sh & + + #continue on with starting mythtv + + if [ x$STARTUP_STYLE = xmythvantage ] + then + start_myth_mv + else + start_myth_default + fi + + } + + +function start_myth_default(){ + + if [ -f /tmp/nomfe ] + then + exit 0 + else + if [ -f /tmp/debug ] + then + echo "using gbd/debug" + gdb /usr/bin/mythfrontend -x $MV_ROOT/mfegdbcommands.txt + mv gdb.txt gdb.txt.mythfrontend + sleep 10 + else + killall -9 irexec + /usr/bin/irexec -d + $STARTCMD 2>&1 & + fi + fi + + + + +} + + +function start_myth_mv(){ + + while [ x = x ] + do + if [ -f /tmp/nomfe ] + then + sleep 120 + else + if [ -f /tmp/debug ] + then + + echo "using gbd/debug" + gdb /usr/local/bin/mythfrontend -x $MV_ROOT/mfegdbcommands.txt + bash -c "osdClient.pl localhost 5000 'Restart: mdb.txt.mythfrontend:::SYS' "& + mv gdb.txt gdb.txt.mythfrontend + sleep 10 + + else + killall -9 irexec + /usr/bin/irexec & + $STARTCMD 2>&1 + fi + fi + echo "_______________________________________________________" + done + + + } + + +function set_background() +{ + echo "Setting the background" + + } + + if [ x$WM = "x" ] then fluxbox > /var/log/fluxbox.log 2>&1 else - $WM 2>&1 + #if using mythvantage style, start the WM right away + # this is done so that starting mythtv can loop. + + if [ x$STARTUP_STYLE = xmythvantage ] + then + $WM & + fi + mouse_move + keylaunch + set_background + unclutter + load_nvidia_settings + run_tilda + start_screensaver + show_help_tip + #update_apple_trailers + first_configure + start_myth + + # start windowmanger + if [ x$STARTUP_STYLE != xmythvantage ] + then + $WM + fi + fi diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index 9baad6e..118b92b 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,14 +1,14 @@ pkgname=LinHES-system pkgver=2 -pkgrel=7 +pkgrel=8 arch=('i686') MVDIR=$startdir/pkg/usr/LH BINDIR=$startdir/pkg/usr/bin install=LinHES.install pkgdesc="scripts and things related to having an automated system" -depends=(linhes-sounds xdotool fluxbox windowmaker) +depends=(linhes-sounds xdotool fluxbox tilda keylaunch ) backup=(etc/modprobe.d/alsa-base) -binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run firstboot.sh load-modules-mythvantage.sh unclutter-toggle.sh tvterm.sh myth_mtc.lr smolt.cron mythfrontend-start" +binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run firstboot.sh load-modules-mythvantage.sh unclutter-toggle.sh tvterm.sh myth_mtc.lr smolt.cron mythfrontend-start set_windowmanager.sh" source=(LinHES-session LinHES-profile.sh $binfiles alsa-base) @@ -37,7 +37,7 @@ build() { mkdir $startdir/pkg/etc/logrotate.d cp $startdir/myth_mtc.lr $startdir/pkg/etc/logrotate.d } -md5sums=('c5f31e92bd94ffd8c5c67e544bbffd07' +md5sums=('6ecd5876ce62a7c17af64c0b852b3523' '5881bdb43d578ec3a79d1f77ea58a3db' 'a875ee97f86e46f34a741c2bc455f894' '76b2637cac0452b3acdbeeb4e8a5474b' @@ -51,4 +51,5 @@ md5sums=('c5f31e92bd94ffd8c5c67e544bbffd07' 'f1870a9522c79e6b248fcbf81dec3280' 'abe887472a170bd1a8e6da6a7b7e93e4' '752488eb8bfb672ce0e4c924f7faf3d1' + 'dae4dfb638b11c8c79fb1424a60b762a' 'eb879fee9603a05d5420d4ce8ed9e450') diff --git a/abs/core/LinHES-system/set_windowmanager.sh b/abs/core/LinHES-system/set_windowmanager.sh new file mode 100644 index 0000000..5c1150d --- /dev/null +++ b/abs/core/LinHES-system/set_windowmanager.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# Script to change the windowmanger used when starting the frontend. +# If a style is given, it will change which & how programs will start. +# +# +windowmanager="$1" +style="$2" + + +function outmsg(){ + echo + echo "Changing windowmanger to $1" + } + +function stylemsg(){ + echo "Startup path will use $1 style" + } + +if [ x$windowmanager = x ] +then + echo + echo "Usage: " + echo " set_windowmanger.sh WINDOWMANAGER STARTUP_STYLE" + echo + echo "Valid WINDOWMANAGER options are:" + echo " default" + echo " enlightenment" + echo " fluxbox" + echo " windowmaker" + echo " place_custom_startup_here" + echo + echo "Valid STARTUP_STYLE options are:" + echo " default" + echo " mythvantage" + echo + echo "If STARTUP_STYLE is not given, then the default will be used." + echo + echo "Example: " + echo " set_windowmanger.sh enlightenment mythvantage" + echo + + + exit 0 +fi + + +case ${windowmanager} in + + default) + outmsg "default/fluxbox" + outline="fluxbox" + echo "" > /etc/X11/WINDOWMANAGER + exit 0 + ;; + + enlightenment) + outmsg "enlightenment" + outline="e16 -P /data/e16_config_dir/" + ;; + + windowmaker) + outmsg "window maker" + outline_2="export GNUSTEP_USER_ROOT=/data/GNUstep" + + outline="wmaker" + ;; + + *) + outline=$windowmanager + outmsg "$outline" + ;; + +esac + + + +case ${style} in + + mythvantage) + + STYLE="mythvantage" + stylemsg MythVantage + ;; + *) + STYLE="$style" + stylemsg "Default" + ;; + +esac + + +echo WM=\"${outline}\" > /etc/X11/WINDOWMANAGER +echo "STARTUP_STYLE=$STYLE" >> /etc/X11/WINDOWMANAGER +echo ${outline_2} >> /etc/X11/WINDOWMANAGER + + + + + + -- cgit v0.12