Why are Font Awesome characters not rendered or replaced on my terminal shell? - font-awesome

I'm trying to customize my Ubuntus on both of my computers with i3-wm, polybar and zsh (with oh-my-zsh on it)
I have some issues on one of my computers I haven't on the other one, despite proceeding on the same way and using the same config files for both of them in order to have the same workspace on both of my devices.
On zsh, I'm using the powerlevel10k/powerlevel10k theme I installed on oh-my-zsh to have a more beautiful terminal.
The thing is that the shell is showing nice font-awesome icons like the branch icon when I'm on a git project, or the clock icon next to the displayed time, etc.
This working perfectly on my first computer, but not on the second one. The icons are not displayed, so my terminal is less attractive on it.
I have the same problem with polybar. Some icons are well rendered on one computer, while on the other one, they are not rendered. Sometimes, they're even replaced by strange Asian (I think it's from an Asian language but I'm not sure) characters.
I would like to know why I don't have the same result on both devices and how to fix it on computer 2.
Here is a summary of the used versions:
Ubuntu = 18.04 LTS
i3-wm = 4.18
Polybar = 3.4.0
zsh = 5.4.2
oh-my-zsh = Version unknown

You need to install a capable font and configure your terminal to use it. Since you are using powerlevel10k, it's a good idea to use the font that powerlevel10k recommends.
Meslo Nerd Font patched for Powerlevel10k
Gorgeous monospace font designed by Jim Lyles for Bitstream,
customized by the same for Apple, further customized by André Berg,
and finally patched by yours truly with customized scripts originally
developed by Ryan L McIntyre of Nerd Fonts. Contains all glyphs and
symbols that Powerlevel10k may need. Battle-tested in dozens of
different terminals on all major operating systems.
Automatic font installation
If you are using iTerm2 or Termux, p10k configure can install the
recommended font for you. Simply answer Yes when asked whether to
install Meslo Nerd Font.
If you are using a different terminal, proceed with manual font
installation. 👇
Manual font installation
Download these four ttf files:
MesloLGS NF Regular.ttf
MesloLGS NF Bold.ttf
MesloLGS NF Italic.ttf
MesloLGS NF Bold Italic.ttf
Double-click on each file and click "Install". This will make
MesloLGS NF font available to all applications on your system.
Configure your terminal to use this font:
iTerm2: Open iTerm2 → Preferences → Profiles → Text and set Font to MesloLGS NF. Alternatively, type p10k configure and answer Yes when asked whether to install Meslo Nerd Font.
Apple Terminal Open Terminal → Preferences → Profiles → Text, click Change under Font and select MesloLGS NF family.
Hyper: Open Hyper → Edit → Preferences and change the value of fontFamily under module.exports.config to MesloLGS NF.
Visual Studio Code: Open File → Preferences → Settings, enter terminal.integrated.fontFamily in the search box and set the value
to MesloLGS NF.
GNOME Terminal (the default Ubuntu terminal): Open Terminal → Preferences and click on the selected profile under Profiles. Check
Custom font under Text Appearance and select MesloLGS NF Regular.
Konsole: Open Settings → Edit Current Profile → Appearance, click Select Font and select MesloLGS NF Regular.
Tilix: Open Tilix → Preferences and click on the selected profile under Profiles. Check Custom font under Text Appearance
and select MesloLGS NF Regular.
Windows Console Host (the old thing): Click the icon in the top left corner, then Properties → Font and set Font to MesloLGS NF.
Windows Terminal (the new thing): Open Settings (Ctrl+,), search for fontFace and set value to MesloLGS NF for every
profile.
Termux: Type p10k configure and answer Yes when asked whether to install Meslo Nerd Font.
IMPORTANT: Run p10k configure after changing terminal font. The old ~/.p10k.zsh may work incorrectly with the new font.
Note: The content I've copied here can go out of date. To be safe, check the primary source.

Related

Set syntax for a specific file name in Sublime Text 2/3

I have a program that uses a file called user.cfg to get its user defined configuration settings. The odd thing is that they chose the syntax for this file to be Tcl (it's not odd that it is Tcl, it's odd they chose the .cfg extension instead of .tcl). So, when I open this file in Sublime Text, it doesn't know what syntax highlighting scheme to choose.
What I would like to do is set the syntax highlighting for user.cfg to Tcl, but not all .cfg files to Tcl.
I have seen this question which is very similar to mine, except in that case the special file name had no extension so Sublime Text knew to assign Ruby highlighting to only that one file. Unfortunately, I have an extension so the solution given there will not work for me.
Is there any known way to get Sublime Text base a highlighting scheme on the full filename?
Take a look at the ApplySyntax plugin.
The previous answer is completely true; however, I thought it would be better to have it here all in one place rather than going on another webpage to find the list of procedure to apply it
Sublime text 3
This is found here
Ensure Package Control is installed. Instructions are found here.
In Sublime Text, press Ctrl+Shift+P (Win, Linux) or Cmd+Shift+P (macOS) to bring up the quick panel and start typing Package Control: Install Package.
Select the command and it will show a list of installable plugins.
Start typing ApplySyntax; when you see it, select it.
Restart to be sure everything is loaded proper.
Enjoy!

