1

I play a lot of Nethack and I suspect that I'm not alone in preferring a larger font for it than I normally use for my terminal. I tend to use 12 for normal terminal stuff (vim or whatever) and 16+ for Nethack. Normally I just change the font in my preferences but I'm getting the urge to automate this process. I want to create a script or an alias or something that will change the font size and launch nethack with a single command. Can it be done?

Edit:

OS: Debian DE: Xfce Shell: Bash

  • 1
    We cannot know if it can be done if we do not know details about what is being used. – Rui F Ribeiro Feb 27 at 10:42
  • Updated it with my distro, shell, and desktop environment. – some_guy632 Feb 27 at 19:48
3

It depends on the terminal emulator you are using.

For instance, xfce4-terminal stores its configuration in ${XDG_CONFIG_DIRS}/xfce4/terminal/terminalrc and ${XDG_CONFIG_DIRS}/xfce4/terminal/accels.scm. When starting a new instance, it also let you execute a given command with the -x/--execute and -e/--command options. With features like these it's easy to create a function/script to automatize what you want.

Example:

run-nano() {
  sed -Ei 's/^(FontName=Noto Mono )9$/\112/g' <config-file>
  nano
  sed -Ei 's/^(FontName=Noto Mono )12$/\19/g' <config-file>
}

Example

  • 1
    Works like a charm. I used an alias instead of a function but now I'm lauching nethack and increasing the font in one command. And I learned about sed! Thanks kind stranger. – some_guy632 Feb 28 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.