mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-21 12:59:41 +00:00
Compare commits
10 Commits
d2496f3b63
...
09d5f776eb
Author | SHA1 | Date | |
---|---|---|---|
|
09d5f776eb | ||
|
76f8e6438b | ||
|
f2b1edf2eb | ||
|
3a0717d267 | ||
|
5e4e336eff | ||
|
bb974b2701 | ||
|
654cd615cf | ||
|
a6e948f1c9 | ||
|
e2f87e38b1 | ||
|
ee090dd31f |
89
.github/mkdocs.yml
vendored
89
.github/mkdocs.yml
vendored
|
@ -1,89 +0,0 @@
|
|||
site_name: Chris Titus LinUtil Official Documentation
|
||||
repo_url: https://github.com/ChrisTitusTech/linutil
|
||||
docs_dir: '../docs'
|
||||
|
||||
nav:
|
||||
- Introduction: 'index.md'
|
||||
- User Guide: 'userguide.md'
|
||||
- Contributing:
|
||||
- Contributing Guide: 'contributing.md'
|
||||
- Roadmap: 'roadmap.md'
|
||||
- Documentation:
|
||||
- Known Issues: 'KnownIssues.md'
|
||||
- FAQ: 'faq.md'
|
||||
|
||||
theme:
|
||||
name: material
|
||||
custom_dir: '../overrides'
|
||||
features:
|
||||
- navigation.tabs
|
||||
- navigation.sections
|
||||
- toc.integrate
|
||||
- navigation.top
|
||||
- search.suggest
|
||||
- search.highlight
|
||||
- content.tabs.link
|
||||
- content.code.annotation
|
||||
- content.code.copy
|
||||
language: en
|
||||
logo: assets/favicon.png
|
||||
favicon: assets/favicon.png
|
||||
palette:
|
||||
# Palette toggle for automatic mode
|
||||
- media: "(prefers-color-scheme)"
|
||||
toggle:
|
||||
icon: material/brightness-auto
|
||||
name: Switch to light mode
|
||||
|
||||
# Palette toggle for light mode
|
||||
- media: "(prefers-color-scheme: light)"
|
||||
scheme: default
|
||||
accent: blue
|
||||
toggle:
|
||||
icon: material/brightness-7
|
||||
name: Switch to dark mode
|
||||
|
||||
# Palette toggle for dark mode
|
||||
- media: "(prefers-color-scheme: dark)"
|
||||
scheme: slate
|
||||
primary: black
|
||||
accent: blue
|
||||
toggle:
|
||||
icon: material/weather-night
|
||||
name: Switch to light mode
|
||||
markdown_extensions:
|
||||
- admonition
|
||||
- pymdownx.details
|
||||
- pymdownx.superfences
|
||||
- pymdownx.superfences:
|
||||
custom_fences:
|
||||
- name: mermaid
|
||||
class: mermaid
|
||||
format: !!python/name:pymdownx.superfences.fence_code_format
|
||||
- abbr
|
||||
- attr_list
|
||||
- pymdownx.snippets
|
||||
- md_in_html
|
||||
- pymdownx.superfences
|
||||
- pymdownx.tabbed:
|
||||
alternate_style: true
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
line_spans: __span
|
||||
pygments_lang_class: true
|
||||
- pymdownx.inlinehilite
|
||||
- def_list
|
||||
- pymdownx.tasklist:
|
||||
custom_checkbox: true
|
||||
- toc:
|
||||
permalink: true
|
||||
|
||||
plugins:
|
||||
- search
|
||||
- awesome-pages
|
||||
- git-revision-date-localized
|
||||
- minify:
|
||||
minify_html: true
|
||||
htmlmin_opts:
|
||||
remove_comments: true
|
||||
cache_safe: true
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
56
.github/workflows/github-pages.yml
vendored
56
.github/workflows/github-pages.yml
vendored
|
@ -1,56 +0,0 @@
|
|||
name: GitHub Pages Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '.github/mkdocs.yml'
|
||||
- '.github/requirements.txt'
|
||||
- 'docs/**'
|
||||
- 'overrides/**'
|
||||
- '.github/CONTRIBUTING.md'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: linutil_env
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: '0' # Fetch all commit history for all branches as well as tags.
|
||||
|
||||
- name: Copy Contributing Guidelines
|
||||
run: |
|
||||
echo -e "<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md'
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
commit-message: Update Contributing Guidelines
|
||||
title: 'docs: Update Contributing Guidelines'
|
||||
body: 'Automated update of Contributing Guidelines from .github/CONTRIBUTING.md'
|
||||
branch: update-contributing-guidelines
|
||||
delete-branch: true
|
||||
base: main
|
||||
labels: documentation
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
if: success()
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x # Install latest Stable release of Python 3
|
||||
cache: 'pip' # Caching pip dependencies
|
||||
|
||||
- name: Install Necessary Dependencies
|
||||
run: pip install -r .github/requirements.txt
|
||||
|
||||
- name: Build & Deploy using mkdocs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: mkdocs gh-deploy --force -f .github/mkdocs.yml
|
6
.github/workflows/preview.yml
vendored
6
.github/workflows/preview.yml
vendored
|
@ -59,16 +59,16 @@ jobs:
|
|||
- name: Generate preview
|
||||
uses: charmbracelet/vhs-action@v2.1.0
|
||||
with:
|
||||
path: "docs/assets/preview.tape"
|
||||
path: ".github/preview.tape"
|
||||
|
||||
- name: Move preview
|
||||
run: mv preview.gif docs/assets/preview.gif
|
||||
run: mv preview.gif .github/preview.gif
|
||||
|
||||
- name: Create PR
|
||||
uses: peter-evans/create-pull-request@v7.0.5
|
||||
with:
|
||||
commit-message: Preview for ${{ env.tag_name }}
|
||||
file-pattern: "docs/assets/preview.gif"
|
||||
file-pattern: ".github/preview.gif"
|
||||
add-options: "--force"
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
branch: feature/preview-${{ env.tag_name }}
|
||||
|
|
58
.github/workflows/xtask.yml
vendored
58
.github/workflows/xtask.yml
vendored
|
@ -1,58 +0,0 @@
|
|||
name: XTasks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "xtask"
|
||||
- "Cargo.toml"
|
||||
- "Cargo.lock"
|
||||
- ".cargo"
|
||||
- "core/tabs"
|
||||
- "docs"
|
||||
push:
|
||||
paths:
|
||||
- "xtask"
|
||||
- "Cargo.toml"
|
||||
- "Cargo.lock"
|
||||
- ".cargo"
|
||||
- "core/tabs"
|
||||
- "docs"
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
docgen:
|
||||
name: DocGen
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Cache Cargo registry
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: ${{ runner.os }}-cargo-registry-
|
||||
|
||||
- name: Cache Cargo index
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cargo/git
|
||||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: ${{ runner.os }}-cargo-index-
|
||||
|
||||
- name: Run cargo xtask docgen
|
||||
run: cargo xtask docgen
|
||||
|
||||
- name: Check uncommitted documentation changes
|
||||
run: |
|
||||
git diff
|
||||
git diff-files --quiet \
|
||||
|| (echo "Run 'cargo xtask docgen' and push the changes" \
|
||||
&& exit 1)
|
|
@ -7,7 +7,7 @@
|
|||
<!-- TODO: crates.io package here + <br> -->
|
||||
[![Crates.io Version](https://img.shields.io/crates/v/linutil_tui?style=for-the-badge&color=%23af3a03)](https://crates.io/crates/linutil_tui) [![linutil AUR Version](https://img.shields.io/aur/version/linutil?style=for-the-badge&label=%5BAUR%5D%20linutil&color=%23230567ff)](https://aur.archlinux.org/packages/linutil) [![linutil-bin AUR Version](https://img.shields.io/aur/version/linutil-bin?style=for-the-badge&label=%5BAUR%5D%20linutil-bin&color=%23230567ff)](https://aur.archlinux.org/packages/linutil-bin)
|
||||
|
||||
![Preview](docs/assets/preview.gif)
|
||||
![Preview](/.github/preview.gif)
|
||||
|
||||
**Linutil** is a distro-agnostic toolbox designed to simplify everyday Linux tasks. It helps you set up applications and optimize your system for specific use cases. The utility is actively developed in Rust 🦀, providing performance and reliability.
|
||||
|
||||
|
@ -128,13 +128,15 @@ If you find Linutil helpful, please consider giving it a ⭐️ to show your sup
|
|||
|
||||
## 🎓 Documentation
|
||||
|
||||
For comprehensive information on how to use Linutil, visit the [Linutil Official Documentation](https://christitustech.github.io/linutil/).
|
||||
For comprehensive information on how to use Linutil, visit the [Linutil Official Documentation](https://chris-titus-docs.github.io/linutil-docs/).
|
||||
|
||||
## 🛠 Contributing
|
||||
|
||||
We welcome contributions from the community! Before you start, please review our [Contributing Guidelines](.github/CONTRIBUTING.md) to understand how to make the most effective and efficient contributions.
|
||||
|
||||
[Official LinUtil Roadmap](https://christitustech.github.io/linutil/roadmap)
|
||||
[Official LinUtil Roadmap](https://chris-titus-docs.github.io/linutil-docs/roadmap/)
|
||||
|
||||
Docs are now [here](https://github.com/Chris-Titus-Docs/linutil-docs)
|
||||
|
||||
## 🏅 Thanks to All Contributors
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
# Known Issues
|
||||
---
|
||||
|
||||
- [Known Issues](https://github.com/ChrisTitusTech/linutil/issues)
|
Binary file not shown.
Before Width: | Height: | Size: 9.6 KiB |
|
@ -1,89 +0,0 @@
|
|||
# VHS documentation
|
||||
#
|
||||
# Output:
|
||||
# Output <path>.gif Create a GIF output at the given <path>
|
||||
# Output <path>.mp4 Create an MP4 output at the given <path>
|
||||
# Output <path>.webm Create a WebM output at the given <path>
|
||||
#
|
||||
# Require:
|
||||
# Require <string> Ensure a program is on the $PATH to proceed
|
||||
#
|
||||
# Settings:
|
||||
# Set FontSize <number> Set the font size of the terminal
|
||||
# Set FontFamily <string> Set the font family of the terminal
|
||||
# Set Height <number> Set the height of the terminal
|
||||
# Set Width <number> Set the width of the terminal
|
||||
# Set LetterSpacing <float> Set the font letter spacing (tracking)
|
||||
# Set LineHeight <float> Set the font line height
|
||||
# Set LoopOffset <float>% Set the starting frame offset for the GIF loop
|
||||
# Set Theme <json|string> Set the theme of the terminal
|
||||
# Set Padding <number> Set the padding of the terminal
|
||||
# Set Framerate <number> Set the framerate of the recording
|
||||
# Set PlaybackSpeed <float> Set the playback speed of the recording
|
||||
# Set MarginFill <file|#000000> Set the file or color the margin will be filled with.
|
||||
# Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set.
|
||||
# Set BorderRadius <number> Set terminal border radius, in pixels.
|
||||
# Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight)
|
||||
# Set WindowBarSize <number> Set window bar size, in pixels. Default is 40.
|
||||
# Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms.
|
||||
#
|
||||
# Sleep:
|
||||
# Sleep <time> Sleep for a set amount of <time> in seconds
|
||||
#
|
||||
# Type:
|
||||
# Type[@<time>] "<characters>" Type <characters> into the terminal with a
|
||||
# <time> delay between each character
|
||||
#
|
||||
# Keys:
|
||||
# Escape[@<time>] [number] Press the Escape key
|
||||
# Backspace[@<time>] [number] Press the Backspace key
|
||||
# Delete[@<time>] [number] Press the Delete key
|
||||
# Insert[@<time>] [number] Press the Insert key
|
||||
# Down[@<time>] [number] Press the Down key
|
||||
# Enter[@<time>] [number] Press the Enter key
|
||||
# Space[@<time>] [number] Press the Space key
|
||||
# Tab[@<time>] [number] Press the Tab key
|
||||
# Left[@<time>] [number] Press the Left Arrow key
|
||||
# Right[@<time>] [number] Press the Right Arrow key
|
||||
# Up[@<time>] [number] Press the Up Arrow key
|
||||
# Down[@<time>] [number] Press the Down Arrow key
|
||||
# PageUp[@<time>] [number] Press the Page Up key
|
||||
# PageDown[@<time>] [number] Press the Page Down key
|
||||
# Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C)
|
||||
#
|
||||
# Display:
|
||||
# Hide Hide the subsequent commands from the output
|
||||
# Show Show the subsequent commands in the output
|
||||
|
||||
Output preview.gif
|
||||
|
||||
Require linutil
|
||||
Require sh
|
||||
|
||||
Set Shell "bash"
|
||||
Set FontFamily "JetBrainsMono Nerd Font"
|
||||
Set FontSize 24
|
||||
Set Width 1920
|
||||
Set Height 1080
|
||||
|
||||
Sleep 1s
|
||||
|
||||
Type "linutil" Sleep 1s Enter
|
||||
|
||||
Sleep 5s
|
||||
|
||||
Left Sleep 2s
|
||||
Down Sleep 1s
|
||||
Down Sleep 1s
|
||||
Down Sleep 1s
|
||||
Down Sleep 2s
|
||||
Right Sleep 3s
|
||||
|
||||
Type "/" Sleep 1s
|
||||
Type@200ms "System Cleanup" Sleep 1s Enter
|
||||
|
||||
Sleep 2s
|
||||
Enter Sleep 3s
|
||||
Type "y" Sleep 15s # CONFIRMATION PROMPT
|
||||
|
||||
Escape
|
|
@ -1,72 +0,0 @@
|
|||
<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->
|
||||
|
||||
# Contributing Guidelines for Linutil
|
||||
|
||||
Thank you for considering contributing to Linutil! We appreciate your effort in helping improve this project. To ensure that your contributions align with the goals and quality standards of Linutil, please follow these guidelines:
|
||||
|
||||
## 1. **Install Rust**:
|
||||
|
||||
Make sure you have Rust installed on your machine. You can install it by following the instructions at [rust-lang.org](https://www.rust-lang.org/tools/install).
|
||||
|
||||
## 2. **Fork and Clone the repo**
|
||||
|
||||
1. Make a fork of the repo in GitHub
|
||||
2. Clone the fork
|
||||
```bash
|
||||
git clone https://github.com/YOUR_USERNAME_HERE/linutil.git
|
||||
cd linutil
|
||||
```
|
||||
|
||||
## 3. Make your changes
|
||||
|
||||
- **Edit the files you want to change**: Make your changes to the relevant files.
|
||||
- **Test your changes**: Run `cargo run` to test your modifications in a local environment and ensure everything works as expected.
|
||||
|
||||
## 4. Understand the existing code
|
||||
|
||||
- **Have a clear reason**: Don’t change the way things are done without a valid reason. If you propose an alteration, be prepared to explain why it’s necessary and how it improves the project.
|
||||
- **Respect existing conventions**: Changes should align with the existing code style, design patterns, and overall project philosophy. If you want to introduce a new way of doing things, justify it clearly.
|
||||
|
||||
## 5. Learn from Past Pull Requests (PRs)
|
||||
|
||||
- **Check merged PRs**: Reviewing merged pull requests can give you an idea of what kind of contributions are accepted and how they are implemented.
|
||||
- **Study rejected PRs**: This is especially important as it helps you avoid making similar mistakes or proposing changes that have already been considered and declined.
|
||||
|
||||
## 6. Write Clean, Descriptive Commit Messages
|
||||
|
||||
- **Be descriptive**: Your commit messages should clearly describe what the change does and why it was made.
|
||||
- **Use the imperative mood**: For example, "Add feature X" or "Fix bug in Y", rather than "Added feature X" or "Fixed bug in Y".
|
||||
- **Keep commits clean**: Avoid committing a change and then immediately following it with a fix for that change. Instead, amend your commit or squash it if needed.
|
||||
|
||||
## 7. Keep Your Pull Requests (PRs) Small and Focused
|
||||
|
||||
- **Make small, targeted PRs**: Focus on one feature or fix per pull request. This makes it easier to review and increases the likelihood of acceptance.
|
||||
- **Avoid combining unrelated changes**: PRs that tackle multiple unrelated issues are harder to review and might be rejected because of a single problem.
|
||||
|
||||
## 8. Understand and Test the Code You Write
|
||||
|
||||
- **Review your code**: Before submitting your changes, take the time to review your code for readability, efficiency and performance. Consider how your changes affect the project.
|
||||
- **Avoid using LLMs**: Don't submit AI-generated code without reviewing and testing it first. Ensure that any code you submit is thoroughly understood and meets the project's standards.
|
||||
- **Testing Requirements**: Failure to conduct testing after multiple requests may result in the closure of your Pull Request.
|
||||
|
||||
## 9. Code Review and Feedback
|
||||
|
||||
- **Expect feedback**: PRs will undergo code review. Be open to feedback and willing to make adjustments as needed.
|
||||
- **Participate in reviews**: If you feel comfortable, review other contributors' PRs as well. Peer review is a great way to learn and ensure high-quality contributions.
|
||||
|
||||
## 10. Contributing Is More Than Just Code
|
||||
|
||||
- **Test the tool**: Running tests and providing feedback on how the tool works in different environments is a valuable contribution.
|
||||
- **Write well-formed issues**: Clearly describe bugs or problems you encounter, providing as much detail as possible, including steps to reproduce the issue.
|
||||
- **Propose reasonable feature requests**: When suggesting new features, ensure they fit within the scope, style, and design of the project. Provide clear reasoning and use cases.
|
||||
|
||||
## 11. Documentation
|
||||
|
||||
- **Update the documentation**: If your change affects the functionality, please update the relevant documentation files to reflect this.
|
||||
- **Automatic generation**: If you decide to add functionality through a new shell script, make sure to fill out all fields in `tab_data.toml` and run `cargo xtask docgen`.
|
||||
|
||||
## 12. License
|
||||
|
||||
- **Agree to the license**: By contributing to Linutil, you agree that your contributions will be licensed under the project's MIT license.
|
||||
|
||||
We appreciate your contributions and look forward to collaborating with you to make Linutil better!
|
|
@ -1,4 +0,0 @@
|
|||
# FAQ's
|
||||
|
||||
## How do I uninstall LinUtil?
|
||||
* You do not have to uninstall LinUtil. As it is a script you run from your terminal it only loads into your RAM. This means as soon as you close LinUtil it will be deleted off your system.
|
|
@ -1,76 +0,0 @@
|
|||
# Welcome to the LinUtil Documentation!
|
||||
|
||||
[![Version](https://img.shields.io/github/v/release/ChrisTitusTech/linutil?color=%230567ff&label=Latest%20Release&style=for-the-badge)](https://github.com/ChrisTitusTech/linutil/releases/latest)
|
||||
![GitHub Downloads (specific asset, all releases)](https://img.shields.io/github/downloads/ChrisTitusTech/linutil/linutil?label=Total%20Downloads&style=for-the-badge)
|
||||
[![](https://dcbadge.limes.pink/api/server/https://discord.gg/bujFYKAHSp)](https://discord.gg/bujFYKAHSp)
|
||||
|
||||
[![Crates.io Version](https://img.shields.io/crates/v/linutil_tui?style=for-the-badge&color=%23af3a03)](https://crates.io/crates/linutil_tui) [![linutil AUR Version](https://img.shields.io/aur/version/linutil?style=for-the-badge&label=%5BAUR%5D%20linutil&color=%23230567ff)](https://aur.archlinux.org/packages/linutil) [![linutil-bin AUR Version](https://img.shields.io/aur/version/linutil-bin?style=for-the-badge&label=%5BAUR%5D%20linutil-bin&color=%23230567ff)](https://aur.archlinux.org/packages/linutil-bin)
|
||||
|
||||
## Running the latest release of LinUtil
|
||||
|
||||
To get started, run the following command in your terminal:
|
||||
|
||||
### Stable branch
|
||||
|
||||
```
|
||||
curl -fsSL https://christitus.com/linux | sh
|
||||
```
|
||||
---
|
||||
|
||||
### Installation
|
||||
|
||||
LinUtil is also available as a package in various repositories:
|
||||
|
||||
[![Packaging status](https://repology.org/badge/vertical-allrepos/linutil.svg)](https://repology.org/project/linutil/versions)
|
||||
|
||||
<details>
|
||||
<summary>Arch Linux</summary>
|
||||
|
||||
LinUtil can be installed on [Arch Linux](https://archlinux.org) with three different [AUR](https://aur.archlinux.org) packages:
|
||||
|
||||
- `linutil` - Stable release compiled from source
|
||||
- `linutil-bin` - Stable release pre-compiled
|
||||
- `linutil-git` - Compiled from the last commit (not recommended)
|
||||
|
||||
by running:
|
||||
|
||||
```bash
|
||||
git clone https://aur.archlinux.org/<package>.git
|
||||
cd linutil
|
||||
makepkg -si
|
||||
```
|
||||
|
||||
Replace `<package>` with your preferred package.
|
||||
|
||||
If you use [yay](https://github.com/Jguer/yay), [paru](https://github.com/Morganamilo/paru) or any other [AUR Helper](https://wiki.archlinux.org/title/AUR_helpers), it's even simpler:
|
||||
|
||||
```bash
|
||||
paru -S linutil
|
||||
```
|
||||
|
||||
Replace `paru` with your preferred helper and `linutil` with your preferred package.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Cargo</summary>
|
||||
|
||||
LinUtil can be installed via [Cargo](https://doc.rust-lang.org/cargo) with:
|
||||
|
||||
```bash
|
||||
cargo install linutil
|
||||
```
|
||||
|
||||
Note that crates installed using `cargo install` require manual updating with `cargo install --force` (update functionality is [included in LinUtil](https://christitustech.github.io/linutil/userguide/#applications-setup))
|
||||
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
After you've ran the command, you should see a GUI on your screen; It will look something like this:
|
||||
|
||||
![preview](assets/preview.gif)
|
||||
|
||||
!!! info
|
||||
|
||||
LinUtil is updated weekly as of the time of writing. Consequently, features and functionalities may evolve, and the documentation may not always reflect the most current images or information.
|
|
@ -25,3 +25,4 @@
|
|||
|
||||
## Community Feedback
|
||||
- Encourage community input and suggestions for future development.
|
||||
|
||||
|
|
|
@ -140,3 +140,4 @@ https://github.com/ChrisTitusTech/dwm-titus
|
|||
- **Ollama**: This utility is designed to manage ollama in your system
|
||||
- **Service Manager**: This utility is designed to manage services in your system
|
||||
- **WiFi Manager**: This utility is designed to manage wifi in your system
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block header %}
|
||||
{{ super() }}
|
||||
<div style="color: red; text-align: center; padding: 10px; font-size: 20px;">
|
||||
<strong>Announcement:</strong> This documentation is still in progress.
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{# Empty block to override the footer #}
|
||||
{% endblock %}
|
|
@ -3,7 +3,7 @@ use std::borrow::Cow;
|
|||
use crate::{float::FloatContent, hint::Shortcut};
|
||||
|
||||
use ratatui::{
|
||||
crossterm::event::{KeyCode, KeyEvent},
|
||||
crossterm::event::{KeyCode, KeyEvent, MouseEvent, MouseEventKind},
|
||||
layout::Alignment,
|
||||
prelude::*,
|
||||
widgets::{Block, Borders, Clear, List},
|
||||
|
@ -85,6 +85,19 @@ impl FloatContent for ConfirmPrompt {
|
|||
frame.render_widget(List::new(paths_text), inner_area);
|
||||
}
|
||||
|
||||
fn handle_mouse_event(&mut self, event: &MouseEvent) -> bool {
|
||||
match event.kind {
|
||||
MouseEventKind::ScrollDown => {
|
||||
self.scroll_down();
|
||||
}
|
||||
MouseEventKind::ScrollUp => {
|
||||
self.scroll_up();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
||||
use KeyCode::*;
|
||||
self.status = match key.code {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ratatui::{
|
||||
crossterm::event::{KeyCode, KeyEvent},
|
||||
crossterm::event::{KeyCode, KeyEvent, MouseEvent},
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
Frame,
|
||||
};
|
||||
|
@ -9,6 +9,7 @@ use crate::hint::Shortcut;
|
|||
pub trait FloatContent {
|
||||
fn draw(&mut self, frame: &mut Frame, area: Rect);
|
||||
fn handle_key_event(&mut self, key: &KeyEvent) -> bool;
|
||||
fn handle_mouse_event(&mut self, key: &MouseEvent) -> bool;
|
||||
fn is_finished(&self) -> bool;
|
||||
fn get_shortcut_list(&self) -> (&str, Box<[Shortcut]>);
|
||||
}
|
||||
|
@ -53,6 +54,10 @@ impl<Content: FloatContent + ?Sized> Float<Content> {
|
|||
self.content.draw(frame, popup_area);
|
||||
}
|
||||
|
||||
pub fn handle_mouse_event(&mut self, event: &MouseEvent) {
|
||||
self.content.handle_mouse_event(event);
|
||||
}
|
||||
|
||||
// Returns true if the floating window is finished.
|
||||
pub fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
||||
match key.code {
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::{float::FloatContent, hint::Shortcut};
|
|||
use linutil_core::Command;
|
||||
|
||||
use ratatui::{
|
||||
crossterm::event::{KeyCode, KeyEvent},
|
||||
crossterm::event::{KeyCode, KeyEvent, MouseEvent, MouseEventKind},
|
||||
layout::Rect,
|
||||
style::{Style, Stylize},
|
||||
text::Line,
|
||||
|
@ -283,6 +283,17 @@ impl FloatContent for FloatingText {
|
|||
frame.render_widget(list, inner_area);
|
||||
}
|
||||
|
||||
fn handle_mouse_event(&mut self, event: &MouseEvent) -> bool {
|
||||
match event.kind {
|
||||
MouseEventKind::ScrollDown => self.scroll_down(),
|
||||
MouseEventKind::ScrollUp => self.scroll_up(),
|
||||
MouseEventKind::ScrollLeft => self.scroll_left(),
|
||||
MouseEventKind::ScrollRight => self.scroll_right(),
|
||||
_ => {}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
||||
use KeyCode::*;
|
||||
match key.code {
|
||||
|
|
|
@ -19,7 +19,7 @@ use clap::Parser;
|
|||
use ratatui::{
|
||||
backend::CrosstermBackend,
|
||||
crossterm::{
|
||||
event::{self, DisableMouseCapture, Event, KeyEventKind},
|
||||
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyEventKind},
|
||||
style::ResetColor,
|
||||
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
||||
ExecutableCommand,
|
||||
|
@ -63,6 +63,8 @@ fn main() -> io::Result<()> {
|
|||
);
|
||||
|
||||
stdout().execute(EnterAlternateScreen)?;
|
||||
stdout().execute(EnableMouseCapture)?;
|
||||
|
||||
enable_raw_mode()?;
|
||||
let mut terminal = Terminal::new(CrosstermBackend::new(stdout()))?;
|
||||
terminal.clear()?;
|
||||
|
@ -92,8 +94,8 @@ fn run(
|
|||
|
||||
// It's guaranteed that the `read()` won't block when the `poll()`
|
||||
// function returns `true`
|
||||
if let Event::Key(key) = event::read()? {
|
||||
// We are only interested in Press and Repeat events
|
||||
match event::read()? {
|
||||
Event::Key(key) => {
|
||||
if key.kind != KeyEventKind::Press && key.kind != KeyEventKind::Repeat {
|
||||
continue;
|
||||
}
|
||||
|
@ -102,5 +104,12 @@ fn run(
|
|||
return Ok(());
|
||||
}
|
||||
}
|
||||
Event::Mouse(mouse_event) => {
|
||||
if !state.handle_mouse(&mouse_event) {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use portable_pty::{
|
|||
ChildKiller, CommandBuilder, ExitStatus, MasterPty, NativePtySystem, PtySize, PtySystem,
|
||||
};
|
||||
use ratatui::{
|
||||
crossterm::event::{KeyCode, KeyEvent, KeyModifiers},
|
||||
crossterm::event::{KeyCode, KeyEvent, KeyModifiers, MouseEvent, MouseEventKind},
|
||||
layout::{Rect, Size},
|
||||
style::{Color, Style, Stylize},
|
||||
text::{Line, Span},
|
||||
|
@ -104,6 +104,18 @@ impl FloatContent for RunningCommand {
|
|||
frame.render_widget(pseudo_term, area);
|
||||
}
|
||||
|
||||
fn handle_mouse_event(&mut self, event: &MouseEvent) -> bool {
|
||||
match event.kind {
|
||||
MouseEventKind::ScrollUp => {
|
||||
self.scroll_offset = self.scroll_offset.saturating_add(1);
|
||||
}
|
||||
MouseEventKind::ScrollDown => {
|
||||
self.scroll_offset = self.scroll_offset.saturating_sub(1);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
true
|
||||
}
|
||||
/// Handle key events of the running command "window". Returns true when the "window" should be
|
||||
/// closed
|
||||
fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
||||
|
|
|
@ -12,8 +12,8 @@ use linutil_core::{ego_tree::NodeId, Config, ListNode, TabList};
|
|||
#[cfg(feature = "tips")]
|
||||
use rand::Rng;
|
||||
use ratatui::{
|
||||
crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers},
|
||||
layout::{Alignment, Constraint, Direction, Flex, Layout},
|
||||
crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers, MouseEvent, MouseEventKind},
|
||||
layout::{Alignment, Constraint, Direction, Flex, Layout, Position, Rect},
|
||||
style::{Style, Stylize},
|
||||
text::{Line, Span, Text},
|
||||
widgets::{Block, Borders, List, ListState, Paragraph},
|
||||
|
@ -41,6 +41,8 @@ P* - privileged *
|
|||
";
|
||||
|
||||
pub struct AppState {
|
||||
/// Areas of tabs
|
||||
areas: Option<Areas>,
|
||||
/// Selected theme
|
||||
theme: Theme,
|
||||
/// Currently focused area
|
||||
|
@ -79,6 +81,11 @@ pub struct ListEntry {
|
|||
pub has_children: bool,
|
||||
}
|
||||
|
||||
pub struct Areas {
|
||||
tab_list: Rect,
|
||||
list: Rect,
|
||||
}
|
||||
|
||||
enum SelectedItem {
|
||||
UpDir,
|
||||
Directory,
|
||||
|
@ -100,6 +107,7 @@ impl AppState {
|
|||
let auto_execute_commands = config_path.map(|path| Config::from_file(&path).auto_execute);
|
||||
|
||||
let mut state = Self {
|
||||
areas: None,
|
||||
theme,
|
||||
focus: Focus::List,
|
||||
tabs,
|
||||
|
@ -315,6 +323,11 @@ impl AppState {
|
|||
.split(horizontal[0]);
|
||||
frame.render_widget(label, left_chunks[0]);
|
||||
|
||||
self.areas = Some(Areas {
|
||||
tab_list: left_chunks[1],
|
||||
list: horizontal[1],
|
||||
});
|
||||
|
||||
let tabs = self
|
||||
.tabs
|
||||
.iter()
|
||||
|
@ -469,6 +482,59 @@ impl AppState {
|
|||
frame.render_widget(keybind_para, vertical[1]);
|
||||
}
|
||||
|
||||
pub fn handle_mouse(&mut self, event: &MouseEvent) -> bool {
|
||||
if !self.drawable {
|
||||
return true;
|
||||
}
|
||||
|
||||
if matches!(self.focus, Focus::TabList | Focus::List) {
|
||||
let position = Position::new(event.column, event.row);
|
||||
let mouse_in_tab_list = self.areas.as_ref().unwrap().tab_list.contains(position);
|
||||
let mouse_in_list = self.areas.as_ref().unwrap().list.contains(position);
|
||||
|
||||
match event.kind {
|
||||
MouseEventKind::Moved => {
|
||||
if mouse_in_list {
|
||||
self.focus = Focus::List
|
||||
} else if mouse_in_tab_list {
|
||||
self.focus = Focus::TabList
|
||||
}
|
||||
}
|
||||
MouseEventKind::ScrollDown => {
|
||||
if mouse_in_tab_list {
|
||||
if self.current_tab.selected().unwrap() != self.tabs.len() - 1 {
|
||||
self.current_tab.select_next();
|
||||
}
|
||||
self.refresh_tab();
|
||||
} else if mouse_in_list {
|
||||
self.selection.select_next()
|
||||
}
|
||||
}
|
||||
MouseEventKind::ScrollUp => {
|
||||
if mouse_in_tab_list {
|
||||
if self.current_tab.selected().unwrap() != 0 {
|
||||
self.current_tab.select_previous();
|
||||
}
|
||||
self.refresh_tab();
|
||||
} else if mouse_in_list {
|
||||
self.selection.select_previous()
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
match &mut self.focus {
|
||||
Focus::FloatingWindow(float) => {
|
||||
float.content.handle_mouse_event(event);
|
||||
}
|
||||
Focus::ConfirmationPrompt(confirm) => {
|
||||
confirm.content.handle_mouse_event(event);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
pub fn handle_key(&mut self, key: &KeyEvent) -> bool {
|
||||
// This should be defined first to allow closing
|
||||
// the application even when not drawable ( If terminal is small )
|
||||
|
|
Loading…
Reference in New Issue
Block a user