Skip to content

Commit

Permalink
Prepare v12.0.0
Browse files Browse the repository at this point in the history
- Add support for Windows and MacOS.
- Rewrite source code using C.
- Return to the design of v10.2.1.
- Remove feature to track current mode of zsh-vi-mode plugin.
- Remove feature to track total background jobs from the right prompt.
- Remove feature to track if you have write access in the current directory
  from left prompt.
  • Loading branch information
skippyr committed Jul 31, 2024
1 parent 30df836 commit 5e50ffc
Show file tree
Hide file tree
Showing 28 changed files with 918 additions and 613 deletions.
12 changes: 1 addition & 11 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
AccessModifierOffset: -4
AllowShortLambdasOnASingleLine: None
AlwaysBreakTemplateDeclarations: true
BasedOnStyle: Microsoft
BreakAfterJavaFieldAnnotations: true
ColumnLimit: 100
FixNamespaceComments: false
JavaScriptQuotes: Double
NamespaceIndentation: All
PointerAlignment: Left
SpacesInContainerLiterals: false
BasedOnStyle: LLVM
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
root = true

[*]
indent_size = 4
indent_size = 2
indent_style = space
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

[Makefile]
indent_style = tab
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*.swp
.DS_Store
.vs
.vscode
build
out
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "libs/libtmk"]
path = libs/libtmk
url = https://github.com/skippyr/libtmk
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.20)
project(river-dreams)
add_subdirectory("${CMAKE_SOURCE_DIR}/libs/libtmk" "${CMAKE_BINARY_DIR}/libtmk")
add_executable(left-prompt "${CMAKE_SOURCE_DIR}/src/left-prompt.c"
"${CMAKE_SOURCE_DIR}/src/left-prompt.h")
add_executable(right-prompt "${CMAKE_SOURCE_DIR}/src/right-prompt.c"
"${CMAKE_SOURCE_DIR}/src/right-prompt.h")
target_link_libraries(left-prompt tmk)
if(APPLE)
target_link_libraries(left-prompt "-framework IOKit"
"-framework CoreFoundation")
endif()
target_link_libraries(right-prompt tmk)
install(TARGETS left-prompt right-prompt
DESTINATION "${CMAKE_SOURCE_DIR}/build/bin")
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Sherman Rofeman <skippyr.developer@gmail.com>
Copyright (c) 2023 Sherman Rofeman <skippyr.developer@icloud.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 0 additions & 14 deletions Makefile

This file was deleted.

153 changes: 82 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,133 +1,144 @@
<div align="center">
<img alt="" src="assets/ornament.webp" />
</div>
<p align="center">
<img alt="" src="assets/ornament.png" width=1020 />
</p>
<h1 align="center">≥v≥v&ensp;river-dreams&ensp;≥v≥v</h1>
<div align="center">
<img alt="" src="https://img.shields.io/github/license/skippyr/river-dreams?style=plastic&label=%E2%B8%96%20license&labelColor=%23221107&color=%23990b3a" />
&nbsp;
<img alt="" src="https://img.shields.io/github/v/tag/skippyr/river-dreams?style=plastic&label=%E2%B8%96%20tag&labelColor=%23221107&color=%23990b3a" />
&nbsp;
<img alt="" src="https://img.shields.io/github/commit-activity/t/skippyr/river-dreams?style=plastic&label=%E2%B8%96%20commits&labelColor=%23221107&color=%23990b3a" />
&nbsp;
<img alt="" src="https://img.shields.io/github/stars/skippyr/river-dreams?style=plastic&label=%E2%B8%96%20stars&labelColor=%23221107&color=%23990b3a" />
</div>
<p align="center">
<img alt="" src="https://img.shields.io/github/license/skippyr/river-dreams?style=plastic&label=%E2%89%A5%20license&labelColor=%2324130e&color=%23b8150d" />
&nbsp;
<img alt="" src="https://img.shields.io/github/v/tag/skippyr/river-dreams?style=plastic&label=%E2%89%A5%20tag&labelColor=%2324130e&color=%23b8150d" />
&nbsp;
<img alt="" src="https://img.shields.io/github/commit-activity/t/skippyr/river-dreams?style=plastic&label=%E2%89%A5%20commits&labelColor=%2324130e&color=%23b8150d" />
&nbsp;
<img alt="" src="https://img.shields.io/github/stars/skippyr/river-dreams?style=plastic&label=%E2%89%A5%20stars&labelColor=%2324130e&color=%23b8150d" />
</p>

