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