Open lasers opened 6 years ago
My ~/src/f2f/f2f.py
script.
#!/usr/bin/env python
from sys import argv, stdin, exit
if __name__ == "__main__":
if '--to-tmux' in argv:
string = '#[fg={color},bright]{output}'
elif '--to-py3status' in argv:
string = '[\?color=#{color}&show {output}]'
elif '--to-lemonbar' in argv:
string = '%{F#{color}}{output}'
elif '--to-xmobar' in argv:
string = '<fc=#{color}>{output}'
else:
exit('No argument')
output_string = ''
for line in stdin:
output_string += ''.join(line.splitlines())
output_list = output_string.split('{color_')[1::1]
for index, parameter in enumerate(output_list):
end = parameter.find('}')
color = parameter[:end]
output = parameter[1 + end:]
output_list[index] = string.format(color=color, output=output)
print(''.join(output_list))
Small changes to pinkybar
module.
self.command = 'conky | ~/src/f2f/f2f.py --to-py3status'
# if not self.command or not self.py3.check_commands(self.command):
# raise Exception(STRING_ERROR)
Result:
py3status
lemonbar
EDIT: This does not leave conky
running in the background so I miss out on different interval time, upload, download, etc... but is definitely better. :+1:
You can add it to the py3status folder too.
I have something in mind to create three --color1,2,3
options that have to be supplied right after --format tmux
, but will see how much time that would take. ♥
Close this? Seems like f2f
does the job okay unless you have something else in mind?
I'm working on implementing color support via --color1 #000fff
with up to three colors that have to supplied right after --format tmux
etc.
It's rather tricky, saving my work for next week.
After some sleep I managed to get it working.
pinkybar --conf ~/.config/pinky-tmux.conf
Notice the new --conf
option that allows you to use different location and different config according to the used program.
--fmt=tmux
--color1="#[fg=blue,bright]"
--color2="#[fg=magenta,bright]"
--color3="#[fg=yellow,bright]"
The first parser introduced by me was kinda working, but not exactly on 100%, so we need another strategy for this.
re: limitation in customizing and/or formatting
In attempt to understand this issue better, I played with
conky
a bit.Output
Conky want
${color 1793d1}
. I used{color_1793d1}
supposedly forpinkybar
to parse.If
pinkybar
can behave likelemonbar
, egecho OUTPUT | pinkybar --format py3status
, thenpinkybar
should be able to support output from any languages without having to be built with.conky
also come with lot of variables... essentially saving you lot of time in writing code and/or fixing bugs for arguments (such as pending unsolved--packages
) reducingpinkybar
into hopefully more of a simplistic bug-free parser/converter.If no
{color_xxx}
are passed, then the output can be shown in any program "without colors" too.Basically, the goal, I wonder, is to attain something like this:
pinky
is a filler for options not available inconky
. You do not have to usepinky
. I usedpinky
in this example because it know I'm onDebian
for--pkgs
. Maybe file a feature request on conky for missing options.. or users can add their own script.One thing I didn't consider is that maybe some format does not support color hex or that it could look bad in some program (such as
tmux
), but withconky
or any other scripting, users can specify different colors so I think it's not going to be a problem anyway.P.S.
conky
also supportexec
andexeci
(same asexec
, but with a specific interval in seconds. The interval can't be less than update_interval in conky configuration.) possibly making it useful forpinky --weather
or such. :+1:Link: https://github.com/brndnmtthws/conky/wiki/Configuration-Variables