set rofi as default
This commit is contained in:
parent
ce07da510b
commit
fcf0a98bd9
3 changed files with 21 additions and 11 deletions
|
@ -24,6 +24,7 @@ proc runDaemon() =
|
|||
while run:
|
||||
# TODO;
|
||||
# Check if WM is running otherwise the TTY will be spammed with "Using Clipnotify" text
|
||||
if XisRunning():
|
||||
echo "Using Clipnotify"
|
||||
let outp = execCmdEx("clipnotify")
|
||||
if outp.exitcode == 0:
|
||||
|
|
18
globurrl.nim
18
globurrl.nim
|
@ -57,10 +57,10 @@ const darkgrey* = "#444"
|
|||
const primary* = yellow
|
||||
const secondary* = red
|
||||
const alert* = "#bd2c40"
|
||||
const MAX_LINES = 20
|
||||
const font = "Hermit-12"
|
||||
const WL_DMENU = "dmenu"
|
||||
const WL_ROFI = "wofi --dmenu"
|
||||
var MAX_LINES* = 0
|
||||
var loop* = false
|
||||
var stoploop* = true
|
||||
var tool* = "dmenu"
|
||||
|
@ -144,6 +144,13 @@ proc checkWayland() =
|
|||
if getEnv("XDG_SESSION_TYPE") == "wayland":
|
||||
wayland = true
|
||||
|
||||
proc XisRunning*(): bool =
|
||||
if getEnv("XAUTHORITY") != "":
|
||||
echo "X IS RUNNING"
|
||||
echo getEnv("XAUTHORITY")
|
||||
return true
|
||||
return false
|
||||
|
||||
proc parseInput*(): i3BarInput =
|
||||
let input = readLineFromStdin("")
|
||||
try:
|
||||
|
@ -197,6 +204,7 @@ proc genMenuCmd*(data: Info, opts: varargs[string], rofi: bool = false): string
|
|||
cmd = cmd & menu.command & " "
|
||||
cmd = cmd & menu.extra_cmd & " "
|
||||
cmd = cmd & menu.i_case & " "
|
||||
if MAX_LINES > 0:
|
||||
cmd = cmd & menu.lines_shown & " " & $MAX_LINES & " "
|
||||
cmd = cmd & menu.prompt & quote(data.title)
|
||||
cmd = cmd & menu.norm_bg & quote(data.unselected_bg)
|
||||
|
@ -209,8 +217,8 @@ proc genMenuCmd*(data: Info, opts: varargs[string], rofi: bool = false): string
|
|||
|
||||
|
||||
|
||||
proc runMenu*(data: Info, opts: varargs[string], rofi: bool = false): string =
|
||||
let cmd = genMenuCmd(data, opts, rofi)
|
||||
proc runMenu*(data: Info, opts: varargs[string], dmenu: bool = false): string =
|
||||
let cmd = genMenuCmd(data, opts, dmenu)
|
||||
#echo cmd
|
||||
#
|
||||
# Run command and get output
|
||||
|
@ -242,8 +250,8 @@ proc getCurrentClipboardContent*(): string =
|
|||
|
||||
proc outputData*(data: Info, args: varargs[string]): string {.discardable.} =
|
||||
var output = ""
|
||||
if tool == "rofi":
|
||||
output = runMenu(data,args, rofi = true)
|
||||
if tool == "dmenu":
|
||||
output = runMenu(data,args, dmenu = true)
|
||||
elif loop:
|
||||
# mainly for i3bar/i3blocks compatible output
|
||||
var j_data = data
|
||||
|
|
|
@ -82,4 +82,5 @@ proc main() =
|
|||
main()
|
||||
|
||||
if isMainModule:
|
||||
MAX_LINES = 0
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue