Compare commits

...

4 Commits

6 changed files with 31 additions and 2 deletions

View File

@ -79,6 +79,10 @@ EntryConfig EntryProvider::readFromDesktopFile(const QString &path)
{ {
result.hidden = args == "true"; result.hidden = args == "true";
} }
if(key == "terminal")
{
result.isTerminalCommand = args == "true";
}
} }
result.type = EntryType::SYSTEM; result.type = EntryType::SYSTEM;
return result; return result;
@ -219,6 +223,7 @@ EntryConfig EntryProvider::readqsrunFile(const QString &path)
} }
result.col = map["col"].toInt(); result.col = map["col"].toInt();
result.row = map["row"].toInt(); result.row = map["row"].toInt();
result.isTerminalCommand = map["terminal"] == "true";
return result; return result;
} }

View File

@ -27,6 +27,7 @@ class EntryConfig
public: public:
EntryType type = SYSTEM; EntryType type = SYSTEM;
bool hidden = false; bool hidden = false;
bool isTerminalCommand = false;
QString entryPath; QString entryPath;
QString key; QString key;
QString name; QString name;

View File

@ -23,7 +23,15 @@ EntryPushButton::EntryPushButton(const EntryConfig &config) : QPushButton()
{ {
this->setText(config.name); this->setText(config.name);
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QIcon icon = resolveIcon(config.iconPath); QIcon icon;
if(config.isTerminalCommand && config.iconPath.isEmpty())
{
icon = resolveIcon("utilities-terminal");
}
else
{
icon = resolveIcon(config.iconPath);
}
this->setIcon(icon); this->setIcon(icon);
if(!icon.availableSizes().isEmpty()) if(!icon.availableSizes().isEmpty())
{ {

View File

@ -28,3 +28,8 @@ bool SettingsProvider::singleInstanceMode() const
{ {
return settings->value("singleInstance", true).toBool(); return settings->value("singleInstance", true).toBool();
} }
QString SettingsProvider::getTerminalCommand() const
{
return settings->value("terminal", "/usr/bin/x-terminal-emulator -e %c").toString();
}

View File

@ -15,6 +15,7 @@ class SettingsProvider
virtual QStringList systemApplicationsEntriesPaths() const; virtual QStringList systemApplicationsEntriesPaths() const;
virtual int getMaxCols() const; virtual int getMaxCols() const;
virtual bool singleInstanceMode() const; virtual bool singleInstanceMode() const;
QString getTerminalCommand() const;
}; };
#endif // SETTINGSPROVIDER_H #endif // SETTINGSPROVIDER_H

View File

@ -120,7 +120,16 @@ void Window::populateGrid(const QVector<EntryPushButton *> &list)
void Window::executeConfig(const EntryConfig &config) void Window::executeConfig(const EntryConfig &config)
{ {
if(config.isTerminalCommand)
{
QString cmd = settingsProvider->getTerminalCommand();
cmd.replace("%c", config.command + " " + config.arguments.join(' '));
QProcess::startDetached(cmd);
}
else
{
QProcess::startDetached(config.command, config.arguments); QProcess::startDetached(config.command, config.arguments);
}
this->closeWindow(); this->closeWindow();
} }