mirror of https://github.com/icedream/ts3bot.git
Add compatibility with other window managers using x-window-manager.
parent
eaa0d00767
commit
8fe17abdf8
|
@ -60,7 +60,7 @@ services = [
|
|||
new(require "./services/ts3client")
|
||||
new(require "./services/vlc")
|
||||
new(require "./services/xvfb")
|
||||
new(require "./services/blackbox")
|
||||
new(require "./services/xwm")
|
||||
]
|
||||
services.sort require("./service_depcomparer") # sort services by dependency
|
||||
for service in services
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
spawn = require("child_process").spawn
|
||||
log = require("../logger")("BlackBox")
|
||||
log = require("../logger")("XWindowManager")
|
||||
services = require("../services")
|
||||
StreamSplitter = require("stream-splitter")
|
||||
require_bin = require("../require_bin")
|
||||
|
||||
blackboxBinPath = require_bin "blackbox", false
|
||||
xwmBinPath = require_bin "x-window-manager", false
|
||||
|
||||
module.exports = class BlackBoxService extends services.Service
|
||||
module.exports = class XWindowManagerService extends services.Service
|
||||
dependencies: [
|
||||
"xvfb"
|
||||
]
|
||||
constructor: -> super "BlackBox",
|
||||
constructor: -> super "XWindowManager",
|
||||
start: (cb) ->
|
||||
if not blackboxBinPath?
|
||||
cb? new Error "Blackbox not available."
|
||||
if not xwmBinPath?
|
||||
cb? new Error "A window manager not available."
|
||||
return
|
||||
|
||||
if @process
|
||||
|
@ -29,7 +29,7 @@ module.exports = class BlackBoxService extends services.Service
|
|||
if err
|
||||
throw new Error "Dependency xvfb failed."
|
||||
|
||||
proc = spawn blackboxBinPath, [ "-rc", "/dev/null" ],
|
||||
proc = spawn xwmBinPath, [ "-rc", "/dev/null" ],
|
||||
stdio: ['ignore', 'pipe', 'pipe']
|
||||
detached: true
|
||||
env:
|
||||
|
@ -55,9 +55,9 @@ module.exports = class BlackBoxService extends services.Service
|
|||
return
|
||||
if not calledCallback
|
||||
calledCallback = true
|
||||
@log.warn "BlackBox terminated unexpectedly during startup."
|
||||
cb? new Error "BlackBox terminated unexpectedly."
|
||||
@log.warn "BlackBox terminated unexpectedly, restarting."
|
||||
@log.warn "Window manager terminated unexpectedly during startup."
|
||||
cb? new Error "Window manager terminated unexpectedly."
|
||||
@log.warn "Window manager terminated unexpectedly, restarting."
|
||||
doStart()
|
||||
|
||||
@process = proc
|
10
x11.iced
10
x11.iced
|
@ -53,12 +53,12 @@ module.exports =
|
|||
cb? new Error "xdotool not available."
|
||||
return
|
||||
|
||||
# blackbox needs to be running for windowactivate to work
|
||||
blackboxService = services.find("BlackBox")
|
||||
if blackboxService.state != "started"
|
||||
await blackboxService.start defer(err)
|
||||
# a window manager needs to be running for windowactivate to work
|
||||
xwmService = services.find("XWindowManager")
|
||||
if xwmService.state != "started"
|
||||
await xwmService.start defer(err)
|
||||
if err
|
||||
cb? new Error "Could not start compatible window manager."
|
||||
cb? new Error "Could not start a window manager."
|
||||
return
|
||||
|
||||
xdoproc = spawn xdotoolBinPath, [ "windowactivate", "--sync", wid, "key", "--clearmodifiers", "--delay", "100" ].concat(keys),
|
||||
|
|
Loading…
Reference in New Issue