Skip to content

Conversation

@CromFr
Copy link

@CromFr CromFr commented Mar 17, 2025

I don't know exactly when this happens (maybe on lock screen?), but sometimes sway does not report any focused window, and this results in a crash in inactive-windows-transparency.py.

'NoneType' object has no attribute 'workspace'
Traceback (most recent call last):
  File "/usr/share/sway-contrib/inactive-windows-transparency.py", line 88, in <module>
    ipc.main()
    ~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/i3ipc/connection.py", line 514, in main
    raise loop_exception
  File "/usr/lib/python3.13/site-packages/i3ipc/connection.py", line 497, in main
    while not self._event_socket_poll():
              ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/i3ipc/connection.py", line 477, in _event_socket_poll
    raise e
  File "/usr/lib/python3.13/site-packages/i3ipc/connection.py", line 474, in _event_socket_poll
    self._pubsub.emit(event_name, event)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/i3ipc/_private/pubsub.py", line 28, in emit
    s['handler'](self.conn, data)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/share/sway-contrib/inactive-windows-transparency.py", line 24, in on_window
    focused_workspace = focused.workspace()
                        ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'workspace'

@CromFr
Copy link
Author

CromFr commented Mar 17, 2025

Damn I just noticed somebody already fixed it in a PR: #56

The implemented solution is a bit different though. From what I understand, @chamlis solution skips setting windows transparency if nothing is focused, while my solution basically sets all windows to transparent

Feel free to close this PR if don't like my implementation :)

@OctopusET
Copy link
Owner

Every PRs are welcomed, thanks.
Though, original behavior wasn't like this.
619783a
But I like your solution too.
Can you fix the conflict?
I think I can try add this at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants