emacs: vc-git: set vc-git-print-log-follow
[~bandali/configs] / .local / bin / rofi-remmina
... / ...
CommitLineData
1#!/usr/bin/env python2
2
3import ConfigParser
4import os
5from subprocess import Popen, PIPE
6
7remmina_dir = os.path.expanduser("~/.local/share/remmina")
8
9fdict = dict()
10
11for f in os.listdir(remmina_dir):
12 fp = os.path.join(remmina_dir, f)
13 c = ConfigParser.ConfigParser()
14 c.read(fp)
15 n = c.get('remmina', 'name')
16 fdict[n] = fp
17
18lines = max(min(15, len(fdict)), 1);
19width = len(max(fdict.keys(), key=len))
20rofi = Popen(["rofi", "-i", "-dmenu", \
21 "-l", str(lines), "-width", str(width), \
22 "-p", "connection"], stdout=PIPE, stdin=PIPE)
23selected = rofi.communicate("\n" \
24 .join(fdict.keys()) \
25 .encode("utf-8"))[0] \
26 .decode("utf-8") \
27 .strip()
28rofi.wait()
29
30r = Popen(["remmina", "-c", fdict[selected]])
31r.wait()