【发布时间】:2020-02-10 16:15:31
【问题描述】:
我想运行一个稍微不同的 bash 命令,具体取决于我在哪个 Xfce 工作区上运行。如何在 bash 命令行上获取当前工作区的 Xfce 工作区名称(或某个唯一编号)。嗯,实际上来自别名。
【问题讨论】:
我想运行一个稍微不同的 bash 命令,具体取决于我在哪个 Xfce 工作区上运行。如何在 bash 命令行上获取当前工作区的 Xfce 工作区名称(或某个唯一编号)。嗯,实际上来自别名。
【问题讨论】:
来自askubuntu Is there a way to detect which workspace you are currently in from the command line? 我粘贴了以下脚本:
workspace=$(xdotool get_desktop)
case "$workspace" in
0) one_command; ;;
1) another_command; ;;
esac
【讨论】:
wmctrl 查找它,或者它可能会在xfce4-query 中列出的某个地方
xprop -root -notype _NET_CURRENT_DESKTOP
这适用于 CentOS 7 上 Xfce 中的 bash 终端。
我在这里找到了答案,但那里接受的答案对我不起作用。
【讨论】: