mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-12-16 00:47:13 +00:00
Add terminal font detection support for terminology
Support for terminology font name detection is based on the terminology config file. This file is always located here: `~/.config/terminology/config/standard/base.cfg` (30cb65625b/src/bin/config.c (L216)) and is in a data/binary format. The only way I found (beside coding a dedicated extractor) is to use `strings`. The font name seems to be placed right before the `font.name` string.
strings ~/.config/terminology/config/standard/base.cfg | grep -B1 font.name | head -1
Here are results that could be output:
$ strings ~/.config/terminology/config/standard/base.cfg | grep -B1 font.name | head -1
6x13.pcf
--> (for a bitmap font) and with another font selected
$ strings ~/.config/terminology/config/standard/base.cfg | grep -B1 font.name | head -1
Inconsolata:style=Regular
These results are easily "parseable" in order to extract the font name for display.
This commit is contained in:
6
neofetch
6
neofetch
@@ -1814,6 +1814,12 @@ gettermfont () {
|
||||
"Apple_Terminal")
|
||||
termfont="$(osascript -e 'tell application "Terminal" to font name of window frontmost')"
|
||||
;;
|
||||
|
||||
"terminology")
|
||||
termfont="$(strings ${XDG_CONFIG_HOME}/terminology/config/standard/base.cfg | grep -B1 font.name | head -1)"
|
||||
termfont="${termfont/.pcf}"
|
||||
termfont="${termfont/:*}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user