xmonad / xmonad-contrib

Contributed modules for xmonad

Home Page:https://xmonad.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Throw warning or error when windowPrompt fails due to lack of font

PapuaHardyNet opened this issue · comments

Problem Description

import XMonad
import XMonad.Config.Desktop
import XMonad.Prompt
import XMonad.Prompt.Window
import XMonad.Util.EZConfig (additionalKeys)

myMod = mod4Mask

main =
  xmonad $
    desktopConfig
      { terminal = "st",
        modMask = myMod
      }
      `additionalKeys` [ ((myMod, xK_BackSpace), windowPrompt def Goto allWindows)
                       ]

Given the above config and the lack of the default prompt font, xmonad should throw an error or a warning either during recompile time or when pressing the keybind using windowPrompt to tell the user that the required font is missing. Silent failure should not occur.

A silent failure occurs.

Steps to Reproduce

Use the above config, but on a machine without bitmap fonts.

Configuration File

Provided above.

Checklist

  • I've read CONTRIBUTING.md

  • I tested my configuration

    • With xmonad version 0.15-188 (commit XXX if using git)
    • With xmonad-contrib version 0.16-170 (commit XXX if using git)

Probably nothing we can do during compile/recompile. Maybe we'd have a module to show runtime warnings, but there are a couple of questions: should it be configurable? is it "opt-in", or can other modules use it without the user explicitly turning it on?

It would probably still be good to catch the error and display a message, because people copy configs around and might not notice that they use e.g. SauceCodePro Nerd Font Mono or one of the other fancy fonts.

(I copied that from an actual config I tested locally, btw)

It would probably still be good to catch the error and display a message, because people copy configs around and might not notice that they use e.g. SauceCodePro Nerd Font Mono or one of the other fancy fonts.

I just saw that initCoreFont and initUtf8Font do have a fallback in case something goes wrong, just that didn't make its way to initXMF... What would be better in that case? Fall back to something like xft:monospace or really bring up xmessage yelling at the user that the font couldn't be found? I guess the conventional solution would be the former.

@PapuaHardyNet what would you, as a user, prefer?