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:
|
while run:
|
||||||
# TODO;
|
# TODO;
|
||||||
# Check if WM is running otherwise the TTY will be spammed with "Using Clipnotify" text
|
# Check if WM is running otherwise the TTY will be spammed with "Using Clipnotify" text
|
||||||
|
if XisRunning():
|
||||||
echo "Using Clipnotify"
|
echo "Using Clipnotify"
|
||||||
let outp = execCmdEx("clipnotify")
|
let outp = execCmdEx("clipnotify")
|
||||||
if outp.exitcode == 0:
|
if outp.exitcode == 0:
|
||||||
|
|
18
globurrl.nim
18
globurrl.nim
|
@ -57,10 +57,10 @@ const darkgrey* = "#444"
|
||||||
const primary* = yellow
|
const primary* = yellow
|
||||||
const secondary* = red
|
const secondary* = red
|
||||||
const alert* = "#bd2c40"
|
const alert* = "#bd2c40"
|
||||||
const MAX_LINES = 20
|
|
||||||
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
|
||||||
var loop* = false
|
var loop* = false
|
||||||
var stoploop* = true
|
var stoploop* = true
|
||||||
var tool* = "dmenu"
|
var tool* = "dmenu"
|
||||||
|
@ -144,6 +144,13 @@ proc checkWayland() =
|
||||||
if getEnv("XDG_SESSION_TYPE") == "wayland":
|
if getEnv("XDG_SESSION_TYPE") == "wayland":
|
||||||
wayland = true
|
wayland = true
|
||||||
|
|
||||||
|
proc XisRunning*(): bool =
|
||||||
|
if getEnv("XAUTHORITY") != "":
|
||||||
|
echo "X IS RUNNING"
|
||||||
|
echo getEnv("XAUTHORITY")
|
||||||
|
return true
|
||||||
|
return false
|
||||||
|
|
||||||
proc parseInput*(): i3BarInput =
|
proc parseInput*(): i3BarInput =
|
||||||
let input = readLineFromStdin("")
|
let input = readLineFromStdin("")
|
||||||
try:
|
try:
|
||||||
|
@ -197,6 +204,7 @@ proc genMenuCmd*(data: Info, opts: varargs[string], rofi: bool = false): string
|
||||||
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)
|
||||||
|
@ -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 =
|
proc runMenu*(data: Info, opts: varargs[string], dmenu: bool = false): string =
|
||||||
let cmd = genMenuCmd(data, opts, rofi)
|
let cmd = genMenuCmd(data, opts, dmenu)
|
||||||
#echo cmd
|
#echo cmd
|
||||||
#
|
#
|
||||||
# Run command and get output
|
# Run command and get output
|
||||||
|
@ -242,8 +250,8 @@ proc getCurrentClipboardContent*(): string =
|
||||||
|
|
||||||
proc outputData*(data: Info, args: varargs[string]): string {.discardable.} =
|
proc outputData*(data: Info, args: varargs[string]): string {.discardable.} =
|
||||||
var output = ""
|
var output = ""
|
||||||
if tool == "rofi":
|
if tool == "dmenu":
|
||||||
output = runMenu(data,args, rofi = true)
|
output = runMenu(data,args, dmenu = true)
|
||||||
elif loop:
|
elif loop:
|
||||||
# mainly for i3bar/i3blocks compatible output
|
# mainly for i3bar/i3blocks compatible output
|
||||||
var j_data = data
|
var j_data = data
|
||||||
|
|
|
@ -82,4 +82,5 @@ proc main() =
|
||||||
main()
|
main()
|
||||||
|
|
||||||
if isMainModule:
|
if isMainModule:
|
||||||
|
MAX_LINES = 0
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue