mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-03 20:57:35 +01:00
Remove "-session" from the commandline to fix session management on KDE. Fixes issue #769
This commit is contained in:
parent
292fdd3e7f
commit
7650c1eddc
@ -75,18 +75,24 @@ CommandlineOptions::CommandlineOptions(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
#ifdef Q_OS_DARWIN
|
#ifdef Q_OS_DARWIN
|
||||||
// Remove -psn_xxx option that Mac passes when opened from Finder.
|
// Remove -psn_xxx option that Mac passes when opened from Finder.
|
||||||
|
RemoveArg("-psn", 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Remove the -session option that KDE passes
|
||||||
|
RemoveArg("-session", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandlineOptions::RemoveArg(const QString& starts_with, int count) {
|
||||||
for (int i = 0; i < argc_; ++i) {
|
for (int i = 0; i < argc_; ++i) {
|
||||||
QString opt(argv_[i]);
|
QString opt(argv_[i]);
|
||||||
if (opt.startsWith("-psn")) {
|
if (opt.startsWith(starts_with)) {
|
||||||
// Shuffle remaining args.
|
for (int j = i; j < argc_ - count + 1; ++j) {
|
||||||
for (int j = i; j < argc_; ++j) {
|
argv_[j] = argv_[j+count];
|
||||||
argv_[j] = argv_[j+1];
|
|
||||||
}
|
}
|
||||||
--argc_;
|
argc_ -= count;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandlineOptions::Parse() {
|
bool CommandlineOptions::Parse() {
|
||||||
|
@ -79,6 +79,7 @@ class CommandlineOptions {
|
|||||||
};
|
};
|
||||||
|
|
||||||
QString tr(const char* source_text);
|
QString tr(const char* source_text);
|
||||||
|
void RemoveArg(const QString& starts_with, int count);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int argc_;
|
int argc_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user