-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make a simplistic format parser/converter #27
Comments
My #!/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 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) EDIT: This does not leave |
You can add it to the py3status folder too. |
I have something in mind to create three |
Close this? Seems like |
I'm working on implementing color support via |
It's rather tricky, saving my work for next week. |
After some sleep I managed to get it working.
Notice the new --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. 👍Link: https://github.com/brndnmtthws/conky/wiki/Configuration-Variables
The text was updated successfully, but these errors were encountered: