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

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

1 Answer 1

4

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
  • 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. Feb 28, 2019 at 1:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .