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 Oct 28 '15

MK13 gravatar image

updated Oct 28 '15

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?

2 answers

Sort by » oldest newest most voted
0

answered Oct 28 '15

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).

Comments

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

MK13 gravatar imageMK13 (Oct 28 '15)edit
1

answered Oct 29 '15

MK13 gravatar image

updated Oct 29 '15

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 }

Question Tools

Stats

Asked: Oct 28 '15

Seen: 145 times

Last updated: Oct 29