0

So I'm trying to add kind of a word of the day thing to conky, but with Chinese words. There's a few ways I've tried this and with no success.

I have my words saved in a csv file formatted like 电脑,dia4nna3o,computer In conky I've tried running ${exec mycommand} Where mycommand has been several things:

1) Writing a python script that will print out a random line. Results in nothing (works in bash)

2) A bash script that echos the a random line. Results in nothing (works in bash)

3) Trying to convert the output from one of the above to an image and then displaying that image. Using

python randword.py | convert label:@- tmp.png

to convert the text to an image. While this displays an image, there is nothing where the Chinese character should be (but the English characters are there). Looks like this:

Output image

I'm really at a loss of what to do. Any idea?


System Info: Distro: Manjaro x86_64 DE: XFCE Conky Version:

[ steven ] [~] > conky --version                                        
conky 1.10.6_pre compiled Thu Dec 29 16:29:51 UTC 2016 for Linux 4.1.37-1-MANJARO x86_64

Compiled in features:

System config file: /etc/conky/conky.conf
Package library path: /usr/lib/conky


 General:
  * math
  * hddtemp
  * portmon
  * IPv6
  * Curl
  * RSS
  * Weather (METAR)
  * Weather (XOAP)
  * wireless
  * support for IBM/Lenovo notebooks
  * nvidia
  * builtin default configuration
  * old configuration syntax
  * Imlib2
  * apcupsd
  * iostats
  * ncurses
  * Internationalization support

 Lua bindings:
  * Cairo
  * Imlib2
  * RSVG
 X11:
  * Xdamage extension
  * Xinerama extension (virtual display)
  * XDBE (double buffer extension)
  * Xft
  * ARGB visual
  * Own window

 Music detection:
  * MPD
  * MOC

 Default values:
  * Netdevice: eth0
  * Local configfile: $HOME/.conkyrc
  * Localedir: /usr/share/locale
  * Maximum netdevices: 64
  * Maximum text size: 16384
  * Size text buffer: 256
  • Does the font you are using in conky contain glyphs for the desired characters? – Fox Dec 15 '18 at 8:20
  • I can only display English characters in conky. Even things like the ├─ from lsblk do not show. I'm not sure how to get other symbols or fonts loaded. Let alone a mixed one. – Steven Walton Dec 15 '18 at 8:23
1

You will need to have a suitable font, and also set the locale for conky. I tried the following on a Linux Fedora using conky 1.10.4. Install a font:

sudo dnf install google-noto-cjk-fonts 

Create a file with some utf8 character:

    printf '\xe5\xba\x83\n' >chars

Create a .conkyrc that sets a global cjk font, and also tries setting a variant within the text part, and uses cat to read the above file:

conky.config = {
    minimum_height = 400,
    minimum_width = 600,
    font = 'Noto Sans CJK TC Regular:size=40',
    use_xft = true,
 };
conky.text = [[
 start  ${exec cat chars}  end
 ${font Noto Sans CJK TC Bold:size=20} start ${exec cat chars} end ${font}
]]

Run conky in a utf8 locale

    LC_ALL=en_US.utf8 conky -c .conkyrc -o

to get the result:

conky

  • Seems like something else is going on. With ONLY what you put in the conkyrc file I still get the square that represents unknown symbol. Again, catting chars shows the correct thing in the terminal. I'll update my post for system info – Steven Walton Dec 15 '18 at 20:53
  • Your conky info is the same as mine. Presumably, fc-match 'Noto Sans CJK TC' shows NotoSansCJK-Regular.ttc as a match. – meuh Dec 15 '18 at 22:29
  • That would be correct. I get the same output. – Steven Walton Dec 15 '18 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.