Giter Club home page Giter Club logo

pokemon-terminal's Introduction

Pokemon-Terminal

Build Status

Features

  • 719 unique Pokemon
  • Select Pokemon by name or by index number
  • Ability to change the Desktop Wallpaper & the Terminal background
  • Internal search system for finding Pokemon
  • Supports iTerm2, ConEmu, Terminology, Windows Terminal and Tilix terminal emulators
  • Supports Windows, MacOS, GNOME, Openbox (with feh), i3wm (with feh) and sway for desktops

Installation

Install Python 3.7 or higher:

Get a compatible terminal emulator:

You can then proceed with one of the following methods for installation:

pip

Linux users: Your distro might include pip in a different package than Python, make sure to have that installed.

Run pip3 install git+https://github.com/LazoCoder/Pokemon-Terminal.git.

If you want a system-wide install, run the command as superuser or administrator.

If you want a per-user install, append the --user flag.

You might want to add the following directories to your PATH on a per-user install, to be able to call pokemon and ichooseyou everywhere:

  • Linux and macOS: ~/.local/bin
  • Windows: (replace X by your Python minor version, for example, 8 for Python 3.8)
    • %AppData%\Python\Python3X\Scripts for a desktop installation of Python;
    • %LocalAppData%\Packages\PythonSoftwareFoundation.Python.3.X_qbz5n2kfra8p0\LocalCache\local-packages\Python3X\Scripts for a Microsoft Store installation of Python (note that there's two X here).

When the command completes, it's installed and ready to go!

npm

Obviously requires to have Node.js installed.

You can install in any (npm-supported) OS using npm install --global pokemon-terminal. That's it, you're done!

Make sure you also have Python installed, npm won't automagically do that for you.

Distutils

This doesn't works on Microsoft Store installations of Python.

You can clone or download this repo, and run python3 setup.py install at the root of the repo.

If you want a system-wide install, run the command as superuser or administrator.

If you want a per-user install, append the --user flag. Look at the pip directives to add a per-user install to your PATH.

Usage

usage: pokemon [-h] [-n NAME]
               [-r [{kanto,johto,hoenn,sinnoh,unova,kalos} [{kanto,johto,hoenn,sinnoh,unova,kalos} ...]]]
               [-l [0.xx]] [-d [0.xx]]
               [-t [{normal,fire,fighting,water,flying,grass,poison,electric,ground,psychic,rock,ice,bug,dragon,ghost,dark,steel,fairy} [{normal,fire,fighting,water,flying,grass,poison,electric,ground,psychic,rock,ice,bug,dragon,ghost,dark,steel,fairy} ...]]]
               [-ne] [-e] [-ss [X]] [-w] [-v] [-dr] [-c]
               [id]

Set a pokemon to the current terminal background or wallpaper

positional arguments:
  id                    Specify the wanted pokemon ID or the exact (case
                        insensitive) name

optional arguments:
  -h, --help            show this help message and exit
  -c, --clear           Clears the current pokemon from terminal background
                        and quits.

Filters:
  Arguments used to filter the list of pokemons with various conditions that
  then will be picked

  -n NAME, --name NAME  Filter by pokemon which name contains NAME
  -r [{kanto,johto,hoenn,sinnoh,unova,kalos} [{kanto,johto,hoenn,sinnoh,unova,kalos} ...]], --region [{kanto,johto,hoenn,sinnoh,unova,kalos} [{kanto,johto,hoenn,sinnoh,unova,kalos} ...]]
                        Filter the pokemons by region
  -l [0.xx], --light [0.xx]
                        Filter out the pokemons darker (lightness threshold
                        lower) then 0.xx (default is 0.7)
  -d [0.xx], --dark [0.xx]
                        Filter out the pokemons lighter (lightness threshold
                        higher) then 0.xx (default is 0.42)
  -t [{normal,fire,fighting,water,flying,grass,poison,electric,ground,psychic,rock,ice,bug,dragon,ghost,dark,steel,fairy} [{normal,fire,fighting,water,flying,grass,poison,electric,ground,psychic,rock,ice,bug,dragon,ghost,dark,steel,fairy} ...]], --type [{normal,fire,fighting,water,flying,grass,poison,electric,ground,psychic,rock,ice,bug,dragon,ghost,dark,steel,fairy} [{normal,fire,fighting,water,flying,grass,poison,electric,ground,psychic,rock,ice,bug,dragon,ghost,dark,steel,fairy} ...]]
                        Filter the pokemons by type.
  -ne, --no-extras      Excludes extra pokemons (from the extras folder)
  -e, --extras          Excludes all non-extra pokemons

Misc:
  -ss [X], --slideshow [X]
                        Instead of simply choosing a random pokemon from the
                        filtered list, starts a slideshow (with X minutes of
                        delay between pokemon) in the background with the
                        pokemon that matched the filters
  -w, --wallpaper       Changes the desktop wallpaper instead of the terminal
                        background
  -v, --verbose         Enables verbose output
  -dr, --dry-run        Implies -v and doesn't actually changes either
                        wallpaper or background after the pokemon has been
                        chosen

Not setting any filters will get a completely random pokemon

Example:

Tips, tricks and common issues

iTerm2 settings

I highly suggest making the font colors black and the terminal window transparent. Some of the images have both light and dark colours and so it can be difficult to see the text sometimes. Transparency resolves this issue. Since Pokemon-Terminal only changes the background, the transparency must be done manually:

  1. Navigate to iTerm2 > Preferences > Profiles > Window
  2. Set the transparency to about half way.
  3. Hit the "blur" checkbox.
  4. Set the blur to maximum.
  5. Optionally you can set the blending to maximum to adjust the colors to look like the samples provided.

The result should look like this:

ConEmu settings

  1. From the menu under the symbol at left of title bar, navigate to Settings > Main > Background
  2. Set Darkening to maximum (255).
  3. Set Placement to Stretch.
  4. Click Save Settings.
  5. Optionally you apply transparency under Features > Transparency.

Windows Terminal settings

You can, like in iTerm2, enable transparency. Simply press the down arrow in the tab bar and click settings. Once the JSON file opens, add the following settings under the defaults section:

"backgroundImageOpacity": 0.5,
"useAcrylic": true,
"acrylicOpacity": 0.0

The result should look like this:

Adding Custom Images

The folder pokemonterminal/Images/Extra is for adding custom images. You can manually add backgrounds to this folder and they will be visible to the program. Only JPG format is supported. To see a list of all the custom backgrounds type:

$ pokemon -e -dr

Alternatively, you can delete images from this folder and it will not break the program. These are some custom backgrounds:

Solutions for Common Issues

  • If you experience a line at the top of the terminal after changing the Pokemon, you can remove it by typing in the clear command or opening a new terminal.

  • If you are using Tilix and the terminal background is not changing, try adjusting the transparency in your profile settings.

  • If you are experiencing issues with Terminology and are running on Ubuntu, make sure that you have installed the latest version:

    $ sudo add-apt-repository ppa:niko2040/e19
    $ sudo apt-get update
    $ sudo apt install terminology

Saving

iTerm2

To save a background you will need to setup a startup command in the profile:

  1. Navigate to iTerm2 > Preferences > General
  2. Locate the field where it says Send text at start under Command.
  3. In that field type pokemon -n [pokemon name]. You can see an example in the image down below.
    • Alternatively you can also type pokemon for a random theme each time you open up a new terminal.
  4. You can leave out ; clear if you don't care about the line showing up at the top of the terminal.

ConEmu

After setting your desired pokemon, from the menu under the symbol at left of title bar, navigate to Settings > Main > Background and click Save Settings.

Terminology

Terminology already saves it automatically, just untick "temporary" in the settings after setting your desired Pokemon:

To show a random Pokemon each session:

  1. Open ~/.bashrc in your favorite text editor.
  2. Add the following lines to it:
    if [[ "$TERMINOLOGY" -eq "1" ]]; then
        pokemon
    fi

That will simply pick a completely random Pokemon each session, but the pokemon line is simply calling the app, so you can still filter with regions, darkness, and etc. like you normally would, or you can also reset to a preset Pokemon every time you start.

Notes & Credits

  • Nearly all of the Pokemon backgrounds were created by Teej.
  • Originally the images were about 100mb in total but ImageOptim was used to compress them down to about 17mb.
  • Since the images are compressed, some of them may have some mild (but negligible) compression artifacts.
  • Platforms:
    • Thanks to @samosaara for the Linux (GNOME and Terminology) port.
    • Thanks to @jimmyorourke for the Windows (ConEMU and wallpaper) port.
    • Thanks to @sylveon for the Windows slideshow functionality and maintaining the AUR package.
  • Terminal & wallpaper support:
  • Thanks to @DrMartinLutherXing for some bug fixes.
  • Thanks to @joanbono for the easy installation script in the readme.
  • Thanks to @BnMcG for the region specific randomize function.
  • Thanks to @therealklanni for adding the project to npm.
  • Thanks to @connordinho for enhancing the slideshow functionality.
  • Thanks to @cclauss for simplifying the code in the database class and the main class, as well as general code quality fixes.
  • Thanks to @Fiskie for implementing the adapter design pattern, piping commands and more.
  • Thanks to @marcobiedermann for better image compression.
  • Thanks to @kamil157 and @dosman711 for the randomized slideshow function.
  • Thanks to @Squirrels for adding Pokemon from the Unova and Kalos regions.
  • Thanks to @caedus75 for pip and reorganizing the files & folders.

pokemon-terminal's People

Contributors

bnmcg avatar caedumil avatar cclauss avatar connordinho avatar cullenlye avatar iamcarbonman avatar jimmyorourke avatar joanbono avatar kyle-seongwoo-jun avatar ls4154 avatar regenbogencode avatar samuelhnrq avatar squirrels avatar sylveon avatar therealklanni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pokemon-terminal's Issues

Getting the following error

/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5: bad interpreter: No such file or directory

osascript not found

On my linux system (elementary os), the run.sh file asks for osascript. It seems like osascript is not usable on linux based systems. Do you know an alternative or a workaround?

Not starting using terminology under arch linux

This project is amazing, and I would love to work with it. Unfortunately I can't make it work.
I installed Terminology and then the pokemon-terminal via the arch repository.

When I first run it I got the error message

$ pokemon mew       
This terminal emulator is not supported.

I looked into the source code and saw you are checking environment variables.
After setting TERMINOLOGY to 1 I get a new error message, but I couldn't find a way to fix it:

$ pokemon mew       
�}bt/home/jonas/gitDownload/Pokemon-Terminal/Images/Generation I - Kanto/151.jpg%  