Gnome 3 displays two icons for same app in dock

I have created my own .desktop file for an application (sublimetext) in gnome 3 (fedora 16) I have succeeded in that:
[Desktop Entry]
Version=1.0
Name=Sublime Text 2
Comment=Text Editor
Terminal=false
Exec=sublime
Icon=/home/asher/apps/SublimeText2/Icon.png
Type=Application
Categories=TextEditor;Tools;
X-Ayatana-Desktop-Shortcuts=NewWindow
[NewWindow Shortcut Group]
Name=New Window
Exec=sublime
I want to add it to my favorites so it's locked to the sidebar. I did that, as you can see in the first screenshot, where no windows are open. The problem is, when I then open the program, another icon displays in the dockbar. The second icon is where the windows for the program are listed. The windows are consolidated to one icon, as you can see in the third screenshoot with two windows open (only two icons, not three).
Is there a way to make the favorited icon be the same as the icon that shows when the app launches? Does it have to be done in the program, or is this something I can do through a gnome 3 config file?
there's nothing wrong with your system.
The duplicated launcher icons explained:
The different icons are different commandline options. Some context applications with call the associated *.desktop icon. The exec option of the icon will depend on how the application is called.
Some of the Icons you show in your image may be obvious because of the difference in the way they are named. You can see the difference in the way the app is called by right clicking and clicking on properties to see other differences.
Some of the *.desktop files have a %U argument, used so the application will accept arguments.
Some of the Launchers are different commands that are called differently and are named differently often by a symbolic link.
Some exampes from the list in you image are:
Name: Online Accounts
Command: unity-control-center credentials
Name: Online Accounts
Command: Online account credentials and settings
Name: Personal File Sharing
Command: gnome-file-share-properties
Name: Rhythmbox
Command: rhythmbox %U
Name: Rhythmbox
Command rhythmbox-client --select-source %U
Source: link

How to prevent Sublime Text 2 from opening that last open file / project when starting up

I am on Lion - and in the command line, when I open up my project using "subl ." in my project folder - it opens up the last project I had open before I quit Sublime.
I have the Max Preference "Restore windows when quitting" unchecked.
How to I prevent this behaviour? Is there a preference setting for this?
I think the behavior you want can be enabled by changing the hot_exit and remember_open_files settings. If you check out the "Global Settings - Default" preferences, there are some comments there describing these settings.
If you want to change them, you should override them in the "Global Settings - User" file to preserve your changes across updates.
If anyone is wondering how to do this in sublime text 3, copy and paste the following into settings - user:
"hot_exit": false,
"remember_open_files": false,
I could only get it to work by also setting "hot_exit": false in my preferences.
On Linux, I had an issue where I couldn't even start Sublime Text 3 because there were too many files open and it would hang before I got a chance to change the settings.
I did what Mike Wizowski suggested and edited my $HOME/.config/sublime-text-3/Packages/User/Preferences.sublime-settings to include those settings.
However, restarting Sublime Text after this did not seem to fix my problem because Sublime still opened all the files and folders.
I found that deleting the 2 ".sublime_session" files in $HOME/.config/sublime-text-3/Local/ made Sublime Text forget what the recently opened files/folders were, thus fixing my hanging text editor.

Using OS 9 resource fork fonts in CSS with #font-face

I have some old OS 9 fonts which contain the font data in the resource fork. When I try to link such a font in a #font-face and open up the HTML in a browser, the text still appears in the default font.
On searching around, I found that the font data can be copied to a regular ttf file using the rsrc attribute. So I ran the command cp <font>/rsrc <font>-attr.ttf and tried linking the new file in the #font-face. Again, the text showed up in the default font.
Another discussion on stackoverflow suggested binary printing and copying of the data using xattr -p <font> | xxd -r > <font>-xxd.ttx. Once again, linking this file failed to change the font.
Just to make sure that the HTML was correct, I linked a newer ttf font from the same directory and it worked correctly. Does anyone know if the old fonts can be used in #font-face, with or without any conversion. Thank you.
Font Suitcases can potentially hold 2 different kinds of fonts: bitmap fonts and TrueType fonts. Bitmap fonts would be 'NFNT' resources along with the necessary 'FOND' (font family information). On the other hand, TrueType fonts would be 'sfnt' resource entries along with the necessary 'FOND' (font family information). Normally, font suitcases that hold bitmap font data are only one half of the font; to be usable you need to have the additional PostScript Outline font files (these will have an LWFN icon).
Otherwise, the font suitcase can represent a TrueType font, which compared to a "PostScript Type 1 Font Suitcase", is truly self-contained.
To convert from a resource-file-based Mac TrueType font to a Windows TrueType font, you just need to extract the 'sfnt' resource entries).
Since Rosetta is no more, I'm without Resorcerer, so I've managed to whip up a barebones resource file editor.
https://markdouma.com/developer/ResourceFinagler.zip
I just added a few lines so that you can now select the individual 'sfnt' resources like shown in the image below, and drag them to the Finder to create the individual Windows TrueType fonts.
Since this is one of the first search results when searching how to handle Resource fork fonts on modern macOS systems here is a solution for batch converting a large group of font suitcases.
First we can group them all in a single directory taking advantage of the find command, because find doesn't see the resource fork and consider the file empty, we create a new directory in the user home and copy all the suitcases there:
mkdir ~/rsrc
find . -type f -empty -exec cp {} ~/rsrc/ \;
Then in mac we can use brew to install Fondu
brew install fondu
Finally we move to the directory with all the suitcases and run fondu on each file like this, the secret to get fondu to work is to make it read the resource fork by adding /../namedfork/rsrc at the end of the file, otherwise it fails.
cd ~/rsrc
find . -type f -empty -exec fondu -force {}/..namedfork/rsrc \;
When the command finishes you should have a folder with the new .ttf, .bdf and .pfb files.
You can delete the suitcase files from this directory running:
find . -type f -empty -delete
The font data in an old Mac OS font suitcase is not in TTF format -- copying the resource fork to a TTF file will give you Mac OS resource data in a file named "font.ttf", which isn't right. You'll need to use a tool like FontForge (free/open-source) to do the conversion.

