diff --git a/src/exec-dmenu.js b/src/exec-dmenu.js index 18e669c..8089cea 100644 --- a/src/exec-dmenu.js +++ b/src/exec-dmenu.js @@ -3,9 +3,12 @@ const { exec } = require('child_process') module.exports = (...args) => choices => new Promise((resolve, reject) => { let choice = '' + let dmenu_path = process.env.DMENU_PATH const error = [] - const execCommand = `dmenu ${args}` + // Use a default of 'dmenu' if not specified in process.env + const dmenu_binary = (typeof dmenu_path === 'undefined') ? 'dmenu' : dmenu_path; + const execCommand = `${dmenu_binary} ${args}` console.debug('$', execCommand) const dmenu = exec(execCommand) dmenu.stdin.write(choices)