dynamic line number for rofi
This commit is contained in:
parent
41e9cf2a5e
commit
21a424f3e6
2 changed files with 6 additions and 4 deletions
|
@ -60,7 +60,7 @@ const alert* = "#bd2c40"
|
||||||
const font = "Hermit-12"
|
const font = "Hermit-12"
|
||||||
const WL_DMENU = "dmenu"
|
const WL_DMENU = "dmenu"
|
||||||
const WL_ROFI = "wofi --dmenu"
|
const WL_ROFI = "wofi --dmenu"
|
||||||
var MAX_LINES* = 0
|
const MAX_LINES = 20
|
||||||
var loop* = false
|
var loop* = false
|
||||||
var stoploop* = true
|
var stoploop* = true
|
||||||
var tool* = "dmenu"
|
var tool* = "dmenu"
|
||||||
|
@ -198,14 +198,17 @@ proc genMenuCmd*(data: Info, opts: varargs[string], rofi: bool = false): string
|
||||||
cmd = cmd & text & "\n"
|
cmd = cmd & text & "\n"
|
||||||
cmd.removeSuffix("\n")
|
cmd.removeSuffix("\n")
|
||||||
|
|
||||||
|
var x_lines = len(opts)
|
||||||
|
if x_lines > MAX_LINES:
|
||||||
|
x_lines = MAX_LINES
|
||||||
|
|
||||||
cmd = "echo -e" & quote(cmd) & " | "
|
cmd = "echo -e" & quote(cmd) & " | "
|
||||||
|
|
||||||
var menu = newMenu()
|
var menu = newMenu()
|
||||||
cmd = cmd & menu.command & " "
|
cmd = cmd & menu.command & " "
|
||||||
cmd = cmd & menu.extra_cmd & " "
|
cmd = cmd & menu.extra_cmd & " "
|
||||||
cmd = cmd & menu.i_case & " "
|
cmd = cmd & menu.i_case & " "
|
||||||
if MAX_LINES > 0:
|
cmd = cmd & menu.lines_shown & " " & $MAX_LINES & " "
|
||||||
cmd = cmd & menu.lines_shown & " " & $MAX_LINES & " "
|
|
||||||
cmd = cmd & menu.prompt & quote(data.title)
|
cmd = cmd & menu.prompt & quote(data.title)
|
||||||
cmd = cmd & menu.norm_bg & quote(data.unselected_bg)
|
cmd = cmd & menu.norm_bg & quote(data.unselected_bg)
|
||||||
cmd = cmd & menu.norm_fg & quote(data.unselected_fg)
|
cmd = cmd & menu.norm_fg & quote(data.unselected_fg)
|
||||||
|
|
|
@ -82,5 +82,4 @@ proc main() =
|
||||||
main()
|
main()
|
||||||
|
|
||||||
if isMainModule:
|
if isMainModule:
|
||||||
MAX_LINES = 0
|
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue