Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Terminal Font Function #252

Merged
merged 36 commits into from
Jun 3, 2016
Merged

Terminal Font Function #252

merged 36 commits into from
Jun 3, 2016

Conversation

dylanaraps
Copy link
Owner

@dylanaraps dylanaraps commented May 16, 2016

This PR introduces two new functions,

term - Get the current terminal emulator.
termfont - Get the terminal font.

This closes #251.

TODO

  • Add termfont support for popular terminal emulators.

Regular Configs:

  • URxvt and Xterm
  • Termite
  • Xfce4-terminal
  • Terminal.app
  • Mintty

Profile Based Configs:

We need to figure out how to get the font on a per profile basis.

  • Gnome-terminal
  • Terminator
  • Konsole
  • iTerm2

No Configs:

Font support can't be added as these terminals are configured at compile time.

  • st

Issues

  • term doesn't work when run from inside a tmux session.
    • This is because the $PPID of tmux is systemd for some odd reason.
  • term doesn't work on Windows.
    • This is because CYGWIN's ps command is missing the -o flag.
    • This has been fixed with an ugly solution imo.

Testing this PR

To test this PR just checkout this branch and run neofetch with
neofetch --config off.

@Brottweiler
Copy link

Termite is in your list twice.

@dylanaraps
Copy link
Owner Author

Thanks, the 2nd termite was supposed to be iTerm2. :)

@iandrewt
Copy link
Contributor

Testing iTerm2 and Terminal.app now

@dylanaraps
Copy link
Owner Author

Font output won't work on them just yet but terminal detection should.

@iandrewt
Copy link
Contributor

Alright. What do you think will be needed for tmux support? I just set it up today :/

@dylanaraps
Copy link
Owner Author

The terminal detection works by finding the parent process id of the current shell.
The parent process of tmux sessions on my pc (Not sure about others) is set to
systemd instead of the shell or terminal emulator for some reason.

This might work on OS X and other systems however and I just pushed a commit
for you to test out.

@iandrewt
Copy link
Contributor

On iTerm2, it doesn't work at all, nothing is printed for Terminal Emulator

On Terminal.app, Terminal Emulator is login

@dylanaraps
Copy link
Owner Author

Is this inside or outside of tmux?

@iandrewt
Copy link
Contributor

Outside

@dylanaraps
Copy link
Owner Author

We can workaround the OS X detection, iTerm2 has an envar and I'm sure
there's something similar for terminal.app

@dylanaraps
Copy link
Owner Author

@iandrewt, what's the value of $TERM_PROGRAM on your OS X system?
(Do echo $TERM_PROGRAM from both terminal emulators).

@iandrewt
Copy link
Contributor

iTerm2 is iTerm.app, Terminal.app is Apple_Terminal. Added bonus, works in tmux.

@dylanaraps
Copy link
Owner Author

Sweet!

Once I'm at uni I'll add support for it.

@dylanaraps
Copy link
Owner Author

@iandrewt, can you test out the PR?

OS X terminal detection should work now.

@iandrewt
Copy link
Contributor

Working for me in iTerm2 (Terminal Emulator: iTerm2), Terminal.app (Terminal Emulator: Apple_Terminal), and Termite (obviously, Terminal Emulator: termite)

@dylanaraps
Copy link
Owner Author

Awesome!

Now we just need to add config file parsing for the OS X terminals.

@tudurom
Copy link
Contributor

tudurom commented May 20, 2016

Not every urxvt user has his colors in ~/.Xresources. For example, mine is in .xres/urxvt. You should parse the output of xrdb -query instead of .Xresources.

@dylanaraps
Copy link
Owner Author

That's a good idea, thanks.

@dylanaraps
Copy link
Owner Author

I want to get this merged soon, can anyone lurking here please test the PR
and let me know if you come across any issues?

Here's how you can test:

  1. git clone https://github.com/dylanaraps/neofetch
  2. cd neofetch
  3. git checkout term_font
  4. ./neofetch --config off

Thanks :)

@dawidd6
Copy link
Contributor

dawidd6 commented Jun 2, 2016

zrzut ekranu z 2016-06-02 10-45-05

Don't worrry about the logo ;)

@dylanaraps
Copy link
Owner Author

Weird that there's a - symbol on the end.

hm

@dylanaraps
Copy link
Owner Author

@dawidd6, the issue should be fixed now.

Please try it again when you have some time. :)

@dawidd6
Copy link
Contributor

dawidd6 commented Jun 2, 2016

Now it's just right 👍

@dylanaraps dylanaraps merged commit e2e0811 into master Jun 3, 2016
@dylanaraps dylanaraps deleted the term_font branch June 3, 2016 08:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terminal font
5 participants