I am trying to port a script from AHK script for Windows to Python script for Ubuntu.
Desired behavior
(1) If user presses F5
when active window is explorer it displays message "explorer is active".
(2) If user presses control-F6
when active window is explorer it displays message "Ctrl-F6 was pressed".
(3) If user presses F5
when active window is NOT explorer it displays a tooltip "Active app IS NOT explorer".
(4) If user presses control-F6
when active window is NOT explorer nothing happens.
AHK implementation:
#IfWinActive ahk_exe explorer.exe
F5::MsgBox % "explorer IS active" /* scenario 1*/
^F6::MsgBox % "Ctrl-F6 was pressed" /* scenario 2*/
#if
F5::ToolTip % "Active app IS NOT explorer" /* scenario 3*/
How to do this in Python under Ubuntu?