Search code examples
pythonkivybackground-service

How can I make cross-platform Kivy app with system-tray/taskbar icon which would detect keyboard input even when app is not focused/in taskbar mode


I want to create application with taskbar/system-tray icon. Crossplatform. OSX, Windows, Linux (Ubuntu/Centos/Mint/Manjaro and other popular distros).

This app should detect keyboard input and react to it. Basically do some actions on specific keys. Example: user wants to play some music, presses shift+ctrl+p. Music starts playing.

I know that Kivy capable of detecting


Solution

  • For the "cross-platform system-tray" thingy - I don't think this is entirely possible without some truly cross-platform framework like Elektron or something, which can give ability to use system-tray/taskbar feature.

    For the detecting mouse even when window is not focused - use pynput with asyncio (example for kivy + asyncio in their official repository). Basically: you can detect keyboard events even when app is not focused with background working code with asyncio. Then it will detect every keystroke.