【问题标题】:How can I tell which Xfce workspace is currently visible from a bash command on terminal in that workspace?如何从该工作区的终端上的 bash 命令中判断当前可以看到哪个 Xfce 工作区?
【发布时间】:2020-02-10 16:15:31
【问题描述】:

我想运行一个稍微不同的 bash 命令,具体取决于我在哪个 Xfce 工作区上运行。如何在 bash 命令行上获取当前工作区的 Xfce 工作区名称(或某个唯一编号)。嗯,实际上来自别名。

【问题讨论】:

    标签: bash xfce


    【解决方案1】:

    来自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
    

    【讨论】:

    • 听起来不错。我在 CentOS 7 上,但不幸的是我无法访问 xdotool。
    • 尝试使用wmctrl 查找它,或者它可能会在xfce4-query 中列出的某个地方
    • 我也没有 wmctrl 可供使用。哇!
    【解决方案2】:

    xprop -root -notype _NET_CURRENT_DESKTOP

    这适用于 CentOS 7 上 Xfce 中的 bash 终端。

    我在这里找到了答案,但那里接受的答案对我不起作用。

    Detecting which workspace you're in from the command line

    【讨论】:

      猜你喜欢
      • 2021-12-23
      • 2016-09-09
      • 2018-01-08
      • 1970-01-01
      • 1970-01-01
      • 2018-09-22
      • 2011-07-06
      • 1970-01-01
      • 2019-09-09
      相关资源
      最近更新 更多