BUG Log is spammed with exceptions on KDE + Wayland when kdotool is missing · Issue #321 · StreamController/StreamController · GitHub
Skip to content

BUG Log is spammed with exceptions on KDE + Wayland when kdotool is missing #321

Description

@fstaffa

Describe the bug
When running latest development version streamcontroller on KDE 6 with Wayland, logic for identifying active window implemented in #308 does not check whether kdotool is installed. It listens on qdbus and on every event tries to run kdotool and fails.

Error:

FileNotFoundError: [Errno 2] No such file or directory: 'kdotool'
2025-01-17 16:10:21.273 | ERROR    | src.backend.WindowGrabber.Integrations.KDE:get_active_window:88 - An error has been caught in function 'get_active_window', process 'MainProcess' (889793), thread 'WatchForActiveWindowChange' (140534482990784):
Traceback (most recent call last):

  File "/nix/store/c9m6yd8fg1flz2j5r4bif1ib5j20a0cy-python3-3.12.8/lib/python3.12/threading.py", line 1032, in _bootstrap
    self._bootstrap_inner()
    │    └ <function Thread._bootstrap_inner at 0x7fd184dafb00>
    └ <WatchForActiveWindowChange(WatchForActiveWindowChange, started daemon 140534482990784)>
  File "/nix/store/c9m6yd8fg1flz2j5r4bif1ib5j20a0cy-python3-3.12.8/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
    │    └ <function WatchForActiveWindowChange.run at 0x7fd0d8117880>
    └ <WatchForActiveWindowChange(WatchForActiveWindowChange, started daemon 140534482990784)>

  File "/nix/store/r5c04anagjjamll18r5iqcz672bwq20s-streamcontroller-1.5.0-beta.7/usr/lib/streamcontroller/src/backend/WindowGrabber/Integrations/KDE.py", line 147, in run
    new_active_window = self.kde.get_active_window()
                        │    │   └ <function KDE.get_active_window at 0x7fd0d81168e0>
                        │    └ <src.backend.WindowGrabber.Integrations.KDE.KDE object at 0x7fd0d701ef00>
                        └ <WatchForActiveWindowChange(WatchForActiveWindowChange, started daemon 140534482990784)>

> File "/nix/store/r5c04anagjjamll18r5iqcz672bwq20s-streamcontroller-1.5.0-beta.7/usr/lib/streamcontroller/src/backend/WindowGrabber/Integrations/KDE.py", line 88, in get_active_window
    kdotool = self._run_command(["kdotool", "getactivewindow"])
              │    └ <function KDE._run_command at 0x7fd0d8115da0>
              └ <src.backend.WindowGrabber.Integrations.KDE.KDE object at 0x7fd0d701ef00>

  File "/nix/store/r5c04anagjjamll18r5iqcz672bwq20s-streamcontroller-1.5.0-beta.7/usr/lib/streamcontroller/src/backend/WindowGrabber/Integrations/KDE.py", line 52, in _run_command
    return Popen(command, stdout=PIPE, cwd="/")
           │     │               └ -1
           │     └ ['kdotool', 'getactivewindow']
           └ <class 'subprocess.Popen'>

  File "/nix/store/c9m6yd8fg1flz2j5r4bif1ib5j20a0cy-python3-3.12.8/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
    │    │              │     │           │           └ True
    │    │              │     │           └ None
    │    │              │     └ None
    │    │              └ ['kdotool', 'getactivewindow']
    │    └ <function Popen._execute_child at 0x7fd184aca7a0>
    └ <Popen: returncode: 255 args: ['kdotool', 'getactivewindow']>
  File "/nix/store/c9m6yd8fg1flz2j5r4bif1ib5j20a0cy-python3-3.12.8/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
          │                    │          │        └ 'kdotool'
          │                    │          └ 'No such file or directory'
          │                    └ 2
          └ <class 'OSError'>

To Reproduce
Steps to reproduce the behavior:

  1. Run latest development version streamcontroller on KDE 6 with Wayland, and without kdotool installed

Expected behavior
Logs error just once on startup

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions