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` - `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) - `calculate` a calculator, utilising `qalculate` - inspired by [@fedops](https://codeberg.org/fedops/scripts)
- `emoji` an emoji picker - `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 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 command_wrapper* = false
var run_command* = "" var run_command* = ""
proc newInfo*(title: string = "Info"): Info = proc newInfo*(str: string = "Info"): Info =
var title = str
if rofi:
title = title & " : "
return Info( return Info(
title: title, title: title,
selected_fg: black, selected_fg: black,

View file

@ -1,16 +1,17 @@
import base import base
import lib/codemap import lib/emojilist
import std/[re,osproc,algorithm] import std/[re,osproc,algorithm]
proc main() = proc main() =
var info = newInfo("Emoji Picker") var info = newInfo("Emoji Picker")
var args = emojiCodemap var args = getEmoji()
args.add("exit") args.add("exit")
let output = outputData(info,args) let output = outputData(info,args)
if output == "exit" or output == "": if output == "exit" or output == "":
return return
else: else:
let e = re.findAll(output,re(".+ :")) let e = re.findAll(output,re(".+ :"))
if len(e) > 0:
let emoji = re.replace(e[0], re(" :"),"") let emoji = re.replace(e[0], re(" :"),"")
copyToClipboard(emoji) copyToClipboard(emoji)
return return

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()