Giter Club home page Giter Club logo

Comments (5)

tobiaspc avatar tobiaspc commented on June 22, 2024

Could you please send me the output of swaymsg -t get_tree and sway -v?

With your changes, the script no longer works for me (Arch Linux, sway 1.4):

Traceback (most recent call last):
  File "./windows.py", line 93, in <module>
    selected_id = parse_id(windows, parsed_windows, selected)
  File "./windows.py", line 72, in parse_id
    getindex = int(parsed_windows.index(selected))
ValueError: '0' is not in list

from wofi-scripts.

 avatar commented on June 22, 2024

That's weird. I have sway v1.4 installed on manjaro, should be the same binary ๐Ÿค”

swaymsg -t get_tree
{
  "id": 1,
  "name": "root",
  "rect": {
    "x": 0,
    "y": 0,
    "width": 1366,
    "height": 768
  },
  "focused": false,
  "focus": [
    3
  ],
  "border": "none",
  "current_border_width": 0,
  "layout": "splith",
  "orientation": "horizontal",
  "percent": null,
  "window_rect": {
    "x": 0,
    "y": 0,
    "width": 0,
    "height": 0
  },
  "deco_rect": {
    "x": 0,
    "y": 0,
    "width": 0,
    "height": 0
  },
  "geometry": {
    "x": 0,
    "y": 0,
    "width": 0,
    "height": 0
  },
  "window": null,
  "urgent": false,
  "floating_nodes": [
  ],
  "sticky": false,
  "type": "root",
  "nodes": [
    {
      "id": 2147483647,
      "name": "__i3",
      "rect": {
        "x": 0,
        "y": 0,
        "width": 1366,
        "height": 768
      },
      "focused": false,
      "focus": [
        2147483646
      ],
      "border": "none",
      "current_border_width": 0,
      "layout": "output",
      "orientation": "horizontal",
      "percent": null,
      "window_rect": {
        "x": 0,
        "y": 0,
        "width": 0,
        "height": 0
      },
      "deco_rect": {
        "x": 0,
        "y": 0,
        "width": 0,
        "height": 0
      },
      "geometry": {
        "x": 0,
        "y": 0,
        "width": 0,
        "height": 0
      },
      "window": null,
      "urgent": false,
      "floating_nodes": [
      ],
      "sticky": false,
      "type": "output",
      "nodes": [
        {
          "id": 2147483646,
          "name": "__i3_scratch",
          "rect": {
            "x": 0,
            "y": 0,
            "width": 1366,
            "height": 768
          },
          "focused": false,
          "focus": [
          ],
          "border": "none",
          "current_border_width": 0,
          "layout": "splith",
          "orientation": "horizontal",
          "percent": null,
          "window_rect": {
            "x": 0,
            "y": 0,
            "width": 0,
            "height": 0
          },
          "deco_rect": {
            "x": 0,
            "y": 0,
            "width": 0,
            "height": 0
          },
          "geometry": {
            "x": 0,
            "y": 0,
            "width": 0,
            "height": 0
          },
          "window": null,
          "urgent": false,
          "floating_nodes": [
          ],
          "sticky": false,
          "type": "workspace"
        }
      ]
    },
    {
      "id": 3,
      "name": "LVDS-1",
      "rect": {
        "x": 0,
        "y": 0,
        "width": 1366,
        "height": 768
      },
      "focused": false,
      "focus": [
        49,
        8
      ],
      "border": "none",
      "current_border_width": 0,
      "layout": "output",
      "orientation": "none",
      "percent": 1.0,
      "window_rect": {
        "x": 0,
        "y": 0,
        "width": 0,
        "height": 0
      },
      "deco_rect": {
        "x": 0,
        "y": 0,
        "width": 0,
        "height": 0
      },
      "geometry": {
        "x": 0,
        "y": 0,
        "width": 0,
        "height": 0
      },
      "window": null,
      "urgent": false,
      "floating_nodes": [
      ],
      "sticky": false,
      "type": "output",
      "active": true,
      "dpms": true,
      "primary": false,
      "make": "Unknown",
      "model": "0x02D3",
      "serial": "0x00000000",
      "scale": 1.0,
      "scale_filter": "nearest",
      "transform": "normal",
      "current_workspace": "4",
      "modes": [
        {
          "width": 1366,
          "height": 768,
          "refresh": 60002
        }
      ],
      "current_mode": {
        "width": 1366,
        "height": 768,
        "refresh": 60002
      },
      "max_render_time": 0,
      "nodes": [
        {
          "id": 49,
          "name": "4",
          "rect": {
            "x": 6,
            "y": 34,
            "width": 1354,
            "height": 728
          },
          "focused": false,
          "focus": [
            50,
            48
          ],
          "border": "none",
          "current_border_width": 0,
          "layout": "stacked",
          "orientation": "none",
          "percent": null,
          "window_rect": {
            "x": 0,
            "y": 0,
            "width": 0,
            "height": 0
          },
          "deco_rect": {
            "x": 0,
            "y": 0,
            "width": 0,
            "height": 0
          },
          "geometry": {
            "x": 0,
            "y": 0,
            "width": 0,
            "height": 0
          },
          "window": null,
          "urgent": false,
          "floating_nodes": [
          ],
          "sticky": false,
          "num": 4,
          "output": "LVDS-1",
          "type": "workspace",
          "representation": "S[firefox gnome-terminal-server]",
          "nodes": [
            {
              "id": 48,
              "name": "Value Error ยท Issue #1 ยท tobiaspc\/wofi-scripts - Mozilla Firefox",
              "rect": {
                "x": 6,
                "y": 88,
                "width": 1354,
                "height": 674
              },
              "focused": false,
              "focus": [
              ],
              "border": "pixel",
              "current_border_width": 1,
              "layout": "none",
              "orientation": "none",
              "percent": 1.0,
              "window_rect": {
                "x": 0,
                "y": 1,
                "width": 1354,
                "height": 674
              },
              "deco_rect": {
                "x": 0,
                "y": 0,
                "width": 1354,
                "height": 27
              },
              "geometry": {
                "x": 0,
                "y": 0,
                "width": 600,
                "height": 701
              },
              "window": null,
              "urgent": false,
              "floating_nodes": [
              ],
              "sticky": false,
              "type": "con",
              "fullscreen_mode": 0,
              "pid": 11517,
              "app_id": "firefox",
              "visible": false,
              "marks": [
              ],
              "max_render_time": 0,
              "nodes": [
              ]
            },
            {
              "id": 50,
              "name": "user@host: ~",
              "rect": {
                "x": 6,
                "y": 88,
                "width": 1354,
                "height": 674
              },
              "focused": true,
              "focus": [
              ],
              "border": "pixel",
              "current_border_width": 1,
              "layout": "none",
              "orientation": "none",
              "percent": 1.0,
              "window_rect": {
                "x": 0,
                "y": 1,
                "width": 1354,
                "height": 674
              },
              "deco_rect": {
                "x": 0,
                "y": 27,
                "width": 1354,
                "height": 27
              },
              "geometry": {
                "x": 0,
                "y": 0,
                "width": 732,
                "height": 444
              },
              "window": null,
              "urgent": false,
              "floating_nodes": [
              ],
              "sticky": false,
              "type": "con",
              "fullscreen_mode": 0,
              "pid": 1952,
              "app_id": "gnome-terminal-server",
              "visible": true,
              "marks": [
              ],
              "max_render_time": 0,
              "nodes": [
              ]
            }
          ]
        },
        {
          "id": 8,
          "name": "6",
          "rect": {
            "x": 6,
            "y": 34,
            "width": 1354,
            "height": 728
          },
          "focused": false,
          "focus": [
            7
          ],
          "border": "none",
          "current_border_width": 0,
          "layout": "stacked",
          "orientation": "none",
          "percent": null,
          "window_rect": {
            "x": 0,
            "y": 0,
            "width": 0,
            "height": 0
          },
          "deco_rect": {
            "x": 0,
            "y": 0,
            "width": 0,
            "height": 0
          },
          "geometry": {
            "x": 0,
            "y": 0,
            "width": 0,
            "height": 0
          },
          "window": null,
          "urgent": false,
          "floating_nodes": [
          ],
          "sticky": false,
          "num": 6,
          "output": "LVDS-1",
          "type": "workspace",
          "representation": "S[gnome-terminal-server]",
          "nodes": [
            {
              "id": 7,
              "name": "Gomuks",
              "rect": {
                "x": 6,
                "y": 61,
                "width": 1354,
                "height": 701
              },
              "focused": false,
              "focus": [
              ],
              "border": "pixel",
              "current_border_width": 1,
              "layout": "none",
              "orientation": "none",
              "percent": 1.0,
              "window_rect": {
                "x": 0,
                "y": 1,
                "width": 1354,
                "height": 728
              },
              "deco_rect": {
                "x": 0,
                "y": 0,
                "width": 1354,
                "height": 27
              },
              "geometry": {
                "x": 0,
                "y": 0,
                "width": 732,
                "height": 444
              },
              "window": null,
              "urgent": false,
              "floating_nodes": [
              ],
              "sticky": false,
              "type": "con",
              "fullscreen_mode": 0,
              "pid": 1952,
              "app_id": "gnome-terminal-server",
              "visible": false,
              "marks": [
              ],
              "max_render_time": 0,
              "nodes": [
              ]
            }
          ]
        }
      ]
    }
  ]
}

from wofi-scripts.

tobiaspc avatar tobiaspc commented on June 22, 2024

Even more weirdness:

Your get_tree output works with my version (I just parsed it instead of parsing swaymsg's output) and fails with your changes...

What python version do you use? 3.8.3 here.

from wofi-scripts.

 avatar commented on June 22, 2024

also using 3.8.3 ๐Ÿ™ƒ

I'm not sure if I understand correctly what is happening inside switch_window(id), but since it keeps returning a string instead of a numeral maybe the difference lies in the shell, not python?

anyway since you script works fine and my changes work for me, i guess i'll just leave it like that and hope it doesn't break at some point ๐Ÿ˜…

from wofi-scripts.

tobiaspc avatar tobiaspc commented on June 22, 2024

FYI: I merged your changes after locating the issue: a config option for wofi that I had set before and forgot about.

from wofi-scripts.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.