diff options
author | Debian Live user <user@debian-BULLSEYE-live-builder-AMD64> | 2023-04-29 16:27:38 -0400 |
---|---|---|
committer | Debian Live user <user@debian-BULLSEYE-live-builder-AMD64> | 2023-04-29 16:27:38 -0400 |
commit | d155edcbcbffcc1f53ed1ec0d7cb2b33831aded8 (patch) | |
tree | 27e185677ff637519eb9280cfdf7a3c61c6ca3e4 /src | |
parent | 622953207bc8662af8ca85a44638f3e31ebc2ab8 (diff) |
Diffstat (limited to 'src')
-rwxr-xr-x | src/firestartx | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/src/firestartx b/src/firestartx index 636fc84..1129f9d 100755 --- a/src/firestartx +++ b/src/firestartx | |||
@@ -1,5 +1,10 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | if [ $# = 0 ] | ||
4 | then | ||
5 | set -- firestart | ||
6 | fi | ||
7 | |||
3 | get_new_display() | 8 | get_new_display() |
4 | { | 9 | { |
5 | for ((n=1; n<99; ++n)) | 10 | for ((n=1; n<99; ++n)) |
@@ -15,44 +20,53 @@ get_new_display() | |||
15 | 20 | ||
16 | get_new_display || exit | 21 | get_new_display || exit |
17 | 22 | ||
18 | if [ $# = 0 ] | 23 | dpi=$(xrdb -query | sed -n -e 's/^Xft.dpi:[ \t]*//p') |
19 | then | ||
20 | set -- firestart | ||
21 | fi | ||
22 | 24 | ||
23 | # TITLE=$* # lol, startx doesn't support arguments with spaces | 25 | launch_xserver() |
24 | TITLE=$1 | 26 | { |
25 | TITLE= # blank title documents the screen grab keys in the title | 27 | "$@" -- "$(which Xephyr)" "$NEW_DISPLAY" \ |
28 | -resizeable \ | ||
29 | -p 0 \ | ||
30 | -terminate \ | ||
31 | ${dpi:+ -dpi "$dpi"} | ||
32 | } | ||
26 | 33 | ||
27 | if [ "$1" != firestart ] | 34 | if [ "$1" != firestart ] |
28 | then | 35 | then |
29 | USE_XINIT=y | ||
30 | fi | ||
31 | |||
32 | if [ "$USE_XINIT" ] | ||
33 | then | ||
34 | set -x | ||
35 | case "$1" in | 36 | case "$1" in |
36 | /*) ;; | 37 | */*) |
37 | *) f1=$(which "$1") || exit | 38 | [ -x "$1" ] || exit |
38 | shift | 39 | ;; |
39 | set -- "$f1" "$@" | 40 | *) |
40 | ;; | 41 | f1=$(command -v "$1") || exit |
42 | shift | ||
43 | set -- "$f1" "$@" | ||
44 | ;; | ||
41 | esac | 45 | esac |
42 | xinit "$@" -- $(which Xephyr) "$NEW_DISPLAY" -resizeable -p 0 -terminate ${TITLE:+ -title "$TITLE"} | 46 | launch_xserver xinit "$@" |
43 | else | 47 | else |
44 | set -x | 48 | XSESSION_IS_FIRESTARTX= |
45 | dpi=$(xrdb -query | sed -n -e 's/^Xft.dpi:[ \t]*//p') | 49 | if grep -qF XSESSION_IS_FIRESTARTX ~/.xsession |
46 | startx -- "$(which Xephyr)" "$NEW_DISPLAY" \ | ||
47 | -resizeable \ | ||
48 | -p 0 \ | ||
49 | -terminate \ | ||
50 | ${TITLE:+ -title "$TITLE"} \ | ||
51 | ${dpi:+ -dpi "$dpi"} \ | ||
52 | & | ||
53 | if [ $# -gt 0 ] | ||
54 | then | 50 | then |
51 | # Our xsession will launch firestartx along with i3, etc. | ||
52 | XSESSION_IS_FIRESTARTX=y launch_xserver startx ~/.xsession & | ||
53 | else | ||
54 | # We need to wait for xrdb to be run, or else firefox will | ||
55 | # disastrously start without the Xft.dpi setting. But we | ||
56 | # cannot poll on the setting forever since it might not exist | ||
57 | # in every configuration. | ||
58 | launch_xserver startx & | ||
59 | enable -f /usr/lib/bash/sleep >/dev/null 2>&1 || true | ||
60 | set -x | ||
61 | tries=0 | ||
62 | while [ $tries -lt 40 ] && | ||
63 | ! xrdb -display "$NEW_DISPLAY" -query | grep -q '^Xft.dpi:' | ||
64 | do | ||
65 | sleep 0.05 | ||
66 | tries=$((tries + 1)) | ||
67 | done | ||
55 | DISPLAY=$NEW_DISPLAY "$@" & | 68 | DISPLAY=$NEW_DISPLAY "$@" & |
56 | fi | 69 | fi |
70 | |||
57 | wait | 71 | wait |
58 | fi | 72 | fi |