From 8fe17abdf8cec65c69cd5d4c479f910301cfe053 Mon Sep 17 00:00:00 2001 From: icedream Date: Wed, 4 Nov 2015 19:39:25 +0100 Subject: [PATCH] Add compatibility with other window managers using x-window-manager. --- services.iced | 2 +- services/{blackbox.iced => xwm.iced} | 20 ++++++++++---------- x11.iced | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) rename services/{blackbox.iced => xwm.iced} (73%) diff --git a/services.iced b/services.iced index 2d6168a..f3e8399 100644 --- a/services.iced +++ b/services.iced @@ -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 diff --git a/services/blackbox.iced b/services/xwm.iced similarity index 73% rename from services/blackbox.iced rename to services/xwm.iced index a645200..757a135 100644 --- a/services/blackbox.iced +++ b/services/xwm.iced @@ -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 diff --git a/x11.iced b/x11.iced index 05ce1f1..948916f 100644 --- a/x11.iced +++ b/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),