## ❡ About

A fast and full-featured tribal looking theme for the `zsh` shell for Linux.
A fast and full-featured tribal looking shell theme for Windows (PowerShell), Linux (ZSH) and MacOS (ZSH).

<p align="center">
<img alt="" src="assets/preview-0.webp" />
<img alt="" src="assets/preview-1.webp" />
<img alt="" src="assets/preview-2.webp" />
<img alt="" src="assets/preview-3.webp" />
<img alt="" src="assets/preview.png" width=1020 />
</p>
<p align="center"><sup><strong>Caption:</strong> River Dreams applied on <code>zsh</code> in different contexts. The terminal theme used is <a href="https://github.com/skippyr/flamerial">Flamerial</a> and font is <a href="https://www.nerdfonts.com/font-downloads">Hack</a> (Nerd Fonts patched).</sup></p>
<p align="center"><strong>Caption:</strong> <code>river-dreams</code> on MacOS.</p>

### Features

Its left prompt displays:

- Your local IPV4 address or "No Address Found" in case no address is found.
- Your disk usage and a warning symbol if it is almost full.
- If you have a battery, its charge and a symbol to indicate its status: a warning symbol if is almost empty or a lightning one if it is charging.
- A calendar displaying the week day, month and day with its ordinal.
- A 24-hours clock with a symbol that changes depending on the day time: dawn, morning, afternoon and night.
- An indicator with a hastag symbol when you are the root user.
- The exit code of the last command you typed in.
- The active mode of the [zsh-vi-mode](https://github.com/jeffreytse/zsh-vi-mode) plugin if it has been sourced: normal (`N`), insert (`I`), visual (`V`) and replace (`R`).
- The active Python virtual environment if you have sourced one.
- The current working directory path, abbreviating parent directories and shorting it when inside of a `git` repository. The last path split and `git` repository names are always highlighted.
- Your local IPV4 address.
- If you have a battery, its charge and if it is charging.
- Your disk usage.
- A calendar.
- A 24 hours clock
- An indicator when you have administrator privileges.
- The exit code of the last command.
- The active Python virtual environment, if you have sourced one.
- The current active directory path, shorting it when inside of a `git` repository.
- The active branch, when inside of a `git` repository.
- A lock symbol when you do not have write access to the current working directory.

Its right prompt displays:

- The total of each entry type in your active directory: blocks, characters, directories, fifos, files, hidden entries, sockets, symlinks and temporary entries. Symlinks are also followed.
- The total of background jobs.
- The total of each entry type in the current active directory: block devices, character devices, directories, fifos, files, hidden entries, sockets, symlinks and temporary entries. Symlinks are also followed.

## ❡ Install

### Dependencies

The following dependencies must be installed before installing it:

- **git**: it will be used to clone this repository.
- **g++**, **make**: they will be used to compile this software.
- **Noto Sans**, [**Nerd Font Symbols**](https://www.nerdfonts.com/font-downloads): these fonts provide the pretty symbols used in the software.
The following dependencies must be installed before it:

### Procedures
#### Dependencies For Windows

#### Manual Procedures
- [**Visual Studio 2022**](https://visualstudio.microsoft.com): it provides all the tools required to build this software.
- [**git**](https://git-scm.com): it will be used to clone this repository.
- **A font patched by the [Nerd Fonts project](https://www.nerdfonts.com/font-downloads)**: it provides the pretty symbols used by the software.

If you want to install this software without a plugin manager or for a specific framework, using a terminal, follow these steps:
#### Dependencies For Linux

- Clone this repository using `git`:
- **gcc**, **cmake**: they will be used to build this software.
- **git**: it will be used to clone this repository.
- **A font patched by the Nerd Fonts project**: it provides the pretty symbols used by the software.

```sh
git clone --depth 1 https://github.com/skippyr/river-dreams ~/.config/zsh/themes/river-dreams;
```
> [!TIP]
> Use your distro package manager to install these packages.
- Source the file `river-dreams.zsh-theme` that is inside of the repository you cloned in your `~/.zshrc` configuration file:
#### Dependencies For MacOS

```sh
source ~/.config/zsh/themes/river-dreams/river-dreams.zsh-theme;
```
- **Apple Command Line Tools**, **cmake**: they will be used to build this software.
- **git**: it will be used to clone this repository.
- **A font patched by the Nerd Fonts project**: it provides the pretty symbols used by the software.

- Open a new `zsh` session.
- Wait for the theme to compile.
> [!TIP]
> Use `xcode-select --install` to install the Apple command line tools. For the rest, use [HomeBrew](https://brew.sh/).
#### Procedures For OhMyZSH
### Procedures

If you want to install and use this software with the [`ohmyzsh`](https://github.com/ohmyzsh/ohmyzsh) framework, using a terminal, follow these steps:
On Windows, using the `Developer PowerShell for VS 2022` profile or, on any other operating systems, using any terminal, follow these instructions:

- Clone this repository using `git`:

```sh
git clone --depth 1 https://github.com/skippyr/river-dreams \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/river-dreams;
```powershell
# For Windows (PowerShell)
git clone --depth 1 --recurse-submodules `
https://github.com/skippyr/river-dreams `
"${env:USERPROFILE}\powershell\themes\river-dreams";
```

- Apply the theme in your `~/.zshrc` configuration file by setting the `ZSH_THEME` variable:

```zsh
ZSH_THEME=river-dreams/river-dreams;
# For Linux (ZSH) and MacOS (ZSH)
git clone --depth 1 --recurse-submodule \
https://github.com/skippyr/river-dreams \
~/.local/share/zsh/themes/river-dreams;
```

- Open a new `zsh` session.
- Wait for the theme to compile.
- Use `cmake` to build and install it:

#### Procedures For Antidote
```powershell
# For Windows (PowerShell)
cmake -S "${env:USERPROFILE}\powershell\themes\river-dreams" `
-B "${env:USERPROFILE}\powershell\themes\river-dreams\build\cmake";
cmake --build "${env:USERPROFILE}\powershell\themes\river-dreams\build\cmake" `
--config release;
cmake --install "${env:USERPROFILE}\powershell\themes\river-dreams\build\cmake";
```

If you want to install this software with the [`antidote`](https://github.com/mattmc3/antidote) plugin manager, using a terminal, follow these steps:
```zsh
# For Linux (ZSH) and MacOS (ZSH)
cmake -S ~/.local/share/zsh/themes/river-dreams \
-B ~/.local/share/zsh/themes/river-dreams/build/cmake;
cmake --build ~/.local/share/zsh/themes/river-dreams/build/cmake \
--config release;
cmake --install ~/.local/share/zsh/themes/river-dreams/build/cmake;
```

- Add this repository to your plugins file, usually `~/.zsh_plugins.txt`.
- Source the specific connector for your shell:
- For Windows (PowerShell): create and edit your PowerShell profile file (use `echo ${PROFILE};` to see its path), adding the following lines to it:

```
skippyr/river-dreams
```powershell
. "${env:USERPROFILE}\powershell\themes\river-dreams\src\connectors\river-dreams.ps1";
```

- Use `antidote` to load your plugins.
- For Linux (ZSH) and MacOS (ZSH): create and edit the file `~/.zshrc`, adding the following lines to it:

```sh
antidote load ~/.zsh_plugins.txt;
```zsh
source ~/.local/share/zsh/themes/river-dreams/src/connectors/river-dreams.zsh;
```

- Wait for the theme to compile.
- Reopen your shell.
- `river-dreams` should now be installed.

## ❡ Help

If you need help related to this project, open a new issue in its [issues pages](https://github.com/skippyr/river-dreams/issues) or send me an [e-mail](mailto:skippyr.developer@gmail.com) describing what is going on.
If you need help related to this project, open a new issue in its [issues pages](https://github.com/skippyr/river-dreams/issues) or send me an [e-mail](mailto:skippyr.developer@icloud.com) describing what is going on.

## ❡ Contributing

This project is open to review and possibly accept contributions, specially fixes and suggestions. If you are interested, send your contribution to its [pull requests page](https://github.com/skippyr/river-dreams/pulls) or to my [e-mail](mailto:skippyr.developer@gmail.com).
This project is open to review and possibly accept contributions, specially fixes and suggestions. If you are interested, send your contribution to its [pull requests page](https://github.com/skippyr/river-dreams/pulls) or to my [e-mail](mailto:skippyr.developer@icloud.com).

By contributing to this project, you agree to license your work under the same license that the project uses.

## ❡ License

This is free software licensed under the MIT License that comes WITH NO WARRANTY. Refer to the `LICENSE` file that comes in its source code for license and copyright details.
This is free software licensed under the BSD-3-Clause License that comes WITH NO WARRANTY. Refer to the `LICENSE` file that comes in its source code for license and copyright details.

&ensp;
<p align="center"><sup><strong>≥v≥v&ensp;Here Be Dragons!&ensp;≥v≥</strong><br />Made with love by skippyr <3</sup></p>
Binary file added assets/ornament.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/ornament.webp
Binary file not shown.
Binary file removed assets/preview-0.webp
Binary file not shown.
Binary file removed assets/preview-1.webp
Binary file not shown.
Binary file removed assets/preview-2.webp
Binary file not shown.
Binary file removed assets/preview-3.webp
Binary file not shown.
Binary file added assets/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions libs/libtmk
Submodule libtmk added at c57954
9 changes: 0 additions & 9 deletions river-dreams.zsh-theme

This file was deleted.

7 changes: 7 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
static int countDigits(int number) {
int totalDigits;
for (totalDigits = !number; number; number /= 10) {
++totalDigits;
}
return totalDigits;
}
25 changes: 25 additions & 0 deletions src/connectors/river-dreams.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
${_riverDreams_root_g} = $(Split-Path $(Split-Path $PSScriptRoot));

Set-Item -Path Env:VIRTUAL_ENV_DISABLE_PROMPT -Value 1;

function Prompt {
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8;
${leftPrompt} =
& "${_riverDreams_root_g}\build\bin\left-prompt.exe" `
$([Console]::WindowWidth) `
$(if (${LASTEXITCODE} -eq $null) { 0 } else { ${LASTEXITCODE} }) `
$(if (([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) `
{ 1 } else { 0 });
${rightPromptParts} =
& "${_riverDreams_root_g}\build\bin\right-prompt.exe" -Split "`n";
Write-Host -NoNewline ${leftPrompt};
if (${rightPromptParts}[1] -gt 0) {
${cursorLeft} = [Console]::CursorLeft;
${cursorTop} = [Console]::CursorTop;
[Console]::SetCursorPosition([Console]::WindowWidth - ${rightPromptParts}[1], ${cursorTop});
Write-Host -NoNewline ${rightPromptParts}[0];
[Console]::SetCursorPosition(${cursorLeft}, ${cursorTop});
}
" "
}
7 changes: 7 additions & 0 deletions src/connectors/river-dreams.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
setopt promptsubst;

export VIRTUAL_ENV_DISABLE_PROMPT=1;
_riverDreams_root_g=$(dirname $(dirname $(dirname ${0})));

PROMPT='$(${_riverDreams_root_g}/build/bin/left-prompt)';
RPROMPT='$(${_riverDreams_root_g}/build/bin/right-prompt)';
Loading

0 comments on commit 5e50ffc

Please sign in to comment.