commit 25bb67e9587a8ff8fda35956a0df2c53dff3100d Author: Errilaz Date: Fri Jul 17 15:57:16 2026 +0200 feat: datcode diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f00bbcd --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +data/share/* +data/state/* +data/config/node_modules + +!data/config/.gitkeep +!data/share/.gitkeep +!data/state/.gitkeep diff --git a/README.md b/README.md new file mode 100644 index 0000000..c1a25b8 --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +# datcode + +![Static Badge](https://img.shields.io/badge/SLOP%20LEVEL-PURE%20VIBES-red?style=for-the-badge) + +> ⚠️ Note: this is not a reusable tool (yet) as it contains hard-coded paths and configuration. + +Run OpenCode directly in an isolated Lima VM with a complete Docker Engine. +The VM starts when a session begins and stops when the tmux session ends. + +## Prerequisites + +- Lima 2.0 or newer +- QEMU with KVM access +- Projects stored under `/dat` + +## Usage + +Invoke the wrapper from the project OpenCode should work on: + +```sh +/dat/datcode/bin/datcode +``` + +The first invocation creates an Ubuntu VM, installs Docker Engine as a system +service, and installs Bun and OpenCode directly in the guest. This can take +several minutes and is bounded by a ten-minute startup timeout. Later +invocations reuse the VM disk but stop the VM after each session. + +Only the invocation's current working directory and `data` are mounted into the +VM. The mounts are replaced before each start, so only one datcode session may +run at a time. + +Docker images, containers, and volumes persist on the VM disk while it is +stopped. OpenCode can use `docker` and `docker compose` normally from inside the +VM. + +Update OpenCode with: + +```sh +/dat/datcode/bin/datcode update +``` + +OpenCode data remains on the host: + +| Host | VM | +| --- | --- | +| `data/config` | `~/.config/opencode` | +| `data/share` | `~/.local/share/opencode` | +| `data/state` | `~/.local/state/opencode` | +| `data/tmux` | `~/.config/tmux` | + +Use `/connect` inside OpenCode to save provider credentials in these mounted +directories. + +OpenCode runs in a tmux session named `dat`. The guest uses the tmux +configuration copied from the host into `data/tmux/tmux.conf`. Exiting OpenCode +returns to a guest shell; exit that shell or detach from tmux to stop the VM. + +Remove the VM and all Docker data with: + +```sh +limactl delete datcode +``` + +Delete and recreate the VM after changing `lima.yaml`; Lima stores the resolved +configuration when it creates the instance. diff --git a/bin/datcode b/bin/datcode new file mode 100755 index 0000000..a8eaa1e --- /dev/null +++ b/bin/datcode @@ -0,0 +1,130 @@ +#!/bin/sh + +set -eu + +instance=datcode +script_path=$(readlink -f -- "$0") +script_dir=$(CDPATH= cd -- "$(dirname -- "$script_path")" && pwd) +root_dir=$(dirname -- "$script_dir") +data_dir=$root_dir/data +workdir=$(pwd -P) +owns_vm=false +mode=run + +if [ "$#" -gt 0 ]; then + if [ "$#" -ne 1 ] || [ "$1" != update ]; then + printf '%s\n' "usage: datcode [update]" >&2 + exit 2 + fi + mode=update +fi + +if ! command -v limactl >/dev/null 2>&1; then + printf '%s\n' "datcode: limactl is not installed or not in PATH" >&2 + exit 1 +fi + +if [ "$mode" = run ]; then + case "$workdir" in + /dat | /dat/*) ;; + *) + printf '%s\n' "datcode: the working directory must be under /dat" >&2 + exit 1 + ;; + esac +fi + +mkdir -p \ + "$data_dir/config" \ + "$data_dir/share" \ + "$data_dir/state" \ + "$data_dir/tmux" + +cleanup() { + status=$? + trap - EXIT HUP INT TERM + + if [ "$owns_vm" = true ]; then + vm_status=$(limactl list "$instance" --format '{{.Status}}' 2>/dev/null || true) + if [ "$vm_status" = "Running" ]; then + if ! limactl stop "$instance" >/dev/null 2>&1; then + printf '%s\n' "datcode: graceful VM shutdown failed; forcing shutdown" >&2 + limactl stop --force "$instance" >/dev/null 2>&1 || true + fi + fi + fi + exit "$status" +} + +trap cleanup EXIT +trap 'exit 129' HUP +trap 'exit 130' INT +trap 'exit 143' TERM + +start_vm() { + owns_vm=true + printf '%s\n' "datcode: starting VM (first boot can take several minutes)" + limactl start --timeout=10m "$instance" +} + +if [ "$(limactl list "$instance" --quiet 2>/dev/null || true)" = "$instance" ]; then + vm_status=$(limactl list "$instance" --format '{{.Status}}') + if [ "$vm_status" != "Stopped" ]; then + printf '%s\n' "datcode: instance is $vm_status; only one datcode session may run at a time" >&2 + exit 1 + fi +else + limactl create --tty=false --name="$instance" "$root_dir/lima.yaml" +fi + +if [ "$mode" = update ]; then + limactl edit --tty=false --mount-only "$data_dir:w" "$instance" +else + case "$data_dir" in + "$workdir" | "$workdir"/*) + limactl edit --tty=false --mount-only "$workdir:w" "$instance" + ;; + *) + case "$workdir" in + "$data_dir" | "$data_dir"/*) + limactl edit --tty=false --mount-only "$data_dir:w" "$instance" + ;; + *) + limactl edit --tty=false \ + --mount-only "$workdir:w" \ + --mount-only "$data_dir:w" \ + "$instance" + ;; + esac + ;; + esac +fi + +start_vm + +if ! limactl shell --tty=false "$instance" /bin/bash -lc \ + 'sudo -n docker info >/dev/null && command -v bun >/dev/null && command -v opencode >/dev/null && command -v tmux >/dev/null'; then + printf '%s\n' "datcode: VM provisioning failed; inspect /var/log/cloud-init-output.log" >&2 + exit 1 +fi + +if ! limactl shell --tty=false "$instance" docker info >/dev/null; then + printf '%s\n' "datcode: restarting VM to activate Docker group membership" + limactl stop "$instance" >/dev/null + start_vm +fi + +if ! limactl shell --tty=false "$instance" /bin/bash -lc \ + 'docker info >/dev/null && command -v bun >/dev/null && command -v opencode >/dev/null && command -v tmux >/dev/null'; then + printf '%s\n' "datcode: VM readiness check failed" >&2 + exit 1 +fi + +if [ "$mode" = update ]; then + limactl shell "$instance" /bin/bash -lc \ + 'export BUN_INSTALL="$HOME/.local"; exec bun install --global opencode-ai' +else + limactl shell --workdir "$workdir" "$instance" \ + /usr/bin/tmux new-session -A -s dat \ + /bin/bash -lc '/usr/local/bin/opencode; exec /bin/bash' +fi diff --git a/data/config/opencode.json b/data/config/opencode.json new file mode 100644 index 0000000..c3eb6a5 --- /dev/null +++ b/data/config/opencode.json @@ -0,0 +1,3 @@ +{ + "$schema": "https://opencode.ai/config.json" +} \ No newline at end of file diff --git a/data/config/tui.json b/data/config/tui.json new file mode 100644 index 0000000..fec26e1 --- /dev/null +++ b/data/config/tui.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://opencode.ai/tui.json", + "keybinds": { + "input_buffer_home": "ctrl+home", + "input_buffer_end": "ctrl+end", + "input_line_home": "home", + "input_line_end": "end", + "messages_first": "ctrl+home", + "messages_last": "ctrl+end", + "app_exit": "ctrl+q", + "input_delete_word_backward": "ctrl+backspace" + } +} \ No newline at end of file diff --git a/data/share/.gitkeep b/data/share/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/state/.gitkeep b/data/state/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/tmux/plugins/tmux/.editorconfig b/data/tmux/plugins/tmux/.editorconfig new file mode 100644 index 0000000..8d81dbe --- /dev/null +++ b/data/tmux/plugins/tmux/.editorconfig @@ -0,0 +1,5 @@ +[*] +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/data/tmux/plugins/tmux/.github/ISSUE_TEMPLATE/bug-report.md b/data/tmux/plugins/tmux/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..d17fe17 --- /dev/null +++ b/data/tmux/plugins/tmux/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,28 @@ +--- +name: Bug Report +about: Report a bug to help us improve +title: 'Bug: [this doesn''t work]' +labels: bug +assignees: '' + +--- + +### Describe the bug +A clear and concise description of what the bug is. + +### To Reproduce +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +### Expected behavior +A clear and concise description of what you expected to happen. + +### Screenshots +If applicable, add screenshots to help explain your problem. + +### System + - OS: +- Tmux Version: diff --git a/data/tmux/plugins/tmux/.github/ISSUE_TEMPLATE/feature_request.md b/data/tmux/plugins/tmux/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..56d9e57 --- /dev/null +++ b/data/tmux/plugins/tmux/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: 'Enhancement: [add this functionality]' +labels: enhancement +assignees: '' + +--- + +### Describe the feature you'd like +A clear and concise description of what you want added to this project. + +### Describe risks you've considered +A clear and concise description of some potential risks of adding such a feature. + +### Describe alternatives you've considered +A clear and concise description of any alternative solutions or features you've considered. diff --git a/data/tmux/plugins/tmux/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/data/tmux/plugins/tmux/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..ccd83bd --- /dev/null +++ b/data/tmux/plugins/tmux/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,12 @@ +## Issue + +Please reference the issue that this PR is solving +Closes #[issue id goes here] + +## Description of Changes + +Please briefly describe the changes being made + +## Testing + +Please explain how you tested these changes and how a maintainer should reproduce the test diff --git a/data/tmux/plugins/tmux/.github/workflows/check-syntax.yml b/data/tmux/plugins/tmux/.github/workflows/check-syntax.yml new file mode 100644 index 0000000..d221bca --- /dev/null +++ b/data/tmux/plugins/tmux/.github/workflows/check-syntax.yml @@ -0,0 +1,14 @@ +name: Check Syntax + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + - name: syntax-check + run: for i in $(ls); do echo $i; if [ ! -z $(bash -n $i) ]; then $(exit 1); fi; done + working-directory: scripts + shell: bash diff --git a/data/tmux/plugins/tmux/.gitignore b/data/tmux/plugins/tmux/.gitignore new file mode 100644 index 0000000..3f4e905 --- /dev/null +++ b/data/tmux/plugins/tmux/.gitignore @@ -0,0 +1,2 @@ +data/weather.txt +tmux.conf diff --git a/data/tmux/plugins/tmux/CONTRIBUTING.md b/data/tmux/plugins/tmux/CONTRIBUTING.md new file mode 100644 index 0000000..e79240b --- /dev/null +++ b/data/tmux/plugins/tmux/CONTRIBUTING.md @@ -0,0 +1,37 @@ +# Dracula Tmux + +Thank you for your interesting in Dracula Tmux and for your contribution. + +We welcome all feature requests, bug reports, and contributions, given that they +follow the guidelines below. + +Dracula Tmux is developed and maintained by volunteers and students, please be +patient when waiting for PR reviews or filing issues. + +## Contributing To Dracula Tmux + +### LLM "AI" usage + +At this time, the Dracula Tmux project permits the usage of LLMs (commonly referred +to as AI) during the contribution process under the following guidelines: + +1. Code contributions are permitted +2. LLM-generated commit messages, PR descriptions, issues, and code comments (including bug reports) are explicitly forbidden +3. All submitted code must be fully explained, justified, and understood by the human contributing the changes +4. Humans must be in the loop for the entire lifecycle of all contributions +5. Contributions from autonomous agentic closed loops like OpenClaw or Hermes are explicitly forbidden + +#### LLM "AI" Transparency + +All LLM usage must be fully and transparently disclosed in issue or PR creation. + +This disclosure must be in the form of the `Assisted-by` Git commit trailer, +including the tool or harness name as well as the primary model and version used. +A `Co-authored-by:` (commonly used by Claude Code) trailer does not satisfy this policy. + +## Enforcement + +If a contribution (be it a PR or issue) is in violation of the above +guidelines, it may be closed without review or explanation. + +Repeat offenders may be banned from future submissions. diff --git a/data/tmux/plugins/tmux/INSTALL.md b/data/tmux/plugins/tmux/INSTALL.md new file mode 100644 index 0000000..a764567 --- /dev/null +++ b/data/tmux/plugins/tmux/INSTALL.md @@ -0,0 +1,47 @@ +### [tmux](https://github.com/tmux/tmux/wiki) + +#### Install using [tpm](https://github.com/tmux-plugins/tpm) + +If you are a tpm user, you can install the theme and keep up to date by adding the following to your .tmux.conf file: + + set -g @plugin 'dracula/tmux' + +Add any configuration options below this line in your tmux config. + +#### Install with [Nix](https://nixos.org) + +If you're using [home-manager](https://github.com/nix-community/home-manager), an example config would look similar to this: +Then run `home-manager switch`, the `Activating theme` section doesn't apply here. + +```nix +programs.tmux = { + enable = true; + clock24 = true; + plugins = with pkgs.tmuxPlugins; [ + sensible + yank + { + plugin = dracula; + extraConfig = '' + set -g @dracula-show-battery false + set -g @dracula-show-powerline true + set -g @dracula-refresh-rate 10 + ''; + } + ]; + + extraConfig = '' + set -g mouse on + ''; +}; +``` + +#### Activating theme + +1. Make sure `run -b '~/.tmux/plugins/tpm/tpm'` is at the bottom of your .tmux.conf +2. Run tmux +3. Use the tpm install command: `prefix + I` (default prefix is ctrl+b) + +#### Configuration + +The configuration options are documented on [our GitHub](https://github.com/dracula/tmux/blob/master/docs/CONFIG.md) diff --git a/data/tmux/plugins/tmux/LICENSE b/data/tmux/plugins/tmux/LICENSE new file mode 100644 index 0000000..bd37307 --- /dev/null +++ b/data/tmux/plugins/tmux/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Dane Williams + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/data/tmux/plugins/tmux/README.md b/data/tmux/plugins/tmux/README.md new file mode 100644 index 0000000..e3bb4ce --- /dev/null +++ b/data/tmux/plugins/tmux/README.md @@ -0,0 +1,75 @@ +# Dracula for [tmux](https://github.com/tmux/tmux/wiki) + +> A dark theme for [tmux](https://github.com/tmux/tmux/wiki) + +![Screenshot](./screenshot.png) + +## Install + +All instructions can be found [in the docs](./INSTALL.md). + +## Configuration + +Configuration and options can be found [in the docs](/docs/CONFIG.md). + +## Color Theming + +In depth configuration of Colors and alternative themes can be found [in the docs](/docs/color_theming/README.md) + +## Features + +- Support for powerline +- Support for NerdFonts +- Day, date, time, timezone +- [Fully custom color theming](/docs/color_theming/README.md) +- Current location based on network with temperature and forecast icon (if available) +- SSH session user, hostname and port of active tmux pane +- Network connection status, bandwidth, SSID and public IP (requires `curl`) +- Git branch and status +- Battery percentage and AC power connection status with icons +- Refresh rate control +- CPU usage (percentage or load average) +- CPU architecture +- RAM usage (system and/or tmux server) +- Custom status texts from external scripts +- GPU stats + - usage, power draw, and VRAM usage for NVIDIA on Linux, with partial support for amd/ intel + - usage, and power draw for MacOS. **requires sudo privileges** +- Color code based on whether a prefix is active or not +- List of windows with the current window highlighted +- When prefix is enabled, the left status bar widget turns from green to yellow +- If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature +- Read system temperature +- Read system uptime +- Info if the Panes are synchronized +- Spotify playback (needs the tool spotify-tui installed). max-len can be configured. +- Music Player Daemon status (needs the tool mpc installed) +- Playerctl, get current track metadata +- Current kubernetes context +- Countdown to tmux-continuum save +- Current working directory of tmux pane +- Kerberos TGT expiration date +- Show your Libre Freestyle 3 readings [Setup instructions](./scripts/libre.sh) + +## Compatibility + +Compatible with macOS and Linux. Tested on tmux 3.1b +FreeBSD compatibility is in development + +## Team + +This theme is maintained by the following person(s) and a bunch of [awesome contributors](https://github.com/dracula/tmux/graphs/contributors). + +| [![Ethan Edwards](https://avatars1.githubusercontent.com/u/60861925?s=70&v=4)](https://github.com/ethancedwards8) | [![Hugo Meinhof](https://avatars.githubusercontent.com/u/19731833?s=70&v=4)](https://github.com/theoreticallyhugo) | [![Dane Williams](https://avatars2.githubusercontent.com/u/22798229?s=70&v=4)](https://github.com/danerwilliams) | +|-------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------| +| [Ethan Edwards](https://github.com/ethancedwards8) | [Hugo Meinhof](https://github.com/theoreticallyhugo) | [Dane Williams](https://github.com/danerwilliams) | + +## Community + +- [Twitter](https://twitter.com/draculatheme) - Best for getting updates about themes and new stuff. +- [GitHub](https://github.com/dracula/dracula-theme/discussions) - Best for asking questions and discussing issues. +- [Discord](https://draculatheme.com/discord-invite) - Best for hanging out with the community. + +## License + +[MIT License](./LICENSE) diff --git a/data/tmux/plugins/tmux/data/.gitkeep b/data/tmux/plugins/tmux/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/tmux/plugins/tmux/docs/CONFIG.md b/data/tmux/plugins/tmux/docs/CONFIG.md new file mode 100644 index 0000000..48bd61f --- /dev/null +++ b/data/tmux/plugins/tmux/docs/CONFIG.md @@ -0,0 +1,973 @@ +# [tmux](https://github.com/tmux/tmux/wiki) + +## Table of Contents + +- [Configuration](#Configuration---up) +- [Status bar options](#status-bar-options---up) + - [Powerline](#powerline---up) + - [Left Icon](#left-icon---up) +- [Color theming](/docs/color_theming/README.md) +- [Plugins](#Plugins) + - [attached-clients](#attached-clients---up) + - [battery](#battery---up) + - [compact-alt](#compact-alt---up) + - [continuum](#continuum---up) + - [cpu-arch](#cpu-arch---up) + - [cpu-usage](#cpu-usage---up) + - [cwd](#cwd---up) + - [fossil](#fossil---up) + - [git](#git---up) + - [GPU Info (gpu-usage, gpu-ram-usage, gpu-power-draw)](#gpu-info---up) + - [hg](#hg---up) + - [Kerberos TGT (krbtgt)](#Kerberos-TGT---up) + - [kubernetes-context](#kubernetes-context---up) + - [libreview](#libreview---up) + - [mac-player](#mac-player---up) + - [mpc](#mpc---up) + - [network](#network---up) + - [network-public-ip](#network-public-ip---up) + - [network-bandwidth](#network-bandwidth---up) + - [network-ping](#network-ping---up) + - [network-vpn](#network-vpn---up) + - [playerctl](#playerctl---up) + - [ram-usage](#ram-usage---up) + - [spotify-tui](#spotify-tui---up) + - [spr](#spr---up) + - [ssh-session](#ssh-session---up) + - [synchronize-panes](#synchronize-panes---up) + - [sys-temp](#sys-temp---up) + - [terraform](#terraform---up) + - [time](#time---up) + - [tmux-ram-usage](#tmux-ram-usage---up) + - [uptime](#uptime---up) + - [weather](#weather---up) + - [custom:script-name](#customscript-name---up) + +## Configuration - [up](#table-of-contents) + +The following configuration works regardless of whether you are using `$HOME/.tmux.conf`, or `$XDG_CONFIG_HOME/tmux/tmux.conf`. +To enable plugins set up the `@dracula-plugins` option in your `.tmux.conf` file, separate plugin by space. +The order that you define the plugins will be the order on the status bar left to right. +The name of the plugin used in the [table of contents](#table-of-contents), as well as each plugins headline, is the name to be used in the `@dracula-plugins` option. + +```bash +set -g @dracula-plugins "cpu-usage gpu-usage ram-usage" +``` + +For each plugin is possible to customize background and foreground colors. +For more fine-grained color customization please reference [Color theming](/docs/color_theming/README.md). + +```bash +# per default available colors: white, gray, dark_gray, light_purple, dark_purple, cyan, green, orange, red, pink, yellow +# set -g @dracula-[plugin-name]-colors "[background] [foreground]" +set -g @dracula-cpu-usage-colors "pink dark_gray" +``` + +## Status bar options - [up](#table-of-contents) + +Enable window flags + +```bash +set -g @dracula-show-flags true +``` + +Adjust the refresh rate for the status bar + +```bash +# the default is 5, it can accept any number +set -g @dracula-refresh-rate 5 +``` + +Enable high contrast pane border + +```bash +set -g @dracula-border-contrast true +``` + +Hide empty plugins + +```bash +set -g @dracula-show-empty-plugins false +``` + +Set plugin padding +Whilst the padding is one space per default, can be whatever you want it to be, whether that's whitespace or other characters. + +```bash +set -g @dracula-left-pad ' ° ' +set -g @dracula-right-pad ' ° ' +``` + +If you want to remove any padding, you can use `false` as a value. + +```bash +set -g @dracula-left-pad false +set -g @dracula-right-pad false +``` + +### Powerline - [up](#table-of-contents) + +Enable powerline symbols + +```bash +set -g @dracula-show-powerline true +``` + +Enable edge icons + +```bash +set -g @dracula-show-edge-icons true +``` + +Switch powerline symbols + +```bash +# for left +set -g @dracula-show-left-sep  + +# for right symbol (can set any symbol you like as separator) +set -g @dracula-show-right-sep  +``` + +Make the powerline background transparent + +```bash +set -g @dracula-transparent-powerline-bg true + +# the left separator symbol is inversed with a transparent background, you can modify it with any symbol you like +set -g @dracula-inverse-divider  +``` + +### Left Icon - [up](#table-of-contents) + +- The left icon can be set to anything static you'd like. +- However if you use tmux on multiple machines, it may be helpful to display the hostname. +- If you use multiple sessions simultaneously it can be good to name them and have the name in the left icon. + +the following example uses formatting to display `"hostname | session_name"`: + +```bash +set -g @dracula-show-left-icon "#h | #S" +``` + +formats: + +```bash +#H: Hostname of local host +#h: Hostname of local host (no domain name) +#S: name of session -> suggestion: alias trs to tmux rename-session +#W: current Window +``` + +more formats can be found here, though those without a shorthand like #H need to be used like #{host}, which is equivalent. +[reference: tmux(1) - OpenBSD manual pages](https://man.openbsd.org/tmux.1#FORMATS) + +besides formats, any other string can be used. + +additionally the left icons padding can be set like so: + +```bash +# default is 1, it can accept any number and 0 disables padding. +set -g @dracula-left-icon-padding 1 +``` + +## [Color Theming](/docs/color_theming/README.md) - [up](#table-of-contents) + +Each individual widget's foreground and background color can be overridden. +Additionally, the variables used for storing color values can be overridden and extended. +This allows for the use of custom themes like catppuccin or gruvbox. + +For everything regarding colors, please refer to [the color theming directory](/docs/color_theming/README.md). + +## Plugins + +### attached-clients - [up](#table-of-contents) + +This widget provides the number of clients attached to the current tmux session. + +Set the minimum number of clients to show (otherwise, show nothing) + +```bash +set -g @dracula-clients-minimum 1 +``` + +Set the label when there is one client, or more than one client + +```bash +set -g @dracula-clients-singular client +set -g @dracula-clients-plural clients +``` + +### battery - [up](#table-of-contents) + +This widget provides information about the current charge of the battery, whether it is attached to a powersupply and charging from it, or running off the powersupply without charging. it also detects desktop pcs having no battery. + +Display any icon for the battery you'd like with: + +```bash +set -g @dracula-battery-label "🦇 " +``` + +to use nothing but nerdfont icons informing you about the current state, use the following, +which will display the battery charge and whether its charging (or just drawing from AC) as nerdfont icons. + +```bash +set -g @dracula-battery-label false +set -g @dracula-show-battery-status true +``` +these settings will introduce the following icons: +- the battery is discharging and at the current level: `󰂎` `󰁺` `󰁻` `󰁼` `󰁽` `󰁾` `󰁿` `󰂀` `󰂁` `󰂂` `󰁹` +- the battery is charging and at the current level: `󰢟` `󰢜` `󰂆` `󰂇` `󰂈` `󰢝` `󰂉` `󰢞` `󰂊` `󰂋` `󰂅` +- power is being drawn from AC, but the battery is neither charging nor discharging: `` +- we were able to determine that the battery is charging/ discharging, but something about the percentage went wrong: `󰂃` +- we don't know the status of the battery: `` + +if you have no battery and would like the widget to hide in that case, set the following: + +```bash +set -g @dracula-no-battery-label false +``` + +alternatively, if you have no battery and would like a nerdfont icon to indicate that, consider setting the following: + +```bash +set -g @dracula-no-battery-label " " +``` + +in case you have multiple batteries: + +the default battery label is only displayed in the very front. +you can specify multiple battery labels by splitting them with `\n` like so: +```bash +set -g @dracula-battery-label "1:\n2:" +``` +additionally you can specify the separator between each battery like so: +```bash +set -g @dracula-battery-separator "; " +``` + +### compact-alt - [up](#table-of-contents) + +This widget allows the user to switch to an alternate list of widgets when the terminal becomes narrow. +Switching only works if the widget is added to `set -g @dracula-plugins "your-plugins-here"`. + +to set what widgets should be shown in narrow mode, set the following variable. _make sure to include the compact-alt widget as you won't be able to switch out of narrow mode otherwise._ + +```bash +set -g @dracula-narrow-plugins "compact-alt battery network weather" +``` + +to determine when to switch to narrow mode, set the following variable. +any value below this threshold is considered narrow. + +```bash +set -g @dracula-compact-min-width 140 +``` + +the compact-alt widget needs to reload your tmux config to switch from wide to narrow and back. +therefore, you need to make sure to set the right path to your config file. + +```bash +set -g @dracula-config-path "$HOME/.config/tmux/tmux.conf" +``` + +if you want to see your window with and whether narrow mode is active, set the following, which is false per default. + +```bash +set -g @dracula-compact-alt-verbose true +``` + +this widget maintains a global variable informing about whether narrow mode is active. +that variable should never be touched by the user and could potentially be used by other widgets/ plugins. + +```bash +# NEVER DO: +set -g @dracula-narrow-mode some-value +``` + +### continuum - [up](#table-of-contents) + +Set the output mode. Options are: + +- **countdown**: Show a T- countdown to the next save (default) +- **time**: Show the time since the last save +- **alert**: Hide output if no save has been performed recently +- **interval**: Show the continuum save interval + +```bash +set -g @dracula-continuum-mode countdown +``` + +Show if the last save was performed less than 60 seconds ago (default threshold is 15 seconds) + +```bash +set -g @dracula-continuum-time-threshold 60 +``` + +Other options. + +```bash +@dracula-continuum-first-save +@resurrect-dir +@continuum-save-last-timestamp +@continuum-save-interval +``` + +### cpu-arch - [up](#table-of-contents) + +This widget displays the cpu architecture. + +possible nerdfont settings for cpu arch label: + +```bash +set -g @dracula-cpu-arch-label "󰍛 " +``` + +### cpu-usage - [up](#table-of-contents) + +This widget displays the cpu usage in percent by default, but can display cpu load on linux. +Load average – is the average system load calculated over a given period of time of 1, 5 and 15 minutes (output: x.x x.x x.x) + +```bash +set -g @dracula-cpu-display-load true +``` + +possible nerdfont settings for cpu usage label: + +```bash +set -g @dracula-cpu-usage-label " " +``` + +nerdfont icons to consider: + +```bash +   󰍛 󰘚 󰻟 󰻠 +``` + +`set -g @dracula-refresh-rate 5` affects this widget + +### cwd - [up](#table-of-contents) + +This widget displays the path of the current working directory, where the path of the users home directory will be shortened to `~`. + +The maximum number of directories and number of characters used for that is unlimited by default, but can be set with the following two options: + +```bash +set -g @dracula-cwd-max-dirs "0" +set -g @dracula-cwd-max-chars "0" +``` + +### fossil - [up](#table-of-contents) + +Fossil has no configurable options + +### git - [up](#table-of-contents) + +This widget displays info about the current git repository. + +Hide details of git changes + +```bash +set -g @dracula-git-disable-status true +``` + +Set symbol to use for when branch is up to date with HEAD + +```bash +# default is ✓. Avoid using non unicode characters that bash uses like $, * and ! +set -g @dracula-git-show-current-symbol ✓ +``` + +Set symbol to use for when branch diverges from HEAD + +```bash +# default is unicode !. Avoid bash special characters +set -g @dracula-git-show-diff-symbol ! +``` + +Set symbol or message to use when the current pane has no git repo + +```bash +# default is unicode no message +set -g @dracula-git-no-repo-message "" +``` + +Hide untracked files from being displayed as local changes + +```bash +# default is false +set -g @dracula-git-no-untracked-files true +``` + +Show remote tracking branch together with diverge/sync state + +```bash +# default is false +set -g @dracula-git-show-remote-status true +``` + +Show the current repository name in the status bar +```bash +# default is false +set -g @dracula-git-show-repo-name true +``` + +Limit the maximum length of git branch names displayed in the status bar. Truncation is disabled by default. +```bash +set -g @dracula-git-truncate-length 10 +``` + +### gpu-info - [up](#table-of-contents) + +These widgets display the current computational, ram, and power usage of installed graphics cards. +They are split into widgets with the names: `gpu-usage, gpu-ram-usage, gpu-power-draw`. + +hardware support: + +- full support for NVIDIA gpus on linux, when using official nvidia drivers. +- partial support for apple m-chips on MacOS. +- partial support for amd and intel on linux + +If your gpu is not recognised, force the script to assume a certain brand. + +```bash +set -g @dracula-force-gpu "NVIDIA" +``` + +To display the used vram in percent (gigabyte is default unit): + +```bash +set -g @dracula-gpu-vram-percent true +``` + +Vram usage is displayed in gigabyte without decimal places per default. To change that behaviour, use the following options with the respective number of decimal places you'd like to get: + +```bash +set -g @dracula-gpu-vram-used-accuracy ".2f" +set -g @dracula-gpu-vram-total-accuracy ".1f" +``` + +To display the power usage in percent (watt is default unit): + +```bash +set -g @dracula-gpu-power-percent true +``` + +Possible nerdfont settings for gpu info labels: + +```bash +set -g @dracula-gpu-power-label "󰢮 " +set -g @dracula-gpu-usage-label "󰢮 " +set -g @dracula-gpu-vram-label "󰢮 " +``` + +nerdfont icons to consider: + +```bash +󰢮 +``` + +`set -g @dracula-refresh-rate 5` affects this widget + +### hg - [up](#table-of-contents) + +This widget displays info about the current mercurial repository. + +Hide details of hg changes + +```bash +set -g @dracula-hg-disable-status true +``` + +Set symbol to use for when branch is up to date with HEAD + +```bash +#default is ✓.Avoid using non unicode characters that bash uses like $, * and ! +set -g @dracula-hg-show-current-symbol ✓ +``` + +Set symbol to use for when branch diverges from HEAD + +```bash +#default is unicode !.Avoid bash special characters +set -g @dracula-hg-show-diff-symbol ! +``` + +Set symbol or message to use when the current pane has no hg repo + +```bash +#default is unicode no message +set -g @dracula-hg-no-repo-message "" +``` + +Hide untracked files from being displayed as local changes + +```bash +#default is false +set -g @dracula-hg-no-untracked-files false +``` + +### Kerberos TGT - [up](#table-of-contents) + +This widgets name is `krbtgt`. + +Set the principal to check the TGT expiration date for (with or without the REALM) + +``` +set -g @dracula-krbtgt-principal "principal" +``` + +### kubernetes-context - [up](#table-of-contents) + +Add prefix label before the context + +```bash +set -g @dracula-kubernetes-context-label "Some Label" +``` + +Hide user from the context string + +```bash +set -g @dracula-kubernetes-hide-user true +``` + +Hide ARN (show only cluster name) - Available for EKS only (only available for cluster names that are ARNs) + +```bash +set -g @dracula-kubernetes-eks-hide-arn true +``` + +Extract the account as a prefix to the cluster name - Available for EKS only (only available for cluster names that are ARNs) + +```bash +set -g @dracula-kubernetes-eks-extract-account true +``` + +Combine the above options and show only the Kubernetes Context + +```bash +set -g @dracula-show-only-kubernetes-context true +``` + +Hide empty plugin when the `~/.kube/config` file is missing + +```bash +set -g @dracula-kubernetes-hide-no-config true +``` + +### libreview - [up](#table-of-contents) + +This script retrieves and displays continuous glucose monitoring (CGM) data from the LibreView API. +It caches the data to minimize API requests and displays the latest glucose level along with a trend indicator in a Tmux status bar. + +### mac-player - [up](#table-of-contents) + +This widget and script displays music information provided by the native macOS players. + +The current supported apps are: + +- Native Players: + - Spotify + - Music - Apple Music +- Browser Players (active tab must match one of these URLs and requires Google Chrome or Safari): + - youtube.com/watch + - open.spotify.com + +It also has a remote-player feature. +The supported remote players are: + +- Spotify +- Music - Apple Music + +To change player icons: + +```bash +set -g @dracula-mac-player-play-icon "♪ " +set -g @dracula-mac-player-pause-icon "❚❚ " + +``` + +To change length of the widget (length 25 by default): + +```bash +set -g @dracula-mac-player-length 25 +``` + +To activate the remote: + +```bash +set -g @dracula-mac-player-remote true +``` + +To specify the app to use(`"Music"` or `"Spotify"`): + +```bash +set -g @dracula-mac-player-app "Music" +``` + +The default keybinds are: + +- ` + P` - Play/Pause +- ` + R` - Back to position 0/previous track +- ` + N` - Next track + +To change the keybinds: + +```bash +set -g @dracula-mac-player-remote-play-pause "P" +set -g @dracula-mac-player-remote-back "R" +set -g @dracula-mac-player-remote-next "N" +``` + +### mpc - [up](#table-of-contents) + +This widget displays music information provided by mpc. + +To format the display format: + +```bash +set -g @dracula-mpc-format "%title% - %artist%" +``` + +`set -g @dracula-refresh-rate 5` affects this widget + +### network - [up](#table-of-contents) + +This widget displays one of three states: offline, ethernet connected, or wifi connected. +however, per default **this will only display the wifi you're connected to, if it provides internet access!** + +You can use different hosts to ping in order to check for a wifi or wired connection. +If you frequently use networks without internet access, you can use local ip-addresses here to still display the connection. + +```bash +set -g @dracula-network-hosts "1.1.1.1 8.8.8.8" +``` + +Possible nerdfont settings for network info: + +```bash +set -g @dracula-network-ethernet-label "󰈀 Eth" +set -g @dracula-network-offline-label "󱍢 " +set -g @dracula-network-wifi-label " " +``` + +Nerdfont icons to consider: + +``` +ethernet: 󰈀 󰒪 󰒍 󰌗 󰌘 +offline: 󰖪 󱍢 +wifi:    󰖩 󰘊 󰒢 +``` + +Known issues: + +- If for some reason `iw` is only in the path for root and not the normal user, wifi connections will be considered ethernet connections. + +### network-public-ip - [up](#table-of-contents) + +This widget displays the public IP address you're using, by querying the public service `ifconfig.me`. + +Possible nerdfont settings for public IP info: + +```bash +set -g @dracula-network-public-ip-label "󰖟 " +``` + +### network-bandwidth - [up](#table-of-contents) + +This widget gives the currently used up and download speeds per second for one interface. + +The most common interfaces name are `eth0` for a wired connection and `wlan0` for a wireless connection. +To set a specific network interface you'd like to monitor, used: + +```bash +set -g @dracula-network-bandwidth "eno0" +``` + +To display the interface name alongside the speeds, set: + +```bash +set -g @dracula-network-bandwidth-show-interface true +``` + +Per default, this widget checks the speeds as frequently as it can. to set longer intervals, use the following: + +```bash +set -g @dracula-network-bandwidth-interval 5 +``` + +### network-ping - [up](#table-of-contents) + +This widget displays the current ping to a specific server. + +You can configure which server (hostname, IP) you want to ping and at which rate (in seconds). Default is google.com at every 5 seconds. + +```bash +set -g @dracula-ping-server "google.com" +set -g @dracula-ping-rate 5 +``` + +### network-vpn - [up](#table-of-contents) + +This widget tries to display whether a vpn is connected. +Tailscale exit nodes are fully supported for Linux and MacOS. + +Set verbose to true in order to see the VPNs IP or name of Tailscale exit node. + +```bash +set -g @dracula-network-vpn-verbose true +``` + +Set the widgets label like so: +```bash +set -g @dracula-network-vpn-label "󰌘 " +``` + +### playerctl - [up](#table-of-contents) + +This widget displays playerctl info. + +Set the playerctl metadata format like so: + +```bash +set -g @dracula-playerctl-format "► {{ artist }} - {{ title }}" +``` + +### ram-usage - [up](#table-of-contents) + +This widget displays the currently used ram as GB per GB. + +Possible nerdfont settings for ram usage: + +```bash +set -g @dracula-ram-usage-label " " +``` + +Nerdfont icons to consider: + +``` +   󰍛 󰘚 +``` + +### spotify-tui - [up](#table-of-contents) + +This widget displays music information provided by spotify-tui. Spotify-tui must be installed to use this widget. + +To format the display format: + +```bash +set -g @dracula-spotify-tui-format "%f %s %t - %a" +``` + +To limit the maximum length (0 means unlimited length): + +```bash +set -g @dracula-spotify-tui-max-len 30 +``` + +`set -g @dracula-refresh-rate 5` affects this widget + +### spr - [up](#table-of-contents) + +This widget displays music information provided by [spotify-player](https://github.com/aome510/spotify-player). spotify-player must be installed to use this widget. + +To change player icons: + +```bash +set -g @dracula-spr-play-icon "♪ " +set -g @dracula-spr-pause-icon "❚❚ " + +``` + +This section includes an experimental remote control feature, but it may limit the widget’s display on macOS. + +In order to utilize the remote feature you need to install the [spotify-player-daemon](https://github.com/aome510/spotify-player#daemon) +To activate the remote: + +```bash +set -g @dracula-spr-remote true +``` + +The default keybinds are: + +- ` + P` - Play/Pause +- ` + R` - Back to position 0/previous track +- ` + N` - Next track + +To change the keybinds: + +```bash +set -g @dracula-spr-remote-play-pause "P" +set -g @dracula-spr-remote-back "R" +set -g @dracula-spr-remote-next "N" +``` + +`set -g @dracula-refresh-rate 5` affects this widget + +### ssh-session - [up](#table-of-contents) + +This widget displays the current username@host combination, both of the local machine as well as when connected via ssh. + +To output nothing (and maybe hide the widget) when not connected via ssh: + +```bash +set -g @dracula-show-ssh-only-when-connected true +``` + +Show SSH session port: + +```bash +set -g @dracula-show-ssh-session-port true +``` + +nerdfont icons to consider: + +``` +󰣀 +``` + +### synchronize-panes - [up](#table-of-contents) + +This widget displays whether the tmux panes are currently synchronised. + +To change the label: + +```bash +set -g @dracula-synchronize-panes-label "Sync" +``` + +The global refresh rate affects this widget: + +```bash +set -g @dracula-refresh-rate 5 +``` + +You can set a custom refresh rate just for synchronize-panes: + +```bash +set -g @dracula-synchronize-panes-refresh-rate "0.5" # default: unset +``` + +**Note:** This only takes precedence for the synchronize-panes widget. This means it won't +override the global `@dracula-refresh-rate`. + +Alternatively, you can automatically hide the label when sync is `off`: + +```bash +set -g @dracula-synchronize-panes-auto-hide true # default: false +``` + +### sys-temp - [up](#table-of-contents) + +This widget displays the system temperature. + +### terraform - [up](#table-of-contents) + +Add prefix label before workspace + +```bash +set -g @dracula-terraform-label "" +``` + +To use a Terraform fork like `tofu` + +```bash +set -g @dracula-terraform-fork "tofu" +``` + +To hide the plugin when a `.terraform` isn't present + +```bash +set -g @dracula-terraform-hide true +``` + +`set -g @dracula-refresh-rate 5` affects this widget + +### time - [up](#table-of-contents) + +This widget displays current date and time. + +Disable timezone + +```bash +set -g @dracula-show-timezone false +``` + +Swap date to day/month + +```bash +set -g @dracula-day-month true +``` + +Enable military time + +```bash +set -g @dracula-military-time true +``` + +Set custom time format e.g (2023-01-01 14:00) + +```bash +set -g @dracula-time-format "%F %R" +``` + +See [[this page]](https://man7.org/linux/man-pages/man1/date.1.html) for other format symbols. + +### tmux-ram-usage - [up](#table-of-contents) + +This widget displays the ram currently used by tmux. + +Possible nerdfont settings for tmux ram usage: + +``` +@dracula-tmux-ram-usage-label " " +``` + +Nerdfont icons to consider: + +``` +   󰍛 󰘚 +``` + +### uptime - [up](#table-of-contents) + +Shows how long the system has been running. + +Possible nerdfont settings for uptime: + +``` +@dracula-uptime-label "󱎫 " +``` + +### weather - [up](#table-of-contents) + +Show weather information for given location. + +Switch from default fahrenheit to celsius + +```bash +set -g @dracula-show-fahrenheit false +``` + +Set your location manually + +```bash +set -g @dracula-fixed-location "Some City" +``` + +Hide your location + +```bash +set -g @dracula-show-location false +``` +Hide the weather plugin output when an error occurs (prints an empty string instead of "Weather Unavailable" / "Unknown Location"). +This is especially useful together with `set -g @dracula-show-empty-plugins false`. + +```bash +set -g @dracula-weather-hide-errors true +``` + +### custom:script-name - [up](#table-of-contents) + +For testing/ running custom plugins, put the bash script into the scripts directory of dracula/tmux plugin. +Additionally, in the `@dracula-plugins` option, add the script as `custom:name-of-script.sh`. diff --git a/data/tmux/plugins/tmux/docs/color_theming/README.md b/data/tmux/plugins/tmux/docs/color_theming/README.md new file mode 100644 index 0000000..1b3fe04 --- /dev/null +++ b/data/tmux/plugins/tmux/docs/color_theming/README.md @@ -0,0 +1,65 @@ +# overriding widget colors +widget color options with default values - sorted alphabetically: +``` +set -g @dracula-attached-clients-colors "cyan dark_gray" +set -g @dracula-battery-colors "pink dark_gray" +set -g @dracula-continuum-colors "cyan dark_gray" +set -g @dracula-cpu-usage-colors "orange dark_gray" +set -g @dracula-custom-plugin-colors "cyan dark_gray" +set -g @dracula-cwd-colors "dark_gray white" +set -g @dracula-fossil-colors "green dark_gray" +set -g @dracula-git-colors "green dark_gray" +set -g @dracula-gpu-power-draw-colors "green dark_gray" +set -g @dracula-gpu-ram-usage-colors "cyan dark_gray" +set -g @dracula-gpu-usage-colors "pink dark_gray" +set -g @dracula-hg-colors "green dark_gray" +set -g @dracula-kubernetes-context-colors "cyan dark_gray" +set -g @dracula-libre-colors "white dark_gray" +set -g @dracula-mpc-colors "green dark_gray" +set -g @dracula-network-bandwidth-colors "cyan dark_gray" +set -g @dracula-network-colors "cyan dark_gray" +set -g @dracula-network-ping-colors "cyan dark_gray" +set -g @dracula-network-vpn-colors "cyan dark_gray" +set -g @dracula-playerctl-colors "green dark_gray" +set -g @dracula-ram-usage-colors "cyan dark_gray" +set -g @dracula-spotify-tui-colors "green dark_gray" +set -g @dracula-ssh-session-colors "green dark_gray" +set -g @dracula-synchronize-panes-colors "cyan dark_gray" +set -g @dracula-terraform-colors "light_purple dark_gray" +set -g @dracula-time-colors "dark_purple white" +set -g @dracula-tmux-ram-usage-colors "cyan dark_gray" +set -g @dracula-weather-colors "orange dark_gray" +``` + +# overriding color variables + +all dracula colors can be overridden and new variables can be added. +use the `set -g @dracula-colors "color variables go here"` option. put each new variable on a new line for readability or all variables on one line to save space. + +for a quick setup, add one of the following options to your config: +**better readability** +``` +set -g @dracula-colors " +# Dracula Color Pallette +white='#f8f8f2' +gray='#44475a' +dark_gray='#282a36' +light_purple='#bd93f9' +dark_purple='#6272a4' +cyan='#8be9fd' +green='#50fa7b' +orange='#ffb86c' +red='#ff5555' +pink='#ff79c6' +yellow='#f1fa8c' +" +``` +**saving space** +``` +set -g @dracula-colors " white='#f8f8f2' gray='#44475a' dark_gray='#282a36' light_purple='#bd93f9' dark_purple='#6272a4' cyan='#8be9fd' green='#50fa7b' orange='#ffb86c' red='#ff5555' pink='#ff79c6' yellow='#f1fa8c' " +``` +## plug and play themes +as part of this directory there are some plug and play themes with explanations on how to use them: +- [catppuccin](/docs/color_theming/catppuccin.md) +- [gruvbox](/docs/color_theming/gruvbox.md) +- [tomorrow night](/docs/color_theming/tomorrow_night.md) diff --git a/data/tmux/plugins/tmux/docs/color_theming/catppuccin.md b/data/tmux/plugins/tmux/docs/color_theming/catppuccin.md new file mode 100644 index 0000000..4e6281a --- /dev/null +++ b/data/tmux/plugins/tmux/docs/color_theming/catppuccin.md @@ -0,0 +1,176 @@ +# drac to cat + + +for a quick setup, set the following option: +``` +set -g @dracula-colors " +# simple catppuccin Color Pallette +pink='#cba6f7' +orange='#fab387' +yellow='#f9e2af' +green='#a6e3a1' +cyan='#89dceb' +light_purple='#b4befe' +white='#cdd6f4' +dark_gray='#313244' +red='#f38ba8' +gray='#45475a' +dark_purple='#6c7086' +" +``` + + +alternatively use the full catppuccin color palette and customise the flags accordingly + +# catppuccin Color Pallette + +# latte +``` +Rosewater='#dc8a78' +Flamingo='#dd7878' +Pink='#ea76cb' +Mauve='#8839ef' +Red='#d20f39' +Maroon='#e64553' +Peach='#fe640b' +Yellow='#df8e1d' +Green='#40a02b' +Teal='#179299' +Sky='#04a5e5' +Sapphire='#209fb5' +Blue='#1e66f5' +Lavender='#7287fd' +Text='#4c4f69' +Subtext1='#5c5f77' +Subtext0='#6c6f85' +Overlay2='#7c7f93' +Overlay1='#8c8fa1' +Overlay0='#9ca0b0' +Surface2='#acb0be' +Surface1='#bcc0cc' +Surface0='#ccd0da' +Base='#eff1f5' +Mantle='#e6e9ef' +Crust='#dce0e8' +``` + +# frappe +``` +Rosewater='#f2d5cf' +Flamingo='#eebebe' +Pink='#f4b8e4' +Mauve='#ca9ee6' +Red='#e78284' +Maroon='#ea999c' +Peach='#ef9f76' +Yellow='#e5c890' +Green='#a6d189' +Teal='#81c8be' +Sky='#99d1db' +Sapphire='#85c1dc' +Blue='#8caaee' +Lavender='#babbf1' +Text='#c6d0f5' +Subtext1='#b5bfe2' +Subtext0='#a5adce' +Overlay2='#949cbb' +Overlay1='#838ba7' +Overlay0='#737994' +Surface2='#626880' +Surface1='#51576d' +Surface0='#414559' +Base='#303446' +Mantle='#292c3c' +Crust='#232634' +``` + +# macchiato +``` +Rosewater='#f4dbd6' +Flamingo='#f0c6c6' +Pink='#f5bde6' +Mauve='#c6a0f6' +Red='#ed8796' +Maroon='#ee99a0' +Peach='#f5a97f' +Yellow='#eed49f' +Green='#a6da95' +Teal='#8bd5ca' +Sky='#91d7e3' +Sapphire='#7dc4e4' +Blue='#8aadf4' +Lavender='#b7bdf8' +Text='#cad3f5' +Subtext1='#b8c0e0' +Subtext0='#a5adcb' +Overlay2='#939ab7' +Overlay1='#8087a2' +Overlay0='#6e738d' +Surface2='#5b6078' +Surface1='#494d64' +Surface0='#363a4f' +Base='#24273a' +Mantle='#1e2030' +Crust='#181926' +``` + +# mocha +``` +Rosewater='#f5e0dc' +Flamingo='#f2cdcd' +Pink='#f5c2e7' +Mauve='#cba6f7' +Red='#f38ba8' +Maroon='#eba0ac' +Peach='#fab387' +Yellow='#f9e2af' +Green='#a6e3a1' +Teal='#94e2d5' +Sky='#89dceb' +Sapphire='#74c7ec' +Blue='#89b4fa' +Lavender='#b4befe' +Text='#cdd6f4' +Subtext1='#bac2de' +Subtext0='#a6adc8' +Overlay2='#9399b2' +Overlay1='#7f849c' +Overlay0='#6c7086' +Surface2='#585b70' +Surface1='#45475a' +Surface0='#313244' +Base='#1e1e2e' +Mantle='#181825' +Crust='#11111b' +``` + +# TODO: check em all +``` +set -g "@dracula-cwd-colors" "Surface0 Text" +set -g "@dracula-fossil-colors" "Green Surface0" +set -g "@dracula-git-colors" "Green Surface0" +set -g "@dracula-hg-colors" "Green Surface0" +set -g "@dracula-battery-colors" "Mauve Surface0" +set -g "@dracula-gpu-usage-colors" "Mauve Surface0" +set -g "@dracula-gpu-ram-usage-colors" "Sky Surface0" +set -g "@dracula-gpu-power-draw-colors" "Green Surface0" +set -g "@dracula-cpu-usage-colors" "orange Surface0" +set -g "@dracula-ram-usage-colors" "Sky Surface0" +set -g "@dracula-tmux-ram-usage-colors" "Sky Surface0" +set -g "@dracula-network-colors" "Sky Surface0" +set -g "@dracula-network-bandwidth-colors" "Sky Surface0" +set -g "@dracula-network-ping-colors" "Sky Surface0" +set -g "@dracula-network-vpn-colors" "Sky Surface0" +set -g "@dracula-attached-clients-colors" "Sky Surface0" +set -g "@dracula-mpc-colors" "Green Surface0" +set -g "@dracula-spotify-tui-colors" "Green Surface0" +set -g "@dracula-playerctl-colors" "Green Surface0" +set -g "@dracula-kubernetes-context-colors" "Sky Surface0" +set -g "@dracula-terraform-colors" "Lavender Surface0" +set -g "@dracula-continuum-colors" "Sky Surface0" +set -g "@dracula-weather-colors" "orange Surface0" +set -g "@dracula-time-colors" "dark_purple white" +set -g "@dracula-synchronize-panes-colors" "Sky Surface0" +set -g "@dracula-libre-colors" "Text Surface0" +set -g "@dracula-ssh-session-colors" "Green Surface0" +``` diff --git a/data/tmux/plugins/tmux/docs/color_theming/gruvbox.md b/data/tmux/plugins/tmux/docs/color_theming/gruvbox.md new file mode 100644 index 0000000..c2850ad --- /dev/null +++ b/data/tmux/plugins/tmux/docs/color_theming/gruvbox.md @@ -0,0 +1,97 @@ +# drac to gruv + +for a quick setup, set the following option: +``` +set -g @dracula-colors " +# simple gruvbox Color Pallette +white='#EBDBB2' +gray='#32302F' +dark_gray='#282828' +light_purple='#B16286' +dark_purple='#504945' +cyan='#689D6A' +green='#98971A' +orange='#D65D0E' +red='#CC241D' +pink='#D3869B' +yellow='#D79921' +" +``` + +alternatively use the full gruvbox color palette and customise the flags accordingly + +# GruvBox Color Pallette +## dark +``` +# === colors === +# --- muted --- +muted_back="#282828" +muted_red="#CC241D" +muted_green="#98971A" +muted_yellow="#D79921" +muted_blue="#458588" +muted_purple="#B16286" +muted_aqua="#689D6A" +muted_orange="#D65D0E" +muted_fore="#A89984" +# --- strong --- +strong_back="#928374" +strong_red="#FB4934" +strong_green="#B8BB26" +strong_yellow="#FABD2F" +strong_blue="#83A598" +strong_purple="#D3869B" +strong_aqua="#8EC07C" +strong_orange="#FE8019" +strong_fore="#EBDBB2" +# === backgrounds === +back_0_hard="#1D2021" +back_0_soft="#32302F" +back_1="#3C3836" +back_2="#504945" +back_3="#665C54" +back_4="#7C6F64" +fore_0_hard="#FBF1C7" +fore_0_soft="#FBF1C7" +fore_1="#EBDBB2" +fore_2="#D5C4A1" +fore_3="#BDAE93" +fore_4="#A89984" +``` +## light +``` +# === colors === +# --- muted --- +muted_back="#FBF1C7" +muted_red="#CC241D" +muted_green="#98971A" +muted_yellow="#D79921" +muted_blue="#458588" +muted_purple="#B16286" +muted_aqua="#689D6A" +muted_orange="#D65D0E" +muted_fore="#7C6F64" +# --- strong --- +strong_back="#928374" +strong_red="#9d0006" +strong_green="#79740E" +strong_yellow="#B57614" +strong_blue="#076678" +strong_purple="#8F3F71" +strong_aqua="#427B58" +strong_orange="#AF3A03" +strong_fore="#3C3836" +# === backgrounds === +back_0_hard="#F9F5D7" +back_0_soft="#F2E5BC" +back_1="#EBDBB2" +back_2="#D5C4A1" +back_3="#BDAE93" +back_4="#A89984" +fore_0_hard="#282828" +fore_0_soft="#282828" +fore_1="#3C3836" +fore_2="#504945" +fore_3="#665C54" +fore_4="#7C6F64" +``` diff --git a/data/tmux/plugins/tmux/docs/color_theming/kanagawa.md b/data/tmux/plugins/tmux/docs/color_theming/kanagawa.md new file mode 100644 index 0000000..47c7e00 --- /dev/null +++ b/data/tmux/plugins/tmux/docs/color_theming/kanagawa.md @@ -0,0 +1,19 @@ +# drac to [kanagawa](https://github.com/rebelot/kanagawa.nvim) +for a quick setup, set the following options: + +```tmux +# kanagawa +set -g @dracula-colors " +white='#dcd7ba' +gray='#2a2a37' +dark_gray='#363646' +light_purple='#363646' +dark_purple='#54546D' +cyan='#6a9589' +green='#938aa9' +orange='#dca561' +red='#e46876' +pink='#d27e99' +yellow='#ff9e3b' +" +``` diff --git a/data/tmux/plugins/tmux/docs/color_theming/monokai_pro.md b/data/tmux/plugins/tmux/docs/color_theming/monokai_pro.md new file mode 100644 index 0000000..79c03f6 --- /dev/null +++ b/data/tmux/plugins/tmux/docs/color_theming/monokai_pro.md @@ -0,0 +1,22 @@ +# Drac to Monokai Pro + +For a quick setup, set the following options: + +```tmux +# Monokai Pro +set -g @dracula-colors " +white='#fcfcfa' +gray='#403e41' +dark_gray='#2d2a2e' +light_purple='#ab9df2' +dark_purple='#5b595c' +cyan='#78dce8' +green='#a9dc76' +orange='#fc9867' +red='#ff6188' +pink='#ff79c6' +yellow='#ffd866' +" +``` + +Based on [maxpetretta/tmux-monokai-pro](https://github.com/maxpetretta/tmux-monokai-pro) diff --git a/data/tmux/plugins/tmux/docs/color_theming/tomorrow_night.md b/data/tmux/plugins/tmux/docs/color_theming/tomorrow_night.md new file mode 100644 index 0000000..e09eea2 --- /dev/null +++ b/data/tmux/plugins/tmux/docs/color_theming/tomorrow_night.md @@ -0,0 +1,106 @@ +# drac to tomorrow night + +for a quick setup, set the following option: +``` +set -g @dracula-colors " +# simple tomorrow night color palette +pink='#cc6666' +orange='#de935f' +yellow='#f0c574' +green='#b5bd68' +cyan='#8abdb6' +blue='#81a2be' +light_purple='#b294ba' +white='#c4c8c5' +dark_gray='#363a41' +red='#cc6666' +gray='#1d1f21' +dark_purple='#373b41' +" +``` + +Alternatively use the full tomorrow color palette and customise the flags accordingly + +# Tomorrow Night Color Palette +## Tomorrow +``` +foreground='#4d4d4c' +background='#ffffff' +highlight='#d6d6d6' +status_line='#efefef' +comment='#8e908c' +red='#c82829' +orange='#f5871f' +yellow='#eab700' +green='#718c00' +aqua='#3e999f' +blue='#4271ae' +purple='#8959a8' +pane='#efefef' +``` +## Tomorrow Night +``` +foreground='#c5c8c6' +background='#1d1f21' +highlight='#373b41' +status_line='#282a2e' +comment='#969896' +red='#cc6666' +orange='#de935f' +yellow='#f0c674' +green='#b5bd68' +aqua='#8abeb7' +blue='#81a2be' +purple='#b294bb' +pane='#4d5057' +``` +## Tomorrow Night Eighties +``` +foreground='#4d4d4c' +background='#ffffff' +highlight='#d6d6d6' +status_line='#efefef' +comment='#8e908c' +red='#c82829' +orange='#f5871f' +yellow='#eab700' +green='#718c00' +aqua='#3e999f' +blue='#4271ae' +purple='#8959a8' +pane='#efefef' +``` +## Tomorrow Night Bright +``` +foreground='#eaeaea' +background='#000000' +highlight='#424242' +status_line='#2a2a2a' +comment='#969896' +red='#d54e53' +orange='#e78c45' +yellow='#e7c547' +green='#b9ca4a' +aqua='#70c0b1' +blue='#7aa6da' +purple='#c397d8' +pane='#4d5057' +``` +## Tomorrow Night Blue +``` +foreground='#ffffff' +background='#002451' +highlight='#003f8e' +status_line='#00346e' +comment='#7285b7' +red='#ff9da4' +orange='#ffc58f' +yellow='#ffeead' +green='#d1f1a9' +aqua='#99ffff' +blue='#bbdaff' +purple='#ebbbff' +pane='#4d5057' +``` + +>For more information about the tomorrow theme, here is the repo made by [chriskempson](https://github.com/chriskempson/tomorrow-theme/tree/master) diff --git a/data/tmux/plugins/tmux/dracula.tmux b/data/tmux/plugins/tmux/dracula.tmux new file mode 100755 index 0000000..e230713 --- /dev/null +++ b/data/tmux/plugins/tmux/dracula.tmux @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# source and run dracula theme + +current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +$current_dir/scripts/dracula.sh + diff --git a/data/tmux/plugins/tmux/screenshot.png b/data/tmux/plugins/tmux/screenshot.png new file mode 100644 index 0000000..c1402e4 Binary files /dev/null and b/data/tmux/plugins/tmux/screenshot.png differ diff --git a/data/tmux/plugins/tmux/scripts/attached_clients.sh b/data/tmux/plugins/tmux/scripts/attached_clients.sh new file mode 100755 index 0000000..ca7056d --- /dev/null +++ b/data/tmux/plugins/tmux/scripts/attached_clients.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# setting the locale, some users have issues with different locales, this forces the correct one +export LC_ALL=en_US.UTF-8 + +# configuration +# @dracula-clients-minimum 1 +# @dracula-clients-singular client +# @dracula-clients-plural clients + +current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source $current_dir/utils.sh + +count_clients() { + pane=$(tmux list-panes -F "#{session_name}" | head -n 1) + tmux list-clients -t $pane | wc -l | tr -d ' ' +} + +main() { + # storing the refresh rate in the variable RATE, default is 5 + RATE=$(get_tmux_option "@dracula-refresh-rate" 5) + clients_count=$(count_clients) + clients_minimum=$(get_tmux_option "@dracula-clients-minimum" 1) + if (( $clients_count >= $clients_minimum )); then + if (( $clients_count > 1 )); then + clients_label=$(get_tmux_option "@dracula-clients-plural" "clients") + else + clients_label=$(get_tmux_option "@dracula-clients-singular" "client") + fi + echo "$clients_count $clients_label" + fi + sleep $RATE +} + +# run main driver +main diff --git a/data/tmux/plugins/tmux/scripts/battery.sh b/data/tmux/plugins/tmux/scripts/battery.sh new file mode 100755 index 0000000..13882c7 --- /dev/null +++ b/data/tmux/plugins/tmux/scripts/battery.sh @@ -0,0 +1,200 @@ +#!/usr/bin/env bash +# setting the locale, some users have issues with different locales, this forces the correct one +export LC_ALL=en_US.UTF-8 + +current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $current_dir/utils.sh + +linux_acpi() { + arg=$1 + BAT=$(ls -d /sys/class/power_supply/*) + if [ ! -x "$(which acpi 2> /dev/null)" ];then + for DEV in $BAT; do + case "$arg" in + status) + [ -f "$DEV/status" ] && cat "$DEV/status" + ;; + percent) + [ -f "$DEV/capacity" ] && cat "$DEV/capacity" + ;; + *) + ;; + esac + done + else + case "$arg" in + status) + acpi | cut -d: -f2- | cut -d, -f1 | tr -d ' ' + ;; + percent) + acpi | cut -d: -f2- | cut -d, -f2 | tr -d '% ' + ;; + *) + ;; + esac + fi +} + +battery_percent() +{ + # Check OS + case $(uname -s) in + Linux) + percent=$(linux_acpi percent) + [ -n "$percent" ] && echo "$percent%" + ;; + + Darwin) + echo $(pmset -g batt | grep -Eo '[0-9]?[0-9]?[0-9]%') + ;; + + FreeBSD) + echo $(apm | sed '8,11d' | grep life | awk '{print $4}') + ;; + + CYGWIN*|MINGW32*|MSYS*|MINGW*) + # leaving empty - TODO - windows compatability + ;; + + *) + ;; + esac +} + +get_battery_status() +{ + # Check OS + case $(uname -s) in + Linux) + status=$(linux_acpi status) + ;; + + Darwin) + status=$(pmset -g batt | sed -n 2p | cut -d ';' -f 2 | tr -d " ") + ;; + + FreeBSD) + status=$(apm | sed '8,11d' | grep Status | awk '{printf $3}') + ;; + + CYGWIN*|MINGW32*|MSYS*|MINGW*) + # leaving empty - TODO - windows compatability + ;; + + *) + ;; + esac + echo "$status" +} + +parse_battery_status() +{ + # $1 is battery_percent + bat_perc="$1" + # $2 is get_battery_status + status="$2" + + case $status in + discharging|Discharging) + # discharging, no AC + declare -A battery_labels=( + [0]="󰂎" + [10]="󰁺" + [20]="󰁻" + [30]="󰁼" + [40]="󰁽" + [50]="󰁾" + [60]="󰁿" + [70]="󰂀" + [80]="󰂁" + [90]="󰂂" + [100]="󰁹" + ) + echo "${battery_labels[$((bat_perc/10*10))]:-󰂃}" + ;; + high|charged|Full) + echo "󰁹" + ;; + charging|Charging) + # charging from AC + declare -A battery_labels=( + [0]="󰢟" + [10]="󰢜" + [20]="󰂆" + [30]="󰂇" + [40]="󰂈" + [50]="󰢝" + [60]="󰂉" + [70]="󰢞" + [80]="󰂊" + [90]="󰂋" + [100]="󰂅" + ) + echo "${battery_labels[$((bat_perc/10*10))]:-󰂃}" + ;; + ACattached|Notcharging|"Not charging") + # drawing from AC but not charging + # ACattached - MacOS + # Not charging - Linux without acpi + # Notcharging - Linux with acpi + echo '' + ;; + finishingcharge) + echo '󰂅' + ;; + *) + # something wrong... + echo '' + ;; + esac + ### Old if statements didn't work on BSD, they're probably not POSIX compliant, not sure + # if [ $status = 'discharging' ] || [ $status = 'Discharging' ]; then + # echo '' + # # elif [ $status = 'charging' ]; then # This is needed for FreeBSD AC checking support + # # echo 'AC' + # else + # echo 'AC' + # fi +} + +main() +{ + # get left most custom label + bat_label=$(get_tmux_option "@dracula-battery-label" "♥") + if [ "$bat_label" == false ]; then + bat_label="" + fi + + # get label for when there is no battery + no_bat_label=$(get_tmux_option "@dracula-no-battery-label" "AC") + if [ "$no_bat_label" == false ]; then + no_bat_label="" + fi + + bat_perc=$(battery_percent) + bat_perc="${bat_perc%\%}" + + # display widget + if [ -z "$bat_perc" ]; then # In case it is a desktop with no battery percent, only AC power + echo "$no_bat_label" + else + IFS=$'\n' read -rd '' -a percs <<<"$bat_perc" + IFS=$'\n' read -rd '' -a stats <<<"$(get_battery_status)" + IFS=$'\n' read -rd '' -a lbls <<<"$bat_label" + num_bats=${#percs[@]} + show_bat_label=$(get_tmux_option "@dracula-show-battery-status" false) + for ((i=0; i