Closed lasers closed 6 years ago
You are missing the function uzer_func
that has to return single string, not other type.
from __future__ import print_function
from os import getloadavg
def uzer_func():
a=', '.join([format(x) for x in getloadavg()])
return a
I said no to --load-xmin because we now have Load/avg 1 Load/avg 5 Load/avg 15. Users can want either LoadAvg 1 (Problem solved by splitting up) or LoadAvg: 1, 5, 15 (Problem created by splitting up).... and possibly more.
Will add another option to stand as "header" or title that can be used to prefix certain option with custom title.
I added the missing uzer_func
, then you pasted code. Both gave me nothing. It's also printing [\?color=yellow&show 0]
which I think came from nowhere.
With just --time
in ~/.pinky
, it printed the time okay, but if I tried PYTHONPATH=~/src/pinky-python ~/.cache/bin/pinkybar --python example.py
, I get [\?color=yellow&show 0]
. Also, does this mean I need to customize pinkybar
module to include PYTHON... line
?
Can you test PYTHONPATH=~/test ~/.cache/bin/pinkybar --python test
notice that test doesn't include test.py
Will add another option to stand as "header" or title that can be used to prefix certain option with custom title.
Yes. I wanted to make an issue about that, but felt that it would be too much because that mean removing all existing headers as well as symbols, characters, etc.. I also was wondering about --color
.... so... Lot of things... hence me not making a post. Will check.
Okay. This works fine now with example
. Don't use example.py
. Ty. :+1:
I will be brave and make a post about that issue. Ty again.
Added the custom title and removed the Load/avg
label from the three load-xmin
functions.
Can't make
with py3status, colors, python3
$ make
Making all in src
make[1]: Entering directory '~/src/pinky-bar/src'
make all-am
make[2]: Entering directory '~/src/pinky-bar/src'
CXXLD pinkybar
Makefile:506: recipe for target 'pinkybar' failed
make[2]: Leaving directory '~/src/pinky-bar/src'
Makefile:398: recipe for target 'all' failed
make[1]: Leaving directory '~/src/pinky-bar/src'
Makefile:502: recipe for target 'all-recursive' failed
EDIT:
make[1]: Entering directory '~/src/pinky-bar/src'
make all-am
make[2]: Entering directory '~/src/pinky-bar/src'
CXXLD pinkybar
extend.o: In function `get_python':
~/src/pinky-bar/src/extend.c:89: undefined reference to `PyUnicode_DecodeFSDefault'
~/src/pinky-bar/src/extend.c:109: undefined reference to `PyUnicode_AsUTF8'
~/src/pinky-bar/src/extend.c:109: undefined reference to `PyUnicode_AsUTF8'
collect2: error: ld returned 1 exit status
Your default python is python2, and the program (extend.m4) is looking for python-config. Will see what I can do to detect the correct python2.7-config or python3.6-config and not python-config.
On my system my default python version is 3.6 and tried a lot of changes to extend.m4 but it just doesn't want --with-python2
, still searches for python3.X no matter what I specified or comment in the python3 code in there.
How do I use both PYTHONPATH=~/scripts ~/.cache/bin/pinkybar --python getloadavg
and --time
in ~/.pinky
?
Execute bare PYTHONPATH=~/scripts ~/.cache/bin/pinkybar
and in your config type --python=getloadavg
with = sign.
Can you try to import py3status and operate it from uzer_func
?
I'm trying to run --python getloadavg
on pinkybar
module right now No problem running this on the terminal.
I came up with something. Users need to specify path
in the config. (https://github.com/lasers/py3status/blob/newmodule-pinkybar/py3status/modules/pinkybar.py)
Open up a PR.
Got through the doors only to get this. (re: python3).
$ ~/.cache/bin/pinkybar
[1] 11281 segmentation fault ~/.cache/bin/pinkybar
It works fine on my system with python3, wondering where it fails.
Can you run gdb
as it's compiled with -g flag and post what it shows ?
Dunno. Went to Py2. You say this. I come back to Py3. Working okay. Cheers. :clinking_glasses:
Just to confirm that python2 and python3 are working fine - https://streamable.com/sw4ey
You want this? https://github.com/lasers/pinky-bar/commit/d7147d6e3d17f58fb426dd7ef6cfba886a995c12
Lot of minor touchups, spelling typos, capitalization, removing beginning The
, not insulting linux brands (eg, VoidLinux --> Void Linux) and few more. Also, solusos
should be solus
too, but I hadn't looked where you put that in (for set.pl thing). It's lot of tiny tiny tweaks.
Yes I really want those changes. Open up a PR.
Okay. I'll do that when I'm 100% finished with nitpicking.
Question? Hmm. Can you explain more about...
--dwm
What does this does/query?--sensors
... Alternative to what?Sorry. Your README.md
alone is almost 1K. It's taking longer than I thought.
--with-dwm
outputs the data to the root window which dwm is using to parse and show it to the user in the form of statusbar.
--sensors
is alternative way to obtain data instead using the pre-defined paths that the kernel is using to store data such as the one provided for motherboard vendor/model and cpu temperature also for voltage and fans too.
Just pushed. https://github.com/lasers/pinky-bar/blob/readme/README.md. Feel free to preserve anything. I'm done with Compile Options
. Kinda looking at Program Options
now.
Thoughts?
It looks great :+1: , waiting for PR.
Question: If users extend pinkybar
with scripts, how can we pass the arguments to script? I can hardcode it inside the script, but this is more for pinkybar
than for the user
. I was thinking about something like this...
pinkybar --python nvidia_smi=temperature.gpu,memory.used
--> Prints 39C, 224MB
If you have NVIDIA GPU, you can try nvidia_smi
w/ py3status
. All of the variable names comes from NVIDIA's nvidia_smi
command.
$ nvidia-smi --format=csv,noheader,nounits --query-gpu=temperature.gpu,memory.used 63, 192
Question: If users extend pinkybar with scripts, how can we pass the arguments to script?
You can't pass arguments as the "scripts" get imported as modules.
edit: You can execute shell commands inside the script and capture the output then return it to pinkybar.
What you can try is write another module and import it on-the-fly inside the primary one, this way you can pass variables/classes/functions/data replaced from sed.
I realize it would be better to use --shell
in the config.
--shell=$(nvidia_smi --format=csv,noheader --query-gpu=temperature.gpu,nounits) --space --title C
--shell=$(nvidia_smi --format=csv,noheader --query-gpu=memory.used)
Notice the absent nounits
in second line as it would print 192 MiB
instead of 192
.
It would come out as 63 C 192 MiB
(in same color).
Also, --text C
(extra space) results in option --title requires an argument.
No space in --text
either. Hmm, tough. Anyhow, having --shell
work in the config seems like a must-have feature. \o/
Got it to work with --shell in the config, replace the following code in options.c:
In your config type --shell command
, there must be a space, no = sign.
void
parse_konf(char *combined) {
FILE *fp = NULL, *fp2 = NULL;
char *ptr = NULL;
char *ello[] = { (char *)PACKAGE_STRING, NULL };
char buf[100], conf[50], temp[100], temp2[VLA], temp3[VLA];
const char *const home = getenv("HOME") ? getenv("HOME") : "empty";
struct arguments arguments = {
.all = combined
};
snprintf(conf, 49, "%s%s", home, "/.pinky");
if (NULL == (fp = fopen(conf, "r"))) {
exit_with_err(ERR, "~/.pinky doesn't exist or $HOME is unset");
}
while (NULL != (fgets(buf, 99, fp))) {
if (EOF == (sscanf(buf, "%[^\n]", temp))) {
CLOSE_FP(fp);
exit_with_err(ERR, "empty line(s) detected.");
}
ptr = temp;
while (0 != (isspace((unsigned char) *ptr))) {
ptr++;
}
if ('-' == *ptr && '-' == *(ptr+1)) {
if ('s' == *(ptr+2) && 'e' == *(ptr+4)) {
if (EOF == (sscanf(ptr, "%*s %[^\n]", temp2))) {
CLOSE_FP(fp);
exit_with_err(ERR, "empty line(s) detected - EOF.");
}
if (NULL == (fp2 = popen(temp2, "r"))) {
continue;
}
CHECK_FSCANF(fp2, "%[^\n]", temp3);
GLUE(arguments.all, "%s ", temp3);
if (-1 == (pclose(fp2))) {
exit_with_err(CANNOT_CLOSE, "popen()");
}
continue;
}
}
ello[1] = ptr;
argp_parse(&arg_parser, 2, ello, ARGP_IN_ORDER, NULL, &arguments);
}
CLOSE_FP(fp);
}
sh: 1: Field: not found
pinkybar 1.00.00: Error: fscanf() failed
with...
--time
--updates
--cpu-percent
--cpu-percent-all
--cpuspeed
--packages
--cputemp
--shell $(nvidia-smi --format=csv,noheader --query-gpu=temperature.gpu,nounits)
--shell $(nvidia-smi --format=csv,noheader --query-gpu=memory.used)
Copy and paste the code in my previous comment as I edited it
--shell nvidia-smi --format=csv,noheader --query-gpu=temperature.gpu,nounits
--shell nvidia-smi --format=csv,noheader --query-gpu=memory.used
Works without $()
. Also, I made mistake.
--shell nvidia-smi --format=csv,noheader,nounits --query-gpu=temperature.gpu
--shell nvidia-smi --format=csv,noheader --query-gpu=memory.used
EDIT: 64 215 MiB
@su8 Do you notice that it ignore other arguments in the config? Edit: What the... Nevermind.
That's why I told you to copy it again, pushed the newer changes to the repository. Perform git pull
.
Hi. I tried this.
Result...
I can add
[\?color=blue&show {result}]
myself forpy3status
, but I do not know how to do that for other things likedwm
,xmobar
,awesomewm
,tmux
,ncurses
, etc as they require different formatting which I am not familiar with.If users write scripts and then they might wanted things to be formatted accordingly to the arguments they gave... partially with colors too. I have other issue of acknowledging that most strings, colors, etc are hardcoded and that there is not lot of flexible in customizing
~/.pinky
like a bash shell.I said no to
--load-xmin
because we now haveLoad/avg 1 Load/avg 5 Load/avg 15
. Users can want eitherLoadAvg 1
(Problem solved by splitting up) orLoadAvg: 1, 5, 15
(Problem created by splitting up).... and possibly more.Sorry for unleashing issues. I can... stop.