https://bugs.kde.org/show_bug.cgi?id=511173

--- Comment #4 from [email protected] ---
I created a shim to see what arguments vim was calling wl-copy with. seems to
be `wl-copy --type plain/text` with the content to be copied written to stdin.
I tried to create a minimal example with PyQt calling out to wl-copy and seeing
if focus is lost but I didn't see any 'focus gained' or 'focus lost' messages.

```
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = [ "PyQt6" ]
# ///

import subprocess

from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QApplication, QWidget


class FocusLogger(QWidget):
    def __init__(self):
        super().__init__()
        self.resize(300, 200)
        self.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
        print("Start")

    def focusInEvent(self, event):
        print("Focus gained")
        event.accept()

    def focusOutEvent(self, event):
        print("Focus lost")
        event.accept()

    def keyPressEvent(self, event):
        if event.key() == Qt.Key.Key_Space:
            print('Copy')
            subprocess.run(["wl-copy", "--type", "text/plain"], input=b"foo",
check=False)
        event.accept()

if __name__ == "__main__":
    app = QApplication([])
    window = FocusLogger()
    window.show()
    app.exec()
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to