forked from mviereck/x11docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx11docker-gui
executable file
·972 lines (902 loc) · 64.2 KB
/
x11docker-gui
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
#! /bin/bash
#########################################
# GUI for x11docker
# Published under MIT licence
# Uses 'kaptain' to provide a GUI
# https://github.com/mviereck/x11docker
#########################################
error() {
echo $1 >&2
command -v xmessage >/dev/null && {
xmessage -default okay "$1"
:
} || {
command -v zenity >/dev/null && {
zenity --error --ellipsize --text="$1"
:
}
} || notify-send "$1"
exit 1
}
warning() {
echo "x11docker-gui: $*
" >&2
}
verbose() {
[ "$Verbose" = "yes" ] && echo "$(tput setaf 4)x11docker-gui:$(tput sgr0) $*" >&2
}
finish() {
# clean up and say goodbye
[ -e "$Timetosaygoodbye" ] && echo timetosaygoodbye >> $Timetosaygoodbye
for Line in $Kaptain_grammar_file $Kaptain_stdin $Kaptain_stdout ; do
[ -e "$Line" ] && rm "$Line"
done
[ "$Kaptain_pid" ] && ps -p $Kaptain_pid >/dev/null 2>/dev/null && kill $Kaptain_pid
exit 0
}
mkfile() { # create file $1 owned by $Hostuser
:> "${1:-}"
chown $Lognameuser "${1:-}"
chgrp $Lognameusergid "${1:-}"
[ -n "${2:-}" ] && chmod ${2:-} "${1:-}" ||:
}
trap finish EXIT
export PATH="$PATH:/usr/local/bin" # can miss if executed as root
# check options
Verboseoption="--silent"
case "${1:-}" in
--icon)
echo "x11docker-gui does not create an icon on demand anymore." >&2
exit 1
;;
-v|--verbose)
Verbose="yes"
Verboseoption="--verbose"
;;
"") ;;
*) echo "Options:
-v --verbose Be verbose"
exit 1
;;
esac
# Try to find x11docker
X11docker_exe="${0%-gui}" # look at path of current x11docker-gui
command -v x11docker >/dev/null && X11docker_exe=x11docker # look whether x11docker is in $PATH
[ ! -x "$X11docker_exe" ] && ! command -v x11docker >/dev/null && error "No executeable x11docker found"
Version="$($X11docker_exe --version)"
verbose "Found x11docker: $X11docker_exe $Version"
# check logged-in user
Lognameuser="$(logname 2>/dev/null)"
[ -z "$Lognameuser" ] && warning "Your terminal seems to be not POSIX compliant.
Command 'logname' does not return a value.
Consider to use another terminal emulator."
[ -z "$Lognameuser" ] && [ -n "$SUDO_USER" ] && Lognameuser="$SUDO_USER" && warning "Will assume \$SUDO_USER = $SUDO_USER as host user."
[ -z "$Lognameuser" ] && [ -n "$PKEXEC_UID" ] && Lognameuser="$PKEXEC_UID" && warning "Will assume user with uid \$PKEXEC_UID = $PKEXEC_UID as host user."
[ -z "$Lognameuser" ] && Lognameuser="$(id -un)" && warning "Will assume \$(id -un) = $(id -un) as host user."
Lognameusergid="$(getent passwd $Lognameuser | cut -d: -f4)"
Lognameuserhome="$(getent passwd $Lognameuser | cut -d: -f6)"
Cachefolder=$Lognameuserhome/.cache/x11docker/x11docker-gui
mkdir -p $Lognameuserhome/.cache/x11docker
chown $Lognameuser $Lognameuserhome/.cache/x11docker
mkdir -p $Cachefolder || Cachefolder=/tmp/x11docker-gui
mkdir -p $Cachefolder
chown $Lognameuser $Cachefolder
Mycookie=$(mcookie | cut -c1-6)
Kaptain_grammar_file=$Cachefolder/x11docker.kaptn.$Mycookie
mkfile $Kaptain_grammar_file
CONTAINERUSER="$Lognameuser"
CONTAINERUSERHOME="$Lognameuserhome"
## needed for github screenshots only
#CONTAINERUSER="\\\$USER"
#CONTAINERUSERHOME="/home/\\\$USER"
#####################
# Preset some options you may want to be set as default
MYWM="auto" # preferred host window manager
DOCKEROPTIONS="" # additional docker options
# Checkboxes: "!" disables option, "" enables it
SHAREHOMEFOLDER="!"
CLIPBOARD="!"
PULSEAUDIO="!"
GPU="!"
DESKTOP="!"
#####################
# check list of available window managers
mkfile $Cachefolder/windowmanager.list
Wm_all="$($X11docker_exe --wmlist)"
HOSTWM=""
for Line in $Wm_all ; do
command -v "$Line" >/dev/null && {
grep -q "$Line" < $Cachefolder/windowmanager.list || echo "$Line" >> $Cachefolder/windowmanager.list
}
done
while read Line; do
HOSTWM="$HOSTWM\"$Line\","
done < <(sort < $Cachefolder/windowmanager.list)
HOSTWM="$HOSTWM\"\",\"auto\",\"none\""
[ -n "$MYWM" ] && ! grep -q "$MYWM" <<< $HOSTWM && HOSTWM="\"$MYWM\",$HOSTWM"
# check sound cards for ALSA
ALSALIST=""
while read Line; do
ALSALIST="\"$Line\",$ALSALIST"
done < <(cat /proc/asound/cards | grep ':' | cut -d[ -f2 | cut -d] -f1)
ALSALIST="$ALSALIST\"\""
# check available images, update list if possible
sudo -n echo 2>/dev/null && Sudo="sudo -n" || Sudo=""
$Sudo docker info>/dev/null 2>&1 && {
mkfile "$Cachefolder/images.list"
while read -r Line ; do
grep -q "<none>" <<<$Line || echo $Line >> "$Cachefolder/images.list"
done < <($Sudo docker images --format "{{.Repository}}:{{.Tag}}" 2>/dev/null | sort)
}
IMAGELIST='""'
[ -e "$Cachefolder/images.list" ] && while read -r Line ; do
Line="${Line%:latest}"
IMAGELIST="$IMAGELIST,\"$Line \""
done < "$Cachefolder/images.list"
IMAGELIST="$IMAGELIST,"'"",
"x11docker/xfce ",
"x11docker/lxde ",
"x11docker/lxqt ",
"x11docker/mate ",
"x11docker/fluxbox ",
"x11docker/fvwm ",
"x11docker/lumina ",
"x11docker/trinity ",
"x11docker/plasma ",
"x11docker/enlightenment ",
"x11docker/lxde-wine ",
"x11docker/xfce-wine-playonlinux ",
"x11docker/cde \ \ # (needs --hostnet)",
"x11docker/deepin \ \ # (needs --systemd)",
"x11docker/cinnamon \ \ # (needs --dbus-system or --systemd)",
"x11docker/xwayland \ \ # (needs --wayland and --gpu)"'
# create combo of language locales
Hostlangland=$(echo $LANG | cut -d. -f1)
Langcombo="\"$Hostlangland\""
for Line in $(echo "aa_DJ aa_ER aa_ET af_ZA ak_GH am_ET an_ES anp_IN
ar_AE ar_BH ar_DZ ar_EG ar_IN ar_IQ ar_JO ar_KW ar_LB ar_LY ar_MA ar_OM ar_QA ar_SA ar_SD ar_SS ar_SY ar_TN ar_YE as_IN ast_ES ayc_PE az_AZ
be_BY bem_ZM ber_DZ ber_MA bg_BG bhb_IN bho_IN bn_BD bn_IN bo_CN bo_IN br_FR brx_IN bs_BA byn_ER C
ca_AD ca_ES ca_FR ca_IT ce_RU chr_US cmn_TW crh_UA csb_PL cs_CZ cv_RU cy_GB da_DK de_AT de_BE de_CH de_DE de_IT de_LI de_LU doi_IN dv_MV dz_BT
el_CY el_GR en_AG en_AU en_BW en_CA en_DK en_GB en_HK en_IE en_IL en_IN en_NG en_NZ en_PH en_SG en_US en_ZA en_ZM en_ZW eo
es_AR es_BO es_CL es_CO es_CR es_CU es_DO es_EC es_ES es_GT es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es_US es_UY es_VE et_EE eu_ES eu_FR
fa_IR ff_SN fi_FI fil_PH fo_FO fr_BE fr_CA fr_CH fr_FR fr_LU fur_IT fy_DE fy_NL ga_IE gd_GB gez_ER gez_ET gl_ES gu_IN gv_GB
hak_TW ha_NG he_IL hi_IN hne_IN hr_HR hsb_DE ht_HT hu_HU hy_AM ia_FR id_ID ig_NG ik_CA is_IS it_CH it_IT iu_CA
ja_JP ka_GE kk_KZ kl_GL km_KH kn_IN kok_IN ko_KR ks_IN ku_TR kw_GB ky_KG lb_LU lg_UG li_BE lij_IT li_NL ln_CD lo_LA lt_LT lv_LV lzh_TW
mag_IN mai_IN mg_MG mhr_RU mi_NZ mk_MK ml_IN mni_IN mn_MN mr_IN ms_MY mt_MT my_MM
nan_TW nb_NO nds_DE nds_NL ne_NP nhn_MX niu_NU niu_NZ nl_AW nl_BE nl_NL nn_NO nr_ZA nso_ZA
oc_FR om_ET om_KE or_IN os_RU pa_IN pap_AW pap_CW pa_PK pl_PL POSIX ps_AF pt_BR pt_PT quz_PE raj_IN ro_RO ru_RU ru_UA rw_RW
sa_IN sat_IN sc_IT sd_IN se_NO sgs_LT shs_CA sid_ET si_LK sk_SK sl_SI so_DJ so_ET so_KE so_SO sq_AL sq_MK sr_ME sr_RS ss_ZA st_ZA sv_FI sv_SE sw_KE sw_TZ szl_PL
ta_IN ta_LK tcy_IN te_IN tg_TJ the_NP th_TH ti_ER ti_ET tig_ER tk_TM tl_PH tn_ZA tr_CY tr_TR ts_ZA tt_RU
ug_CN uk_UA unm_US ur_IN ur_PK uz_UZ ve_ZA vi_VN wa_BE wae_CH wal_ET wo_SN xh_ZA yi_US yo_NG yue_HK zh_CN zh_HK zh_SG zh_TW zu_ZA")
do Langcombo="$Langcombo,\"$Line\""; done
# create combo of keymaps
Keymaps="$(sed '/^! layout$/,/^ *$/!d ; //d' /usr/share/X11/xkb/rules/base.lst | awk '{print $1}' | sort)"
Hostkeymap="$(setxkbmap -query | grep layout | rev | cut -d' ' -f1 | rev)"
Keymapscombo=\"$Hostkeymap\"
Keymapscombo=${Keymapscombo:-\"\"}
for Line in $Keymaps; do Keymapscombo="$Keymapscombo,\"$Line\"" ; done
# Look for icon
[ -e /usr/share/icons/hicolor/64x64/apps/x11docker.png ] && X11docker_icon=/usr/share/icons/hicolor/64x64/apps/x11docker.png
[ -e /usr/local/share/icons/hicolor/64x64/apps/x11docker.png ] && X11docker_icon=/usr/local/share/icons/hicolor/64x64/apps/x11docker.png
Kaptain_grammar='#! /usr/bin/kaptain
start "Run GUI applications in docker containers - x11docker '$Version'" -> options previewline buttons;
options:beside -> frameleft frameright;
frameleft -> choose_image_framed xserver_tabbed blablabuttons;
frameright -> options_tabbed;
blablabuttons:beside -> xinfobutton xdependenciesbutton security_dialog help ;
choose_image_framed:framed -> choose_image;
choose_image "Choose docker image" -> logo_imageorexe dockerimage;
logo_imageorexe:beside -> @icon("'$X11docker_icon'") imageorexe ;
imageorexe -> image | exe | xonly;
image:beside "Run docker image." -> "-- \ " ;
exe "--exe: Run host application instead of docker image." -> "--exe -- ";
xonly "--xonly: Only create new empty X server." -> "--xonly -- ";
dockerimage "Docker image [and command] to run:" -> "--IMG=" @combow('$IMAGELIST');
xserver_tabbed:tabbed -> xserver_choose xserver_appearance;
xserver_choose "Choose X server" -> xservercombo desktop gpu wayland wm;
xservercombo -> s/(:.*$)/ / @combo(
": Auto-choose X server",
"--xpra: Seamless application windows",
"--xephyr: Desktop window",
"--nxagent: Seamless applications and --desktop mode",
"--xpra-xwayland: Like --xpra (allows --gpu)",
"--weston-xwayland: Like --xephyr (allows --gpu)",
"--hostdisplay: Share host X display '$DISPLAY' (Less secure!)",
"--xorg: Xorg on tty (switch with <CTRL><ALT><F1>...<F12>)",
"--xwayland: Blanc Xwayland (needs running Wayland on host).",
"--xdummy: Invisible X server Xdummy",
"--xvfb: Invisible X server Xvfb",
"--kwin-xwayland: Like --weston-xwayland, but using kwin_wayland",
"--kwin: Wayland in KWin without X",
"--weston: Wayland in Weston without X",
"--hostwayland: Share host Wayland display without X",
"--nothing: No X and no Wayland"
);
gpu "--gpu: Hardware acceleration for OpenGL graphics." -> "--gpu " | '$GPU' "";
wm :beside "--wm: Host window manager to use:" -> "--wm=\"" @combow('$HOSTWM')="'$MYWM'" "\" " | ! "" ;
desktop "--desktop: Image contains a desktop environment." -> "--desktop " | '$DESKTOP' "" ;
wayland "--wayland: Create Wayland environment." -> "--wayland " | ! "" ;
xserver_appearance " Appearance of new X server" -> sizefullscreenline scale rotate dpi outputcount xfishtank;
sizefullscreenline:beside -> size fullscreen;
size:beside "--size: Virtual screen size:" -> "--size \"" @combow("320x240","640x480","800x600","1024x768","1280x800","1280x1024","1400x1050","1680x1200","1920x1080")="800x600" "\" "| !"" ;
fullscreen "--fullscreen" -> "--fullscreen " | ! "" ;
xfishtank "--xfishtank: Show a fish tank." -> "--xfishtank " | ! "" ;
scale:beside "--scale: Zoom factor:" -> "--scale=\"" @combow("0.25","0.5","0.75","0.9","1","1.25","1.5","2","2.5","3")="1.5" "\" " | ! "" ;
rotate:beside "--rotate: Rotation and mirroring:" -> "--rotate=\"" @combo("0","90","180","270","flipped","flipped-90","flipped-180","flipped-270")="180" "\" " | ! "" ;
dpi:beside "--dpi: Dots per inch (influences font size):" -> "--dpi=\"" @combow("36","48","60","72","84","96","120","150","256","300")="96" "\" " | ! "" ;
outputcount:beside "--output-count: Multiple displays:" -> "--output-count=\"" @combow("1","2","3","4")="2" "\" " | ! "" ;
options_tabbed:tabbed -> tab_regular tab_advanced tab_output;
tab_regular:framed "Regular Options" -> options_normal options_hostfolders;
tab_advanced "Advanced Options" -> options_advanced_framed options_init_framed develdialog;
options_advanced_framed:framed -> options_advanced;
options_init_framed:framed -> options_init;
tab_output:framed "Terminal output" -> options_verbosity options_stdstream options_show ;
tabcollect -> options_normal options_hostfolders options_advanced options_init options_verbosity options_stdstream options_show ;
options_normal "Sound, clipboard and language" -> clipboard pulseaudio alsaline lang ;
clipboard "--clipboard: Clipboard sharing. (Picture clips: --xpra or --hostdisplay) \n
(Removes security restrictions of --hostdisplay)." -> "--clipboard " | '$CLIPBOARD' "";
pulseaudio "--pulseaudio: Sound with pulseaudio. (Needs pulseaudio in image)" -> "--pulseaudio " | '$PULSEAUDIO' "";
alsaline -> alsa alsacard;
alsa "--alsa: Sound with ALSA. (You may need to specify ALSA_CARD)" -> "--alsa " | ! "" ;
alsacard:beside "--env ALSA_CARD=" -> "--env ALSA_CARD=\"" @combow('$ALSALIST') "\" " | ! "";
lang:beside "--lang: Language locale. (Generated if missing):" -> "--lang=\"" @combow('$Langcombo')="'$Hostlangland'" "\" " | ! "" ;
options_hostfolders "Host directories to share" -> home homedir sharedir1 sharedir2;
home "--home: Share a host folder in '$CONTAINERUSERHOME'/x11docker \n
as '$CONTAINERUSERHOME' in container." -> "--home " | '$SHAREHOMEFOLDER' "";
homedir "--homedir: Host directory to use as container home: " -> "--homedir=\"" @directory="" "\" " | ! "" ;
sharedir1:beside "--sharedir: Share host folder:" -> "--sharedir=\"" @directory="" "\" " | ! "" ;
sharedir2:beside "--sharedir: Share host folder:" -> "--sharedir=\"" @directory="" "\" " | ! "" ;
options_advanced "Advanced options"-> sudouser nointernet noentrypoint workdir pw setenvdialog;
sudouser "--sudouser: Allow su and sudo in container. Password: x11docker\n
Severe reduction of container security!" -> "--sudouser " | ! "" ;
noentrypoint "--no-entrypoint: Disable ENTRYPOINT in image." -> "--no-entrypoint " | ! "" ;
nointernet "--no-internet: Disable internet access for container." -> "--no-internet " | ! "" ;
pw:beside "--pw: Password prompt frontend:" -> "--pw=\"" @combo("su","sudo","gksu","gksudo","lxsu","lxsudo","kdesu","kdesudo","beesu","pkexec","none")="sudo" "\" " | ! "" ;
workdir:beside "--workdir: Working directory: " -> "--workdir=\"" @string="" "\" " | ! "";
options_init "Init system and dbus in container" -> dbus dbusdaemon initsystem sharecgroup;
initsystem:beside " Run init system in container (default: --tini)." -> @combo( "--tini","--systemd ","--sysvinit ","--runit ","--openrc ","--no-init")="--systemd " | ! "" ;
dbusdaemon "--dbus-system: Run dbus system daemon in container." -> "--dbus-system " | ! "" ;
dbus "--dbus: Run dbus user session in container." -> "--dbus " | ! "" ;
sharecgroup "--sharecgroup: Share /sys/fs/cgroup. Allows elogind in container\n
if used with --dbus-system or an init system option." -> "--sharecgroup " | ! "" ;
options_verbosity "Verbosity" -> verbose silent debug;
verbose "--verbose: Be verbose." -> "--verbose " | ! "" ;
silent "--silent: Be silent." -> "--silent " | ! "" ;
debug "--debug: Debugging mode." -> "--debug " | ! "" ;
options_stdstream "Standard streams" -> stdout stderr stdin;
stdout "--stdout: Show stdout of container on stdout." -> "--stdout " | ! "" ;
stderr "--stderr: Show stderr of container on stderr." -> "--stderr " | ! "" ;
stdin "--stdin: Forward stdin to container stdin." -> "--stdin " | ! "" ;
options_show "Show internals on stdout" -> show_explanation showenv showid showpid1;
show_explanation -> @text="Catch output of following options with \"read var < <(x11docker ...)\"" ;
showenv "--showenv: Output of environment variables of new X server." -> "--showenv " | ! "" ;
showid "--showid: Output of container ID." -> "--showid " | ! "" ;
showpid1 "--showpid1: Output of host PID of container PID 1." -> "--showpid1" | ! "" ;
develdialogline:beside -> @fill develdialog @fill;
develdialog:dialog "Additional special options" -> developeroptions @execclose("echo develclose")=" close";
developeroptions:beside -> develleft develright;
develleft:framed -> devauth devxconfig devaddcommands ;
develright:framed -> devuser devcaps devrun devmisc ;
develcollect -> devaddcommands devauth devxconfig devmisc devuser devcaps;
devuser "User settings" -> user hostuser groupadd;
user:beside "--user: Container user (name or uid)\n
(default: same as host user)\n
(a gid can be specified with user:gid)" -> "--user=\"" @string="'$CONTAINERUSER'" "\" " | ! "" ;
hostuser:beside "--hostuser: run x11docker as user \n
different from \$(logname)='$CONTAINERUSER':\n
(x11docker must be started as root)" -> "--hostuser=\"" @string="" "\" " | ! "" ;
groupadd:beside "--group-add: Additional groups for container user: " -> "--group-add=\"" @string="" "\" " | ! "" ;
devmisc "Miscellaneous" -> ps cachedir ;
ps "--ps: Keep created container and cache files" -> "--ps " | ! "" ;
cachedir:beside "--cachedir: Host cache folder: " -> "--cachedir=\"" @directory="" "\" " | ! "" ;
devaddcommands "Additional commands" -> runfromhost runasroot ;
runfromhost "--runfromhost: Run host command on new X server. Use sh syntax:" -> "--runfromhost=\"" @string="/usr/bin/launchy &" "\" " | ! "" ;
runasroot "--runasroot: Run command as root in container. Use sh syntax:" -> "--runasroot=\"" @string="" "\" " | ! "" ;
devauth "X authentication" -> untrusted trusted xhost noauth noxhost;
untrusted "--untrusted: Create untrusted cookies restricting X access. \n
Default for --hostdisplay. (Some systems like fedora do not support that.)" -> "--untrusted " | ! "" ;
trusted "--trusted: Trusted cookies for --hostdisplay. Default for --gpu and --clipboard." -> "--trusted " | ! "" ;
xhost:beside "--xhost: see \"man xhost\". Use with care:" -> "--xhost=\"" @string="+SI:localuser:'$CONTAINERUSER'" "\" " | ! "" ;
noauth "--no-auth: Disable cookie authentication on new X server." -> "--no-auth " | ! "" ;
noxhost "--no-xhost: Disable any \"xhost +...\" access to host X server." -> "--no-xhost " | ! "" ;
devenvironment "Environment" -> sharewayland waylandenv;
sharewayland "--sharewayland: Share wayland socket and \$WAYLAND_DISPLAY.\n
Default for --wayland, --weston, --kwin and --hostwayland." -> "--sharewayland " | ! "" ;
waylandenv "--waylandenv: Set wayland toolkit environment variables.\n
Default for --wayland, needed for QT5 in Wayland." -> "--waylandenv " | ! "" ;
devxconfig "X and Wayland configuration" -> vt display xtest noxtest keymap westonini;
vt :beside "--vt: virtual terminal/tty to use:
(--xorg, --xpra, --xdummy)" -> "--vt=\"" @string="8" "\" " | ! "";
display :beside "--display: display number to use (X and Wayland): " -> "--display=\"" @string="1000" "\" " | ! "";
xtest "--xtest: enable X extension XTEST. Default for --xdummy, --xvfb, --xpra" -> "--xtest " | ! "";
noxtest "--no-xtest: disable X extension XTEST for --xdummy, --xvfb, --xpra" -> "--no-xtest " | ! "";
keymap:beside "--keymap: XKB keyboard layout: (X and Wayland)" -> "--keymap \"" @combow('$Keymapscombo') "\" " | ! "";
westonini "--westonini: Custom weston.ini (see man weston.ini)" -> "--westonini=\"" @infile="/usr/share/doc/weston/examples/weston.ini" "\" " | ! "";
devrun -> setcapsdialog dockeroptions ;
dockeroptions "Custom options for \"docker run\" " -> "--OPT=\"" @string="'$DOCKEROPTIONS'" "\"" ;
devcaps "Container capabilities and namespaces" -> @text("These options severely degrade container isolation!") capdefault sysadmin ipc net;
capdefault "--cap-default: Allow default container capabilities." -> "--cap-default " | ! "" ;
sysadmin "--sys-admin: Add capability SYS_ADMIN. (Please do not)." -> "--sys-admin " | ! "" ;
ipc "--hostipc: Disable IPC namespacing. Allows MIT-SHM extension. \n
Shares host interprocess communication and shared memory. " -> "--hostipc " | ! "" ;
net "--hostnet: Disable network namespacing. Shares host network stack." -> "--hostnet " | ! "" ;
setenvdialog:beside "Set custom environment variables: --env" -> envdialog ;
envdialog:dialog "Environment variables" -> envdialogwaylandinfo envXDG envGTK envQT envQTegl envClutter envSDL envElementary1 envElementary2 envEvas
envdialogothers envKWin envQT4shm envQT5deco envBWbackend envBWdisplay envLANG envSHELL
envCustom1 envCustom2 envCustom3 envCustom4 @close="close";
envdialogwaylandinfo "This environment variables summon toolkits to use Wayland instead of X11" -> "";
envXDG:beside -> "--env=\"" @string="XDG_SESSION_TYPE=wayland" "\" " | ! "" ;
envGTK:beside "GTK3" -> "--env=\"" @string="GDK_BACKEND=wayland" "\" " | ! "" ;
envQT:beside "QT5" -> "--env=\"" @string="QT_QPA_PLATFORM=wayland" "\" " | ! "" ;
envQTegl:beside "QT5" -> "--env=\"" @string="QT_QPA_PLATFORM=wayland-egl" "\" " | ! "" ;
envClutter:beside "Clutter" -> "--env=\"" @string="CLUTTER_BACKEND=wayland" "\" " | ! "" ;
envSDL:beside "SDL" -> "--env=\"" @string="SDL_VIDEODRIVER=wayland" "\" " | ! "" ;
envElementary1:beside "Elementary" -> "--env=\"" @string="ELM_DISPLAY=wl" "\" " | ! "" ;
envElementary2:beside "Elementary" -> "--env=\"" @string="ELM_ACCEL=opengl" "\" " | ! "" ;
envEvas:beside "Ecore_Evas" -> "--env=\"" @string="ECORE_EVAS_ENGINE=wayland_egl" "\" " | ! "" ;
envdialogothers:beside "Other environment variable settings" -> "";
envKWin:beside "KWin" -> "--env=\"" @string="KWIN_COMPOSE=Q" "\" " | ! "" ;
envQT4shm:beside "QT4" -> "--env=\"" @string="QT_X11_NO_MITSHM=1" "\" " | ! "" ;
envQT5deco:beside "QT5" -> "--env=\"" @string="QT_WAYLAND_DISABLE_WINDOWDECORATION=1" "\" " | ! "" ;
envBWbackend:beside "GTK3" -> "--env=\"" @string="GDK_BACKEND=broadway" "\" " | ! "" ;
envBWdisplay:beside "GTK3" -> "--env=\"" @string="BROADWAY_DISPLAY=:5" "\" " | ! "" ;
envLANG:beside "Language" -> "--env=\"" @string="LANG='$LANG'" "\" " | ! "" ;
envSHELL:beside "User shell" -> "--env=\"" @string="SHELL='$SHELL'" "\" " | ! "" ;
envCustom1:beside "Custom" -> "--env=\"" @string="" "\" " | ! "" ;
envCustom2:beside "Custom" -> "--env=\"" @string="" "\" " | ! "" ;
envCustom3:beside "Custom" -> "--env=\"" @string="" "\" " | ! "" ;
envCustom4:beside "Custom" -> "--env=\"" @string="" "\" " | ! "" ;
setcapsdialog:beside "Add container capabilities:" -> capsdialog ;
capsdialog:dialog "docker capabilities and privileges" -> capsreference capstable @close="close";
capsreference " Add container capabilities degrading container isolation if needed. Use with care.\n\n
x11docker disables all this capabilities per default with \"--cap-drop=ALL --security-opt=no-new-privileges\". \n\n
Left column (SETPCAP till SETFCAP) contains capabilities normally enabled by docker per default.\n
Middle and right column (SYS_MODULE till BLOCK_SUSPEND) contain capabilities disabled by docker per default.\n\n
See \"man capabilities\" and docker run reference: https://docs.docker.com/engine/reference/run/ " -> "" ;
capstable:framed:beside -> capsleft capsmiddle capsright;
capsleft -> drop_1 drop_2 drop_3 drop_4 drop_5 drop_6 drop_7 drop_8 drop_9 drop_10 drop_11 drop_12 drop_13 drop_14 ;
drop_1:beside "--cap-add" -> "--cap-add=" @string="SETPCAP" " " | ! "" ;
drop_2:beside "--cap-add" -> "--cap-add=" @string="MKNOD" " " | ! "" ;
drop_3:beside "--cap-add" -> "--cap-add=" @string="AUDIT_WRITE" " " | ! "" ;
drop_4:beside "--cap-add" -> "--cap-add=" @string="CHOWN" " " | ! "" ;
drop_5:beside "--cap-add" -> "--cap-add=" @string="NET_RAW" " " | ! "" ;
drop_6:beside "--cap-add" -> "--cap-add=" @string="DAC_OVERRIDE" " " | ! "" ;
drop_7:beside "--cap-add" -> "--cap-add=" @string="FOWNER" " " | ! "" ;
drop_8:beside "--cap-add" -> "--cap-add=" @string="FSETID" " " | ! "" ;
drop_9:beside "--cap-add" -> "--cap-add=" @string="KILL" " " | ! "" ;
drop_10:beside "--cap-add" -> "--cap-add=" @string="SETGID" " " | ! "" ;
drop_11:beside "--cap-add" -> "--cap-add=" @string="SETUID" " " | ! "" ;
drop_12:beside "--cap-add" -> "--cap-add=" @string="NET_BIND_SERVICE" " " | ! "" ;
drop_13:beside "--cap-add" -> "--cap-add=" @string="SYS_CHROOT" " " | ! "" ;
drop_14:beside "--cap-add" -> "--cap-add=" @string="SETFCAP" " " | ! "" ;
capsmiddle -> add_1 add_2 add_3 add_4 add_5 add_6 add_7 add_8 add_9 add_10 add_11 add_12 add_13 add_14 ;
add_1:beside "--cap-add" -> "--cap-add=" @string="SYS_MODULE" " " | ! "" ;
add_2:beside "--cap-add" -> "--cap-add=" @string="SYS_RAWIO" " " | ! "" ;
add_3:beside "--cap-add" -> "--cap-add=" @string="SYS_PACCT" " " | ! "" ;
add_4:beside "--cap-add" -> "--cap-add=" @string="SYS_ADMIN" " " | ! "" ;
add_5:beside "--cap-add" -> "--cap-add=" @string="SYS_NICE" " " | ! "" ;
add_6:beside "--cap-add" -> "--cap-add=" @string="SYS_RESOURCE" " " | ! "" ;
add_7:beside "--cap-add" -> "--cap-add=" @string="SYS_TIME" " " | ! "" ;
add_8:beside "--cap-add" -> "--cap-add=" @string="SYS_TTY_CONFIG" " " | ! "" ;
add_9:beside "--cap-add" -> "--cap-add=" @string="AUDIT_CONTROL" " " | ! "" ;
add_10:beside "--cap-add" -> "--cap-add=" @string="MAC_OVERRIDE" " " | ! "" ;
add_11:beside "--cap-add" -> "--cap-add=" @string="MAC_ADMIN" " " | ! "" ;
add_12:beside "--cap-add" -> "--cap-add=" @string="NET_ADMIN" " " | ! "" ;
add_13:beside "--cap-add" -> "--cap-add=" @string="SYSLOG" " " | ! "" ;
add_14:beside "--cap-add" -> "--cap-add=" @string="DAC_READ_SEARCH" " " | ! "" ;
capsright -> add_15 add_16 add_17 add_18 add_19 add_20 add_21 add_22 add_23 @fill device_1 device_2 device_3 device_4 @fill privileged;
add_15:beside "--cap-add" -> "--cap-add=" @string="LINUX_IMMUTABLE" " " | ! "" ;
add_16:beside "--cap-add" -> "--cap-add=" @string="NED_BROADCAST" " " | ! "" ;
add_17:beside "--cap-add" -> "--cap-add=" @string="IPC_LOCK" " " | ! "" ;
add_18:beside "--cap-add" -> "--cap-add=" @string="IPC_OWNER" " " | ! "" ;
add_19:beside "--cap-add" -> "--cap-add=" @string="SYS_PTRACE" " " | ! "" ;
add_20:beside "--cap-add" -> "--cap-add=" @string="SYS_BOOT" " " | ! "" ;
add_21:beside "--cap-add" -> "--cap-add=" @string="LEASE" " " | ! "" ;
add_22:beside "--cap-add" -> "--cap-add=" @string="WAKE_ALARM" " " | ! "" ;
add_23:beside "--cap-add" -> "--cap-add=" @string="BLOCK_SUSPEND" " " | ! "" ;
device_1:beside"--device" -> "--device=" @string="" " " | ! "" ;
device_2:beside"--device" -> "--device=" @string="" " " | ! "" ;
device_3:beside"--device" -> "--device=" @string="" " " | ! "" ;
device_4:beside"--device" -> "--device=" @string="" " " | ! "" ;
privileged "--privileged" -> "--privileged " | ! "" ;
xinfobutton:dialog "X server info" -> xinfo @close=" close";
xinfo:beside -> xinfo_option xinfotext xinfo_gpu;
xinfo_option -> xinfo_option_title xinfo_option_auto
xinfo_option_nxagent
xinfo_option_xephyr
xinfo_option_xpra
xinfo_option_xpraxwayland xinfo_option_westonxwayland
xinfo_option_hostdisplay xinfo_option_xorg
xinfo_option_xwayland xinfo_option_xdummy
xinfo_option_kwinxwayland xinfo_option_kwin
xinfo_option_weston xinfo_option_wayland;
xinfo_option_title -> @text(" X server");
xinfo_option_auto -> @text(" --auto \ (default)\n\n");
xinfo_option_nxagent -> @text(" --nxagent\n");
xinfo_option_xephyr -> @text(" --xephyr");
xinfo_option_xpra -> @text(" --xpra\n\n\n");
xinfo_option_xorg -> @text(" --xorg\n");
xinfo_option_hostdisplay -> @text(" --hostdisplay\n\n\n");
xinfo_option_xpraxwayland -> @text(" --xpra-xwayland\n\n");
xinfo_option_westonxwayland -> @text(" --weston-xwayland\n\n");
xinfo_option_xwayland -> @text(" --xwayland\n");
xinfo_option_xdummy -> @text(" --xdummy\n --xvfb\n");
xinfo_option_kwinxwayland -> @text(" --kwin-xwayland\n");
xinfo_option_weston -> @text(" --weston\n");
xinfo_option_kwin -> @text(" --kwin\n");
xinfo_option_wayland -> @text(" --hostwayland\n");
xinfotext -> xinfo_title xinfo_auto
xinfo_nxagent
xinfo_xephyr
xinfo_xpra
xinfo_xpraxwayland xinfo_westonxwayland
xinfo_hostdisplay xinfo_xorg
xinfo_xwayland xinfo_xdummy
xinfo_kwinxwayland xinfo_kwin
xinfo_weston xinfo_wayland;
xinfo_title -> @text(" ");
xinfo_auto -> @text(" Chooses an X server depending on installed dependencies and on given or missing options --desktop, --gpu and --wayland.\n
Option --desktop indicates a desktop environment in image (instead of a single application).");
xinfo_nxagent -> @text(" Supports seamless mode for single applications and --desktop mode. Toggle fullscreen in desktop mode with [SHIFT][F11].");
xinfo_xephyr -> @text(" Alternative to nxagent to run desktop environments. Desktop appears in a window on host display.");
xinfo_xpra -> @text(" Seamless mode to run single applications. Application windows appear on host display. \n
Best --clipboard support, picture clips are possible. Seamless scaling (0,5x, 1.5x, 3x ...) with option --scale is possible\n
(Supports option --desktop, too, but --nxagent and --xephyr are more performant in desktop mode.)");
xinfo_xorg -> @text(" Core X server. Switch between displays with keys [CTRL][ALT][F1]...[F12]. Runs ootb from console.");
xinfo_hostdisplay -> @text(" Share host display :0 instead of running second X server. Attention: Low security, quite bad container isolation!\n
To reduce risks and to avoid bad RAM access, untrusted cookies restricting X access are used. \n
Some applications will fail in untrusted mode. Options --clipboard or --gpu disable untrusted mode. \n");
xinfo_xpraxwayland -> @text(" Like --xpra, uses Xwayland in background. Additional to --xpra, GPU acceleration with option --gpu is possible.\n
(Supports option --desktop, too, but --weston-xwayland is more performant in desktop mode.)");
xinfo_westonxwayland -> @text(" Can run on X or Wayland in a window or on its own from console. \n
GPU acceleration, scaling (2x, 3x, 4x ...) and display rotation (0°, 90°, 180°, 270°, flipped, flipped-90°, ...) are possible.");
xinfo_xwayland -> @text(" Core Xwayland needs a Wayland environment to run in. Fullscreen display can be moved around with [META][LMB].\n");
xinfo_xdummy:beside -> @text(" Invisible X server for custom access. Output of environment variables on stdout. \n
With --gpu a setup with Weston, Xwayland and xdotool is used (instead of Xdummy or Xvfb).") xinfo_xdummy_network;
xinfo_weston -> @text(" Weston without X to run pure Wayland applications. Runs in X, in Wayland or from console. Scaling and rotation is possible.");
xinfo_kwinxwayland -> @text(" Like --weston-xwayland, but using Kwin instead of Weston. Runs in X, in Wayland or from console.");
xinfo_kwin -> @text(" kwin_wayland without X to run pure Wayland applications. Runs in X, in Wayland or from console.");
xinfo_wayland -> @text(" Shares host wayland socket without X to run pure Wayland applications. Needs a running Wayland compositor.");
xinfo_gpu -> xinfo_gpu_title xinfo_gpu_auto
xinfo_gpu_nxagent
xinfo_gpu_xephyr
xinfo_gpu_xpra
xinfo_gpu_xpraxwayland xinfo_gpu_westonxwayland
xinfo_gpu_hostdisplay xinfo_gpu_xorg
xinfo_gpu_xwayland xinfo_gpu_xdummy
xinfo_gpu_kwinxwayland xinfo_gpu_kwin
xinfo_gpu_weston xinfo_gpu_wayland;
xinfo_gpu_title -> @text(" --gpu ");
xinfo_gpu_auto -> @text(" \n\n");
xinfo_gpu_nxagent -> @text(" no\n");
xinfo_gpu_xephyr -> @text(" no\n");
xinfo_gpu_xpra -> @text(" no\n\n\n");
xinfo_gpu_xorg -> @text(" yes\n");
xinfo_gpu_hostdisplay -> @text(" yes\n\n\n");
xinfo_gpu_xpraxwayland -> @text(" yes\n\n");
xinfo_gpu_westonxwayland -> @text(" yes\n\n");
xinfo_gpu_xwayland -> @text(" yes\n");
xinfo_gpu_xdummy -> @text(" yes\n\n");
xinfo_gpu_weston -> @text(" yes\n");
xinfo_gpu_kwinxwayland -> @text(" yes\n");
xinfo_gpu_kwin -> @text(" yes\n");
xinfo_gpu_wayland -> @text(" yes\n");
xinfo_xdummy_network:dialog "Network setup example" -> @text(" Sample setup for HTML5 web application:\n
\n
\ \ read Xenv < <(x11docker --xdummy x11docker/lxde pcmanfm)\n
\ \ echo \$Xenv\n
\ \ export \$Xenv\n
\ \ xpra start \$DISPLAY --use-display --html=on --bind-tcp=localhost:14500\n
\n
In your browser you can access the dockered application at address:\n
\n
\ \ http://localhost:14500\n
\n
Further infos at https://xpra.org/trac/wiki/Clients/HTML5
")
@text(" Sample setup for VNC\n
\n
\ \ read Xenv < <(x11docker --xdummy x11docker/lxde pcmanfm)\n
\ \ echo \$Xenv\n
\ \ export \$Xenv\n
\ \ x11vnc -localhost -noshm \n
\n
In another terminal, start VNC viewer with \n
\n
\ \ vncviewer localhost:0 \n
\n
See \"man x11vnc\" for many details and further infos.\n
x11vnc option \"-noshm\" disables shared memory (MIT-SHM). \n
To allow shared memory, use insecure x11docker option --ipc.
")
@fill(" Sample setup to access dockered GUI applications over ssh:\n
\n
\ \ read Xenv < <(x11docker --xdummy x11docker/lxde pcmanfm)\n
\ \ echo \$Xenv\n
\ \ export \$Xenv\n
\ \ xhost +SI:localuser:\$USER\n
\ \ xpra start ssh:127.0.0.1\$DISPLAY --use-display --start-via-proxy=no\n
\n
In another terminal, you can connect with:\n
\n
\ \ xpra attach ssh:127.0.0.1\$NEWDISPLAY # NEWDISPLAY must be same as DISPLAY in \$Xenv
")
@fill(" To allow access for rest of world, read https://xpra.org/trac/wiki/Clients/HTML5 and\n
make sure to take care of security, opening firewall and router ports and such stuff.\n
In this case, do not use a host window manager with option --wm, it can be risky and is needless!\n
\n
For security and authentication, read xpra manpage and \n
http://xpra.org/trac/wiki/Encryption/SSL
") @close=" Close";
xdependenciesbutton:dialog "Dependencies" -> xdependencies @text(" Other dependencies, some in image, too:") xdependencies2 @close=" close";
xdependencies:beside -> xdep_option xdep_host xdep_xrunning ;
xdep_option -> xdep_option_title
xdep_option_nxagent
xdep_option_xpra xdep_option_xephyr
xdep_option_xpraxwayland xdep_option_westonxwayland
xdep_option_hostdisplay xdep_option_xorg
xdep_option_xwayland xdep_option_xdummy xdep_option_xvfb
xdep_option_wayland xdep_option_kwin
xdep_option_weston ;
xdep_option_title -> @text(" X server");
xdep_option_nxagent -> @text(" --nxagent");
xdep_option_xpra -> @text(" --xpra");
xdep_option_xephyr -> @text(" --xephyr");
xdep_option_xorg -> @text(" --xorg");
xdep_option_hostdisplay -> @text(" --hostdisplay");
xdep_option_xpraxwayland -> @text(" --xpra-xwayland");
xdep_option_westonxwayland -> @text(" --weston-xwayland");
xdep_option_xwayland -> @text(" --xwayland");
xdep_option_xdummy -> @text(" --xdummy");
xdep_option_xvfb -> @text(" --xvfb");
xdep_option_weston -> @text(" --weston");
xdep_option_kwin -> @text(" --kwin, --kwin-xwayland ");
xdep_option_wayland -> @text(" --hostwayland");
xdep_host -> xdep_host_title
xdep_host_nxagent
xdep_host_xpra xdep_host_xephyr
xdep_host_xpraxwayland xdep_host_westonxwayland
xdep_host_hostdisplay xdep_host_xorg
xdep_host_xwayland xdep_host_xdummy xdep_host_xvfb
xdep_host_wayland xdep_host_kwin
xdep_host_weston ;
xdep_host_title -> @text(" Dependencies on host");
xdep_host_nxagent -> @text(" nxagent");
xdep_host_xpra -> @text(" xpra");
xdep_host_xephyr -> @text(" Xephyr");
xdep_host_xorg:beside -> @text(" - \ [ xerver-xorg-legacy ]") xdep_xorg_setupdialog;
xdep_host_hostdisplay -> @text(" -");
xdep_host_xpraxwayland -> @text(" Xwayland \ weston \ xpra \ xdotool");
xdep_host_westonxwayland -> @text(" Xwayland \ weston");
xdep_host_xwayland -> @text(" Xwayland");
xdep_host_xdummy -> @text(" (dummy video driver for Xorg)");
xdep_host_xvfb -> @text(" Xvfb");
xdep_host_weston -> @text(" weston");
xdep_host_kwin -> @text(" kwin Xwayland");
xdep_host_wayland -> @text(" -");
xdep_xrunning -> xdep_xrun_title
xdep_xrun_nxagent
xdep_xrun_xpra xdep_xrun_xephyr
xdep_xrun_xpraxwayland xdep_xrun_westonxwayland
xdep_xrun_hostdisplay xdep_xrun_xorg
xdep_xrun_xwayland xdep_xrun_xdummy xdep_xrun_xvfb
xdep_xrun_wayland xdep_xrun_kwin
xdep_xrun_weston ;
xdep_xrun_title -> @text(" Needs running X or Wayland on host");
xdep_xrun_nxagent -> @text(" X \ (or Xwayland on Wayland)");
xdep_xrun_xpra -> @text(" X \ (or Xwayland on Wayland)");
xdep_xrun_xephyr -> @text(" X \ (or Xwayland on Wayland)");
xdep_xrun_xorg -> @text(" -");
xdep_xrun_hostdisplay -> @text(" X \ (or Xwayland on Wayland)");
xdep_xrun_xpraxwayland -> @text(" X \ (or Xwayland on Wayland)");
xdep_xrun_westonxwayland -> @text(" -");
xdep_xrun_xwayland -> @text(" Wayland");
xdep_xrun_xdummy -> @text(" -");
xdep_xrun_xvfb -> @text(" -");
xdep_xrun_weston -> @text(" -");
xdep_xrun_kwin -> @text(" -");
xdep_xrun_wayland -> @text(" Wayland");
xdependencies2:beside -> xdep_options xdep_text ;
xdep_options -> xdep_gpu xdep_xclip xdep_pulseaudio xdep_dbus;
xdep_text -> xdep_gpu_text xdep_xclip_text xdep_pulseaudio_text xdep_dbus_text;
xdep_xclip -> @text("--clipboard") ;
xdep_xclip_text -> @text("Needs xclip or xsel on host (except for options --nxagent, --xpra, --xpra-xwayland and --hostdisplay).") ;
xdep_pulseaudio -> @text("--pulseaudio") ;
xdep_pulseaudio_text -> @text("Needs pulseaudio installed on host AND in image.") ;
xdep_dbus -> @text("--dbus, --dbus-system") ;
xdep_dbus_text -> @text("Needs dbus installed in image.") ;
xdep_gpu -> @text("--gpu\n\n") ;
xdep_gpu_text -> @text("Needs OpenGL dependencies (MESA) installed in image. \n
Works best with open source drivers on host. For closed source driver setups read terminal messages.");
xdep_xorg_setupdialog:dialog "Setup" -> @text(" Option --xorg runs out of the box on console tty1...tty6. \n
\n
To run a second Xorg server from within an already running X session, \n
edit file /etc/X11/Xwrapper.config and replace line:\n
\n
\ \ allowed_users=console \n
\n
with lines:\n
\n
\ \ allowed_users=anybody \n
\ \ needs_root_rights=yes \n
\n
On debian 9 and Ubuntu 16.04 you need to install package xserver-xorg-legacy.
") @close=" close";
help:dialog "Help" -> @text(
" x11docker allows you to run GUI applications and desktop environments from inside of docker images. \n
\n
Simplest use case: \n
\ \ \ x11docker IMAGENAME [IMAGECOMMAND]\n
\n
Security:\n
x11docker is focussed on avoiding X security leaks and improving container isolation. \n
Depending on chosen options, you can have high or low container isolation. \n
Look at button [Security info] for further informations. \n
x11docker shows terminal messages if something is less secure.\n
\n
Automatically choosing an X server:\n
If no X server option is chosen, x11docker looks for best match in dependencies to run a single application.\n
If option --desktop is given, it looks for the best match to run a desktop environment.\n
Please install nxagent and/or Xephyr to allow a secure X server setup.\n
\n
GPU acceleration:\n
With option --gpu you can get hardware acceleration for OpenGL graphics rendering. \n
Please install weston and Xwayland to allow a secure X server setup. \n
For seamless applications also install xpra and xdotool.\n
If GPU acceleration fails, check OpenGL dependencies in image. (Compare dialog button \"Dependencies\")\n
If you have closed source NVIDIA driver on host, please regard terminal output for possible driver setup.\n
\n
Wayland: \n
If option --wayland is given, x11docker sets up a pure Wayland environment without X.\n
You can specify your preferred Wayland compositor with --weston, --kwin or --hostwayland.\n
\n
Troubleshooting:\n
Run in terminal to see some messages. Activate option --verbose to see full logfile output.\n
If the automatically chosen password prompt does not fit your setup, choose another one with option --pw.\n
Some applications may not work well with --hostdisplay. Choose another X server option.\n
\n
x11docker and x11docker-gui are published under MIT licence. \n
Some example docker images can be found at https://hub.docker.com/u/x11docker\n
Please report issues and get further infos at github: https://github.com/mviereck/x11docker\n
") helpbuttons;
helpbuttons:beside -> MIT @close=" close" ;
security_dialog:dialog "Security info" -> sec_info sec_degrading_title sec_degrading @close=" close";
sec_info -> @text(" Intention of x11docker is allowing to run GUI applications in docker on X11 or Wayland as secure as possible. \n
\n
Warnings: \n
x11docker shows warning messages in terminal if chosen options degrade container isolation.\n
\n
X security: \n
To avoid common X security leaks like keylogging and remote control of host applications, \n
x11docker runs segregated additional X servers. Only option --hostdisplay is insecure here.\n
Please install at least one of: \ nxagent, \ Xephyr, \ Xnest, \ xpra \ or \ weston+Xwayland \n
\n
Container security:\n
- Default user in container is same as host user to avoid root in container.\n
- All default docker container capabilities like user switching, chroot and setuid/setgid are disabled.\n
\n
Weaknesses:\n
If docker daemon runs with --selinux-enabled, SELinux restrictions are degraded with label container_runtime_t to allow access to X unix socket.\n
User namespace remapping is disabled to allow options --home and --homedir. (Less an issue as container user is not root.)\n
\n
If you do not care about container isolation at all, get a quite fast insecure setup with \"x11docker --hostdisplay --gpu IMAGENAME\"
") ;
sec_degrading_title -> @text(" Most used options degrading container isolation:");
sec_degrading:beside -> sec_deg_opt sec_deg_text;
sec_deg_opt -> sec_hostdisplay_opt sec_gpu_opt sec_pulseaudio_opt sec_sudouser_opt sec_capdefault_opt ;
sec_deg_text -> sec_hostdisplay_text sec_gpu_text sec_pulseaudio_text sec_sudouser_text sec_capdefault_text ;
sec_gpu_opt -> @text(" --gpu \n\n\n\n");
sec_gpu_text -> @text(" Option --gpu enables hardware acceleration for OpenGL applications. \n
Access to GPU hardware can allow rootkits. Example rootkit: https://github.com/x0r1/jellyfish\n
Furthermore, container applications can grab video RAM content formerly drawn by host applications (palinopsia leak). \n
Both issues affect X servers and Wayland compositors as well. ");
sec_hostdisplay_opt -> @text(" --hostdisplay \n\n\n");
sec_hostdisplay_text -> @text(" Quite bad container isolation, but least overhead of all X server options. Use with trusted images only.\n
Instead of creating a new segregated X server to avoid X security leaks, your host X server is shared with container. \n
x11docker tries to avoid keylogging and other attacks with untrusted cookies, but do not rely on this. \n");
sec_pulseaudio_opt -> @text(" --pulseaudio \n --alsa\n");
sec_pulseaudio_text -> @text(" With sound enabled, container applications can catch your audio output and also can hear everything you say \n
if your computer has microphones. With option --alsa, container applications have immediate access to sound hardware.");
sec_capdefault_opt -> @text(" --cap-default ");
sec_capdefault_text -> @text(" Allows default container capabilities. Disables container security hardening of x11docker.");
sec_sudouser_opt -> @text(" --sudouser ");
sec_sudouser_text -> @text(" Allows su and sudo with password \"x11docker\" in container. Allows many capabilities. Outbreaking applications have no limits. ");
MIT:dialog "MIT license" -> @text(
" MIT License\n
\n
Copyright (c) 2015,2016,2017,2018 Martin Viereck\n
\n
Permission is hereby granted, free of charge, to any person obtaining a copy\n
of this software and associated documentation files (the \"Software\"), to deal\n
in the Software without restriction, including without limitation the rights\n
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n
copies of the Software, and to permit persons to whom the Software is\n
furnished to do so, subject to the following conditions:\n
\n
The above copyright notice and this permission notice shall be included in all\n
copies or substantial portions of the Software.\n
\n
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n
SOFTWARE.") @close="close";
previewline:beside -> previewclipboard previewtext;
previewtext -> @text="";
previewclipboard -> @echo("--CLIPBOARD")="Copy to clipboard:" ;
buttons:horizontal -> run runxterm starter cleanupxterm quit;
run -> @echo("--RUN")=" Run";
starter -> @echo("--STARTER")="Create starter on desktop" ;
runxterm -> @echo("--XTERM")="Run in xterm" ;
cleanupxterm -> @echo("--CLEANUP")="Clean up and exit";
quit -> @dump("--EXIT")="Exit" ;
'
# remove double whitespaces
Kaptain_grammar="$(sed -e 's/ */ /g' <<< "$Kaptain_grammar")"
echo "$Kaptain_grammar" >> $Kaptain_grammar_file
# output of kaptain grammar script
verbose "created kaptain grammar:
$(printf "%s" "$Kaptain_grammar" | nl)
"
# check if kaptain is available on host
command -v kaptain >/dev/null && Hostkaptain="yes" || Hostkaptain="no"
# check kaptain version
verbose "$(kaptain --version 2>/dev/null)"
[ "$Hostkaptain" = "yes" ] && kaptain --version 2>&1 | grep -q 'kaptain 0.72' && {
# regard kde3-kaptain from openSUSE KDE:KDE3 repository
# up to date from decades ago is 0.73
warning " Your version 0.72 of kaptain is outdated.
kaptain version 0.73 with important bugfixes is available at:
https://github.com/mviereck/kaptain
Output of 'kaptain --version':
$(kaptain --version)
Fallback: Using image x11docker/kaptain instead"
Hostkaptain="no"
}
# Run kaptain either from host or with x11docker/kaptain image
case $Hostkaptain in
yes)
Exe="--exe"
Cmd=kaptain
;;
no)
Exe=
Cmd=x11docker/kaptain
warning "Did not find executeable 'kaptain'.
If your distribution does not provide package kaptain (>=0.73), look at
kaptain repository: https://github.com/mviereck/kaptain
Fallback: Will try to use image x11docker/kaptain."
;;
esac
{ IFS= read Xenv ; read Kaptain_pid ; } < <($X11docker_exe $Verboseoption \
--stdin --showenv --showpid1 \
--clipboard --gpu --hostdisplay \
--sharedir "$X11docker_icon" \
--sharedir "$Kaptain_grammar_file" \
--env HOME="$CONTAINERUSERHOME" \
$Exe \
-- \
--volume="$CONTAINERUSERHOME":"$CONTAINERUSERHOME":ro \
$Cmd --stdio $Kaptain_grammar_file )
[ "$Kaptain_pid" ] && {
X11DOCKER_CACHE="$(export $Xenv; echo $X11DOCKER_CACHE)"
Kaptain_stdin="$X11DOCKER_CACHE/share/stdin"
exec 6<>$Kaptain_stdin
Kaptain_stdout="$X11DOCKER_CACHE/share/stdout"
Timetosaygoodbye="$X11DOCKER_CACHE/share/timetosaygoodbye.fifo"
[ "$DISPLAY$WAYLAND_DISPLAY" ] || export $Xenv
} || {
warning "Startup of $Cmd was not successfull."
exit 1
}
send() {
# send messages to kaptain over its stdin
echo "$1" >&6
verbose "sent: $1"
}
# watch kaptain messages
while read Line; do
verbose "received: $Line"
# Option output starts with --
# --CAPitalized options are internal x11docker-gui signals
[ "$(echo $Line | cut -c1-2)" = "--" ] && {
case "$(echo $Line | cut -c1-5)" in
--OPT) # custom docker options appear behind -- and without on x11docker option on their own
Line="$(echo "$Line" | cut -c7-)"
[ "$Line" = '""' ] || Previewline="$Previewline $Line"
Line=""
;;
--IMG) # docker image and command. Appears after -- without an opion on its own. Last one in refresh request sequence.
Line="$(echo "$Line" | cut -c7-)"
[ "$Line" = '""' ] || Previewline="$Previewline $Line"
Line=""
# refresh request is ready, write preview line into GUI
send "previewtext='$Previewline'"
# execute x1docker if "Run" button was pressed before
[ "$Runit" ] && {
verbose "Running: $Previewline"
case $Runit in
run)
bash -c "$Previewline" & Pid=$!
;;
runxterm)
xterm -hold -e "$Previewline" & Pid=$!
;;
runstarter)
xterm -e "$X11docker_exe --starter $(echo "$Previewline" | cut -d' ' -f2-)" & Pid=$!
;;
esac
disown $Pid
{ # show pstree of x11docker
sleep 5
verbose "pstree of: $Previewline
$(pstree -p $Pid)"
} &
Previewline="$X11docker_exe" # workaround for double-receiving options that happens for unknown reason if editing image+command line and pressing "Run"
Runit=""
}
;;
--RUN) # "Run" button was pressed
{ # animated run button to give some startup feedback
for Count in 1 2 3 4 5; do
send "run('--RUN')='Starting x11docker *'"
sleep 0.5
send "run('--RUN')='* Starting x11docker'"
sleep 0.5
done
send "run('--RUN')=' Run'"
} &
# x11docker will run after refresh in --IMG)
Runit="run"
# call for rehfresh of option preview
Line="refresh"
;;
--XTE) # --XTERM: run in xterm window
Runit="runxterm"
Line="refresh"
command -v xterm >/dev/null || send "runxterm='Please install xterm'"
;;
--CLE) # --CLEANUP: run --cleanup in xterm window
command -v xterm >/dev/null && {
send "run('--RUN')='(disabled, cleaning up now)'"
env X11DOCKER_LASTCLEANFOLDER="$(basename $X11DOCKER_CACHE)" xterm -hold -e "$X11docker_exe --cleanup"
finish
} || send "runxterm='Please install xterm'"
;;
--STA) # --STARTER: create desktop starter icon
Runit="runstarter"
Line="refresh"
command -v xterm >/dev/null || send "runxterm='Please install xterm'"
;;
--CLI) # --CLIPBOARD: copy to clipboard
command -v xclip >/dev/null && {
echo -n "$Previewline" | xclip -selection clipboard
} || {
echo -n "$Previewline" | xsel -i -b
} || send "previewclipboard='Please install xsel or xclip'"
;;
--EXI) # --EXIT: Button "Quit" or tail exits due to closed x1ddocker-gui window
break
;;
*) # other messages beginning with -- are chosen options.
Previewline="$Previewline $Line"
Line=""
;;
esac
}
# on all action messages (without --) refresh preview line. Ask for all set options to be written on stdout.
[ "$Line" ] && {
verbose "Refreshing preview"
Previewline="$X11docker_exe"
for Line in xserver_choose xserver_appearance \
options_normal options_hostfolders \
options_advanced options_init \
options_verbosity options_stdstream options_show \
devaddcommands devauth devxconfig devmisc devuser devcaps \
imageorexe capstable dockeroptions dockerimage; do
send "$Line?"
done
}
done < <(tail -f ${Kaptain_stdout:-"filenotfound"} --pid ${Kaptain_pid:-"-1"} 2>/dev/null; echo '--EXIT')