forked from speedie/spmenu
some script improvements
TODO: generate-keybind-list is absolutely horrible
This commit is contained in:
parent
63bfbceb7d
commit
9373133c03
|
@ -1,2 +1,28 @@
|
|||
#!/bin/sh
|
||||
grep "{ " "$1" | grep -v "[*]" | sed "s/{.i = //g; s/{.f = //g; s/{0} }/0/g; s/ } }//g; s/,//g; s/{ //g; s/^\s*//g; s/XK_//g"
|
||||
grep "{ " "$1" | \
|
||||
grep -v "[*]" | \
|
||||
sed "s/{.i = //g; s/{.c = //g; s/{.f = //g; s/{0} }/0/g; s/ } }//g; s/,//g; s/{ //g; s/^\s*//g; s/XK_//g; s/|/+/g" \
|
||||
> /tmp/data
|
||||
|
||||
cat << EOF > /tmp/wipdata
|
||||
| Mode | Modifier | Key | Function | Argument |
|
||||
| :----------------- | :----------------- | :----------------- | :----------------- | :----------------- |
|
||||
EOF
|
||||
|
||||
i=1
|
||||
|
||||
while true; do
|
||||
len="$(wc -l < /tmp/data)"
|
||||
mode="$(printf '%-18s' "$(sed -n ${i},${i}p /tmp/data | awk '{ print $1 }')")"
|
||||
mod="$(printf '%-18s' "$(sed -n ${i},${i}p /tmp/data | awk '{ print $2 }')")"
|
||||
key="$(printf '%-18s' "$(sed -n ${i},${i}p /tmp/data | awk '{ print $3 }')")"
|
||||
func="$(printf '%-18s' "$(sed -n ${i},${i}p /tmp/data | awk '{ print $4 }')")"
|
||||
arg="$(printf '%-18s' "$(sed -n ${i},${i}p /tmp/data | awk '{ print $5 }')")"
|
||||
cat << EOF >> /tmp/wipdata
|
||||
| $mode | $mod | $key | $func | $arg |
|
||||
EOF
|
||||
[ "$i" = "$len" ] && break
|
||||
i=$((i+1))
|
||||
done
|
||||
cat /tmp/wipdata
|
||||
rm -f /tmp/wipdata /tmp/data
|
||||
|
|
|
@ -18,8 +18,7 @@ read_colors() {
|
|||
while true; do
|
||||
color[i]="$(sed -n ${i},${i}p $1)"
|
||||
ccol="${color[i]}"
|
||||
[ "${#ccol}" != "7" ] && color[i]="#000000"
|
||||
[ "${ccol:0:1}" != "#" ] && color[i]="#000000"
|
||||
[ "${#ccol}" != "7" ] || [ "${ccol:0:1}" != "#" ] && color[i]="#000000"
|
||||
[ "$i" = "18" ] && break
|
||||
i=$((i+1))
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue