[Solved] Using Inxi in Terminal or in Conky gives different output format!

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
RemonK
Level 4
Level 4
Posts: 395
Joined: Wed Feb 06, 2019 6:32 pm
Location: Land van Umme
Contact:

[Solved] Using Inxi in Terminal or in Conky gives different output format!

Post by RemonK »

When execute inxi in a terminal inxi -Sxxx >/tmp/inxi_for_conky.log i get this:

Code: Select all

System:    Host: P3300LX Kernel: 4.15.0-58-generic x86_64 bits: 64 compiler: gcc v: 7.4.0 Desktop: Cinnamon 4.2.3 
           wm: muffin 4.2.2 dm: LightDM 1.26.0 Distro: Linux Mint 19.2 Tina base: Ubuntu 18.04 bionic 

When i give the exact same execution in conky i get this in my log:

Code: Select all

12System:    12Host P3300LX 12Kernel 4.15.0-58-generic x86_64 12bits 64 12compiler gcc 12v 7.4.0 
           12Desktop Cinnamon 4.2.3 12wm muffin 4.2.2 12dm LightDM 1.26.0 12Distro Linux Mint 19.2 Tina 
           12base Ubuntu 18.04 bionic 

If i put the same execution in a script and run it in a terminal i get the first output.
When i execute that same script from within conky i again get the second output !? (and btw, there are more unknown characters in it wich do not show up in this post!)

Am i doing something wrong here?? I want the first output, plain text!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Het leven is net een kartbaan; Sensatie, adrenaline en veel te snel voorbij!
Joeptjoep - Feestboek
RemonK
Level 4
Level 4
Posts: 395
Joined: Wed Feb 06, 2019 6:32 pm
Location: Land van Umme
Contact:

Re: Using Inxi in Terminal or in Conky gives different output format!

Post by RemonK »

Maybe a few screenshots say more than words..

Normal terminal output:
Schermafdruk van 2019-08-27 23-40-49.png

Wicked output:
Schermafdruk van 2019-08-27 23-40-34.png
Het leven is net een kartbaan; Sensatie, adrenaline en veel te snel voorbij!
Joeptjoep - Feestboek
User avatar
karlchen
Level 23
Level 23
Posts: 18228
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Using Inxi in Terminal or in Conky gives different output format!

Post by karlchen »

Hello, RemonK.

More likely than not, all which you are seeing in the Conky logfile, is the effect of the inxi commandline option -c<number>
Please, consult the inxi internal commandline help by
+ executing inxi --help | more
+ and reading the section on the commandline option -c<number> specifically.

Code: Select all

Output Control Options:
[...]
 -c, --color          Set color scheme (0-42). For piped or redirected output, you must use an explicit color selector. 
                      Example: inxi -c 11 
                      Color selectors let you set the config file value for the selection (NOTE: IRC and global only show safe 
                      color set) 
                         94  Console, out of X
                         95  Terminal, running in X - like xTerm
                         96  Gui IRC, running in X - like Xchat, Quassel, Konversation etc.
                         97  Console IRC running in X - like irssi in xTerm
                         98  Console IRC not in X
                         99  Global - Overrides/removes all settings. Setting specific removes global.
Regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 792 days now.
Lifeline
RemonK
Level 4
Level 4
Posts: 395
Joined: Wed Feb 06, 2019 6:32 pm
Location: Land van Umme
Contact:

Re: Using Inxi in Terminal or in Conky gives different output format!

Post by RemonK »

Inxi manual says this:

Code: Select all

       -c, --color [0-42]
              Set color scheme. If no scheme number is supplied, 0 is assumed.

       -c [94-99]

              These color selectors run a color selector option  prior to inxi starting which lets you set the config
              file value for the selection.

              NOTE:  All configuration file set color values are removed when output is piped or redirected. You must
              use the explicit runtime -c <color number> option if  you  want  color  codes  to  be  present  in  the
              piped/redirected output.

              Color selectors for each type display (NOTE: IRC and global only show safe color set):
