refactor: WlClipbaord::empty use QProcess
This commit is contained in:
parent
ab4feaa037
commit
4ebf5ff479
1 changed files with 10 additions and 7 deletions
|
|
@ -236,15 +236,18 @@ bool WlClipboard::empty()
|
||||||
if (!m_open) {
|
if (!m_open) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
auto cmd = new QProcess(this);
|
||||||
|
cmd->setProgram(s_copyApp);
|
||||||
|
m_runningWlCopies.append(cmd);
|
||||||
|
connect(cmd, &QProcess::finished, this, [&] { m_runningWlCopies.removeAll(cmd); });
|
||||||
|
|
||||||
std::vector<const char *> args;
|
QStringList args = {s_noNewLine, ""};
|
||||||
if (m_useClipboard) {
|
if (!m_useClipboard)
|
||||||
args = {"wl-copy", nullptr};
|
args.prepend(s_isPrimary);
|
||||||
} else {
|
|
||||||
args = {"wl-copy", "-p", nullptr};
|
|
||||||
}
|
|
||||||
|
|
||||||
bool success = executeCommandWithInput(args, "");
|
cmd->setArguments(args);
|
||||||
|
cmd->start();
|
||||||
|
bool success = cmd->waitForStarted(100);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
// Update ownership and cache only if command succeeded
|
// Update ownership and cache only if command succeeded
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue