uxterm 和 dwm 状态栏中的 Unicode 字符

uxterm 和 dwm 状态栏中的 Unicode 字符

我想在dwm的状态栏中显示汉字。更具体地说,我希望这些符号代表 dwm 中的不同标签。使用在线转换器,我发现我想要的符号的 unicode 表示形式是:

憤怒
unicode: 憤怒

将 unicode 字符直接放入 my 中config.h不起作用,它们甚至不会出现在vim.我的语言环境设置为ISO-8859-1,并且我正在使用 dwm 的 Liberation Mono 字体。

我该怎么做才能把这些符号放在那里?

编辑 按照 Mat 的说明并修补 dwm,修补命令挂起。跑步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, 

我可能错过了什么吗?

答案1

dwm我认为如果不修补它(并且添加额外的依赖项,特别是pango),您将无法获得 Unicode 支持。

如果这是您的选择,pango官方补丁列表中的补丁似乎有效,只需patch在 dwm 文件夹中运行命令,将补丁文件传递到标准输入:

$ tar xzf dwm-6.0.tar.gz 
$ cd dwm-6.0
$ patch -Np1 < ../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" };

第一项是À,第二项是您的两个符号,第三项是一些格鲁吉亚文字(因为我认为它看起来很酷)。

使用大字体时,结果是:

在状态栏标签中显示 unicode 字符

相关内容