rofix
v1.1.7
Published
Rofi Menu Wrapper
Downloads
17
Maintainers
Readme
Rofix
Simple JavaScript Rofi wrapper
Installation
npm install rofix
Useage
const { Menu } = require('rofix')
const items = [
'Legacy Brand Liaison',
'International Identity Liaison',
'Internal Creative Orchestrator'
]
let menu = new Menu(items, {
width: -40,
font: 'Aldrich 14'
})
// Open Rofi dmenu with Callback function
menu.open((err, stdout) => {
console.log(stdout)
})
// Open Rofi dmenu using promise
menu.open().then(resp => {
console.log(resp)
})
// Get command
console.log(menu.getCmd())
// outputs: rofi -dmenu -threads 0 -cycle -matching "fuzzy" -i -width -40 -font "Aldrich 14"
Defaults
dmenu: ''
threads: 0
cycle: ''
matching: 'fuzzy',
i: ''
Chaining
const { Menu } = require('rofix')
const items = [
'Legacy Brand Liaison',
'International Identity Liaison',
'Internal Creative Orchestrator'
]
const settings = {
'width': -40,
'font': 'Aldrich 14'
}
let a = new Menu('a b c d'.split(' '), settings)
let b = new Menu('1 2 3 4 5'.split(' '), settings)
let c = new Menu('x y z'.split(' '), settings)
let menu = new Menu(items, settings)
let selected = []
menu.open()
.then(resp => {
selected.push(resp)
return a.open()
})
.then(resp => {
selected.push(resp)
return b.open()
})
.then(resp => {
selected.push(resp)
return c.open()
})
.then(resp => {
selected.push(resp)
console.log(selected)
})
Requirements
- xclip