Move everything into an old directory; we've completely restarted
This commit is contained in:
parent
1c5a44eaf3
commit
12cf8877f5
1807 changed files with 0 additions and 0 deletions
70
old_work/xrdb2st.py
Executable file
70
old_work/xrdb2st.py
Executable file
|
|
@ -0,0 +1,70 @@
|
|||
#!/usr/bin/env python
|
||||
#coding:utf-8
|
||||
"""
|
||||
Author: sir garbagetruck --<>
|
||||
Purpose: convert xrdb defs into st array
|
||||
Created: 25/01/17
|
||||
"""
|
||||
|
||||
import argparse
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def main(filename):
|
||||
"""the main chunk"""
|
||||
|
||||
f = open(filename)
|
||||
colors = {}
|
||||
c2 = {}
|
||||
print("{")
|
||||
for i in f.readlines():
|
||||
(crap,color,rgb)=i.split(' ')
|
||||
cbits = color.split('_')
|
||||
rgb = rgb.rstrip()
|
||||
try:
|
||||
idx = int(cbits[1])
|
||||
colors[idx] = rgb
|
||||
c2[rgb] = idx
|
||||
except:
|
||||
# print(color)
|
||||
if color == 'Background_Color':
|
||||
bg = rgb
|
||||
if color == 'Cursor_Color':
|
||||
cs = rgb
|
||||
if color == 'Foreground_Color':
|
||||
fg = rgb
|
||||
pass
|
||||
l = colors.keys()
|
||||
for i in l:
|
||||
print(' "'+colors[i]+'", // '+str(i))
|
||||
|
||||
x = 256
|
||||
# the 255 line
|
||||
print(" [255] = 0,")
|
||||
|
||||
try:
|
||||
print("//static unsigned int defaultbg = " + str(c2[bg])) +';'
|
||||
except:
|
||||
print(' "'+bg+'", /* bg color */')
|
||||
print("//static unsigned int defaultbg = " + str(x)) +';'
|
||||
x=x+1
|
||||
try:
|
||||
print("//static unsigned int defaultfg = " + str(c2[fg])) +';'
|
||||
except:
|
||||
print(' "'+fg+'", /* fg color */')
|
||||
print("//static unsigned int defaultfg = " + str(x)) +';'
|
||||
x=x+1
|
||||
|
||||
try:
|
||||
print("//static unsigned int defaultcs = " + str(c2[cs])) +';'
|
||||
except:
|
||||
print(' "'+cs+'" /* cs color */')
|
||||
print("//static unsigned int defaultcs = " + str(x)) +';'
|
||||
|
||||
print("},")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("file",help="the file to read")
|
||||
args = parser.parse_args()
|
||||
main(args.file)
|
||||
Loading…
Add table
Add a link
Reference in a new issue