I have the latest arch linux version and terminology is also up to date. I use the i3 window manager and the zsh, in case some of that is important.

Command to show current pokemon

I'm less familiar with the Pokemon in the more recent regions, and don't always recognize them right away from the image. Is there an easy way to tell which Pokemon is currently being featured?

[Feature Request] filter by color

Can we get something like a color parameter? I really really really love this project you have no idea. My xinitrc spawns a random Pokemon on my wallpaper every boot and my config.fish gives a random Pokemon to each terminal. Maybe it's just a phase but this never ceases to bring me joy. My eyes, however, do not appreciate the sudden burst of yellow Pikachu or white Arceus when they've adjusted to Giratina or Skuntank. At the very least, a parameter to specify "light" or "dark" would be greatly appreciated.

Selecting a theme fails on terminology

Hello.

I am trying to run the themes in terminology. When I run the command pokemon random-kanto I get the following errors on the terminal I have used to spawn terminology:

ERR<29944>:terminology media.c:1237 media_add() can not decode '/home/fotis/.Pokemon-Terminal/Images/Generation I - Kanto/139.png'
ERR<29944>:eo lib/eo/eo_ptr_indirection.x:275 _eo_obj_pointer_get() obj_id (nil) is not pointing to a valid object. Maybe it has already been freed.

with no obvious change to the theme inside terminology. Am I doing something wrong? I have installed the theme package through the officially described way in the readme and I am trying to run it on Terminology on Ubuntu 16.04, with terminology being installed from the distribution repositories.

Linux Port

What would be needed to re-do/change in order for a Linux port? How much is the current 'method' tied to iTerm2/macOSx? Is this an iTerm2 feature?

Because AFAIK, images on Linux terminals are a deadly sin, except maybe for terminology... So, what kind of work needs doing till I can add this to my rice 😃

ValueError: '=' alignment not allowed in string format specifier

I get this error when calling pokemon and a parameter:

Traceback (most recent call last):
File "/home/daaaavid/.Pokemon-Terminal/pokemon", line 246, in
single_argument_handler(argv[1].lower())
File "/home/daaaavid/.Pokemon-Terminal/pokemon", line 172, in single_argument_handler
db = Database()
File "/home/daaaavid/.Pokemon-Terminal/database.py", line 51, in init
self.__load_data()
File "/home/daaaavid/.Pokemon-Terminal/database.py", line 161, in __load_data
identifier = '{:03}'.format(identifier)
ValueError: '=' alignment not allowed in string format specifier


I even get this when calling the help parameter.

Remove Selected Pokemon

Is there a command to remove the theme? I know you can just open a new shell, but I didn't know if it was possible to have a way to set the selected pokemon to none.

Feature request: pokemon clear

Love it so far and already added to startup script. There are some times when I do need to be professional though, so a pokemon clear command to reset the terminal, or at least to set a black/white default, would be really nice.

Unexpected Identifier

When typing pokemon [any pokemon] I recieve the following:

/usr/local/lib/node_modules/pokemon-terminal/./Scripts/background.scpt:39:46: script error: Expected end of line but found identifier. (-2741)

script error: Expected end of line but found identifier. (-2741)

Hwy, Actually I was trying the pokemon terminal for the first time and I encountered with a issue on first run.

The error says

/usr/local/lib/node_modules/pokemon-terminal/./Scripts/background.scpt:39:46: script error: Expected end of line but found identifier. (-2741)

OS: macOS 10.12 Sierra
Python: 3.5.1
Terminal: iTerm2 3.0.15
Installation type: npm

Command tried: pokemon pikachu

Completions

It'd be neat if this had completion support so that you could do something like pokemon pik TAB which would complete to pokemon pikachu.

No such file or directory

I used npm to install but I cannot run the commands anywhere.

"env: python3: No such file or directory" is the error.

pokemon terminal not working

i use linux mint kde,so the console over here is konsole.
when i type commands " pokemon pikachu" over here
"Terminal emulator not supported" is been printed

color scheme?

I just use default scheme and it looks really bad
any recommendations for text color scheme?

Scripter could accept image_file_path instead of pokemon

Scripter and the adapter scripts could be generalized to accept image_file_path instead of pokemon objects.

  • scripter.change_terminal(pokemon) --> scripter.change_terminal(image_file_path)
  • scripter.change_wallpaper(pokemon) --> scripter.change_wallpaper(image_file_path)
  • similar changes in the adapter files

Currently these functions pass around pokemon instances and then at the end the call chain merely do pokemon.get_path(). Changing them to accept file paths and do the pokemon.get_path() higher up the call stack would reduce data movement, ease testing, and make scripter and friends easier to spin out into a separate project which could attract broader developer support for building and testing adapters.

When printing, use name.title() instead of name.capitalize()

#!/usr/bin/env python3

"""
 id  name        .title()    .capitalize()
 29  nidoran-f   Nidoran-F   Nidoran-f
 32  nidoran-m   Nidoran-M   Nidoran-m
 83  farfetch'd  Farfetch'D  Farfetch'd
122  mr.mime     Mr.Mime     Mr.mime
250  ho-oh       Ho-Oh       Ho-oh
474  porygon-z   Porygon-Z   Porygon-z
"""

import os

f'F-strings requires Python 3.6 of better'
DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'Data')


def print_a_pokemon(i, line):
    line = line.strip().split()
    name = line[0]
    if name.title() != name.capitalize():
        print(f'{i + 1:>3}  {name:<11} {name.title():<11} {name.capitalize()}')


print(' id  name        .title()    .capitalize()')
with open(os.path.join(DATA_DIR, 'pokemon.txt')) as in_file:
    for i, line in enumerate(in_file):
        print_a_pokemon(i, line)

Command engine rework

I was thinking on reworking the command engine. Not only because the actual one isn't optimal it will be a pain in the ass moving forward.

Quick recap here is how it works now if you don't type any commands it exits. If you type one or more it tries to match against one of the sub-command that does its own thing and quits. If it can't it tries to match a pokemon, if it can't errors and quit.

It works, but for more complex stuff like (already mentioned by @LazoCoder), filter chaining this is not good enough. So the new system I came up with is based on gnu-utils find(but maybe without the boolean operations(e.g.: -and, -or, -not), at least to start off):

  • Instead each sub-command doing a different thing they will filter part of the whole list, in order of appearance (I'm not sure here if order matter).
  • All sub-commands will become flags.
  • Implicit random, after filtering the pokemon list with the flags a random one from the filtered list is picked. Or maybe not, and they follow the national pokedex ordem but for me that would be a silly default
  • The pokemon name will be the only true argument, and is to filter the list by name, the trick here, is that I was thinking on using stuff like, nameStr.contains and well doing that with stuff like pikachu will filter the list down to a single element so in the end, same effect. I was thinking of also adding support to regexp here but this can be delayed to the future.
  • Some examples:
    1. pokemon -type grass will pick a random grass type pokemon and set the terminal background.
    2. pokemon -type dragon -light will pick a dragon pokemon that is also light colored and set the terminal background.
    3. pokemon pikachu will filter down the list to a single one, pikachu and set the terminal background
    4. pokemon -list -type grass -region jhoto will apply all the filters, but in the end it won't pick one of them and set the background, it will print the filtered pokemon list
    5. pokemon -wallpapper -slideshow 60 -type poison nid will make a random slideshow with one minute between each Nidoking and Nidoqueen with are basically all the pokemon that match that filter to the best of my knowledge.

Here's some pseudo-code on how more or less it would work in the new system

def set_pkmn(pokemon) {
    if wallpapper {
       setWallpapper(pokemon)
       return
    }
    setTermBg(pokemon)
}

def loadPkmnList(){
    finalList = []    
    filters = parseArgs(argv)
    for line in dblines {
        pokemon = Pokermon(stuff, read, from, database)
        matches = true
        for f in filters {
            matches = f.match(pokemon)
        }
        if matches {
            finalList.append(pokemon)
        }
    }
}

list = loadPkmnList()
if isPrint {
   print_list(list)
   sys.exit(0)
}
set_pokemon(random.choice(list))

So I was wanting some input from you guys, what are your thoughts before I start to get my hands dirty. That is of course if you guys accept the change.

Getting the following error

.Pokemon-Terminal/./Scripts/background.scpt:39:46: script error: Expected end of line but found identifier. (-2741)

That's the error when I do: pokemon [*****]

Color issues

Hi - can you please update the readme with your color setup? You went over the transparency/blurring, but how it looks is highly dependent on your colors.

Maybe export your colors and put them in the repository?

`pokemon ?` not working

According to the docs, it should be displaying what pokemon is in the terminal. Instead it changes the terminal background (to moltres?) and displays a menu.

Should Pokemon be a namedtuple, instead of a class?

import collections

Pokemon = collections.namedtuple('Pokemon', 'id name region path')

def is_extra(pokemon):
    return not pokemon.id

def as_str(pokemon):
    id = '{:03}'.format(pokemon.id) if pokemon.id else  '---'
    return '{} {name} at {path}'.format(id, **pokemon._asdict())

Should we stop supporting Python 3.5 and earlier?

Python 3.6 is the latest stable version of python. From December of 2016 brings many awesome feature like formatted strings, __init_subclass__ and many other great improvements, naturally since it's a newer version, but users of more 'conservative' distros might not have the version (even though is very safe to assume such distros would have an available upgrade given how popular and important python is noways. What I'm really asking is are you guys O.K increasing the minimum version to python 3.6

No shinies

There's should be a minimal chance for a shine pokemon, just a improve.

FileNotFoundError: [Errno 2] No such file or directory: '/Library/Frameworks/Python.framework/Versions/3.5/bin/./Data/pokemon.txt'

I'm getting a FileNotFoundError. Running on Python 3.5.

Traceback (most recent call last):
  File "/Users/35131/Projects/Pokemon-Terminal-master/pokemon", line 201, in <module>
    single_argument_handler(argv[1].lower())
  File "/Users/35131/Projects/Pokemon-Terminal-master/pokemon", line 143, in single_argument_handler
    db = Database()
  File "/Users/35131/Projects/Pokemon-Terminal-master/database.py", line 53, in __init__
    self.__load_data()
  File "/Users/35131/Projects/Pokemon-Terminal-master/database.py", line 174, in __load_data
    data_file = open(path, "r+")
FileNotFoundError: [Errno 2] No such file or directory: '/Library/Frameworks/Python.framework/Versions/3.5/bin/./Data/pokemon.txt'

Error

39:46: syntax error: Expected end of line but found identifier. (-2741)

I've looked at the solutions offered in #15, but .Pokemon-Terminal/./Scripts does not exist, and there is no __terminal_script function in scripter.py

Database file unnecessary lines?

Looking at the Pokemon database text file, the id's correspond to the line they are on, why bother with the id if it is also the line number?

Not working on Linux Mint 18.1 using Tilix

I installed via npm following the documentation. And I'm running python 3.5.2. When I run pokemon tauros for example in Tilix, nothing happens. It does indeed recognise the pokemon command but running it yields no result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.