| 4074 | |
| 4075 | |
| 4076 | static int pythonDbusPresent(void) |
| 4077 | { |
| 4078 | static int lDbusPresent = -1 ; |
| 4079 | char lPythonCommand[256]; |
| 4080 | char lPythonParams[256] = |
| 4081 | "-c \"try:\n\timport dbus;bus=dbus.SessionBus();\ |
| 4082 | notif=bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications');\ |
| 4083 | notify=dbus.Interface(notif,'org.freedesktop.Notifications');\nexcept:\n\tprint(0);\""; |
| 4084 | |
| 4085 | if ( lDbusPresent < 0 ) |
| 4086 | { |
| 4087 | lDbusPresent = 0 ; |
| 4088 | if ( python2Present() ) |
| 4089 | { |
| 4090 | strcpy(gPythonName , gPython2Name ) ; |
| 4091 | sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ; |
| 4092 | lDbusPresent = tryCommand(lPythonCommand) ; |
| 4093 | } |
| 4094 | |
| 4095 | if ( ! lDbusPresent && python3Present() ) |
| 4096 | { |
| 4097 | strcpy(gPythonName , gPython3Name ) ; |
| 4098 | sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ; |
| 4099 | lDbusPresent = tryCommand(lPythonCommand) ; |
| 4100 | } |
| 4101 | |
| 4102 | if (tinyfd_verbose) printf("lDbusPresent %d\n", lDbusPresent) ; |
| 4103 | if (tinyfd_verbose) printf("gPythonName %s\n", gPythonName) ; |
| 4104 | } |
| 4105 | return lDbusPresent && graphicMode() && !(isDarwin() && getenv("SSH_TTY") ); |
| 4106 | } |
| 4107 | |
| 4108 | |
| 4109 | static void sigHandler(int sig) |
no test coverage detected