I had a feeling that it were indeed color coded charcacter.. But when i use inxi with | cut etc etc then the output is piped to the cut command isn't it? Even then i get the strange characters! While the manual says with piping the colors are stripped!
So i don't get what i do wrong. And i also do not get why, when i run the script in a terminal, the color codes won't show up in the log, but when the script is started by conky the code DO show up in the log???
Het leven is net een kartbaan; Sensatie, adrenaline en veel te snel voorbij!
Joeptjoep - Feestboek
RemonK
Level 4
Level 4
Posts: 395
Joined: Wed Feb 06, 2019 6:32 pm
Location: Land van Umme
Contact:

Re: Using Inxi in Terminal or in Conky gives different output format!

Post by RemonK »

Pff.. shoot me! Now suddenly the -c0 option does work! :shock:
Het leven is net een kartbaan; Sensatie, adrenaline en veel te snel voorbij!
Joeptjoep - Feestboek
User avatar
karlchen
Level 23
Level 23
Posts: 18228
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: [Solved] Using Inxi in Terminal or in Conky gives different output format!

Post by karlchen »

Hello, RemonK.

Seems as if your inxi is an older version than mine (3.0.36).
By default inxi will use colour codes in terminal windows in order to make its output look nicer and clearer.
By default inxi will switch to -c0 (switch off colour codes) in all cases where it detects that its output is either redirected to a file or sent to some pipe.
You can use the -c<number> option in order to force inxi to use colour codes even in cases where its output is sent to a pipe or redirected to a file.
This is what will have happened in the case of your Conky logfile.

Regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 792 days now.
Lifeline
RemonK
Level 4
Level 4
Posts: 395
Joined: Wed Feb 06, 2019 6:32 pm
Location: Land van Umme
Contact:

Re: [Solved] Using Inxi in Terminal or in Conky gives different output format!

Post by RemonK »

Yes i know, and i did use the -c0 within conky, but it still printed the colorcodes! So i was confused why i got these codes in the logfile while using the exact same script . Using it at the Terminal no codes, using it from within conky got codes (in script starting inxi with -c0).
Then yesterday all of a sudden it DID work!? :shock:
But i find it also strange that when i execute the exact same inxi command from the terminal the logfile has 2 lines of info and when i start it from within conky i get 3 lines of info (the same info). What does conky do that these exact same commands have different output?

Btw my inxi is version 3.0.32 and bash is 4.4.20
Het leven is net een kartbaan; Sensatie, adrenaline en veel te snel voorbij!
Joeptjoep - Feestboek
User avatar
AndyMH
Level 21
Level 21
Posts: 13757
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: [Solved] Using Inxi in Terminal or in Conky gives different output format!

Post by AndyMH »

why are you using inxi, what are you trying to display? the odds are that there is a conky variable you can use instead, e.g.

Code: Select all

${color0}System:$alignr$sysname $machine
Kernel:$alignr$kernel
Host:$alignr$nodename
Uptime:$alignr$uptime_short
gives
Workspace 1_025.png
Workspace 1_025.png (25.14 KiB) Viewed 2997 times
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
RemonK
Level 4
Level 4
Posts: 395
Joined: Wed Feb 06, 2019 6:32 pm
Location: Land van Umme
Contact:

Re: [Solved] Using Inxi in Terminal or in Conky gives different output format!

Post by RemonK »

I have all i want in my conky applets, but i want to learn what i can and can't do with grep, awk, head etc.. and not only from a file, but from a pipe also! And at the same time play with conky.. ;)
But not all you can get from the standard variables of conky.. no mobo or bios info, no gnome or gtk version.. most info i got, i got it from files all over the place. If i can get all this info from inxi, then why not? Then I have to do one inxi run with most info output and i can get all the info from 1 log!
Het leven is net een kartbaan; Sensatie, adrenaline en veel te snel voorbij!
Joeptjoep - Feestboek
Locked

Return to “Compiz, Conky, Docks & Widgets”