【问题标题】:Use unicode characters for Xmonad workspaces对 Xmonad 工作区使用 unicode 字符
【发布时间】:2020-03-14 22:23:12
【问题描述】:

我想为我在 Xmonad 中的工作区使用来自 Nerd Fonts 的 Unicode 字符。

myWorkspaces = ["1:", "2:", "3:", "4:", "5:", "6:ﱘ", "7:", "8:", "9:"]

供参考:

但是,我在编译时收到以下错误:

xmonad.hs:191:13: error:
    lexical error in string/character literal at character '\62057'
    |
191 |         ["1:", "2:", "3:", "4:", "5:", "6:ﱘ", "7:", "8:", "9:"]
    |             ^

Please check the file for errors.

Warning: Missing charsets in String to FontSet conversion 

有没有机会使用全套 nerd fonts unicode 字符?我看到其他人在 their config 中使用了 unicode 的子集。

【问题讨论】:

  • 源文件的编码是什么?您是否尝试过使用转义序列指定符号?
  • @max630,我正在使用file -i xmonad.hs: xmonad.hs: text/plain; charset=utf-8。转义序列是什么?

标签: haskell unicode xmonad


【解决方案1】:

我认为您遇到了GHC bug #5518。作为一种解决方法,请尝试使用转义语法(例如,"1:\62057""1:\xf269" 而不是 "1:")。

【讨论】:

  • 太棒了,谢谢。您可以补充一点,使用第二种方法并从 nerdfonts.com 提取十六进制值很容易
  • 也许值得注意的是,虽然这与错误 #5518 相关,但这种行为实际上并不是错误。 Haskell 标准和 GHC 要求字符串文字仅包含“图形”Unicode 字符(字母、标记、数字、标点符号、符号。和空格,对应于 Unicode 类别 L、M、N、P、S 和 Zs,并且不包括上述大多数字符(被指定为“私人使用”或类别 Co)。
  • @K.A.Buhr 我认为这仍然是一个错误,只是标准中的一个错误,而不是实现中的一个错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-10-05
  • 1970-01-01
相关资源
最近更新 更多