Xorg
uxterm 和 dwm 狀態欄中的 Unicode 字元
我想在dwm的狀態欄中顯示漢字。更具體地說,我希望這些符號代表 dwm 中的不同標籤。使用線上轉換器,我發現我想要的符號的 unicode 表示是:
憤怒 unicode: 憤怒
將 unicode 字元直接放入 my
config.h
不起作用,它們甚至不會出現在vim
. 我的語言環境設置為ISO-8859-1
,我使用 Liberation Mono 字型作為 dwm。我該怎麼做才能把這些符號放在那裡?
編輯 按照 Mat 的說明和修補 dwm,patch 命令掛起。執行
strace
:[max@prometheus dwm-6.0]$ strace patch -Np1 ../dwm-pango/dwm-pango/dwm-6.0-pango.patch execve("/usr/bin/patch", ["patch", "-Np1", "../dwm-pango/dwm-pango/dwm-6.0-p"...], [/* 30 vars */]) = 0 brk(0) = 0x1d52000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc4713000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=92801, ...}) = 0 mmap(NULL, 92801, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9dc46fc000 close(3) = 0 open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\25\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1983446, ...}) = 0 mmap(NULL, 3804112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9dc4152000 mprotect(0x7f9dc42e9000, 2097152, PROT_NONE) = 0 mmap(0x7f9dc44e9000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x197000) = 0x7f9dc44e9000 mmap(0x7f9dc44ef000, 15312, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9dc44ef000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc46fb000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc46fa000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc46f9000 arch_prctl(ARCH_SET_FS, 0x7f9dc46fa700) = 0 mprotect(0x7f9dc44e9000, 16384, PROT_READ) = 0 mprotect(0x61a000, 4096, PROT_READ) = 0 mprotect(0x7f9dc4714000, 4096, PROT_READ) = 0 munmap(0x7f9dc46fc000, 92801) = 0 brk(0) = 0x1d52000 brk(0x1d75000) = 0x1d75000 getpid() = 10412 lstat("/tmp/po8GP02f", 0x7fffdc075210) = -1 ENOENT (No such file or directory) lstat("/tmp/pikSWXEs", 0x7fffdc075210) = -1 ENOENT (No such file or directory) lstat("/tmp/prB1wVgF", 0x7fffdc075210) = -1 ENOENT (No such file or directory) lstat("/tmp/pp27ATSR", 0x7fffdc075210) = -1 ENOENT (No such file or directory) rt_sigaction(SIGCHLD, {SIG_DFL, [CHLD], SA_RESTORER|SA_RESTART, 0x7f9dc4186cb0}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGHUP, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGHUP, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0 rt_sigaction(SIGPIPE, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGPIPE, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0 rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGTERM, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0 rt_sigaction(SIGXCPU, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGXCPU, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0 rt_sigaction(SIGXFSZ, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGXFSZ, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0 rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGINT, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0 fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 open("/tmp/pp27ATSR", O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3 fcntl(3, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE) fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc4712000 lseek(3, 0, SEEK_CUR) = 0 fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc4711000 read(0,
我會錯過什麼嗎?
我認為如果
dwm
不修補它(並添加額外的依賴項,特別是pango
),您將無法獲得 Unicode 支持。如果這是您的選擇,Arch 包
dwm-pango
似乎可以工作。(下載 tarball,解壓,然後用更新檔文件給你的 dwm 打更新檔——你不需要使用 Arch。更新檔應用在dwm-0.6
.)$ tar xzf dwm-6.0.tar.gz $ tar xzf dwm-pango.tar.gz $ cd dwm-6.0 $ patch -Np1 < ../dwm-pango/dwm-6.0-pango.patch
之後,您可以編輯配置文件並將 unicode 文字(
\u
後跟十六進制的 unicode 程式碼點)放在tags
字元串中。/* tagging */ static const char *tags[] = { "\u00c0", "\u61a4\u6012", "\u10e5\u10d0\u10e0", "4", "5", "6", "7", "8", "9" };
第一項是
À
,第二項是你的兩個符號,第三項是一些格魯吉亞文字(因為我覺得它看起來很酷)。使用大字型,這會導致: