set rofi as default

This commit is contained in:
Paul Wilde 2023-02-17 11:20:54 +00:00
parent ce07da510b
commit fcf0a98bd9
3 changed files with 21 additions and 11 deletions

View file

@ -24,11 +24,12 @@ proc runDaemon() =
while run:
# TODO;
# Check if WM is running otherwise the TTY will be spammed with "Using Clipnotify" text
echo "Using Clipnotify"
let outp = execCmdEx("clipnotify")
if outp.exitcode == 0:
var content = getCurrentClipboardContent()
addClip(content)
if XisRunning():
echo "Using Clipnotify"
let outp = execCmdEx("clipnotify")
if outp.exitcode == 0:
var content = getCurrentClipboardContent()
addClip(content)
echo "Exiting Daemon..."

View file

@ -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,7 +204,8 @@ 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 & " "
cmd = cmd & menu.lines_shown & " " & $MAX_LINES & " "
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)
cmd = cmd & menu.norm_fg & quote(data.unselected_fg)
@ -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

View file

@ -82,4 +82,5 @@ proc main() =
main()
if isMainModule:
MAX_LINES = 0
main()