added reminurr

This commit is contained in:
Paul Wilde 2023-11-23 10:02:06 +00:00
parent ae102073b8
commit 079c5d9526
7 changed files with 21 additions and 34 deletions

View file

@ -7,6 +7,7 @@ import util/volurrme
import util/netwurrk import util/netwurrk
import util/emurrji import util/emurrji
import util/calendurr import util/calendurr
import util/remminurr
proc dispatch*(cfg: Config) = proc dispatch*(cfg: Config) =
case cfg.run case cfg.run
@ -24,5 +25,7 @@ proc dispatch*(cfg: Config) =
emurrji.go() emurrji.go()
of Calendurr: of Calendurr:
calendurr.go() calendurr.go()
of Remminurr:
remminurr.go()
else: else:
echo "No valid run command given" echo "No valid run command given"

View file

@ -8,4 +8,5 @@ type
Volurrme, Volurrme,
Netwurrk, Netwurrk,
Emurrji, Emurrji,
Calendurr Calendurr,
Remminurr

View file

@ -7,7 +7,7 @@ proc stripQuotes(str: string): string =
var text = replace(str,"\"",""") var text = replace(str,"\"",""")
return text return text
proc quote(str: string): string = proc quote*(str: string): string =
var text = str var text = str
# May need to put some further work to escape some special chars here # May need to put some further work to escape some special chars here
text = stripQuotes(text) text = stripQuotes(text)

View file

@ -27,6 +27,8 @@ proc parseArgs*() =
myConfig.run = Emurrji myConfig.run = Emurrji
of "calendurr", "calender", "cal": of "calendurr", "calender", "cal":
myConfig.run = Calendurr myConfig.run = Calendurr
of "remminurr", "remmina", "rdp", "rem":
myConfig.run = Remminurr
else: else:
echo p.help echo p.help
quit(1) quit(1)

View file

@ -1,14 +0,0 @@
# Package
version = "0.1.0"
author = "Paul Wilde"
description = "A Remmina client tool and opener"
license = "GPL-3.0-or-later"
srcDir = "src"
bin = @["remmina_choosurr"]
# Dependencies
requires "nim >= 1.6.6"
requires "configparser >= 0.1.0"

View file

@ -1,20 +1,18 @@
import ../../globurrl import os
import std/[os,osproc,tables,algorithm] import osproc
import tables
import algorithm
import configparser import configparser
import ../common
import ../output
const REMMINA_DIR = getHomeDir() & ".local/share/remmina" const REMMINA_DIR = getHomeDir() & ".local/share/remmina"
const SWITCH_WS = false
const REMMINA_WS = "4"
var sessions = initTable[string,string]() var sessions = initTable[string,string]()
var names: seq[string] = @[] var names: seq[string] = @[]
proc main()
proc switchWorkspace() =
if SWITCH_WS and REMMINA_WS != "":
discard execCmd("i3-msg workspace number " & REMMINA_WS)
proc getRemminaFiles(): seq[string] = proc getRemminaFiles(): seq[string] =
if len(names) < 1: if len(names) < 1:
for file in walkFiles(REMMINA_DIR & "/*.remmina"): for file in walkFiles(REMMINA_DIR & "/*.remmina"):
@ -38,6 +36,8 @@ proc startRemmina(conn: string) =
let session = sessions[conn] let session = sessions[conn]
discard execCmd("remmina -c " & quote(session)) discard execCmd("remmina -c " & quote(session))
proc go*() # adding as need to refer back to it in selectRemmina
proc selectRemmina(conn: string) = proc selectRemmina(conn: string) =
var info = newInfo("Remmina Choosurr : " & conn) var info = newInfo("Remmina Choosurr : " & conn)
let args = @["connect", "edit", "back"] let args = @["connect", "edit", "back"]
@ -51,11 +51,9 @@ proc selectRemmina(conn: string) =
editRemmina(conn) editRemmina(conn)
#switchWorkspace() #switchWorkspace()
of "back": of "back":
main() go()
proc go*() =
proc main() =
var info = newInfo("Remmina Choosurr") var info = newInfo("Remmina Choosurr")
var args: seq[string] = getRemminaFiles() var args: seq[string] = getRemminaFiles()
args.add("new") args.add("new")
@ -68,7 +66,3 @@ proc main() =
elif output in names: elif output in names:
selectRemmina(output) selectRemmina(output)
return return
return
if isMainModule:
main()

View file

@ -13,3 +13,4 @@ bin = @["wmtools"]
requires "nim >= 2.0.0" requires "nim >= 2.0.0"
requires "parsetoml >= 0.7.1" requires "parsetoml >= 0.7.1"
requires "argparse" requires "argparse"
requires "configparser"