我已经使用纤薄的登录管理器在裸 X 上设置了 Openbox,所有这些都在systemd init 上(在 Gentoo 上)。我在桌面上使用了两个不同的终端模拟器,以便能够为我的rc.xml文件中的每个创建不同的行为(标准大小的lxterminal对齐到左上角,roxterm向右垂直最大化)。我更进一步,在我的.config/openbox/autostart文件中添加了一个条目,以便在登录时自动启动 lxterminal。然后我手动打开了另外两个 lxterminal 实例,以及 roxterm。查看pstree输出:
systemd
??acpid -f
??agetty --noclear tty1
??at-spi-bus-laun
? ??dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork--print-addres
? ??2*[{at-spi-bus-laun}]
??at-spi2-registr --use-gnome-session
? ??{at-spi2-registr}
??dbus-daemon --system --address=systemd: --nofork --nopidfile--systemd-activation
??dbus-daemon --fork --print-pid 6 --print-address 8 --session
??dbus-launch --exit-with-session /etc/X11/Sessions/openbox
??dhcpcd -q --nobackground
??lal -c blue -s 10 -b -f %c -w 152
??lxterminal <----------(1)
? ??bash
? ? ??htop
? ??bash
? ? ??su
? ? ??bash
? ? ??grc /usr/lib/python-exec/python2.7/grc tail -f ...
? ? ??grcat /usr/lib/python-exec/python2.7/grcat conf.log
? ? ??tail -f /var/log/emerge.log
? ??bash
? ? ??su
? ? ??bash
? ? ??grc /usr/lib/python-exec/python2.7/grc tail -f /var/log/dmesg
? ? ??grcat /usr/lib/python-exec/python2.7/grcat conf.log
? ? ??tail -f /var/log/dmesg
? ??gnome-pty-helpe
? ??{lxterminal}
??slim -nodaemon -s
? ??X -nolisten tcp -br -deferglyphs 16 vt07 -auth /var/run/slim.auth
? ??sh /etc/X11/Sessions/openbox
? ??openbox --startup /usr/libexec/openbox-autostart OPENBOX
? ??firefox
? ? ??plugin-containe /usr/lib64/nsbrowser/plugins/libflashplayer.so ...
? ? ? ??6*[{plugin-containe}]
? ? ??35*[{firefox}]
? ??roxterm <------------------------(2)
? ??bash
? ? ??pstree -a
? ??gnome-pty-helpe
? ??{roxterm}
??systemd --user
? ??(sd-pam)
??systemd-journal
??systemd-logind
??systemd-udevd
??xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55
Run Code Online (Sandbox Code Playgroud)
我注意到 lxterminal(1) 和bash我通过手动启动它调用的其他实例不是 slim/X/openbox 进程的子实例,如 roxterm(2) 或 firefox 是;相反,他们的父母是直接系统化的。我不明白为什么源于 Openbox 自动启动的东西会产生一个不是它的直接后代的进程。尽管如此,受到 Archbang 下似乎设置了一些“小部件”的启发,我修改了自动启动以包含替换$(lxterminal) &而不是仅包含lxterminal &. 结果仍然在 Openbox 进程上下文之外,这是相关部分:
??sh /home/myuser/.config/openbox/autostart
? ??lxterminal <----------------------(3)
? ??bash
? ??bash
? ? ??pstree -a
? ??gnome-pty-helpe
? ??{lxterminal}
Run Code Online (Sandbox Code Playgroud)
部分ps -aux输出,查看进程状态列(参见 man 中的代码)等:
root 1 0.0 0.0 40008 3096 ? Ss 17:16 0:00 /usr/lib/systemd/systemd
...
root 3290 0.0 0.0 30048 1656 ? Ss 17:17 0:00 /usr/lib/systemd/systemd-logind
root 3291 0.0 0.0 4248 824 ? Ss 17:17 0:00 /usr/sbin/acpid -f
message+ 3292 0.0 0.0 21732 1568 ? Ss 17:17 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root 3299 0.0 0.0 19900 1104 tty1 Ss+ 17:17 0:00 /sbin/agetty --noclear tty1
user 3359 0.0 0.0 30916 2064 ? Ss 17:17 0:00 /usr/lib/systemd/systemd --user
user 3362 0.0 0.0 56820 1132 ? S 17:17 0:00 (sd-pam)
root 3820 0.0 0.0 0 0 ? S 17:31 0:00 [kworker/1:1]
root 3823 0.0 0.0 0 0 ? S 17:31 0:00 [kworker/3:0]
root 4644 0.0 0.0 0 0 ? S 18:09 0:00 [kworker/1:2]
root 4912 0.0 0.0 0 0 ? S 18:18 0:00 [kworker/1:0]
root 4918 0.0 0.0 0 0 ? S 18:18 0:00 [kworker/0:0]
root 4919 0.2 0.4 132660 17632 ? Ss 18:18 0:00 /usr/bin/slim -nodaemon -s
root 4921 2.6 0.8 132044 34176 tty7 Ss+ 18:18 0:05 /usr/bin/X -nolisten tcp -br -deferglyphs 16 vt07 -auth /var/run/slim.auth
user 4931 0.0 0.0 14804 1384 ? S 18:18 0:00 /bin/sh /etc/X11/Sessions/openbox
user 4961 0.0 0.0 24480 628 ? S 18:18 0:00 /usr/bin/dbus-launch --exit-with-session /etc/X11/Sessions/openbox
user 4962 0.0 0.0 21716 1068 ? Ss 18:18 0:00 /usr/bin/dbus-daemon --fork --print-pid 6 --print-address 8 --session
user 4963 0.1 0.2 108152 9484 ? S 18:18 0:00 /usr/bin/openbox --startup /usr/libexec/openbox-autostart OPENBOX
user 4973 0.0 0.0 31056 2896 ? S 18:18 0:00 xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55
user 4974 0.0 0.0 35636 3764 ? S 18:18 0:00 lal -c blue -s 10 -b -f %c -w 152
user 4976 0.1 0.3 330660 12916 ? Sl 18:18 0:00 lxterminal
user 4978 0.0 0.0 14696 808 ? S 18:18 0:00 gnome-pty-helper
user 4979 0.0 0.0 23368 2200 pts/0 Ss 18:18 0:00 /bin/bash
user 4988 0.0 0.0 23368 2200 pts/1 Ss 18:18 0:00 /bin/bash
user 4996 0.0 0.0 23368 2252 pts/2 Ss 18:18 0:00 /bin/bash
user 5003 0.4 0.0 21668 1952 pts/0 S+ 18:18 0:00 htop
user 5004 0.2 0.4 300924 18704 ? Sl 18:19 0:00 roxterm
user 5006 0.0 0.0 258980 2972 ? Sl 18:19 0:00 /usr/libexec/at-spi-bus-launcher
user 5009 0.0 0.0 21612 1508 ? S 18:19 0:00 /usr/bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3
user 5012 0.0 0.0 120304 3284 ? Sl 18:19 0:00 /usr/libexec/at-spi2-registryd --use-gnome-session
user 5014 0.0 0.0 14696 780 ? S 18:19 0:00 gnome-pty-helper
user 5015 0.0 0.0 23368 2316 pts/3 Ss 18:19 0:00 -bash
root 5027 0.0 0.0 59876 2020 pts/1 S 18:19 0:00 su
root 5030 0.0 0.0 23480 2292 pts/1 S 18:19 0:00 bash
root 5035 0.0 0.1 24904 4796 pts/1 S+ 18:19 0:00 /usr/bin/python2.7 /usr/lib/python-exec/python2.7/grc tail -f /var/log/emerge.log
root 5036 0.0 0.0 7292 608 pts/1 S+ 18:19 0:00 tail -f /var/log/emerge.log
root 5037 0.0 0.1 25180 4860 pts/1 S+ 18:19 0:00 /usr/bin/python2.7 /usr/lib/python-exec/python2.7/grcat conf.log
root 5039 0.0 0.0 59876 2020 pts/2 S 18:19 0:00 su
root 5042 0.0 0.0 23476 2292 pts/2 S 18:19 0:00 bash
root 5047 0.0 0.1 24904 4792 pts/2 S+ 18:19 0:00 /usr/bin/python2.7 /usr/lib/python-exec/python2.7/grc tail -f /var/log/dmesg
root 5048 0.0 0.0 7292 612 pts/2 S+ 18:19 0:00 tail -f /var/log/dmesg
root 5049 0.0 0.1 25180 4856 pts/2 S+ 18:19 0:00 /usr/bin/python2.7 /usr/lib/python-exec/python2.7/grcat conf.log
user 5051 10.6 5.7 901616 231196 ? Sl 18:19 0:13 /opt/firefox/firefox
root 5106 0.0 0.0 59876 2020 pts/3 S 18:20 0:00 su
root 5109 0.0 0.0 23488 2380 pts/3 S 18:20 0:00 bash
root 5181 0.0 0.0 20560 1304 pts/3 R+ 18:22 0:00 ps -aux
Run Code Online (Sandbox Code Playgroud)
主要的实际实现是窗口管理器的后代将继承窗口管理器的环境变量。这对于处理加密密钥代理(例如 gpg-agent 或 ssh-agent)很有帮助,其中登录管理器启动代理,以便窗口管理器及其后代自动继承 和SSH_AGENT_PID环境SSH_AUTH_SOCK变量。
您可以比较/proc/PID/environ两个进程的输出:
cat /proc/`pgrep openbox`/environ | xargs -0 -l1
Run Code Online (Sandbox Code Playgroud)
和
cat /proc/`pgrep lxterminal`/environ | xargs -0 -l1
Run Code Online (Sandbox Code Playgroud)
简单地xargs -0 -l1将空终止输出打印environ到多行。