Merge branch 'master' into wordWrappingEndOfScreenBell
This commit is contained in:
commit
159498d8c7
10
README.md
10
README.md
@ -25,7 +25,11 @@ ReadWrite permission
|
|||||||
- python-daemonize [use fenrir as background service on Unix like systems]
|
- python-daemonize [use fenrir as background service on Unix like systems]
|
||||||
|
|
||||||
# installation
|
# installation
|
||||||
Currently there is no setupscript (sorry). But you can just run as root or setup needed permission
|
- Archlinux: PKGBUILD in AUR
|
||||||
|
- install.sh (there is currently no uninstall)
|
||||||
|
- run from git:
|
||||||
|
You can just run the following as root:
|
||||||
cd src/fenrir-package/
|
cd src/fenrir-package/
|
||||||
sudo ./fenrir.py
|
sudo ./fenrir
|
||||||
Settings are located in the config directory.
|
Settings are located in the "config" directory.
|
||||||
|
|
||||||
|
92
play zone/vcsa.py
Executable file
92
play zone/vcsa.py
Executable file
@ -0,0 +1,92 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from cairo import *
|
||||||
|
from fcntl import ioctl
|
||||||
|
from array import array
|
||||||
|
import struct
|
||||||
|
import errno
|
||||||
|
import sys
|
||||||
|
|
||||||
|
GIO_UNIMAP = 0x4B66
|
||||||
|
VT_GETHIFONTMASK = 0x560D
|
||||||
|
|
||||||
|
if len(sys.argv) != 3:
|
||||||
|
print "Usage: %s <tty-number> <output-png>" % sys.argv[0]
|
||||||
|
exit()
|
||||||
|
|
||||||
|
ttyno = int(sys.argv[1])
|
||||||
|
png = sys.argv[2]
|
||||||
|
|
||||||
|
tty = open('/dev/tty%d' % ttyno, 'rb')
|
||||||
|
himask = array("H", (0,))
|
||||||
|
ioctl(tty, VT_GETHIFONTMASK, himask)
|
||||||
|
hichar, = struct.unpack_from("@H", himask)
|
||||||
|
|
||||||
|
sz = 512
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
unipairs = array("H", [0]*(2*sz))
|
||||||
|
unimapdesc = array("B", struct.pack("@HP", sz, unipairs.buffer_info()[0]))
|
||||||
|
ioctl(tty.fileno(), GIO_UNIMAP, unimapdesc)
|
||||||
|
break
|
||||||
|
except IOError as e:
|
||||||
|
if e.errno != errno.ENOMEM:
|
||||||
|
raise
|
||||||
|
sz *= 2
|
||||||
|
tty.close()
|
||||||
|
|
||||||
|
ncodes, = struct.unpack_from("@H", unimapdesc)
|
||||||
|
utable = struct.unpack_from("@%dH" % (2*ncodes), unipairs)
|
||||||
|
|
||||||
|
charmap = {}
|
||||||
|
for u, b in zip(utable[::2], utable[1::2]):
|
||||||
|
if charmap.get(b) is None:
|
||||||
|
charmap[b] = unichr(u)
|
||||||
|
|
||||||
|
vcs = open('/dev/vcsa%d' % ttyno, 'rb')
|
||||||
|
|
||||||
|
head = vcs.read(4)
|
||||||
|
rows = ord(head[0])
|
||||||
|
cols = ord(head[1])
|
||||||
|
caretX = ord(head[2])
|
||||||
|
caretY = ord(head[3])
|
||||||
|
|
||||||
|
surf = ImageSurface(FORMAT_RGB24, cols * 8, rows * 16)
|
||||||
|
|
||||||
|
cr = Context(surf)
|
||||||
|
cr.set_source_rgb(1,1,1)
|
||||||
|
cr.set_font_face(ToyFontFace("Mono", FONT_SLANT_NORMAL, FONT_WEIGHT_NORMAL));
|
||||||
|
m = Matrix()
|
||||||
|
m.scale(10.0, 12.0)
|
||||||
|
cr.set_font_matrix(m)
|
||||||
|
|
||||||
|
def CairoColor(b, a):
|
||||||
|
return (b if a & 4 else 0, b if a & 2 else 0, b if a & 1 else 0)
|
||||||
|
|
||||||
|
for y in range(rows):
|
||||||
|
for x in range(cols):
|
||||||
|
data = vcs.read(2)
|
||||||
|
(sh,) = struct.unpack("=H", data)
|
||||||
|
attr = (sh >> 8) & 0xFF
|
||||||
|
ch = sh & 0xFF
|
||||||
|
if hichar == 0x100:
|
||||||
|
attr >>= 1
|
||||||
|
|
||||||
|
ink = attr & 0x0F
|
||||||
|
paper = (attr>>4) & 0x0F
|
||||||
|
b = 1.0 if attr & 0x80 else 0.75
|
||||||
|
if sh & hichar:
|
||||||
|
ch |= 0x100
|
||||||
|
|
||||||
|
cr.set_source_rgb(*CairoColor(b, paper))
|
||||||
|
cr.rectangle(x*8, y*16, 8, 16)
|
||||||
|
cr.fill()
|
||||||
|
|
||||||
|
cr.set_source_rgb(*CairoColor(b, ink))
|
||||||
|
cr.move_to(x*8, 12 + y*16)
|
||||||
|
cr.show_text(charmap.get(ch, u'?'))
|
||||||
|
cr.stroke()
|
||||||
|
vcs.close()
|
||||||
|
|
||||||
|
surf.write_to_png(png)
|
||||||
|
|
@ -16,7 +16,7 @@ class command():
|
|||||||
return 'enables or disables tracking of highlighted'
|
return 'enables or disables tracking of highlighted'
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
currMode=self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight')
|
currMode = self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight')
|
||||||
|
|
||||||
self.env['runtime']['settingsManager'].setSetting('focus', 'highlight', str(not currMode))
|
self.env['runtime']['settingsManager'].setSetting('focus', 'highlight', str(not currMode))
|
||||||
self.env['runtime']['settingsManager'].setSetting('focus', 'cursor', str(currMode))
|
self.env['runtime']['settingsManager'].setSetting('focus', 'cursor', str(currMode))
|
||||||
|
@ -53,7 +53,7 @@ settings = {
|
|||||||
'dateFormat': '%A, %B %d, %Y',
|
'dateFormat': '%A, %B %d, %Y',
|
||||||
'autoSpellCheck': False,
|
'autoSpellCheck': False,
|
||||||
'spellCheckLanguage': 'en_US',
|
'spellCheckLanguage': 'en_US',
|
||||||
'scriptPath':'/etc/fenrir/scripts',
|
'scriptPath':'/usr/share/fenrir/scripts',
|
||||||
},
|
},
|
||||||
'focus':{
|
'focus':{
|
||||||
'cursor': True,
|
'cursor': True,
|
||||||
|
@ -32,19 +32,23 @@ def trackHighlights(oldAttr, newAttr, text, lenght):
|
|||||||
old = splitEvery(oldAttr,lenght)
|
old = splitEvery(oldAttr,lenght)
|
||||||
new = splitEvery(newAttr,lenght)
|
new = splitEvery(newAttr,lenght)
|
||||||
textLines = text.split('\n')
|
textLines = text.split('\n')
|
||||||
|
background = []
|
||||||
if len(textLines) != len(new):
|
if len(textLines) != len(new):
|
||||||
return result, currCursor
|
return result, currCursor
|
||||||
|
|
||||||
try:
|
try:
|
||||||
background = Counter(newAttr).most_common(1)
|
bgStat = Counter(newAttr).most_common(3)
|
||||||
background = background[0][0]
|
background.append(bgStat[0][0])
|
||||||
|
# if there is a third color add a secondary background (for dialogs for example)
|
||||||
|
if len(bgStat) > 2:
|
||||||
|
if bgStat[1][1] > 40:
|
||||||
|
background.append(bgStat[1][0])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
background = chr(7)
|
background.append(chr(7))
|
||||||
for line in range(len(new)):
|
for line in range(len(new)):
|
||||||
if old[line] != new[line]:
|
if old[line] != new[line]:
|
||||||
for column in range(len(new[line])):
|
for column in range(len(new[line])):
|
||||||
if old[line][column] != new[line][column]:
|
if old[line][column] != new[line][column]:
|
||||||
if new[line][column] != background:
|
if not new[line][column] in background:
|
||||||
if not currCursor:
|
if not currCursor:
|
||||||
currCursor = {}
|
currCursor = {}
|
||||||
currCursor['x'] = column
|
currCursor['x'] = column
|
||||||
|
Loading…
Reference in New Issue
Block a user