【问题标题】:How to check whether any window is open in i3如何检查i3中是否打开了任何窗口
【发布时间】:2018-07-15 15:33:16
【问题描述】:

我怎样才能知道在 i3 中是否打开了任何窗口?比如,检查任何工作区是否包含任何窗口。

【问题讨论】:

    标签: archlinux window-managers i3


    【解决方案1】:

    您可以使用xdotool 检查是否在 i3 中打开了任何“可见”窗口: 你可以用sudo pacman -S xdotool安装xdotool

    WINDOWS=$(xdotool search --all --onlyvisible --desktop $(xprop -notype -root _NET_CURRENT_DESKTOP | cut -c 24-) "" 2>/dev/null)
    NUM=$(echo "$WINDOWS" | wc -l)
    if [ $NUM -eq 0 ]; then
        echo "No windows open."
    fi
    

    【讨论】:

      【解决方案2】:

      也许试试i3-save-tree。您必须先安装perl-anyevent-i3perl-json-xs

      https://i3wm.org/docs/layout-saving.html

      例子:

      $ i3-save-tree --workspace 10
      // vim:ts=4:sw=4:et
      {
          "border": "pixel",
          "current_border_width": 1,
          "floating": "auto_off",
          "geometry": {
             "height": 720,
             "width": 1366,
             "x": 0,
             "y": 0
          },
          "name": "Waterfox Start Page - Waterfox",
          "percent": 1,
          "swallows": [
             {
             // "class": "^Waterfox$",
             // "instance": "^Navigator$",
             // "title": "^Waterfox\\ Start\\ Page\\ \\-\\ Waterfox$",
             // "transient_for": "^$",
             // "window_role": "^browser$"
             }
          ],
          "type": "con"
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-05-15
        • 1970-01-01
        • 1970-01-01
        • 2012-08-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多