Цикл скриптов: Запуск приложений в новом сервере иксов
#!/bin/zsh
#echo "argv(argc-1)=" $argv[$argc-1]
#echo "argv(argc-2)=" $argv[$argc-2]
#if ! $argv[$argc-1]; then echo "if argc-1" 1; else echo 0; fi
#if ! $argv[$argc-2]; then echo "if argc-2" 1; else echo 0; fi
case "$argv[$argc-1]" in
star)
SCREEN_RES="640x480"
MSENS=1.35
BPP=16
;;
d2)
SCREEN_RES="800x600"
MSENS=1.15
BPP=16
;;
*)
SCREEN_RES="Screen 1"
MSENS=1.35
BPP=24
;;
esac
case "$argv[$argc-2]" in
"")
case "$argv[$argc-1]" in
"")
echo "Usage: runXapp DISP_NUMBER \"application\""
echo "\tif applicattion is shell command with spaces it must be given between duble quotes as in example"
echo "\tif no DISP_NUMBER is given then it is set to 1"
echo "\tif no application is given then only thing done is X started"
echo "Predefined apps:"
echo "\t\"Star\" - StarCraft (you must modify script to correct path to game)"
echo "\t\"d2\" - Diablo2 (you must modify script to correct path to game)"
;;
*)
DISP=1
if ! cat /tmp/.X1-lock >/dev/null 2>/dev/null;
then
echo "Starting X on DISPLAY :1"
X -ac :$DISP -screen $SCREEN_RES -depth $BPP &
;
else
echo "Server already started"
;
fi
;;
esac
;;
*)
DISP=$argv[$argc-2]
if ! cat /tmp/.X$2-lock >/dev/null 2>/dev/null;
then
echo "Starting X on DISPLAY :" $DISP
X -ac :$DISP -screen $SCREEN_RES -depth $BPP &
;
else
echo "Server already started"
;
fi
;;
esac
if ! cat /tmp/.X$DISP-lock then
sleep 1
# DISPLAY=:$DISP yakuake
DISPLAY=:$DISP xset m 1.35
;
fi
case "$argv[$argc-1]" in
star)
DISPLAY=:$DISP cd /home/vortex/Games_win/Starcraft/
DISPLAY=:$DISP xset -m $MSENS
DISPLAY=:$DISP nice -10 wine loader.exe
;;
d2)
DISPLAY=:$DISP cd /home/vortex/Games_win/Diablo_2
DISPLAY=:$DISP xset mouse $MSENS
DISPLAY=:$DISP wine nice -10 d2loader.exe
;;
*)
DISPLAY=:$DISP xset mouse $MSENS
DISPLAY=:$DISP $argv[$argc-1]
;;
esac
Все вроде должно быть понятно по описанию котороые выводится при запуске без аргументов. Заранее вписан старкрафт и диабло. Но пути естессно неправильные
Почему-то не смог заставить его работать в баше и sh-e =(
кроме того надо в "/etc/X11/xorg.conf" добавить следующее:
#echo "argv(argc-1)=" $argv[$argc-1]
#echo "argv(argc-2)=" $argv[$argc-2]
#if ! $argv[$argc-1]; then echo "if argc-1" 1; else echo 0; fi
#if ! $argv[$argc-2]; then echo "if argc-2" 1; else echo 0; fi
case "$argv[$argc-1]" in
star)
SCREEN_RES="640x480"
MSENS=1.35
BPP=16
;;
d2)
SCREEN_RES="800x600"
MSENS=1.15
BPP=16
;;
*)
SCREEN_RES="Screen 1"
MSENS=1.35
BPP=24
;;
esac
case "$argv[$argc-2]" in
"")
case "$argv[$argc-1]" in
"")
echo "Usage: runXapp DISP_NUMBER \"application\""
echo "\tif applicattion is shell command with spaces it must be given between duble quotes as in example"
echo "\tif no DISP_NUMBER is given then it is set to 1"
echo "\tif no application is given then only thing done is X started"
echo "Predefined apps:"
echo "\t\"Star\" - StarCraft (you must modify script to correct path to game)"
echo "\t\"d2\" - Diablo2 (you must modify script to correct path to game)"
;;
*)
DISP=1
if ! cat /tmp/.X1-lock >/dev/null 2>/dev/null;
then
echo "Starting X on DISPLAY :1"
X -ac :$DISP -screen $SCREEN_RES -depth $BPP &
;
else
echo "Server already started"
;
fi
;;
esac
;;
*)
DISP=$argv[$argc-2]
if ! cat /tmp/.X$2-lock >/dev/null 2>/dev/null;
then
echo "Starting X on DISPLAY :" $DISP
X -ac :$DISP -screen $SCREEN_RES -depth $BPP &
;
else
echo "Server already started"
;
fi
;;
esac
if ! cat /tmp/.X$DISP-lock then
sleep 1
# DISPLAY=:$DISP yakuake
DISPLAY=:$DISP xset m 1.35
;
fi
case "$argv[$argc-1]" in
star)
DISPLAY=:$DISP cd /home/vortex/Games_win/Starcraft/
DISPLAY=:$DISP xset -m $MSENS
DISPLAY=:$DISP nice -10 wine loader.exe
;;
d2)
DISPLAY=:$DISP cd /home/vortex/Games_win/Diablo_2
DISPLAY=:$DISP xset mouse $MSENS
DISPLAY=:$DISP wine nice -10 d2loader.exe
;;
*)
DISPLAY=:$DISP xset mouse $MSENS
DISPLAY=:$DISP $argv[$argc-1]
;;
esac
Section "Screen"
Identifier "640x480"
Device "7300GT"
Monitor "vg700b"
DefaultDepth 24
SubSection "Display"
Depth 8
Modes "640x512"
EndSubSection
SubSection "Display"
Depth 16
Modes "640x512"
EndSubSection
SubSection "Display"
Depth 24
Modes "640x512"
EndSubSection
EndSection
Section "Screen"
Identifier "800x600"
Device "7300GT"
Monitor "vg700b"
DefaultDepth 24
SubSection "Display"
Depth 8
Modes "800x600"
EndSubSection
SubSection "Display"
Depth 16
Modes "800x600"
EndSubSection
SubSection "Display"
Depth 24
Modes "800x600"
EndSubSection
EndSection
Section "Screen"
Identifier "1024x768"
Device "7300GT"
Monitor "vg700b"
DefaultDepth 24
SubSection "Display"
Depth 8
Modes "1024x768"
EndSubSection
SubSection "Display"
Depth 16
Modes "1024x768"
EndSubSection
SubSection "Display"
Depth 24
Modes "1024x768"
EndSubSection
EndSection