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: 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
echo "Using Clipnotify" if XisRunning():
let outp = execCmdEx("clipnotify") echo "Using Clipnotify"
if outp.exitcode == 0: let outp = execCmdEx("clipnotify")
var content = getCurrentClipboardContent() if outp.exitcode == 0:
addClip(content) var content = getCurrentClipboardContent()
addClip(content)
echo "Exiting Daemon..." echo "Exiting Daemon..."

View file

@ -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,7 +204,8 @@ 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 & " "
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.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)
@ -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

View file

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