Syntax highlighting when pasting into emails

Im in the situation that I often send small codesnippets and xml-snippets to coworkers and partners via my outlook.
Has anyone got a good idea or tool that I can use to have my pastes syntaxhighlighted before I paste them into an email.
I was thinking of an intermediate paste to "$fancytool" and then I would have something to copy that will htmlified so I can copy paste it into the "compose email" window.
Edit-More-info:
Im pasting from windows within a VMWare virtual Machine, it might be eclipse, xmlspy, logfiles and other programs
Even-more-info:
I've seen this link how to do it from Vim. Unfortunately it seldom from vim im copying Code, and my email machine hasnt got any vim. The vmware machines has gvim, but I was hoping for an easier way that pasting to vim, saving to file, opening in internetexplorer and then copy/paste
Late but I can give an answer that works.
You need 2 things
putty
access to some Unix server (With vim)
In putty options, Under window → selection , turn the check box on for
Paste in to clipboard in RTF as well as plain text.
Log on to the server using putty.
start vim by typing vim
Paste your text (for example XML ) in to vim.
enter command mode (of vim by pressing ESC) and type
:set syn=xml.
Syntax highlighting kicks in.
Copy the text using mouse and paste it into your email.
5 years too late, sorry, but I've a much simpler solution than the accepted answer.
Use this online tool: http://tohtml.com/
copy the preview from your browser window and just paste into Word or Outlook.
Vim (or GVim) will output your code as formatted HTML. Then as long as your email is using an HTML format you can copy and paste it in.
Just an update on this matter, if you're on Windows, you can install Notepad++ (which is one of the best windows editors anyway), it comes out of the box with a plugin for this: "Copy text with Syntax Highlighting", when you select some text and right click on it.
If you just want the Add-In here it is.
If you want to know how it is done, here is an article on how to write the Add-In.
Comment: svrist mentioned a code paste site with syntax highlighting. Try http://codepad.org/
(don't have enough mojo to comment yet)
This link led me to SciTE.
Looks like SciTE has a Copy to RTF feature:
Edit(vmware upgrade):
But it looks like I am pretty much lost when I use vmware because I cant transfer rtf clipboard items to the vmware host. And I cant install software on the vmware host.
Maybe a paste-site with syntax highlighting?
If you're on Windows, Visual Studio does this automatically. At least it does for me, using Visual Studio 2005 on XP and copy/pasting to both MS Word and Lotus Notes
HeidiSQL does this for sql queries, and the syntax highlighting choices they made are quite readable. However, this will only work for sql queries, not other code. I like Notepad++ for Windows-based systems, and here are some instructions for Notepad++. Several people mentioned VIM for unix/shell environment.
For gVim (Windows), I defined this function and a convenience mapping:
function! HlCopy() range
exec a:firstline.','.a:lastline.'TOhtml'
normal yG
q!
!start /min powershell "Get-Clipboard | Set-Clipboard -AsHtml"
redraw
endfun
vmap Y :call HlCopy()<CR>
How to use?
Enter visual mode with v or by selecting text with left mouse. Then copy the current selection as raw text with y or highlighted text with Y.
Pass range directly (without visual mode): :1,3call HlCopy().
If you are lazy like me, you can set additional options for TOhtml in that function. I have this in my vimrc:
function! HlCopy() range
let g:html_font = "Consolas"
let g:html_number_lines = 0
exec a:firstline.','.a:lastline.'TOhtml'
normal yG
q!
!start /min powershell "Get-Clipboard | Set-Clipboard -AsHtml"
redraw
endfun
vmap Y :call HlCopy()<CR>