added remmina tool
This commit is contained in:
parent
310b8d9c1e
commit
bf5731a2d6
5 changed files with 3647 additions and 1578 deletions
5
base.nim
5
base.nim
|
@ -63,7 +63,10 @@ var passmenu* = false
|
|||
var command_wrapper* = false
|
||||
var run_command* = ""
|
||||
|
||||
proc newInfo*(title: string = "Info"): Info =
|
||||
proc newInfo*(str: string = "Info"): Info =
|
||||
var title = str
|
||||
if rofi:
|
||||
title = title & " : "
|
||||
return Info(
|
||||
title: title,
|
||||
selected_fg: black,
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import base
|
||||
import lib/codemap
|
||||
import lib/emojilist
|
||||
import std/[re,osproc,algorithm]
|
||||
|
||||
proc main() =
|
||||
var info = newInfo("Emoji Picker")
|
||||
var args = emojiCodemap
|
||||
var args = getEmoji()
|
||||
args.add("exit")
|
||||
let output = outputData(info,args)
|
||||
if output == "exit" or output == "":
|
||||
return
|
||||
else:
|
||||
let e = re.findAll(output,re(".+ :"))
|
||||
if len(e) > 0:
|
||||
let emoji = re.replace(e[0], re(" :"),"")
|
||||
copyToClipboard(emoji)
|
||||
return
|
||||
|
|
1573
lib/codemap.nim
1573
lib/codemap.nim
File diff suppressed because it is too large
Load diff
3572
lib/emojilist.nim
Normal file
3572
lib/emojilist.nim
Normal file
File diff suppressed because it is too large
Load diff
66
remmina.nim
Normal file
66
remmina.nim
Normal file
|
@ -0,0 +1,66 @@
|
|||
import base
|
||||
import lib/emojilist
|
||||
import std/[re,os,osproc,tables,algorithm]
|
||||
import configparser
|
||||
|
||||
const REMMINA_DIR = getHomeDir() & ".local/share/remmina"
|
||||
|
||||
var sessions = initTable[string,string]()
|
||||
var names: seq[string] = @[]
|
||||
|
||||
proc main()
|
||||
|
||||
proc getRemminaFiles(): seq[string] =
|
||||
if len(names) < 1:
|
||||
for file in walkFiles(REMMINA_DIR & "/*.remmina"):
|
||||
let content = readFile(file)
|
||||
let ini = parseIni(content)
|
||||
let group = ini.getProperty("remmina","group")
|
||||
let name = ini.getProperty("remmina","name")
|
||||
let server = ini.getProperty("remmina","server")
|
||||
if name != "" and server != "":
|
||||
let slug = group & " : " & name & " : (" & server & ")"
|
||||
sessions[slug] = file
|
||||
names.add(slug)
|
||||
names.sort()
|
||||
return names
|
||||
|
||||
proc editRemmina(conn: string) =
|
||||
let session = sessions[conn]
|
||||
discard execCmd("remmina -e " & quote(session))
|
||||
|
||||
proc startRemmina(conn: string) =
|
||||
let session = sessions[conn]
|
||||
discard execCmd("remmina -c " & quote(session))
|
||||
|
||||
proc selectRemmina(conn: string) =
|
||||
var info = newInfo("Remmina : " & conn)
|
||||
let args = @["connect", "edit", "back"]
|
||||
let output = outputData(info,args)
|
||||
if output in args:
|
||||
case output:
|
||||
of "connect":
|
||||
startRemmina(conn)
|
||||
of "edit":
|
||||
editRemmina(conn)
|
||||
of "back":
|
||||
main()
|
||||
|
||||
|
||||
proc main() =
|
||||
var info = newInfo("Remmina")
|
||||
var args: seq[string] = getRemminaFiles()
|
||||
args.add("new")
|
||||
args.add("exit")
|
||||
let output = outputData(info,args)
|
||||
if output == "exit" or output == "":
|
||||
return
|
||||
elif output == "new":
|
||||
discard execCmd("remmina --new")
|
||||
elif output in names:
|
||||
selectRemmina(output)
|
||||
return
|
||||
return
|
||||
|
||||
if isMainModule:
|
||||
main()
|
Loading…
Reference in a new issue