e: add xinerama options to x-ui. Patch by Thanatermesis

Also switch to bash.

SVN revision: 75079
This commit is contained in:
Boris Faure 2012-08-10 09:57:33 +00:00
parent ffac12a5e1
commit 4f59520f88
1 changed files with 57 additions and 2 deletions

59
x-ui.sh
View File

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env bash
DPI=${DPI:-142} DPI=${DPI:-142}
SCREEN=${SCREEN:-640x480} SCREEN=${SCREEN:-640x480}
@ -11,6 +11,52 @@ CALLGRIND=${CALLGRIND}
HOST_CURSOR=${HOST_CURSOR} HOST_CURSOR=${HOST_CURSOR}
TEST_HOME=${TEST_HOME} TEST_HOME=${TEST_HOME}
xinerama_auto_modes()
{
local x y screen_res screen_res_x screen_res_y div_x div_y single_res single_res_x single_res_y walker_x walker_y
div_x="${1%x*}"
div_y="${1#*x}"
# get your display resolution
screen_res="$( xdpyinfo | grep dimensions | awk '{print $2}' )"
screen_res_x="${screen_res%x*}"
screen_res_y="${screen_res#*x}"
# add some offset for your window-borders
screen_res_x="$(( ${screen_res_x} - 20 ))"
screen_res_y="$(( ${screen_res_y} - 40 ))"
# set size for xephir
SCREEN="${screen_res_x}x${screen_res_y}"
# which size per screen ?
single_res_x="$(( ${screen_res_x} / ${div_x} ))"
single_res_y="$(( ${screen_res_y} / ${div_y} ))"
single_res="${single_res_x}x${single_res_y}"
walker_x=0
walker_y=0
for (( y=0 ; $y < ${div_y} ; y++ )) ; do
for (( x=0 ; $x < ${div_x} ; x++ )) ; do
# add a new horizontal xinerama screen
xinerama_auto_args="${xinerama_auto_args} -fake-xinerama-screen ${single_res}+${walker_x}+${walker_y}"
walker_x="$(( ${walker_x} + ${single_res_x} ))"
done
# previous loop finished, set horizontal back to 0
walker_x=0
# add a new vertical xinerama screen
walker_y="$(( ${walker_y} + ${single_res_y} ))"
done
#echo "${xinerama_auto_args}"
}
show_help() show_help()
{ {
cat <<HELP_EOF cat <<HELP_EOF
@ -25,6 +71,8 @@ where options are:
-s, --screen=SPEC WIDTHxHEIGHT[xDEPTH] to be used. -s, --screen=SPEC WIDTHxHEIGHT[xDEPTH] to be used.
-x, --fxs=WxH+X+Y Fake xinerama screen resolution -x, --fxs=WxH+X+Y Fake xinerama screen resolution
(can be applied repeatedly) (can be applied repeatedly)
-ax 2x3 Automatic set of fake xineramas, 2 horizontal
screens per 3 of vertical ones
-p, --profile=NAME Enlightenment profile name. -p, --profile=NAME Enlightenment profile name.
-e, --empty-home[=PATH] Run with \$HOME being a new, empty directory at /tmp -e, --empty-home[=PATH] Run with \$HOME being a new, empty directory at /tmp
@ -150,6 +198,13 @@ while [ $# -gt 0 ]; do
-callgrind|--callgrind) -callgrind|--callgrind)
CALLGRIND="1" CALLGRIND="1"
;; ;;
-ax|-auto-xinerama|--auto-xinerama)
if [ -z "$value" ]; then
value=$1
shift
fi
xinerama_auto_modes $value
;;
*) *)
echo "Unknown option: $option" 1>&2 echo "Unknown option: $option" 1>&2
;; ;;
@ -221,5 +276,5 @@ enlightenment_start \
-no-precache \ -no-precache \
-i-really-know-what-i-am-doing-and-accept-full-responsibility-for-it \ -i-really-know-what-i-am-doing-and-accept-full-responsibility-for-it \
-profile $PROFILE \ -profile $PROFILE \
$E_OPTIONS \ $E_OPTIONS $xinerama_auto_args \
$DEBUGGER $DEBUGGER