X-Git-Url: https://develop.uap-core.de/gitweb/uwplayer.git/blobdiff_plain/a5bc5f23f204464e636227b79759d46a97df3a0e..01d5015ba093f8c5fdb18b669943c7da6450e72f:/application/main.c diff --git a/application/main.c b/application/main.c index 42078dc..422b6ee 100644 --- a/application/main.c +++ b/application/main.c @@ -32,8 +32,8 @@ #include "main.h" #include "settings.h" -#include -#include +#include +#include static XtAppContext app; static Display *display; @@ -51,7 +51,7 @@ static String fallback[] = { "*pbbutton.shadowThickness: 1", "*pbbutton.highlightThickness: 1", - + "*XmText.baseTranslations: #override\\n" \ "Ctrl~Alt~Metav: paste-clipboard()\\n" \ "Ctrl~Alt~Metac: copy-clipboard()\\n" \ @@ -114,6 +114,26 @@ int main(int argc, char** argv) { open_file_arg = argv[1]; } + // load settings + if(load_config()) { + return 1; + } + + // try single instance open + if(open_file_arg) { + char *instance_path = InstanceFilePath(display); + int instance_fd = ConnectToInstance(instance_path); + free(instance_path); + + if(instance_fd >= 0) { + write(instance_fd, "open ", 5); + write(instance_fd, open_file_arg, strlen(open_file_arg)); + write(instance_fd, "\n", 1); + close(instance_fd); + return 0; + } + } + XtAppAddInput( app, event_pipe[0], @@ -121,15 +141,10 @@ int main(int argc, char** argv) { input_proc, NULL); - // load settings - if(load_config()) { - return 1; - } - MainWindow *window = WindowCreate(display); toplevel_window = window->window; - // random numbers only used for creating tmp dirs + // random numbers used for creating tmp dirs and for random playback srand(time(NULL)); WindowShow(window);