diff --git a/main.cpp b/main.cpp index 14fcf46..fbcb5a2 100644 --- a/main.cpp +++ b/main.cpp @@ -69,9 +69,9 @@ int main(int argc, char *argv[]) SettingsProvider settingsProvider{settings}; EntryProvider entryProvider(settingsProvider.userEntriesPaths(), settingsProvider.systemApplicationsEntriesPaths()); - // TODO if setting single instance mode + QLocalSocket localSocket; - localSocket.connectToServer("/tmp/qsrun.socket"); + localSocket.connectToServer(settingsProvider.socketPath()); SingleInstanceServer server; if(localSocket.isOpen() && localSocket.isWritable()) { @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) } else { - if(!server.listen("/tmp/qsrun.socket")) + if(!server.listen(settingsProvider.socketPath())) { qDebug() << "Failed to listen on socket!"; } diff --git a/settingsprovider.cpp b/settingsprovider.cpp index 1b7368d..1089d0c 100644 --- a/settingsprovider.cpp +++ b/settingsprovider.cpp @@ -33,3 +33,8 @@ QString SettingsProvider::getTerminalCommand() const { return settings->value("terminal", "/usr/bin/x-terminal-emulator -e %c").toString(); } + +QString SettingsProvider::socketPath() const +{ + return settings->value("singleInstanceSocket", "/tmp/qsrun").toString(); +} diff --git a/settingsprovider.h b/settingsprovider.h index 48e3ea5..99ad897 100644 --- a/settingsprovider.h +++ b/settingsprovider.h @@ -16,6 +16,7 @@ class SettingsProvider virtual int getMaxCols() const; virtual bool singleInstanceMode() const; QString getTerminalCommand() const; + QString socketPath() const; }; #endif // SETTINGSPROVIDER_H