Code Monkey home page Code Monkey logo

i3-swap-focus's Introduction

i3-swap-focus's People

Contributors

antonalekseev avatar fabio-blanco avatar olivierlemoal avatar p1-olm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

i3-swap-focus's Issues

It seems that window_stack can be empty sometimes

Wile executing this code, sometimes I got this error:

Task exception was never retrieved
future: <Task finished coro=<on_signal() done, defined at /home/my-user/bin/i3-swap-focus:15> exception=AttributeError("'NoneType' object has no attribute 'workspace'",)>
Traceback (most recent call last):
  File "/home/my-user/bin/i3-swap-focus", line 20, in on_signal
    window_workspace = (await i3.get_tree()).find_by_id(window_id).workspace().id
AttributeError: 'NoneType' object has no attribute 'workspace'

My i3wm version is 4.19 running on an Ubuntu 18.04 with three monitors with this configuration:

Monitor 1: workspaces 1, 4 and 6
Monitor 2: workspaces 2 and 5
Monitor 3: workspace 3

On the workspace 5 I have 12 Intellij windows and I was using i3-swap-focus to change mainly between those windows while sometimes interacting with workspace 1 where I have two terminal windows. I'm using the --stay-in-workspace parameter.
Sometimes when I came back from workspace 1 to workspace 2 and try the key combination to call i3-swap-focus the error happens.

Because I am on Ubuntu 18.04, I'm still using it's default Python 3.6.9 so I had to make some adaptations on your original code due to incompatibility with asyncio.create_task, argparse.BooleanOptionalAction, asyncio.run (added just on python 3.7 or 3.8):

#loop.add_signal_handler(signal.SIGUSR1, lambda: asyncio.create_task(on_signal(i3)))
loop.add_signal_handler(signal.SIGUSR1, lambda: loop.create_task(on_signal(i3)))
#parser.add_argument('--stay-in-workspace', action=argparse.BooleanOptionalAction, default=False, help="Do not switch focus if window is on a different workspace")
parser.add_argument('--stay-in-workspace', default=False, help="Do not switch focus if window is on a different workspace")
stay_in_workspace = parser.parse_args().stay_in_workspace
#asyncio.run(main())
main_loop = asyncio.get_event_loop()
main_loop.run_until_complete(main())

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.