Skip to content

Emojis in PS1 based on a schedule, sometimes animated

License

Notifications You must be signed in to change notification settings

bigomega/emoji-ps1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Emoji Command Prompt 💻

Kapture 2021-08-30 at 20 10 05

Table of Contents

📦 Installation

# Clone the repo
git clone [email protected]:bigomega/emoji-ps1.git
cd emoji-ps1

cd-ing into the repo is inmportant because we'll be using $PWD

With OhMyZsh

This is written on top of the robbyrussell (default) theme.

# Link it to the custom themes folder
ln $PWD/emoji.js $HOME/.oh-my-zsh/custom/themes/emoji.js
ln $PWD/emoji.zsh-theme  $HOME/.oh-my-zsh/custom/themes/emoji.zsh-theme

Set the theme in ~/.zshrc file

ZSH_THEME="emoji"

Without OhMyZsh

For a simple version

# Prepending emoji to the current PS1
echo "\n#Emoji PS1\nPS1=\"\\\$(node $PWD/emoji.js) \"\$PS1" >> ~/.bashrc
source ~/.bashrc

For animations, copy the psanimate and psanimate_stop functions from the /emoji.zsh-theme file to ~/.bashrc

If you face issues with node, install/update node to the latest stable version. This was developed on v16.6.0

🥁 Features & Customization 🛠️

🗓️ Schedule

The emoji.js file contains the logic behind the what emoji to show and when. There's a Schedule for the emoji which you can/should change in JS here.

const timings = [
  // from, duration, emoji, highlight?, unstoppable?
  [0, 500, '🛌', true, true],
  [530, 200, getRandom(activity_list)],
  [800, 200, '🥪', true],
  [1300, 130, '🍛', true],
  ...

The highlight flag shows an arrow after the emoji Screenshot 2021-08-30 at 21 33 31 The unstoppable flag says that the scheduled emoji cannot be overridden by

You can/should edit these two lists as well depending your interests, likes and visually appealing emojis.

const fun_list = "👾,🍀,🥑,⛰️ ,🪂,🍺,👨🏻‍🌾,🐢,🐼,🐙,🐳,🐓,🪵 ,🍄,🔥,🌪 ,🍁,🐚,🌊,🍉,🥝,🍋".split(',')
const activity_list = '🎨,🦮,📚,✍️ ,🎸,🛹,🏃🏻‍♂️'.split(',')

🎮 Animation

All of these could be animated. You can start the animation with the command (bash function) psanimate <interval-in-seconds>, defaults to 1 second. Animate calls the emoji function in the given interval with a rotating SWITCH boolean. Kapture 2021-08-30 at 22 05 28

The following is dinner-time highighted emoji with psanimate .2 Kapture 2021-08-30 at 21 58 12

Animation runs as a background process, stores the pid in /tmp/psanimatepid-$$.

🦾 Automating animations

This is disabled by default since automated animations could be very much annoying. But you can enable it by setting the PS_AUTO_ANIMATE variable. The schedule and check-interval is in the function right below the variable. By default it checks every 30 minutes and animates during sleep time.

PS_AUTO_ANIMATE=1

✅ Finishing tasks

Certain activity emojis like food can be overridden (when it's over). This can be done with the command pstaskover. This sets the env variable PS_TASK_OVER and so an emoji from the fun_list is picked up after. Kapture 2021-09-03 at 12 29 52

The PS_TASK_OVER resets after an hour. It uses bash traps.

🍻 Contribution & Request

If you find this idea interesting or if you can imagine beautiful ideas, please send a PR or raise a request for it. Thanks 🙏

🎫 License

MIT © bigomega

About

Emojis in PS1 based on a schedule, sometimes animated

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published