mirror of
https://gitlab.com/ceda_ei/wish
synced 2025-10-23 05:50:05 +02:00
Compare commits
22 Commits
config-fil
...
main
Author | SHA1 | Date | |
---|---|---|---|
940e0cf2d7 | |||
315fe0bab7 | |||
bbe08b8244 | |||
08530330c1 | |||
a17a04075a | |||
8851af744d | |||
2af949e7b6 | |||
e39e955046 | |||
c5ed5caaa6 | |||
07e406d3f1 | |||
58aefa063b | |||
7cb8857e5e | |||
869a754ede | |||
61ade4610c | |||
4b9c2b6982 | |||
cc5eefb197 | |||
de9e43365f | |||
11ad2e081f | |||
1db62a7be8 | |||
e05f37b5b9 | |||
c53939cdfe | |||
48ff98764d |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
config.gie
|
config.gie
|
||||||
|
site/
|
||||||
|
8
.readthedocs.yaml
Normal file
8
.readthedocs.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
version: 2
|
||||||
|
build:
|
||||||
|
os: ubuntu-22.04
|
||||||
|
tools:
|
||||||
|
python: "3.12"
|
||||||
|
|
||||||
|
mkdocs:
|
||||||
|
configuration: mkdocs.yml
|
106
README.md
106
README.md
@@ -1,25 +1,113 @@
|
|||||||
# Wish
|
# Wish
|
||||||
|
|
||||||
A customizable bash prompt.
|
A customizable, extensible, themable bash prompt.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
+ **Extensible**: Parts can be added using simple plugins.
|
||||||
|
+ **Themable**: Choose from an existing theme or create your own.
|
||||||
|
+ **Customizable**: The prompt can be customized via a simple config file.
|
||||||
|
+ **Right Prompt**: Allows for two prompts — one on left, one on right.
|
||||||
|
+ **Auto newline**: Automatically adds a newline if the last output doesn't end with one.
|
||||||
|
+ **Powerline support**: Supports powerline symbols in both prompts.
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
## One step Installation
|
## One step Installation
|
||||||
|
|
||||||
`curl https://gitlab.com/ceda_ei/wish/raw/master/install.sh | bash`
|
```sh
|
||||||
|
curl https://gitlab.com/ceda_ei/wish/raw/main/install.sh | bash
|
||||||
|
```
|
||||||
|
|
||||||
## Manual Installation
|
## Manual Installation
|
||||||
|
|
||||||
+ `cd ~/.config/`
|
+ `cd ~/.config/`
|
||||||
+ `git clone https://gitlab.com/ceda_ei/wish.git`
|
+ `git clone https://gitlab.com/ceda_ei/wish.git`
|
||||||
+ Add the following lines to ~/.bashrc
|
+ `cp wish/config.default.gie wish/config.gie`
|
||||||
|
|
||||||
```bash
|
|
||||||
WISH_PLUGINS=(exit_code_smiley bg_jobs date path newline vcs)
|
# Documentation
|
||||||
WISH_THEME=plain
|
|
||||||
source ~/.config/wish/wish.sh
|
[Check the wiki for details about customization and
|
||||||
|
plugins.](https://wish.readthedocs.io/)
|
||||||
|
|
||||||
|
# Customization
|
||||||
|
|
||||||
|
Customization of wish is done using a gINIe file (format specific to wish)
|
||||||
|
which is an extended INI config file. The default location for config file is
|
||||||
|
`~/.config/wish/config.gie`. The default config file is automatically copied
|
||||||
|
over. The location can be customized using `WISH_CONFIG_FILE` variable.
|
||||||
|
Multiple config files can be supplied as an array to `WISH_CONFIG_FILE`.
|
||||||
|
|
||||||
|
Comments start with a `#` or `;` and always exist on a line of their own.
|
||||||
|
|
||||||
|
Key value pairs are in the form of `key = value`. Keys cannot have whitespaces
|
||||||
|
or `=` in them. Values can have any character as part of them. Surrounding
|
||||||
|
spaces in values are stripped away. To keep surrounding spaces as a part of
|
||||||
|
the value. Although, keys are case-sensitive in gINIe, wish treats them case-
|
||||||
|
insensitively.
|
||||||
|
|
||||||
|
Block names are enclosed in `[]` (e.g. `[core]`). Block names are case
|
||||||
|
sensitive. All key value pairs after a block starts and before the next block
|
||||||
|
begins are considered a part of that block. All key value pairs must be in a
|
||||||
|
block.
|
||||||
|
|
||||||
|
Available Blocks:
|
||||||
|
|
||||||
|
+ `core`: Core block configures Wish itself. Available keys are:
|
||||||
|
- `auto_newline`: Automatically add a newline if last line of output
|
||||||
|
doesn't end in newline. (0 to disable, 1 to enable)
|
||||||
|
- `theme`: Wish theme.
|
||||||
|
- `powerline`: Enable / Disable powerline. (0 to disable, 1 to enable)
|
||||||
|
+ `plugin`: Adds a plugin to the section the block is added to. All config for
|
||||||
|
that plugin goes there. Check wiki for details on available keys for
|
||||||
|
plugins. The key "name" defines the plugin to use. Plugin blocks
|
||||||
|
outside a section are ignored.
|
||||||
|
|
||||||
|
Section names are enclosed in `||` (e.g. `|left|`). All blocks after a section
|
||||||
|
starts and before the next section begins are considered a part of that
|
||||||
|
section. Blocks don't necessarily need to be in a section.
|
||||||
|
|
||||||
|
Available sections are `left`, `right` for left prompt and right prompt
|
||||||
|
respectively.
|
||||||
|
|
||||||
|
Sample config file
|
||||||
|
|
||||||
|
```
|
||||||
|
[core]
|
||||||
|
auto_newline = 1
|
||||||
|
powerline = 1
|
||||||
|
theme = rgb_gradient
|
||||||
|
|
||||||
|
|left|
|
||||||
|
[plugin]
|
||||||
|
name = path_powerline
|
||||||
|
max_perc = 50
|
||||||
|
|
||||||
|
[plugin]
|
||||||
|
name = python_venv
|
||||||
|
|
||||||
|
[plugin]
|
||||||
|
name = newline
|
||||||
|
|
||||||
|
[plugin]
|
||||||
|
name = custom_text
|
||||||
|
text = ' λ '
|
||||||
|
|
||||||
|
[plugin]
|
||||||
|
name = space
|
||||||
|
|
||||||
|
|right|
|
||||||
|
[plugin]
|
||||||
|
name = date
|
||||||
|
format = %a %b %H:%M
|
||||||
|
|
||||||
|
[plugin]
|
||||||
|
name = hostname
|
||||||
```
|
```
|
||||||
|
|
||||||
# Wiki
|
Which results in the following prompt
|
||||||
|
|
||||||
[Check the wiki for details about customization and plugins.](https://gitlab.com/ceda_ei/wish/wikis/home)
|

|
||||||
|
3
docs/Customization.md
Normal file
3
docs/Customization.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Customization
|
||||||
|
|
||||||
|
TODO
|
17
docs/Installation.md
Normal file
17
docs/Installation.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Installation
|
||||||
|
|
||||||
|
## One step Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl https://gitlab.com/ceda_ei/wish/raw/main/install.sh | bash
|
||||||
|
```
|
||||||
|
|
||||||
|
## Manual Installation
|
||||||
|
|
||||||
|
+ `cd ~/.config/`
|
||||||
|
+ `git clone https://gitlab.com/ceda_ei/wish.git`
|
||||||
|
+ `cp wish/config.default.gie wish/config.gie`
|
||||||
|
|
||||||
|
## Customization
|
||||||
|
|
||||||
|
Head over to [Customization](Customization.md)
|
3
docs/Themes.md
Normal file
3
docs/Themes.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Themes
|
||||||
|
|
||||||
|
TODO
|
3
docs/development/creating_plugins.md
Normal file
3
docs/development/creating_plugins.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Creating Plugins
|
||||||
|
|
||||||
|
TODO
|
13
docs/development/creating_themes.md
Normal file
13
docs/development/creating_themes.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Creating Themes
|
||||||
|
|
||||||
|
Themes need to define the following variables.
|
||||||
|
|
||||||
|
+ `WISH_DEFAULT_FG`
|
||||||
|
+ `WISH_DEFAULT_BG`
|
||||||
|
|
||||||
|
Plugins will fallback to these variables if they are not themed.
|
||||||
|
|
||||||
|
Themes also need to define variables for plugins. For each plugin named `abc`,
|
||||||
|
the theme needs to define `WISH_ABC_BG` and `WISH_ABC_FG`. Themes can
|
||||||
|
optionally iterate over `WISH_PLUGINS` array to ensure to theme all elements.
|
||||||
|
Check existing [themes](https://gitlab.com/ceda_ei/wish/tree/main/themes).
|
15
docs/index.md
Normal file
15
docs/index.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Wish
|
||||||
|
|
||||||
|
A customizable bash prompt.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Extremely configurable: Wish is configured by a single gINIe file
|
||||||
|
- Easy to switch themes: Switching themes is as simple as changing a single line.
|
||||||
|
- Easy custom themes: Users can override colors for plugins.
|
||||||
|
- Responsive: Adapts to terminal width.
|
||||||
|
- Easy to create plugins: Plugins are written in bash allowing great flexibility to extend.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Head over to [Installation](Installation.md)
|
18
docs/plugins/battery.md
Normal file
18
docs/plugins/battery.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Battery
|
||||||
|
|
||||||
|
Shows the amount of charge in the battery and if it is charging/discharging.
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = battery
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
| Key | Meaning | Default |
|
||||||
|
|-------------|------------------------------------------|---------|
|
||||||
|
| id | ID of Battery to check. | BAT0 |
|
||||||
|
| charging | Symbol while the battery is charging. | ϟ |
|
||||||
|
| discharging | Symbol while the battery is discharging. | ⏚ |
|
15
docs/plugins/bgjobs.md
Normal file
15
docs/plugins/bgjobs.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Background Jobs
|
||||||
|
|
||||||
|
Shows the number of background jobs running
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = bg_jobs
|
||||||
|
```
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
| Key | Meaning | Default |
|
||||||
|
|--------|---------------------------------------------|---------|
|
||||||
|
| suffix | Suffix to add to number of background jobs. | & |
|
17
docs/plugins/customtext.md
Normal file
17
docs/plugins/customtext.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Custom Text
|
||||||
|
|
||||||
|
Display the provided custom text in the prompt.
|
||||||
|
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = custom_text
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
| Key | Meaning | Default |
|
||||||
|
|------|----------------------|:-------:|
|
||||||
|
| text | Custom text to show. | - |
|
16
docs/plugins/date.md
Normal file
16
docs/plugins/date.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Date
|
||||||
|
|
||||||
|
Shows the current date and time.
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = date
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
| Key | Meaning | Default |
|
||||||
|
|--------|---------------------------------------------------------------------------------|---------|
|
||||||
|
| format | set the date format. Refer to `FORMAT` section of `man date` for more details. | %F %T |
|
15
docs/plugins/exitcode.md
Normal file
15
docs/plugins/exitcode.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Exit Code
|
||||||
|
|
||||||
|
Shows the exit code of the last command if it is non-zero.
|
||||||
|
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = exit_code
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
No plugin specific config options are available.
|
19
docs/plugins/exitcodesmiley.md
Normal file
19
docs/plugins/exitcodesmiley.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Exit Code Smiley
|
||||||
|
|
||||||
|
Shows a happy/sad smiley face based on whether the last command ran successfully or not.
|
||||||
|
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = exit_code_smiley
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
| Key | Meaning | Default |
|
||||||
|
|--------------|--------------------------------------------------------------|---------|
|
||||||
|
| pass | Text to show when the last command ran successfully. | :) |
|
||||||
|
| fail | Text to show when the last command failed. | :( |
|
||||||
|
| hide_on_pass | Whether to hide the output if command executes successfully. | 0 |
|
14
docs/plugins/hostname.md
Normal file
14
docs/plugins/hostname.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Hostname
|
||||||
|
|
||||||
|
Shows the current system's hostname.
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = hostname
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
No plugin specific config options are available.
|
14
docs/plugins/newline.md
Normal file
14
docs/plugins/newline.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Newline
|
||||||
|
|
||||||
|
Adds a newline to prompt to push the next plugins into next line.
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = newline
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
No plugin specific config options are available.
|
17
docs/plugins/path.md
Normal file
17
docs/plugins/path.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Path
|
||||||
|
|
||||||
|
Shows the current path and whether it is writeable.
|
||||||
|
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = path
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
| Key | Meaning | Default |
|
||||||
|
|-----------------|----------------------------------------------|---------|
|
||||||
|
| no_write_suffix | Suffix if the current path is not writeable. | |
|
28
docs/plugins/path_powerline.md
Normal file
28
docs/plugins/path_powerline.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Path Powerline
|
||||||
|
|
||||||
|
Shows the current path and whether it is writeable.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Powerline symbols used as path separators.
|
||||||
|
- Long paths are shrunk down to allow for more space for other plugins.
|
||||||
|
- e.g. `/usr/lib/systemd/system/` might get shortened to one of the
|
||||||
|
following based on config + screen width: `/u/l/s/system`,
|
||||||
|
`/u/l/systemd/system` or `/u/lib/systemd/system`
|
||||||
|
- This is configurable and disabled by default (check `max_perc` config)
|
||||||
|
- Recommended value for `max_perc` is `50`
|
||||||
|
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = path
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
| Key | Meaning | Default |
|
||||||
|
|-----------------|--------------------------------------------------------------|--------------|
|
||||||
|
| no_write_suffix | Suffix if the current path is not writeable. | |
|
||||||
|
| max_perc | Maximum percentage of screen width path should take. (0-100) | 0 (disabled) |
|
14
docs/plugins/pythonvenv.md
Normal file
14
docs/plugins/pythonvenv.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Python Virtualenv
|
||||||
|
|
||||||
|
Shows the currently active virtualenv. If the venv is `.venv`, it shows the parent directory's name.
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = python_venv
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
No plugin specific config options are available.
|
18
docs/plugins/reinit.md
Normal file
18
docs/plugins/reinit.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Re-Init
|
||||||
|
|
||||||
|
Re-initialize wish from config every time the prompt is redrawn. This plugin is
|
||||||
|
primarily intended for playing around with config and should ideally be removed
|
||||||
|
after that.
|
||||||
|
|
||||||
|
> Note: Add this plugin as the first plugin in `left` prompt.
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = reinit
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
No plugin specific config options are available.
|
14
docs/plugins/space.md
Normal file
14
docs/plugins/space.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Space
|
||||||
|
|
||||||
|
Simple plugin that adds an empty space.
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = space
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
No plugin specific config options are available.
|
14
docs/plugins/tmux.md
Normal file
14
docs/plugins/tmux.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Tmux Detached Sessions
|
||||||
|
|
||||||
|
Lists the number of tmux sessions that are detached.
|
||||||
|
|
||||||
|
### Add to wish
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = vcs
|
||||||
|
```
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
| Key | Meaning | Default |
|
||||||
|
|--------|--------------------------------------------------|---------|
|
||||||
|
| suffix | suffix to add after number of detached sessions. | d |
|
14
docs/plugins/username.md
Normal file
14
docs/plugins/username.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Username
|
||||||
|
|
||||||
|
Shows the current unix username
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = username
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
No plugin specific config options are available.
|
24
docs/plugins/vcs.md
Normal file
24
docs/plugins/vcs.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Version Control System (Git)
|
||||||
|
|
||||||
|
Provides the state of the git repository in the current directory.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Notifies if there are any untracked symbols
|
||||||
|
- Name of the current branch
|
||||||
|
- Amount of changes (additions/subtractions)
|
||||||
|
|
||||||
|
## Add to wish
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[plugin]
|
||||||
|
name = vcs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config options
|
||||||
|
|
||||||
|
| Key | Meaning | Default |
|
||||||
|
|----------------------|-----------------------------------------------------------------|---------|
|
||||||
|
| git_symbol | Symbol to indicate that the current directory is a git repo. | |
|
||||||
|
| default | Symbol to display when the current directory is not a git repo. | $ |
|
||||||
|
| git_untracked_symbol | Symbol to show if the current git repo has untracked files. | ● |
|
42
docs/reference/gINIe.md
Normal file
42
docs/reference/gINIe.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# gINIe file format
|
||||||
|
|
||||||
|
|
||||||
|
Customization of wish is done using a gINIe file (format specific to wish)
|
||||||
|
which is an extended INI config file. The default location for config file is
|
||||||
|
`~/.config/wish/config.gie`. The default config file is automatically copied
|
||||||
|
over. The location can be customized using `WISH_CONFIG_FILE` variable.
|
||||||
|
Multiple config files can be supplied as an array to `WISH_CONFIG_FILE`.
|
||||||
|
|
||||||
|
Comments start with a `#` or `;` and always exist on a line of their own.
|
||||||
|
|
||||||
|
Key value pairs are in the form of `key = value`. Keys cannot have whitespaces
|
||||||
|
or `=` in them. Values can have any character as part of them. Surrounding
|
||||||
|
spaces in values are stripped away. To keep surrounding spaces as a part of
|
||||||
|
the value. Although, keys are case-sensitive in gINIe, wish treats them case-
|
||||||
|
insensitively.
|
||||||
|
|
||||||
|
Block names are enclosed in `[]` (e.g. `[core]`). Block names are case
|
||||||
|
sensitive. All key value pairs after a block starts and before the next block
|
||||||
|
begins are considered a part of that block. All key value pairs must be in a
|
||||||
|
block.
|
||||||
|
|
||||||
|
Available Blocks:
|
||||||
|
|
||||||
|
+ `core`: Core block configures Wish itself. Available keys are:
|
||||||
|
- `auto_newline`: Automatically add a newline if last line of output
|
||||||
|
doesn't end in newline. (0 to disable, 1 to enable)
|
||||||
|
- `theme`: Wish theme.
|
||||||
|
- `powerline`: Enable / Disable powerline. (0 to disable, 1 to enable)
|
||||||
|
+ `plugin`: Adds a plugin to the section the block is added to. All config for
|
||||||
|
that plugin goes there. Check wiki for details on available keys for
|
||||||
|
plugins. The key "name" defines the plugin to use. Plugin blocks
|
||||||
|
outside a section are ignored.
|
||||||
|
|
||||||
|
Section names are enclosed in `||` (e.g. `|left|`). All blocks after a section
|
||||||
|
starts and before the next section begins are considered a part of that
|
||||||
|
section. Blocks don't necessarily need to be in a section.
|
||||||
|
|
||||||
|
Available sections are `left`, `right` for left prompt and right prompt
|
||||||
|
respectively.
|
||||||
|
|
||||||
|
|
@@ -3,12 +3,8 @@
|
|||||||
if hash git; then
|
if hash git; then
|
||||||
git clone https://gitlab.com/ceda_ei/Wish.git $HOME/.config/wish
|
git clone https://gitlab.com/ceda_ei/Wish.git $HOME/.config/wish
|
||||||
else
|
else
|
||||||
curl https://gitlab.com/ceda_ei/wish/-/archive/master/wish-master.tar -o /tmp/wish.tar
|
echo 'Git not found. Please install git.' >&2
|
||||||
mkdir $HOME/.config 2> /dev/null
|
exit 1
|
||||||
cd /tmp/
|
|
||||||
tar xf wish.tar
|
|
||||||
mv wish-master/ wish/
|
|
||||||
mv wish/ $HOME/.config/
|
|
||||||
fi
|
fi
|
||||||
cp $HOME/.config/wish/config.default.gie $HOME/.config/wish/config.gie
|
cp $HOME/.config/wish/config.default.gie $HOME/.config/wish/config.gie
|
||||||
|
|
||||||
|
37
mkdocs.yml
Normal file
37
mkdocs.yml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
site_name: Wish
|
||||||
|
repo_url: https://gitlab.com/ceda_ei/wish
|
||||||
|
edit_uri: edit/main/docs/
|
||||||
|
|
||||||
|
theme: readthedocs
|
||||||
|
markdown_extensions:
|
||||||
|
- toc:
|
||||||
|
permalink: true
|
||||||
|
|
||||||
|
|
||||||
|
nav:
|
||||||
|
- index.md
|
||||||
|
- Installation.md
|
||||||
|
- Customization.md
|
||||||
|
- Themes.md
|
||||||
|
- plugins:
|
||||||
|
- plugins/battery.md
|
||||||
|
- plugins/bgjobs.md
|
||||||
|
- plugins/customtext.md
|
||||||
|
- plugins/date.md
|
||||||
|
- plugins/exitcode.md
|
||||||
|
- plugins/exitcodesmiley.md
|
||||||
|
- plugins/hostname.md
|
||||||
|
- plugins/newline.md
|
||||||
|
- plugins/path.md
|
||||||
|
- plugins/path_powerline.md
|
||||||
|
- plugins/pythonvenv.md
|
||||||
|
- plugins/reinit.md
|
||||||
|
- plugins/space.md
|
||||||
|
- plugins/tmux.md
|
||||||
|
- plugins/username.md
|
||||||
|
- plugins/vcs.md
|
||||||
|
- development:
|
||||||
|
- development/creating_plugins.md
|
||||||
|
- development/creating_themes.md
|
||||||
|
- reference:
|
||||||
|
- reference/gINIe.md
|
@@ -24,7 +24,7 @@ function wish_path_lensum() {
|
|||||||
function wish_path_powerline_shrink() {
|
function wish_path_powerline_shrink() {
|
||||||
local IFS='/'
|
local IFS='/'
|
||||||
local path=( $1 )
|
local path=( $1 )
|
||||||
local max=$2
|
local max=$(( $2 - 3 * ${#path[@]} ))
|
||||||
for ((i=0; i <$((${#path[@]} - 1)); i++)); do
|
for ((i=0; i <$((${#path[@]} - 1)); i++)); do
|
||||||
path[$i]=${path[$i]:0:1}
|
path[$i]=${path[$i]:0:1}
|
||||||
if [[ $(wish_path_lensum ${path[@]}) -lt $max ]]; then
|
if [[ $(wish_path_lensum ${path[@]}) -lt $max ]]; then
|
||||||
|
@@ -13,7 +13,7 @@ function wish_python_venv_set_colors() {
|
|||||||
|
|
||||||
function wish_python_venv_main() {
|
function wish_python_venv_main() {
|
||||||
if [[ -v VIRTUAL_ENV ]]; then
|
if [[ -v VIRTUAL_ENV ]]; then
|
||||||
local venv=$(echo $VIRTUAL_ENV | sed 's|.*/||')
|
local venv=$(echo $VIRTUAL_ENV | sed ';s|/.venv$||;s|.*/||')
|
||||||
wish_append $WISH_PYTHON_VENV_BG $WISH_PYTHON_VENV_FG " $venv "
|
wish_append $WISH_PYTHON_VENV_BG $WISH_PYTHON_VENV_FG " $venv "
|
||||||
else
|
else
|
||||||
wish_append $WISH_PYTHON_VENV_BG $WISH_PYTHON_VENV_FG ""
|
wish_append $WISH_PYTHON_VENV_BG $WISH_PYTHON_VENV_FG ""
|
||||||
|
15
plugins/reinit.sh
Normal file
15
plugins/reinit.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
function wish_reinit_start() {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function wish_reinit_end() {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function wish_reinit_set_colors() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
function wish_reinit_main() {
|
||||||
|
wish_init
|
||||||
|
}
|
@@ -10,7 +10,7 @@ function wish_vcs_set_colors() {
|
|||||||
WISH_VCS_FG=${WISH_VCS_FG:-$WISH_DEFAULT_FG}
|
WISH_VCS_FG=${WISH_VCS_FG:-$WISH_DEFAULT_FG}
|
||||||
WISH_VCS_BG=${WISH_VCS_BG:-$WISH_DEFAULT_BG}
|
WISH_VCS_BG=${WISH_VCS_BG:-$WISH_DEFAULT_BG}
|
||||||
WISH_VCS_GIT_SYMBOL=${WISH_VCS_GIT:-}
|
WISH_VCS_GIT_SYMBOL=${WISH_VCS_GIT:-}
|
||||||
WISH_VCS_DEFAULT=${WISH_VCS_DEFAULT:-$}
|
[[ -v WISH_VCS_DEFAULT ]] || WISH_VCS_DEFAULT="$"
|
||||||
WISH_VCS_GIT_UNTRACKED_SYMBOL=${WISH_VCS_GIT_UNTRACKED_SYMBOL:-●}
|
WISH_VCS_GIT_UNTRACKED_SYMBOL=${WISH_VCS_GIT_UNTRACKED_SYMBOL:-●}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ function wish_vcs_main() {
|
|||||||
fi
|
fi
|
||||||
wish_append $WISH_VCS_BG $WISH_VCS_FG "$git"
|
wish_append $WISH_VCS_BG $WISH_VCS_FG "$git"
|
||||||
else
|
else
|
||||||
wish_append $WISH_VCS_BG $WISH_VCS_FG " $WISH_VCS_DEFAULT "
|
wish_append $WISH_VCS_BG $WISH_VCS_FG "$WISH_VCS_DEFAULT"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
themes/icy_candy.sh
Normal file
32
themes/icy_candy.sh
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function wish_icy_candy_theme {
|
||||||
|
local i
|
||||||
|
local l_gradient=(f5a9b8 f6b7c3 f8c5cf fad4db fbe2e7 fdf0f3 ffffff)
|
||||||
|
local r_gradient=(5bcefa 76d6fa 91defb ade6fc c8eefd e3f6fe ffffff)
|
||||||
|
local fg_gradient=(000000 000000 000000 000000 000000 000000 000000)
|
||||||
|
local j=0
|
||||||
|
for i in "${WISH_PLUGINS[@]}"; do
|
||||||
|
[[ $i =~ newline$ ]] && j=0 && continue
|
||||||
|
eval "WISH_${i^^}_FG=${fg_gradient[$j]}"
|
||||||
|
eval "WISH_${i^^}_BG=${l_gradient[$j]}"
|
||||||
|
((j++))
|
||||||
|
if [[ $j -eq ${#l_gradient[@]} ]]; then
|
||||||
|
j=0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
j=0
|
||||||
|
for ((idx=$((${#WISH_RIGHT_PLUGINS[@]} - 1)); idx >= 0; idx--)); do
|
||||||
|
i=${WISH_RIGHT_PLUGINS[$idx]}
|
||||||
|
[[ $i =~ newline$ ]] && j=0 && continue
|
||||||
|
eval "WISH_${i^^}_BG=${r_gradient[$j]}"
|
||||||
|
eval "WISH_${i^^}_FG=${fg_gradient[$j]}"
|
||||||
|
((j++))
|
||||||
|
if [[ $j -eq ${#r_gradient[@]} ]]; then
|
||||||
|
j=0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
wish_icy_candy_theme
|
31
themes/luminus.sh
Normal file
31
themes/luminus.sh
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function wish_luminous_theme {
|
||||||
|
local i
|
||||||
|
local gradient=(ef7126 f7894c fea16f ffb892 ffd0b5 ffe7da ffffff)
|
||||||
|
local fg_gradient=(000000 000000 000000 000000 000000 000000 000000)
|
||||||
|
local j=0
|
||||||
|
for i in "${WISH_PLUGINS[@]}"; do
|
||||||
|
[[ $i =~ newline$ ]] && j=0 && continue
|
||||||
|
eval "WISH_${i^^}_FG=${fg_gradient[$j]}"
|
||||||
|
eval "WISH_${i^^}_BG=${gradient[$j]}"
|
||||||
|
((j++))
|
||||||
|
if [[ $j -eq ${#gradient[@]} ]]; then
|
||||||
|
j=0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
j=0
|
||||||
|
for ((idx=$((${#WISH_RIGHT_PLUGINS[@]} - 1)); idx >= 0; idx--)); do
|
||||||
|
i=${WISH_RIGHT_PLUGINS[$idx]}
|
||||||
|
[[ $i =~ newline$ ]] && j=0 && continue
|
||||||
|
eval "WISH_${i^^}_BG=${gradient[$j]}"
|
||||||
|
eval "WISH_${i^^}_FG=${fg_gradient[$j]}"
|
||||||
|
((j++))
|
||||||
|
if [[ $j -eq ${#gradient[@]} ]]; then
|
||||||
|
j=0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
wish_luminous_theme
|
80
wish.sh
80
wish.sh
@@ -1,10 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
|
||||||
# INTERNAL USE ONLY! Do not use this in plugins.
|
# INTERNAL USE ONLY! Do not use this in plugins.
|
||||||
function wish_print_right_prompt() {
|
function wish_print_right_prompt() {
|
||||||
local idx=0
|
local idx=0
|
||||||
for i in ${WISH_RPL[@]}; do
|
for i in "${WISH_RPL[@]}"; do
|
||||||
echo "\e[$(($COLUMNS - $i + 1))G${WISH_RIGHT_PS1[$idx]}"
|
echo "\e[$((COLUMNS - i + 1))G${WISH_RIGHT_PS1[idx]}"
|
||||||
((idx++))
|
((idx++))
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -22,10 +23,14 @@ function wish_init() {
|
|||||||
# Source config files
|
# Source config files
|
||||||
for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
|
for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
|
||||||
if [[ -f "$path/wish/wish.py" ]]; then
|
if [[ -f "$path/wish/wish.py" ]]; then
|
||||||
source <($path/wish/wish.py ${WISH_CONFIG_FILE[@]})
|
source <("$path/wish/wish.py" "${WISH_CONFIG_FILE[@]}")
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Set defaults for core if not found
|
||||||
|
: "${WISH_POWERLINE_LEFT:=}"
|
||||||
|
: "${WISH_POWERLINE_RIGHT=}"
|
||||||
# Source all plugins
|
# Source all plugins
|
||||||
# If WISH_CONFIG_FILE is not set, then assume that the user hasn't updated
|
# If WISH_CONFIG_FILE is not set, then assume that the user hasn't updated
|
||||||
# to a config file yet. Set WISH_PLUGINS_SOURCE=WISH_PLUGINS.
|
# to a config file yet. Set WISH_PLUGINS_SOURCE=WISH_PLUGINS.
|
||||||
@@ -34,20 +39,20 @@ function wish_init() {
|
|||||||
fi
|
fi
|
||||||
local plugin
|
local plugin
|
||||||
local path
|
local path
|
||||||
for plugin in ${WISH_PLUGINS_SOURCE[@]}; do
|
for plugin in "${WISH_PLUGINS_SOURCE[@]}"; do
|
||||||
for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
|
if ! for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
|
||||||
source "$path/wish/plugins/$plugin.sh" &> /dev/null && break
|
source "$path/wish/plugins/$plugin.sh" &> /dev/null && break
|
||||||
done
|
done; then
|
||||||
[[ $? -ne 0 ]] && echo "Plugin $plugin not found." >&2
|
echo "Plugin $plugin not found." >&2
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Source theme
|
# Source theme
|
||||||
WISH_THEME=${WISH_THEME:-plain}
|
WISH_THEME=${WISH_THEME:-plain}
|
||||||
while :; do
|
while :; do
|
||||||
for theme in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
|
if for theme in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
|
||||||
source "$theme/wish/themes/$WISH_THEME.sh" &> /dev/null && break
|
source "$theme/wish/themes/$WISH_THEME.sh" &> /dev/null && break
|
||||||
done
|
done; then
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
echo "Theme $WISH_THEME not found. Using theme plain." >&2
|
echo "Theme $WISH_THEME not found. Using theme plain." >&2
|
||||||
@@ -60,8 +65,8 @@ function wish_init() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Call plugins to set colors
|
# Call plugins to set colors
|
||||||
for plugin in ${WISH_PLUGINS[@]} ${WISH_RIGHT_PLUGINS[@]}; do
|
for plugin in "${WISH_PLUGINS[@]}" "${WISH_RIGHT_PLUGINS[@]}"; do
|
||||||
eval wish_$(echo $plugin)_set_colors $prev
|
"wish_${plugin}_set_colors" "$prev"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,13 +84,13 @@ function color_to_escape_code() {
|
|||||||
if [[ $color == -1 ]]; then
|
if [[ $color == -1 ]]; then
|
||||||
echo "\[\033[0;5;0m\]"
|
echo "\[\033[0;5;0m\]"
|
||||||
else
|
else
|
||||||
if [[ ${#fg_code} -eq 6 ]]; then
|
if [[ ${#color} -eq 6 ]]; then
|
||||||
local r=$(( 16#${color:0:2} ))
|
local r=$(( 16#${color:0:2} ))
|
||||||
local g=$(( 16#${color:2:2} ))
|
local g=$(( 16#${color:2:2} ))
|
||||||
local b=$(( 16#${color:4:2} ))
|
local b=$(( 16#${color:4:2} ))
|
||||||
echo "\[\033[${choice}8;2;$r;$g;${b}m\]"
|
echo "\[\033[${choice}8;2;$r;$g;${b}m\]"
|
||||||
else
|
else
|
||||||
echo "\[\033[${choice}8;5;${fg_code}m\]"
|
echo "\[\033[${choice}8;5;${color}m\]"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -97,7 +102,7 @@ function wish_append_left() {
|
|||||||
local prompt_text="${text@P}"
|
local prompt_text="${text@P}"
|
||||||
if [[ $text == "\n" ]]; then
|
if [[ $text == "\n" ]]; then
|
||||||
((WISH_LPLINE++))
|
((WISH_LPLINE++))
|
||||||
WISH_LPL=(${WISH_LPL[@]} 0)
|
WISH_LPL=("${WISH_LPL[@]}" 0)
|
||||||
WISH_LEFT_PS1="$WISH_LEFT_PS1$colors$text"
|
WISH_LEFT_PS1="$WISH_LEFT_PS1$colors$text"
|
||||||
else
|
else
|
||||||
if [[ $((${WISH_LPL[$WISH_LPLINE]} + ${#prompt_text})) -lt $COLUMNS ]]; then
|
if [[ $((${WISH_LPL[$WISH_LPLINE]} + ${#prompt_text})) -lt $COLUMNS ]]; then
|
||||||
@@ -116,7 +121,7 @@ function wish_append_right() {
|
|||||||
if [[ $text == "\n" ]]; then
|
if [[ $text == "\n" ]]; then
|
||||||
((WISH_RPLINE++))
|
((WISH_RPLINE++))
|
||||||
WISH_RIGHT_PS1=("${WISH_RIGHT_PS1[@]}" "")
|
WISH_RIGHT_PS1=("${WISH_RIGHT_PS1[@]}" "")
|
||||||
WISH_RPL=(${WISH_RPL[@]} 0)
|
WISH_RPL=("${WISH_RPL[@]}" 0)
|
||||||
elif [[ $((${WISH_LPL[$WISH_RPLINE]} + ${WISH_RPL[$WISH_RPLINE]} + ${#prompt_text})) -lt $COLUMNS ]]; then
|
elif [[ $((${WISH_LPL[$WISH_RPLINE]} + ${WISH_RPL[$WISH_RPLINE]} + ${#prompt_text})) -lt $COLUMNS ]]; then
|
||||||
WISH_RIGHT_PS1[$WISH_RPLINE]="${WISH_RIGHT_PS1[$WISH_RPLINE]}$colors$text"
|
WISH_RIGHT_PS1[$WISH_RPLINE]="${WISH_RIGHT_PS1[$WISH_RPLINE]}$colors$text"
|
||||||
WISH_RPL[$WISH_RPLINE]=$((${WISH_RPL[$WISH_RPLINE]} + ${#prompt_text}))
|
WISH_RPL[$WISH_RPLINE]=$((${WISH_RPL[$WISH_RPLINE]} + ${#prompt_text}))
|
||||||
@@ -136,8 +141,10 @@ function wish_append() {
|
|||||||
local bg_code=$1
|
local bg_code=$1
|
||||||
local fg_code=$2
|
local fg_code=$2
|
||||||
local text=$3
|
local text=$3
|
||||||
local fg=$(color_to_escape_code 3 $fg_code)
|
local fg
|
||||||
local bg=$(color_to_escape_code 4 $bg_code)
|
local bg
|
||||||
|
fg=$(color_to_escape_code 3 "$fg_code")
|
||||||
|
bg=$(color_to_escape_code 4 "$bg_code")
|
||||||
|
|
||||||
if [[ $fg_code == -1 ]]; then
|
if [[ $fg_code == -1 ]]; then
|
||||||
case $WISH_STATE in
|
case $WISH_STATE in
|
||||||
@@ -167,9 +174,9 @@ function wish_append() {
|
|||||||
# line.
|
# line.
|
||||||
wish_remaining_chars() {
|
wish_remaining_chars() {
|
||||||
if [[ $WISH_STATE -eq 0 ]]; then
|
if [[ $WISH_STATE -eq 0 ]]; then
|
||||||
echo "$(( $COLUMNS - ${WISH_LPL[$WISH_LPLINE]} ))"
|
echo "$(( COLUMNS - ${WISH_LPL[$WISH_LPLINE]} ))"
|
||||||
else
|
else
|
||||||
echo "$(( $COLUMNS - ${WISH_LPL[$WISH_RPLINE]} - ${WISH_RPL[$WISH_RPLINE]} ))"
|
echo "$(( COLUMNS - ${WISH_LPL[$WISH_RPLINE]} - ${WISH_RPL[$WISH_RPLINE]} ))"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,8 +193,11 @@ function wish_main() {
|
|||||||
WISH_LPLINE=0
|
WISH_LPLINE=0
|
||||||
local i
|
local i
|
||||||
# Set newline
|
# Set newline
|
||||||
if [[ $WISH_AUTONEWLINE != 0 ]]; then
|
if [[ $WISH_AUTO_NEWLINE != 0 ]]; then
|
||||||
echo -ne "\033[6n" ; read -s -d ';'; read -s -d R WISH_CURSOR_POSITION
|
echo -ne "\033[6n"
|
||||||
|
read -rs -d ';'
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
read -rs -d R WISH_CURSOR_POSITION
|
||||||
if [[ $WISH_CURSOR_POSITION != "1" ]]; then
|
if [[ $WISH_CURSOR_POSITION != "1" ]]; then
|
||||||
PS1="\n"
|
PS1="\n"
|
||||||
fi
|
fi
|
||||||
@@ -195,21 +205,21 @@ function wish_main() {
|
|||||||
# Generate left prompt.
|
# Generate left prompt.
|
||||||
WISH_STATE=0 # 0 = left prompt, 1 = right prompt
|
WISH_STATE=0 # 0 = left prompt, 1 = right prompt
|
||||||
for i in $(seq 0 $((${#WISH_PLUGINS[@]} - 1))); do
|
for i in $(seq 0 $((${#WISH_PLUGINS[@]} - 1))); do
|
||||||
wish_${WISH_PLUGINS[i]}_main $prev
|
"wish_${WISH_PLUGINS[i]}_main" "$prev"
|
||||||
if [[ -v WISH_POWERLINE ]] && [[ $WISH_POWERLINE != 0 ]]; then
|
if [[ -v WISH_POWERLINE ]] && [[ $WISH_POWERLINE != 0 ]]; then
|
||||||
if wish_${WISH_PLUGINS[$i]}_end $prev; then
|
if "wish_${WISH_PLUGINS[$i]}_end" $prev; then
|
||||||
if [[ $i -lt $((${#WISH_PLUGINS[@]} - 1)) ]]; then
|
if [[ $i -lt $((${#WISH_PLUGINS[@]} - 1)) ]]; then
|
||||||
if wish_${WISH_PLUGINS[$(($i + 1))]}_start $prev; then
|
if "wish_${WISH_PLUGINS[$((i + 1))]}_start" "$prev"; then
|
||||||
local plugin=${WISH_PLUGINS[$i]}
|
local plugin=${WISH_PLUGINS[$i]}
|
||||||
local next_plugin=${WISH_PLUGINS[$(($i+1))]}
|
local next_plugin=${WISH_PLUGINS[$((i + 1))]}
|
||||||
local fg_name="WISH_${plugin^^}_BG"
|
local fg_name="WISH_${plugin^^}_BG"
|
||||||
local bg_name="WISH_${next_plugin^^}_BG"
|
local bg_name="WISH_${next_plugin^^}_BG"
|
||||||
wish_append ${!bg_name} ${!fg_name}
|
wish_append "${!bg_name}" "${!fg_name}" "${WISH_POWERLINE_LEFT}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
local plugin=${WISH_PLUGINS[$i]}
|
local plugin=${WISH_PLUGINS[$i]}
|
||||||
local fg_name="WISH_${plugin^^}_BG"
|
local fg_name="WISH_${plugin^^}_BG"
|
||||||
wish_append -1 ${!fg_name}
|
wish_append -1 "${!fg_name}" "${WISH_POWERLINE_LEFT}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -218,26 +228,28 @@ function wish_main() {
|
|||||||
WISH_STATE=1
|
WISH_STATE=1
|
||||||
for i in $(seq 0 $((${#WISH_RIGHT_PLUGINS[@]} - 1))); do
|
for i in $(seq 0 $((${#WISH_RIGHT_PLUGINS[@]} - 1))); do
|
||||||
if [[ -v WISH_POWERLINE ]] && [[ $WISH_POWERLINE != 0 ]]; then
|
if [[ -v WISH_POWERLINE ]] && [[ $WISH_POWERLINE != 0 ]]; then
|
||||||
if wish_${WISH_RIGHT_PLUGINS[$i]}_end $prev; then
|
if "wish_${WISH_RIGHT_PLUGINS[$i]}_end" "$prev"; then
|
||||||
if [[ $i == 0 ]]; then
|
if [[ $i == 0 ]]; then
|
||||||
local plugin=${WISH_RIGHT_PLUGINS[$i]}
|
local plugin=${WISH_RIGHT_PLUGINS[$i]}
|
||||||
local fg_name="WISH_${plugin^^}_BG"
|
local fg_name="WISH_${plugin^^}_BG"
|
||||||
wish_append -1 ${!fg_name}
|
wish_append -1 "${!fg_name}" "${WISH_POWERLINE_RIGHT}"
|
||||||
elif wish_${WISH_RIGHT_PLUGINS[$(($i - 1))]}_start $prev; then
|
elif "wish_${WISH_RIGHT_PLUGINS[$((i - 1))]}_start" $prev; then
|
||||||
local plugin=${WISH_RIGHT_PLUGINS[$i]}
|
local plugin=${WISH_RIGHT_PLUGINS[$i]}
|
||||||
local prev_plugin=${WISH_RIGHT_PLUGINS[$(($i-1))]}
|
local prev_plugin=${WISH_RIGHT_PLUGINS[$((i - 1))]}
|
||||||
local fg_name="WISH_${plugin^^}_BG"
|
local fg_name="WISH_${plugin^^}_BG"
|
||||||
local bg_name="WISH_${prev_plugin^^}_BG"
|
local bg_name="WISH_${prev_plugin^^}_BG"
|
||||||
wish_append ${!bg_name} ${!fg_name}
|
wish_append "${!bg_name}" "${!fg_name}" "${WISH_POWERLINE_RIGHT}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
wish_${WISH_RIGHT_PLUGINS[$i]}_main $prev
|
"wish_${WISH_RIGHT_PLUGINS[$i]}_main" "$prev"
|
||||||
done
|
done
|
||||||
# Save cursor position, print right prompt, restore cursor position,
|
# Save cursor position, print right prompt, restore cursor position,
|
||||||
# print left prompt, reset terminal
|
# print left prompt, reset terminal
|
||||||
|
# shellcheck disable=SC2025
|
||||||
PS1=$PS1"\[\e7"
|
PS1=$PS1"\[\e7"
|
||||||
PS1="$PS1$(wish_print_right_prompt)"
|
PS1="$PS1$(wish_print_right_prompt)"
|
||||||
|
# shellcheck disable=SC2025
|
||||||
PS1="$PS1\e8\]$WISH_LEFT_PS1\[\033[0;5;0m\]"
|
PS1="$PS1\e8\]$WISH_LEFT_PS1\[\033[0;5;0m\]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user