Themizer
An easy and fast CLI app to change between custom themes in Unix-like systems
Installation
> pip install themizer # Install with pip
> themizer -v # Check if themizer has been installed correctly
Usage
Create a theme:
> themizer create foo
Apply a theme:
> themizer apply bar
Apply the last used theme:
When you not specify the theme to use themizer will try to use the last applied theme.
> themizer apply
Delete a theme:
> themizer delete baz
Note: you can use quotes for themes with spaces in its name. E.g.
themizer apply 'Space Plumber'
Creating a theme
If you create a theme and apply it directly it will raise this error:
[ ERROR ] The theme config body is empty
This happens because you should configure your theme manually, this little guide will help you in the process of create a new one.
Theme structure
All the themes are saved in ~/.config/themizer/themes/ by default, and the structure of a theme looks like this:
'theme-name/'
├── after-execute
├── before-execute
├── theme.config
└── ...
| Directory / File | Description |
|---|---|
theme.config |
Here is stored all info about the theme and the instructions to apply it, more info below. |
before-execute |
This file will be execute before Themizer actually moves the themes and applies it. Use its shebang to execute anything you want. |
after-execute |
The same as before-execute but after the theme is actually applied. |
Configuration of the theme
The theme.config is spliced in two parts, the header and the body.
The header:
The header stores optional information about the theme itself and the body what directories should move from the theme and where they should go. Looking like this:
[theme] # Header of the theme config
name = 'custom_name' # The default name is the name of the directory
clear_terminal = true # By default is false, if is true the theme will clear the terminal after applying the theme
The body:
The body is former for the relative path of the config to move theme-name/super-config and the destination ~/.config/super-app. Looking like this:
['foobar'] # Relative directory from the theme path
dest = '~/.config/super-app' # Absolute path (can use ~to refer the home path)
Example:
Directory structure:
foo-theme/
├── after-execute
├── before-execute
├── theme.config
├── fish/... # Some config for fish shell
└── htop/... # Some config for htop
Configuration file:
[theme]
name = 'Kanagawa Theme'
['fish']
dest = '~/.config/fish'
['htop/htop.config']
dest = '~/.htop'
When you run themizer apply 'Kanagawa Theme' themizer will execute before-script, copy foo-theme/fish/ to ~/.config/fish/, copy foo-theme/htop.config to ~/.htop and finally execute after-script.
Note: The subdirectory
themewill not work correctly as its name is used to refer the header of the configuration.'
Configuration
Your configuration directory is located by default in ~/.config/themizer/.
Custom config path
You can use your custom path for the config using --config:
> themizer --config /path/to/config/directory
Scripting
You can automatize all the things you can do with Themizer this way:
from themizer import App
theme_manager: App = App()
# You can also set a custom config path
from pathlib import Path
custom_theme_manager: App = App(Path('/your/custom/path/'))
The App class has this set of useful methods to interact with Themizer:
| Method | Description |
|---|---|
apply_theme(theme_name: str) |
Apply an existing theme. Leave theme_name None to try to use the last theme applied. Return the theme applied. |
create_theme(theme_name: str) |
Create a new theme. |
delete_theme(theme_name: str) |
Delete an existing theme. |
move_theme_config |
Only moves the directories indicated in the theme and not run the 'before' and 'after' scripts. |
run_before_script(theme_name: str) |
Run the 'before' script of the selected theme. |
run_after_script(theme_name: str) |
Run the 'after' script of the selected theme. |
get_theme_config(theme_name: str) |
Return all the config of the theme. |
get_theme_config_head(theme_name: str) |
Return the head of the config of the theme. |
get_theme_config_body(theme_name: str) |
Return the body of the config of the theme. |
get_themes_dict) |
Return a dict with the names of all themes and its internal object. |
set_last_theme_used(theme_name: str) |
Set the last theme to a custom one. |
get_last_theme_used) |
Return the last theme used by the user. |
get_clear_terminal(theme_name: str) |
Return if the theme selected should clear the terminal. |
Contributing
Feel free to report a bug or request a branch merge, I appreciate any contribution.
Author
Created with ❤️ by Kutu.
Metadata
Release files for themizer 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| themizer-1.1.2.tar.gz | 11.0 kB | Without provenance | Details for themizer-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| themizer-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for themizer-1.1.2-py3-none-any.whl |
Total release size: 22.6 kB
Release files / themizer-1.1.2.tar.gz
| Download URL | themizer-1.1.2.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ece1c05f967ea4fa43bbd1bb2683b0b0f000c381cf7cf5eeb49e8b4c7028f9c
|
|
BLAKE2b-256 checksum How to use checksums |
7c3ad344cbe1a86898bd2937ec1780db0138b64072fd66443ffca8f6cb53969b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.11.0 Darwin/22.1.0
|
Release files / themizer-1.1.2-py3-none-any.whl
| Download URL | themizer-1.1.2-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f4de4a23b82e8b04d9162196e1cc428c841ae5c075091de54d65d8c0fd3ae82
|
|
BLAKE2b-256 checksum How to use checksums |
d47d1d66d4c205433b160308e154b06984ffa5ea869dd2e6b167c09eec84052e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.11.0 Darwin/22.1.0
|
Security for themizer 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.