@@ -132,6 +132,7 @@ struct CommandState {
132
132
struct {
133
133
bool printVersion = false ;
134
134
bool killAll = false ;
135
+ bool noDuplicate = false ;
135
136
} misc;
136
137
};
137
138
@@ -239,13 +240,13 @@ int runCommand(int argc, char** argv, QCoreApplication* coreApplication) {
239
240
{
240
241
cli.add_flag (" -V,--version" , state.misc .printVersion )
241
242
->description (" Print quickshell's version and exit." );
243
+
244
+ cli.add_flag (" --no-duplicate" , state.misc .noDuplicate )
245
+ ->description (" Exit immediately if another instance of the given config is running." );
242
246
}
243
247
244
248
{
245
- auto * sub = cli.add_subcommand (" log" , " Read quickshell logs.\n " )
246
- ->description (" If file is specified, the given file will be read.\n "
247
- " If not, the log of the first launched instance matching"
248
- " the instance selection flags will be read." );
249
+ auto * sub = cli.add_subcommand (" log" , " Print quickshell logs." );
249
250
250
251
auto * file = sub->add_option (" file" , state.log .file , " Log file to read." );
251
252
@@ -644,6 +645,14 @@ int launchFromCommand(CommandState& cmd, QCoreApplication* coreApplication) {
644
645
auto r = locateConfigFile (cmd, configPath);
645
646
if (r != 0 ) return r;
646
647
648
+ {
649
+ InstanceLockInfo info;
650
+ if (cmd.misc .noDuplicate && selectInstance (cmd, &info) == 0 ) {
651
+ qCDebug (logBare) << " An instance of this configuration is already running." ;
652
+ return 0 ;
653
+ }
654
+ }
655
+
647
656
return launch (
648
657
{
649
658
.configPath = configPath,
0 commit comments