Merge pull request #2 from samueldr/feature/show-again-when-running
saturn: Show current instance on re-exec
This commit is contained in:
commit
11facddf8a
@ -25,15 +25,28 @@
|
|||||||
|
|
||||||
|
|
||||||
(local DBUS_NAME_FLAG_DO_NOT_QUEUE 4)
|
(local DBUS_NAME_FLAG_DO_NOT_QUEUE 4)
|
||||||
|
(local DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1)
|
||||||
|
(local DBUS_REQUEST_NAME_REPLY_IN_QUEUE 2)
|
||||||
|
(local DBUS_REQUEST_NAME_REPLY_EXISTS 3)
|
||||||
|
(local DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4)
|
||||||
|
|
||||||
(let [ret (bus:RequestName "net.telent.saturn" DBUS_NAME_FLAG_DO_NOT_QUEUE)]
|
(let [ret (bus:RequestName "net.telent.saturn" DBUS_NAME_FLAG_DO_NOT_QUEUE)]
|
||||||
(if (or (= ret 1) (= ret 4))
|
(if (or (= ret DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) (= ret DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER))
|
||||||
true
|
true
|
||||||
(= ret 2)
|
(= ret DBUS_REQUEST_NAME_REPLY_IN_QUEUE)
|
||||||
(error "unexpected DBUS_REQUEST_NAME_REPLY_IN_QUEUE")
|
(error "unexpected DBUS_REQUEST_NAME_REPLY_IN_QUEUE")
|
||||||
(= ret 3)
|
(= ret DBUS_REQUEST_NAME_REPLY_EXISTS)
|
||||||
(do
|
;; Show the currently running instance
|
||||||
(print "already running")
|
(let [saturn (dbus.Proxy:new
|
||||||
(os.exit 0))))
|
{
|
||||||
|
:bus dbus.Bus.SESSION
|
||||||
|
:name "net.telent.saturn"
|
||||||
|
:interface "net.telent.saturn"
|
||||||
|
:path "/net/telent/saturn"
|
||||||
|
})]
|
||||||
|
(saturn:SetVisible true)
|
||||||
|
(os.exit 0)
|
||||||
|
)))
|
||||||
|
|
||||||
|
|
||||||
(local lfs (require :lfs))
|
(local lfs (require :lfs))
|
||||||
|
Loading…
Reference in New Issue
Block a user