From kde-devel Thu Jul 29 21:06:28 1999 From: "Glen Parker" Date: Thu, 29 Jul 1999 21:06:28 +0000 To: kde-devel Subject: RE: Single instance only applications X-MARC-Message: https://marc.info/?l=kde-devel&m=93328241819632 > Well, if you insist to use lock files, you can just write some text into > the file so that such multi-instance programs can check and decide if > they're allowed to run another instance exactly because another option is > used. E.g., writing "screensaver" in the lock file, will allow kcmdisplay > to spawn a new process if you attempt to run `kcmdisplay color` but not if > you try to start `kcmdisplay screensaver`. But, once again, lock files But really, this should be done in the file name, like: kcmdisplay.$DISPLAY..lock And maybe write the pid into the file. That way, a second instance would generate a file name, and if it already exists, then exit, without having to worry about the contents (except for error reporting maybe). > are a poor solution: a) because user can change them (their name, > delete them, or change their contents) b) and what you can do if you have So? A user should be expected to live with the consequenses of modifying files in /tmp. Besides, no ordinary user would do that anyway. > `kcmdisplay screensaver` running and user tries to run `kcmdisplay` (with > all tabs). Then you certainly want to have `kcmdisplay` running, but > you'll have the screensaver functions duplicated (which is wrong, I > agree). -- Glen Parker glenebob@nwlink.com