Compare commits
No commits in common. "9713f40fac11eacad9b858a875bad8608439a48f" and "310b8d9c1e4c333618cd898bccdf8cff70ca5d21" have entirely different histories.
9713f40fac
...
310b8d9c1e
6 changed files with 1578 additions and 3648 deletions
|
@ -17,7 +17,6 @@ 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
|
||||||
|
|
||||||
|
|
5
base.nim
5
base.nim
|
@ -63,10 +63,7 @@ var passmenu* = false
|
||||||
var command_wrapper* = false
|
var command_wrapper* = false
|
||||||
var run_command* = ""
|
var run_command* = ""
|
||||||
|
|
||||||
proc newInfo*(str: string = "Info"): Info =
|
proc newInfo*(title: string = "Info"): Info =
|
||||||
var title = str
|
|
||||||
if rofi:
|
|
||||||
title = title & " : "
|
|
||||||
return Info(
|
return Info(
|
||||||
title: title,
|
title: title,
|
||||||
selected_fg: black,
|
selected_fg: black,
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
import base
|
import base
|
||||||
import lib/emojilist
|
import lib/codemap
|
||||||
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 = getEmoji()
|
var args = emojiCodemap
|
||||||
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
|
||||||
|
|
1573
lib/codemap.nim
Normal file
1573
lib/codemap.nim
Normal file
File diff suppressed because it is too large
Load diff
3572
lib/emojilist.nim
3572
lib/emojilist.nim
File diff suppressed because it is too large
Load diff
66
remmina.nim
66
remmina.nim
|
@ -1,66 +0,0 @@
|
||||||
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