Skip to content

Commit 3f2c8c6

Browse files
authored
Merge pull request #3829 from cmitu/runcommand-xinit-a
runcommand: add a new launch prefix for X11 programs
2 parents 6eab997 + ccbee7c commit 3f2c8c6

File tree

3 files changed

+24
-30
lines changed

3 files changed

+24
-30
lines changed

scriptmodules/ports/micropolis.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,7 @@ function remove_micropolis() {
2929

3030
function configure_micropolis() {
3131
local binary="/usr/games/micropolis"
32-
! isPlatform "x11" && binary="XINIT:$md_inst/micropolis.sh"
32+
! isPlatform "x11" && binary="XINIT-WM:/usr/bin/micropolis"
3333

3434
addPort "$md_id" "micropolis" "Micropolis" "$binary"
35-
36-
mkdir -p "$md_inst"
37-
cat >"$md_inst/micropolis.sh" << _EOF_
38-
#!/bin/bash
39-
xset -dpms s off s noblank
40-
matchbox-window-manager &
41-
/usr/games/micropolis
42-
_EOF_
43-
chmod +x "$md_inst/micropolis.sh"
4435
}

scriptmodules/ports/minecraft.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,5 @@ function remove_minecraft() {
2929
}
3030

3131
function configure_minecraft() {
32-
addPort "$md_id" "minecraft" "Minecraft" "XINIT:$md_inst/Minecraft.sh"
33-
34-
cat >"$md_inst/Minecraft.sh" << _EOF_
35-
#!/bin/bash
36-
xset -dpms s off s noblank
37-
matchbox-window-manager &
38-
/usr/bin/minecraft-pi
39-
_EOF_
40-
chmod +x "$md_inst/Minecraft.sh"
32+
addPort "$md_id" "minecraft" "Minecraft" "XINIT-WM:/usr/bin/minecraft-pi"
4133
}

scriptmodules/supplementary/runcommand/runcommand.sh

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,19 +1201,30 @@ function get_sys_command() {
12011201
quake_dir="${quake_dir%/*}"
12021202
COMMAND="${COMMAND//\%QUAKEDIR\%/\"$quake_dir\"}"
12031203
1204-
# if it starts with CON: it is a console application (so we don't redirect stdout later)
1205-
if [[ "$COMMAND" == CON:* ]]; then
1206-
# remove CON:
1207-
COMMAND="${COMMAND:4}"
1208-
CONSOLE_OUT=1
1204+
# check if COMMAND starts with a launch OPTION:
1205+
if [[ "$COMMAND" =~ ^([A-Z\-]+?):(.*)$ ]]; then
1206+
# extract the command
1207+
COMMAND="${BASH_REMATCH[2]}"
1208+
1209+
case "${BASH_REMATCH[1]}" in
1210+
# if it starts with CON: it is a console application (so we don't redirect stdout later)
1211+
CON)
1212+
CONSOLE_OUT=1
1213+
;;
1214+
# if it starts with XINIT it is an X11 application (so we need to launch via xinit)
1215+
XINIT*)
1216+
XINIT=1
1217+
;;&
1218+
# if it starts with XINIT-WM or XINIT-WMC (with cursor) it is an X11 application needing a window manager
1219+
XINIT-WM)
1220+
XINIT_WM=1
1221+
;;
1222+
XINIT-WMC)
1223+
XINIT_WM=2
1224+
;;
1225+
esac
12091226
fi
12101227
1211-
# if it starts with XINIT: it is an X11 application (so we need to launch via xinit)
1212-
if [[ "$COMMAND" == XINIT:* ]]; then
1213-
# remove XINIT:
1214-
COMMAND="${COMMAND:6}"
1215-
XINIT=1
1216-
fi
12171228
}
12181229
12191230
function show_launch() {

0 commit comments

Comments
 (0)