I created scripts to return random sad and angry emojis for each command with an error result in the terminal, for both Windows PowerShell Core and Bash powerline:
$ERROR_EMOJI = "😖", "😵", "🥴", "😭", "😱", "😡", "🤬", "🙃", `
"🤔", "🙄", "🥺", "😫", "💀", "💩", "😰"
In this article I will show how you can use them.
⚠ DISCLAIMER: these scripts are meant to be useful to me. I can help with any questions, but I do not intend to maintain it or fix issues. Feel free to use and modify as you wish.
First follow the steps from the How To Install Powerline For Windows Terminal article. After this just edit your PowerShell profile %USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
adding the content of the follow file: powerline-mysegments/PowerShell/Microsoft.PowerShell_profile.ps1
Now close the current tab from Windows Terminal or open a new PowerShell Core tab to see your new terminal. Try to input some incorrect commands to test the random emojis:
Here I used an 👽 emoji to decorate my username. You can change this emoji by modifying the line 99
from powerline-mysegments/PowerShell/Microsoft.PowerShell_profile.ps1:
# my user name
{ " $env:USERNAME 🦄" }
In that same file I added some more custom segments that I found useful for my environment:
Each block script from:
[System.Collections.Generic.List[ScriptBlock]]$Prompt
will be a segment. Beginin on line 20
from powerline-mysegments/PowerShell/Microsoft.PowerShell_profile.ps1. So if you do not want to use any of these extra custom segments just remove the corresponding script block.
⚠ WARNING: if you are going to remove any script block but keep the script block from the random emojis segment you will have to fix the color index. Lines 70
, 77
, 78
, 84
, 90
, 91
. You will also have to adjust the colors set for each segment passed during the Set-PowerLinePrompt
line 110
First follow the steps from the How To Install Powerline For Bash article. After this follow the steps:
cd ~
git clone https://github.com/microhobby/powerline-mysegments
cd powerline-mysegments/Bash/segments
pip3 install --editable ./
To verify that the installation was successful, run the following command:
pip3 list
You will need to have the following entry in the list:
mysegments 0.0.1 /home/<your-user>/powerline-mysegments/Bash/segments
For this custom segments I am also using some colors and customized settings. To apply these settings, run the following commands:
powerline-daemon --replace
cd ~
cd powerline-mysegments/Bash
cp -r .config ~
After that the new style with the customized segments should already be displayed. Try to input some incorrect commands to test the random emojis::
Here I used a 🦄 emoji to decorate my username. You can change this emoji by modifying the line 68
from powerline-mysegments/Bash/segments/mysegments/custom.py:
return [{
'contents': "{} 👽".format(usr),
'highlight_groups': ['cool'],
}]
In the same mysegments
package I added some more custom segments that I found useful for my environment:
The segments to be used are set in the file powerline-mysegments/Bash/.config/powerline/themes/shell/default_leftonly.json. For example if you want to remove the Docker segment just edit the file and remove the block:
{
"function": "mysegments.custom.docker",
"priority": 10
},
Easy peasy 😁