The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

Different font for workspace and status section

asked 2015-10-28 19:38:50 +0000

MK13 gravatar image

updated 2015-10-28 19:46:39 +0000

I would like to set two different fonts for the workspace section on left side and the status output on the right side of the i3bar. I know that I can change the font for the whole i3bar, but as far as I can tell by reading the official documentation using two different fonts is not possible.

Does someone has a solution for this problem or would I need to change the source code?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-10-28 20:52:34 +0000

Airblader gravatar image

You can try using pango markup which allows changing the font. If that doesn't work, you either need to change the source code or hack together a really tricky font that combines two others (not exactly my recommendation).

edit flag offensive delete link more

Comments

Thanks for your fast reply. I will look into into pango markup.

MK13 gravatar imageMK13 ( 2015-10-28 21:33:23 +0000 )edit
1

answered 2015-10-29 19:10:59 +0000

MK13 gravatar image

updated 2015-10-29 19:11:47 +0000

Thanks to airblader for pointing me into the right direction :)

Here is the solution I came up with by utilizing pango markup:

i3statuswrapper.sh:

  1 #!/bin/bash
  2 
  3 function f_ram()
  4 {
  5         echo $(free | grep Mem | awk '{printf("%.0fMiB/%.0fMiB", $3/1024, $2/1024)}')
  6 }
  7 
  8 function f_uptime()
  9 {
 10         echo $(uptime -p)
 11 }
 12 
 13 echo '{ "version": 1 }'
 14 echo '['
 15 echo '[]'
 16 
 17 i3status | while :
 18 do
 19         read line
 20         ram_s=$(f_ram)
 21         uptime_s=$(f_uptime)
 22         full="UP: $uptime_s | RAM: $ram_s | $line"
 23 
 24         echo ",[{\"name\": \"all\",\"full_text\":\"<span font='DejaVu Sans Mono'>"$full"</span>\",\"align\": \"right\",\"urgent\": false,\"separator\": false,\"markup\": \"pango\"}]"
 25 done

i3status/config:

...
# ordinary config
14 order += "cpu_usage"
15 order += "disk /media"
16 order += "disk /home"
17 order += "disk /"
18 order += "volume master"
19 order += "tztime local"
...

i3/config:

144 bar {                                                                                                                                                      
145         status_command /home/USER/.config/i3status/i3statuswrapper.sh
146         
147 
148         font pango:RealChinese 10
...
159 }
edit flag offensive delete link more

Question Tools

Stats

Asked: 2015-10-28 19:38:50 +0000

Seen: 145 times

Last updated: Oct 29