SettingsProvider/main: Read single instance socket path from config
This commit is contained in:
parent
8eb52fbfb3
commit
5b5333585c
6
main.cpp
6
main.cpp
@ -68,9 +68,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
SettingsProvider settingsProvider{settings};
|
SettingsProvider settingsProvider{settings};
|
||||||
EntryProvider entryProvider(settingsProvider.userEntriesPaths(), settingsProvider.systemApplicationsEntriesPaths());
|
EntryProvider entryProvider(settingsProvider.userEntriesPaths(), settingsProvider.systemApplicationsEntriesPaths());
|
||||||
// TODO if setting single instance mode
|
|
||||||
QLocalSocket localSocket;
|
QLocalSocket localSocket;
|
||||||
localSocket.connectToServer("/tmp/qsrun.socket");
|
localSocket.connectToServer(settingsProvider.socketPath());
|
||||||
SingleInstanceServer server;
|
SingleInstanceServer server;
|
||||||
if(localSocket.isOpen() && localSocket.isWritable())
|
if(localSocket.isOpen() && localSocket.isWritable())
|
||||||
{
|
{
|
||||||
@ -83,7 +83,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!server.listen("/tmp/qsrun.socket"))
|
if(!server.listen(settingsProvider.socketPath()))
|
||||||
{
|
{
|
||||||
qDebug() << "Failed to listen on socket!";
|
qDebug() << "Failed to listen on socket!";
|
||||||
}
|
}
|
||||||
|
@ -33,3 +33,8 @@ QString SettingsProvider::getTerminalCommand() const
|
|||||||
{
|
{
|
||||||
return settings->value("terminal", "/usr/bin/x-terminal-emulator -e %c").toString();
|
return settings->value("terminal", "/usr/bin/x-terminal-emulator -e %c").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString SettingsProvider::socketPath() const
|
||||||
|
{
|
||||||
|
return settings->value("singleInstanceSocket", "/tmp/qsrun").toString();
|
||||||
|
}
|
||||||
|
@ -16,6 +16,7 @@ class SettingsProvider
|
|||||||
virtual int getMaxCols() const;
|
virtual int getMaxCols() const;
|
||||||
virtual bool singleInstanceMode() const;
|
virtual bool singleInstanceMode() const;
|
||||||
QString getTerminalCommand() const;
|
QString getTerminalCommand() const;
|
||||||
|
QString socketPath() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGSPROVIDER_H
|
#endif // SETTINGSPROVIDER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user