Compare commits

..

2 commits

Author SHA1 Message Date
9713f40fac added remmina tool 2022-05-10 20:48:05 +01:00
bf5731a2d6 added remmina tool 2022-05-10 20:47:15 +01:00
6 changed files with 3648 additions and 1578 deletions

View file

@ -17,6 +17,7 @@ which are selectable options in dmenu.
- `notes` a simple one liner note taking tool, displaying notes in `dmenu`/`rofi`
- `calculate` a calculator, utilising `qalculate` - inspired by [@fedops](https://codeberg.org/fedops/scripts)
- `emoji` an emoji picker
- `remmina` reads the files in your remmina config directory and allows you to connect to and edit them
The next two do not work with `rofi` unless you have `alias dmenu=rofi` set, but they're pretty nice tools

View file

@ -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,

View file

@ -1,18 +1,19 @@
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(".+ :"))
let emoji = re.replace(e[0], re(" :"),"")
copyToClipboard(emoji)
if len(e) > 0:
let emoji = re.replace(e[0], re(" :"),"")
copyToClipboard(emoji)
return
if isMainModule:

File diff suppressed because it is too large Load diff

3572
lib/emojilist.nim Normal file

File diff suppressed because it is too large Load diff

66
remmina.nim Normal file
View 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()