Browse Source

Add support for setting dmenu path.

Allows users to configure the path to dmenu with the `DMENU_PATH` env
variable to allow support for drop-in alternatives like rofi.
master
Lee Watson 6 years ago
parent
commit
524bf102a6
No known key found for this signature in database GPG Key ID: 21EDF715E0BC8F8
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/exec-dmenu.js

+ 4
- 1
src/exec-dmenu.js View File

@ -3,9 +3,12 @@ const { exec } = require('child_process')
module.exports = (...args) => choices => module.exports = (...args) => choices =>
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
let choice = '' let choice = ''
let dmenu_path = process.env.DMENU_PATH
const error = [] 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) console.debug('$', execCommand)
const dmenu = exec(execCommand) const dmenu = exec(execCommand)
dmenu.stdin.write(choices) dmenu.stdin.write(choices)


Loading…
Cancel
Save