mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-23 21:51:56 +00:00
Compare commits
16 Commits
81b83c5d1f
...
af2caa8d1a
Author | SHA1 | Date | |
---|---|---|---|
|
af2caa8d1a | ||
|
02b06129e1 | ||
|
2f1f5fd543 | ||
|
0be3a44eb5 | ||
|
7147ed93e9 | ||
|
fab3415c48 | ||
|
16dd91ca29 | ||
|
c4ad5a9471 | ||
|
432d6b3b0c | ||
|
c42014d991 | ||
|
e93eca54a5 | ||
|
d8607487a6 | ||
|
f400eee4b1 | ||
|
da5fb7a511 | ||
|
2f773e2c7d | ||
|
76f8e6438b |
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
|
|
12
.github/workflows/preview.yml
vendored
12
.github/workflows/preview.yml
vendored
|
@ -34,15 +34,14 @@ jobs:
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
per_page: 1
|
per_page: 1
|
||||||
});
|
});
|
||||||
core.setOutput('result', releases.data[0].tag_name);
|
return releases.data[0].tag_name;
|
||||||
result-encoding: string
|
|
||||||
|
|
||||||
- name: Set tag name ( Workflow Run )
|
- name: Set tag name ( Workflow Run )
|
||||||
if: github.event_name == 'workflow_run'
|
if: github.event_name == 'workflow_run'
|
||||||
run: echo "tag_name=${{ steps.latest_tag.outputs.result }}" >> $GITHUB_ENV
|
run: echo "tag_name=${{ steps.latest_tag.outputs.result }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Set tag name ( Workflow Dispatch )
|
- name: Set tag name ( Workflow Dispatch )
|
||||||
if: ${{ github.event_name }} == 'workflow_dispatch'
|
if: github.event_name == 'workflow_dispatch'
|
||||||
run: echo "tag_name=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
|
run: echo "tag_name=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Download binary
|
- name: Download binary
|
||||||
|
@ -59,20 +58,19 @@ jobs:
|
||||||
- name: Generate preview
|
- name: Generate preview
|
||||||
uses: charmbracelet/vhs-action@v2.1.0
|
uses: charmbracelet/vhs-action@v2.1.0
|
||||||
with:
|
with:
|
||||||
path: "docs/assets/preview.tape"
|
path: ".github/preview.tape"
|
||||||
|
|
||||||
- name: Move preview
|
- name: Move preview
|
||||||
run: mv preview.gif docs/assets/preview.gif
|
run: mv preview.gif .github/preview.gif
|
||||||
|
|
||||||
- name: Create PR
|
- name: Create PR
|
||||||
uses: peter-evans/create-pull-request@v7.0.5
|
uses: peter-evans/create-pull-request@v7.0.5
|
||||||
with:
|
with:
|
||||||
commit-message: Preview for ${{ env.tag_name }}
|
commit-message: Preview for ${{ env.tag_name }}
|
||||||
file-pattern: "docs/assets/preview.gif"
|
|
||||||
add-options: "--force"
|
|
||||||
token: ${{ secrets.PAT_TOKEN }}
|
token: ${{ secrets.PAT_TOKEN }}
|
||||||
branch: feature/preview-${{ env.tag_name }}
|
branch: feature/preview-${{ env.tag_name }}
|
||||||
title: "Update preview for ${{ env.tag_name }}"
|
title: "Update preview for ${{ env.tag_name }}"
|
||||||
body: |
|
body: |
|
||||||
Automated PR to update preview gif for version ${{ env.tag_name }}
|
Automated PR to update preview gif for version ${{ env.tag_name }}
|
||||||
|
![preview](https://raw.githubusercontent.com/${{ github.repository }}/feature/preview-${{ env.tag_name }}/.github/preview.gif)
|
||||||
if: success()
|
if: success()
|
||||||
|
|
4
.github/workflows/shellcheck.yml
vendored
4
.github/workflows/shellcheck.yml
vendored
|
@ -6,6 +6,10 @@ on:
|
||||||
- '**/*.sh'
|
- '**/*.sh'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
shellcheck:
|
shellcheck:
|
||||||
name: Shellcheck
|
name: Shellcheck
|
||||||
|
|
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)
|
|
110
Cargo.lock
generated
110
Cargo.lock
generated
|
@ -29,55 +29,12 @@ version = "0.2.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
|
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstream"
|
|
||||||
version = "0.6.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
|
|
||||||
dependencies = [
|
|
||||||
"anstyle",
|
|
||||||
"anstyle-parse",
|
|
||||||
"anstyle-query",
|
|
||||||
"anstyle-wincon",
|
|
||||||
"colorchoice",
|
|
||||||
"is_terminal_polyfill",
|
|
||||||
"utf8parse",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle"
|
name = "anstyle"
|
||||||
version = "1.0.8"
|
version = "1.0.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
|
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-parse"
|
|
||||||
version = "0.2.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
|
|
||||||
dependencies = [
|
|
||||||
"utf8parse",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-query"
|
|
||||||
version = "1.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
|
|
||||||
dependencies = [
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-wincon"
|
|
||||||
version = "3.0.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
|
|
||||||
dependencies = [
|
|
||||||
"anstyle",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.88"
|
version = "1.0.88"
|
||||||
|
@ -144,6 +101,12 @@ version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg_aliases"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.20"
|
version = "4.5.20"
|
||||||
|
@ -160,10 +123,8 @@ version = "4.5.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54"
|
checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"clap_lex",
|
"clap_lex",
|
||||||
"strsim",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -184,12 +145,6 @@ version = "0.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
|
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "colorchoice"
|
|
||||||
version = "1.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "compact_str"
|
name = "compact_str"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
|
@ -304,6 +259,12 @@ dependencies = [
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.15.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
|
@ -346,12 +307,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.5.0"
|
version = "2.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
|
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown",
|
"hashbrown 0.15.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -379,12 +340,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "is_terminal_polyfill"
|
|
||||||
version = "1.70.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
|
@ -430,6 +385,7 @@ version = "24.9.28"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"linutil_core",
|
"linutil_core",
|
||||||
|
"nix 0.29.0",
|
||||||
"oneshot",
|
"oneshot",
|
||||||
"portable-pty",
|
"portable-pty",
|
||||||
"rand",
|
"rand",
|
||||||
|
@ -470,7 +426,7 @@ version = "0.12.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904"
|
checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown",
|
"hashbrown 0.14.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -515,6 +471,18 @@ dependencies = [
|
||||||
"pin-utils",
|
"pin-utils",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix"
|
||||||
|
version = "0.29.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.6.0",
|
||||||
|
"cfg-if",
|
||||||
|
"cfg_aliases",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-conv"
|
name = "num-conv"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -590,7 +558,7 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"nix",
|
"nix 0.25.1",
|
||||||
"serial",
|
"serial",
|
||||||
"shared_library",
|
"shared_library",
|
||||||
"shell-words",
|
"shell-words",
|
||||||
|
@ -684,9 +652,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.5.4"
|
version = "0.5.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853"
|
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
]
|
]
|
||||||
|
@ -892,12 +860,6 @@ version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520"
|
checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "strsim"
|
|
||||||
version = "0.11.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strum"
|
name = "strum"
|
||||||
version = "0.26.3"
|
version = "0.26.3"
|
||||||
|
@ -1022,9 +984,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.22.20"
|
version = "0.22.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d"
|
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -1279,9 +1241,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.6.18"
|
version = "0.6.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f"
|
checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
18
README.md
18
README.md
|
@ -7,7 +7,7 @@
|
||||||
<!-- TODO: crates.io package here + <br> -->
|
<!-- 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)
|
[![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.
|
**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.
|
||||||
|
|
||||||
|
@ -24,13 +24,16 @@ curl -fsSL https://christitus.com/linux | sh
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL https://christitus.com/linuxdev | sh
|
curl -fsSL https://christitus.com/linuxdev | sh
|
||||||
```
|
```
|
||||||
<details>
|
|
||||||
<summary>CLI arguments</summary>
|
### CLI arguments
|
||||||
|
|
||||||
Linutil supports various command-line arguments to customize its behavior. Here are some common arguments you can use:
|
Linutil supports various command-line arguments to customize its behavior. Here are some common arguments you can use:
|
||||||
|
|
||||||
- `-t, --theme <THEME>` : Set the theme to use in the application [default: default] [possible values: default, compatible].
|
- `-c, --config <CONFIG>` : Path to the configuration file.
|
||||||
- `--override-validation` : Show all available options, disregarding compatibility checks (UNSAFE).
|
- `--override-validation` : Show all available options, disregarding compatibility checks (UNSAFE).
|
||||||
|
- `--size-bypass` : Bypass the terminal size limit.
|
||||||
|
- `-y, --skip-confirmation` : Skip confirmation prompt before executing commands.
|
||||||
|
- `-t, --theme <THEME>` : Set the theme to use in the application [default: `default`] [possible values: `default`, `compatible`].
|
||||||
- `-h, --help` : Print help.
|
- `-h, --help` : Print help.
|
||||||
|
|
||||||
For more detailed usage, run:
|
For more detailed usage, run:
|
||||||
|
@ -42,7 +45,6 @@ curl -fsSL https://christitus.com/linux | sh -s -- --help
|
||||||
```bash
|
```bash
|
||||||
linutil --help
|
linutil --help
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
## ⬇️ Installation
|
## ⬇️ Installation
|
||||||
|
|
||||||
|
@ -128,13 +130,15 @@ If you find Linutil helpful, please consider giving it a ⭐️ to show your sup
|
||||||
|
|
||||||
## 🎓 Documentation
|
## 🎓 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
|
## 🛠 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.
|
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
|
## 🏅 Thanks to All Contributors
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,17 @@
|
||||||
|
|
||||||
installNgrok() {
|
installNgrok() {
|
||||||
if ! command_exists ngrok; then
|
if ! command_exists ngrok; then
|
||||||
printf "%b\n" "${YELLOW}Installing Ngrok...${RC}"
|
printf "%b\n" "${YELLOW}Installing Ngrok.${RC}"
|
||||||
curl -sSLO https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz | "$ESCALATION_TOOL" tar -xz -C /usr/local/bin
|
case "$ARCH" in
|
||||||
|
x86_64)
|
||||||
|
url="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz"
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
url="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
curl -sSL "$url" -o ngrok.tgz
|
||||||
|
"$ESCALATION_TOOL" tar -xzf ngrok.tgz -C /usr/local/bin
|
||||||
else
|
else
|
||||||
printf "%b\n" "${GREEN}Ngrok is already installed.${RC}"
|
printf "%b\n" "${GREEN}Ngrok is already installed.${RC}"
|
||||||
fi
|
fi
|
||||||
|
@ -13,4 +22,4 @@ installNgrok() {
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
installNgrok
|
installNgrok
|
||||||
|
|
|
@ -23,7 +23,12 @@ installSublime() {
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
"$ESCALATION_TOOL" rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg
|
"$ESCALATION_TOOL" rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo
|
dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1)
|
||||||
|
if [ "$dnf_version" -eq 4 ]; then
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.sublimetext.com/rpm/dev/x86_64/sublime-text.repo
|
||||||
|
else
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.sublimetext.com/rpm/dev/x86_64/sublime-text.repo
|
||||||
|
fi
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y sublime-text
|
"$ESCALATION_TOOL" "$PACKAGER" install -y sublime-text
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
111
core/tabs/applications-setup/auto-cpufreq.sh
Normal file
111
core/tabs/applications-setup/auto-cpufreq.sh
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. ../common-script.sh
|
||||||
|
|
||||||
|
installAutoCpufreq() {
|
||||||
|
clear
|
||||||
|
|
||||||
|
AUTO_CPUFREQ_PATH="$HOME/.local/share/auto-cpufreq"
|
||||||
|
|
||||||
|
if ! command_exists auto-cpufreq; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing auto-cpufreq.${RC}"
|
||||||
|
|
||||||
|
if ! command_exists git && [ "$PACKAGER" != "pacman" ]; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing git.${RC}"
|
||||||
|
case "$PACKAGER" in
|
||||||
|
*)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y git
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$PACKAGER" in
|
||||||
|
pacman)
|
||||||
|
if command_exists powerprofilesctl; then
|
||||||
|
printf "%b\n" "${YELLOW}Disabling powerprofilesctl service.${RC}"
|
||||||
|
"$ESCALATION_TOOL" systemctl disable --now power-profiles-daemon
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$AUR_HELPER" -S --needed --noconfirm auto-cpufreq
|
||||||
|
"$ESCALATION_TOOL" systemctl enable --now auto-cpufreq
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
mkdir -p "$HOME/.local/share"
|
||||||
|
|
||||||
|
if [ -d "$AUTO_CPUFREQ_PATH" ]; then
|
||||||
|
rm -rf "$AUTO_CPUFREQ_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "%b\n" "${YELLOW}Cloning auto-cpufreq repository.${RC}"
|
||||||
|
git clone --depth=1 https://github.com/AdnanHodzic/auto-cpufreq.git "$AUTO_CPUFREQ_PATH"
|
||||||
|
|
||||||
|
cd "$AUTO_CPUFREQ_PATH"
|
||||||
|
printf "%b\n" "${YELLOW}Running auto-cpufreq installer.${RC}"
|
||||||
|
"$ESCALATION_TOOL" ./auto-cpufreq-installer
|
||||||
|
"$ESCALATION_TOOL" auto-cpufreq --install
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}auto-cpufreq is already installed.${RC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
applyTweak() {
|
||||||
|
printf "%b\n" "${YELLOW}Configuring auto-cpufreq.${RC}"
|
||||||
|
|
||||||
|
if command_exists auto-cpufreq; then
|
||||||
|
if ls /sys/class/power_supply/BAT* >/dev/null 2>&1; then
|
||||||
|
printf "%b\n" "${GREEN}System detected as laptop. Updating auto-cpufreq for laptop.${RC}"
|
||||||
|
"$ESCALATION_TOOL" auto-cpufreq --force powersave
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}System detected as desktop. Updating auto-cpufreq for desktop.${RC}"
|
||||||
|
"$ESCALATION_TOOL" auto-cpufreq --force performance
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
printf "%b\n" "${RED}auto-cpufreq is not installed.${RC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
removeTweak() {
|
||||||
|
if command_exists auto-cpufreq; then
|
||||||
|
printf "%b\n" "${YELLOW}Removing auto-cpufreq tweak.${RC}"
|
||||||
|
"$ESCALATION_TOOL" auto-cpufreq --force reset
|
||||||
|
else
|
||||||
|
printf "%b\n" "${RED}auto-cpufreq is not installed.${RC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
printf "%b\n" "${YELLOW}Do you want to apply the auto-cpufreq tweak or remove it?${RC}"
|
||||||
|
printf "%b\n" "${YELLOW}1) Apply tweak${RC}"
|
||||||
|
printf "%b\n" "${YELLOW}2) Remove tweak${RC}"
|
||||||
|
printf "%b\n" "${YELLOW}3) Exit${RC}"
|
||||||
|
printf "%b" "Enter your choice [1/3]: "
|
||||||
|
read -r choice
|
||||||
|
|
||||||
|
case "$choice" in
|
||||||
|
1)
|
||||||
|
applyTweak
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
removeTweak
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
printf "%b\n" "${GREEN}Exiting.${RC}"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "%b\n" "${RED}Invalid choice. Exiting.${RC}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf "%b\n" "${GREEN}auto-cpufreq setup complete.${RC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
checkEscalationTool
|
||||||
|
installAutoCpufreq
|
||||||
|
main
|
|
@ -25,7 +25,12 @@ installBrave() {
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y dnf-plugins-core
|
"$ESCALATION_TOOL" "$PACKAGER" install -y dnf-plugins-core
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo
|
dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1)
|
||||||
|
if [ "$dnf_version" -eq 4 ]; then
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo
|
||||||
|
else
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo
|
||||||
|
fi
|
||||||
"$ESCALATION_TOOL" rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
|
"$ESCALATION_TOOL" rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y brave-browser
|
"$ESCALATION_TOOL" "$PACKAGER" install -y brave-browser
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -15,7 +15,12 @@ installVivaldi() {
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y dnf-plugins-core
|
"$ESCALATION_TOOL" "$PACKAGER" install -y dnf-plugins-core
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://repo.vivaldi.com/stable/vivaldi-fedora.repo
|
dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1)
|
||||||
|
if [ "$dnf_version" -eq 4 ]; then
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://repo.vivaldi.com/stable/vivaldi-fedora.repo
|
||||||
|
else
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://repo.vivaldi.com/stable/vivaldi-fedora.repo
|
||||||
|
fi
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y vivaldi-stable
|
"$ESCALATION_TOOL" "$PACKAGER" install -y vivaldi-stable
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
|
|
|
@ -28,7 +28,12 @@ install_docker() {
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
|
"$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
|
dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1)
|
||||||
|
if [ "$dnf_version" -eq 4 ]; then
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
|
||||||
|
else
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo
|
||||||
|
fi
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
|
"$ESCALATION_TOOL" "$PACKAGER" -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
|
||||||
"$ESCALATION_TOOL" systemctl enable --now docker
|
"$ESCALATION_TOOL" systemctl enable --now docker
|
||||||
;;
|
;;
|
||||||
|
@ -58,7 +63,12 @@ install_docker_compose() {
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
|
"$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
|
dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1)
|
||||||
|
if [ "$dnf_version" -eq 4 ]; then
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
|
||||||
|
else
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo
|
||||||
|
fi
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y docker-compose-plugin
|
"$ESCALATION_TOOL" "$PACKAGER" install -y docker-compose-plugin
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
|
|
|
@ -227,6 +227,12 @@ description = "Universal Android Debloater (UAD) is a tool designed to help user
|
||||||
script = "android-debloat.sh"
|
script = "android-debloat.sh"
|
||||||
task_list = "I"
|
task_list = "I"
|
||||||
|
|
||||||
|
[[data]]
|
||||||
|
name = "Auto CPU Frequency"
|
||||||
|
description = "Automatic CPU speed & power optimizer.\nhttps://github.com/AdnanHodzic/auto-cpufreq"
|
||||||
|
script = "auto-cpufreq.sh"
|
||||||
|
task_list = "I SS"
|
||||||
|
|
||||||
[[data]]
|
[[data]]
|
||||||
name = "Bash Prompt"
|
name = "Bash Prompt"
|
||||||
description = "The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems. It is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful. This command configures the key sections and functionalities defined in the .bashrc file from CTT's mybash repository. https://github.com/ChrisTitusTech/mybash"
|
description = "The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems. It is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful. This command configures the key sections and functionalities defined in the .bashrc file from CTT's mybash repository. https://github.com/ChrisTitusTech/mybash"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
. ../common-script.sh
|
. ../common-script.sh
|
||||||
|
|
||||||
checkGpu() {
|
checkGpu() {
|
||||||
if lspci | grep -i nvidia > /dev/null; then
|
if lspci | grep -i nvidia >/dev/null; then
|
||||||
printf "%b\n" "${RED}Waydroid is not compatible with NVIDIA GPUs.${RC}"
|
printf "%b\n" "${RED}Waydroid is not compatible with NVIDIA GPUs.${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -11,28 +11,31 @@ checkGpu() {
|
||||||
|
|
||||||
installWaydroid() {
|
installWaydroid() {
|
||||||
if ! command_exists waydroid; then
|
if ! command_exists waydroid; then
|
||||||
printf "%b\n" "${YELLOW}Installing Waydroid...${RC}"
|
printf "%b\n" "${YELLOW}Installing Waydroid...${RC}"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
"$AUR_HELPER" -S --needed --noconfirm waydroid
|
"$AUR_HELPER" -S --needed --noconfirm waydroid
|
||||||
|
|
||||||
if ! command_exists dkms; then
|
if ! command_exists dkms; then
|
||||||
installed_kernels=$("$PACKAGER" -Q | grep -E '^linux(| |-rt|-rt-lts|-hardened|-zen|-lts)[^-headers]' | cut -d ' ' -f 1)
|
|
||||||
for kernel in $installed_kernels; do
|
|
||||||
header="${kernel}-headers"
|
|
||||||
printf "%b\n" "${CYAN}Installing headers for $kernel...${RC}"
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$header"
|
|
||||||
done
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm dkms
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm dkms
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
installed_kernels=$("$PACKAGER" -Q | grep -E '^linux(| |-rt|-rt-lts|-hardened|-zen|-lts)[^-headers]' | cut -d ' ' -f 1)
|
||||||
|
for kernel in $installed_kernels; do
|
||||||
|
header="${kernel}-headers"
|
||||||
|
printf "%b\n" "${CYAN}Installing headers for $kernel...${RC}"
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$header"
|
||||||
|
done
|
||||||
|
|
||||||
"$AUR_HELPER" -S --needed --noconfirm binder_linux-dkms
|
"$AUR_HELPER" -S --needed --noconfirm binder_linux-dkms
|
||||||
"$ESCALATION_TOOL" modprobe binder-linux device=binder,hwbinder,vndbinder
|
"$ESCALATION_TOOL" modprobe binder-linux device=binder,hwbinder,vndbinder
|
||||||
;;
|
;;
|
||||||
apt-get|nala)
|
apt-get | nala)
|
||||||
curl https://repo.waydro.id | "$ESCALATION_TOOL" sh
|
curl https://repo.waydro.id | "$ESCALATION_TOOL" sh
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y waydroid
|
"$ESCALATION_TOOL" "$PACKAGER" install -y waydroid
|
||||||
if command_exists dkms; then
|
if command_exists dkms; then
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y git
|
||||||
mkdir -p "$HOME/.local/share/" # only create it if it doesnt exist
|
mkdir -p "$HOME/.local/share/"
|
||||||
git clone https://github.com/choff/anbox-modules.git "$HOME/.local/share/anbox-modules"
|
git clone https://github.com/choff/anbox-modules.git "$HOME/.local/share/anbox-modules"
|
||||||
cd "$HOME/.local/share/anbox-modules"
|
cd "$HOME/.local/share/anbox-modules"
|
||||||
"$ESCALATION_TOOL" cp anbox.conf /etc/modules-load.d/
|
"$ESCALATION_TOOL" cp anbox.conf /etc/modules-load.d/
|
||||||
|
@ -47,7 +50,7 @@ installWaydroid() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y waydroid
|
"$ESCALATION_TOOL" "$PACKAGER" install -y waydroid
|
||||||
if command_exists dkms; then
|
if command_exists dkms; then
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y git
|
||||||
mkdir -p "$HOME/.local/share/" # only create it if it doesnt exist
|
mkdir -p "$HOME/.local/share/"
|
||||||
git clone https://github.com/choff/anbox-modules.git "$HOME/.local/share/anbox-modules"
|
git clone https://github.com/choff/anbox-modules.git "$HOME/.local/share/anbox-modules"
|
||||||
cd "$HOME/.local/share/anbox-modules"
|
cd "$HOME/.local/share/anbox-modules"
|
||||||
"$ESCALATION_TOOL" cp anbox.conf /etc/modules-load.d/
|
"$ESCALATION_TOOL" cp anbox.conf /etc/modules-load.d/
|
||||||
|
|
|
@ -86,6 +86,13 @@ checkAURHelper() {
|
||||||
checkEscalationTool() {
|
checkEscalationTool() {
|
||||||
## Check for escalation tools.
|
## Check for escalation tools.
|
||||||
if [ -z "$ESCALATION_TOOL_CHECKED" ]; then
|
if [ -z "$ESCALATION_TOOL_CHECKED" ]; then
|
||||||
|
if [ "$(id -u)" = "0" ]; then
|
||||||
|
ESCALATION_TOOL="eval"
|
||||||
|
ESCALATION_TOOL_CHECKED=true
|
||||||
|
printf "%b\n" "${CYAN}Running as root, no escalation needed${RC}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
ESCALATION_TOOLS='sudo doas'
|
ESCALATION_TOOLS='sudo doas'
|
||||||
for tool in ${ESCALATION_TOOLS}; do
|
for tool in ${ESCALATION_TOOLS}; do
|
||||||
if command_exists "${tool}"; then
|
if command_exists "${tool}"; then
|
||||||
|
|
|
@ -236,7 +236,8 @@ write_iso(){
|
||||||
printf "%b" "${RED}WARNING: This will erase all data on ${USB_DEVICE}. Are you sure you want to continue? (y/N): ${RC}"
|
printf "%b" "${RED}WARNING: This will erase all data on ${USB_DEVICE}. Are you sure you want to continue? (y/N): ${RC}"
|
||||||
read -r CONFIRMATION
|
read -r CONFIRMATION
|
||||||
|
|
||||||
if [ "$CONFIRMATION" != "yes" ]; then
|
CONFIRMATION="$(echo "$CONFIRMATION" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
if [ "${CONFIRMATION}" != "yes" ] && [ "${CONFIRMATION}" != "y" ]; then
|
||||||
printf "%b\n" "${YELLOW}Operation cancelled.${RC}"
|
printf "%b\n" "${YELLOW}Operation cancelled.${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
#!/bin/sh -e
|
|
||||||
|
|
||||||
. ../common-script.sh
|
|
||||||
|
|
||||||
installAutoCpufreq() {
|
|
||||||
clear
|
|
||||||
printf "%b\n" "${YELLOW}Checking if auto-cpufreq is already installed...${RC}"
|
|
||||||
|
|
||||||
# Check if auto-cpufreq is already installed
|
|
||||||
if command_exists auto-cpufreq; then
|
|
||||||
printf "%b\n" "${GREEN}auto-cpufreq is already installed.${RC}"
|
|
||||||
else
|
|
||||||
printf "%b\n" "${YELLOW}Installing auto-cpufreq...${RC}"
|
|
||||||
|
|
||||||
# Install git if not already installed
|
|
||||||
if ! command_exists git; then
|
|
||||||
printf "%b\n" "${YELLOW}git not found. Installing git...${RC}"
|
|
||||||
case "$PACKAGER" in
|
|
||||||
pacman)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm git
|
|
||||||
;;
|
|
||||||
apk)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" add git
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y git
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clone the auto-cpufreq repository and run the installer
|
|
||||||
if [ ! -d "auto-cpufreq" ]; then
|
|
||||||
printf "%b\n" "${YELLOW}Cloning auto-cpufreq repository...${RC}"
|
|
||||||
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd auto-cpufreq
|
|
||||||
printf "%b\n" "${YELLOW}Running auto-cpufreq installer...${RC}"
|
|
||||||
"$ESCALATION_TOOL" ./auto-cpufreq-installer
|
|
||||||
"$ESCALATION_TOOL" auto-cpufreq --install
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
configureAutoCpufreq() {
|
|
||||||
printf "%b\n" "${YELLOW}Configuring auto-cpufreq...${RC}"
|
|
||||||
|
|
||||||
if command_exists auto-cpufreq; then
|
|
||||||
# Check if the system has a battery to determine if it's a laptop
|
|
||||||
if ls /sys/class/power_supply/BAT* >/dev/null 2>&1; then
|
|
||||||
printf "%b\n" "${GREEN}System detected as laptop. Updating auto-cpufreq for laptop...${RC}"
|
|
||||||
"$ESCALATION_TOOL" auto-cpufreq --force powersave
|
|
||||||
else
|
|
||||||
printf "%b\n" "${GREEN}System detected as desktop. Updating auto-cpufreq for desktop...${RC}"
|
|
||||||
"$ESCALATION_TOOL" auto-cpufreq --force performance
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
printf "%b\n" "${RED}auto-cpufreq is not installed, skipping configuration.${RC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
removeAutoCpufreqTweak() {
|
|
||||||
printf "%b\n" "${YELLOW}Removing auto-cpufreq tweak...${RC}"
|
|
||||||
|
|
||||||
if command_exists auto-cpufreq; then
|
|
||||||
printf "%b\n" "${YELLOW}Resetting auto-cpufreq configuration...${RC}"
|
|
||||||
"$ESCALATION_TOOL" auto-cpufreq --force reset
|
|
||||||
else
|
|
||||||
printf "%b\n" "${RED}auto-cpufreq is not installed, skipping removal.${RC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
apply_or_remove_auto_cpufreq() {
|
|
||||||
# Prompt user for action
|
|
||||||
printf "%b\n" "${YELLOW}Do you want to apply the auto-cpufreq tweak or remove it?${RC}"
|
|
||||||
printf "%b\n" "${YELLOW}1) Apply tweak${RC}"
|
|
||||||
printf "%b\n" "${YELLOW}2) Remove tweak${RC}"
|
|
||||||
printf "%b" "Enter your choice [1/2]: "
|
|
||||||
read -r choice
|
|
||||||
|
|
||||||
case $choice in
|
|
||||||
1)
|
|
||||||
configureAutoCpufreq
|
|
||||||
;;
|
|
||||||
2)
|
|
||||||
removeAutoCpufreqTweak
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
printf "%b\n" "${RED}Invalid choice. Exiting.${RC}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
printf "%b\n" "${GREEN}auto-cpufreq setup complete.${RC}"
|
|
||||||
}
|
|
||||||
|
|
||||||
checkEnv
|
|
||||||
checkEscalationTool
|
|
||||||
installAutoCpufreq
|
|
||||||
apply_or_remove_auto_cpufreq
|
|
|
@ -127,11 +127,6 @@ name = "Auto Login"
|
||||||
script = "auto-login.sh"
|
script = "auto-login.sh"
|
||||||
task_list = "DE setup"
|
task_list = "DE setup"
|
||||||
|
|
||||||
[[data]]
|
|
||||||
name = "Auto Power Profiling"
|
|
||||||
script = "power-profile.sh"
|
|
||||||
task_list = "I"
|
|
||||||
|
|
||||||
[[data]]
|
[[data]]
|
||||||
name = "Bluetooth Manager"
|
name = "Bluetooth Manager"
|
||||||
description = "This utility is designed to manage bluetooth in your system"
|
description = "This utility is designed to manage bluetooth in your system"
|
||||||
|
|
|
@ -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
|
## Community Feedback
|
||||||
- Encourage community input and suggestions for future development.
|
- 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
|
- **Ollama**: This utility is designed to manage ollama in your system
|
||||||
- **Service Manager**: This utility is designed to manage services 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
|
- **WiFi Manager**: This utility is designed to manage wifi in your system
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" manpage for Linutil
|
.\" manpage for Linutil
|
||||||
.TH "linutil" "1" "October 2024" "" "Linutil Manual"
|
.TH "linutil" "1" "November 2024" "Linutil 2024.10.31" "Linutil Manual"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
linutil \- Chris Titus Tech's Linux Toolbox
|
linutil \- Chris Titus Tech's Linux Toolbox
|
||||||
|
@ -26,6 +26,18 @@ curl -fsSL https://christitus.com/linuxdev | sh
|
||||||
\fB\-c\fR, \fB\-\-config\fR \fI<path>\fR
|
\fB\-c\fR, \fB\-\-config\fR \fI<path>\fR
|
||||||
Path to the configuration file.
|
Path to the configuration file.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-\-override\-validation\fR
|
||||||
|
Show all available entries, disregarding compatibility checks (\fBUNSAFE\fR).
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-\-size\-bypass\fR
|
||||||
|
Bypass the terminal size limit.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-y\fR, \fB\-\-skip\-confirmation\fR
|
||||||
|
Skip confirmation prompt before executing commands.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-t\fR, \fB\-\-theme\fR \fI<theme>\fR
|
\fB\-t\fR, \fB\-\-theme\fR \fI<theme>\fR
|
||||||
Set the theme to use in the TUI.
|
Set the theme to use in the TUI.
|
||||||
|
@ -36,18 +48,6 @@ Possible values:
|
||||||
.br
|
.br
|
||||||
Defaults to \fIdefault\fR.
|
Defaults to \fIdefault\fR.
|
||||||
|
|
||||||
.TP
|
|
||||||
\fB\-y\fR, \fB\-\-skip\-confirmation\fR
|
|
||||||
Skip confirmation prompt before executing commands.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fB\-\-override\-validation\fR
|
|
||||||
Show all available entries, disregarding compatibility checks. (\fBUNSAFE\fR)
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fB\-\-size\-bypass\fR
|
|
||||||
Bypass the terminal size limit
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-h\fR, \fB\-\-help\fR
|
\fB\-h\fR, \fB\-\-help\fR
|
||||||
Print help.
|
Print help.
|
||||||
|
|
|
@ -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 %}
|
|
|
@ -14,18 +14,19 @@ default = ["tips"]
|
||||||
tips = ["rand"]
|
tips = ["rand"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.5.20", features = ["derive"] }
|
clap = { version = "4.5.20", features = ["derive", "std"], default-features = false }
|
||||||
oneshot = "0.1.8"
|
oneshot = { version = "0.1.8", features = ["std"], default-features = false }
|
||||||
portable-pty = "0.8.1"
|
portable-pty = "0.8.1"
|
||||||
ratatui = "0.29.0"
|
ratatui = { version = "0.29.0", features = ["crossterm"], default-features = false }
|
||||||
tui-term = "0.2.0"
|
tui-term = "0.2.0"
|
||||||
temp-dir = "0.1.14"
|
temp-dir = "0.1.14"
|
||||||
time = { version = "0.3.36", features = ["local-offset", "macros", "formatting"] }
|
time = { version = "0.3.36", features = ["formatting", "local-offset", "macros"], default-features = false }
|
||||||
|
unicode-width = { version = "0.2.0", default-features = false }
|
||||||
rand = { version = "0.8.5", optional = true }
|
rand = { version = "0.8.5", optional = true }
|
||||||
linutil_core = { path = "../core", version = "24.9.28" }
|
linutil_core = { version = "24.9.28", path = "../core" }
|
||||||
tree-sitter-highlight = "0.24.3"
|
tree-sitter-highlight = "0.24.3"
|
||||||
tree-sitter-bash = "0.23.1"
|
tree-sitter-bash = "0.23.1"
|
||||||
unicode-width = "0.2.0"
|
nix = { version = "0.29.0", features = [ "user" ] }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "linutil"
|
name = "linutil"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{float::FloatContent, hint::Shortcut, theme};
|
use crate::{float::FloatContent, hint::Shortcut, theme};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
crossterm::event::{KeyCode, KeyEvent},
|
crossterm::event::{KeyCode, KeyEvent, MouseEvent, MouseEventKind},
|
||||||
layout::Alignment,
|
layout::Alignment,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
widgets::{Block, Borders, Clear, List},
|
widgets::{Block, Borders, Clear, List},
|
||||||
|
@ -86,6 +86,19 @@ impl FloatContent for ConfirmPrompt {
|
||||||
frame.render_widget(List::new(paths_text), inner_area);
|
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 {
|
fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
||||||
use ConfirmStatus::*;
|
use ConfirmStatus::*;
|
||||||
use KeyCode::{Char, Down, Esc, Up};
|
use KeyCode::{Char, Down, Esc, Up};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{hint::Shortcut, theme::Theme};
|
use crate::{hint::Shortcut, theme::Theme};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
crossterm::event::{KeyCode, KeyEvent},
|
crossterm::event::{KeyCode, KeyEvent, MouseEvent},
|
||||||
layout::{Constraint, Direction, Layout, Rect},
|
layout::{Constraint, Direction, Layout, Rect},
|
||||||
Frame,
|
Frame,
|
||||||
};
|
};
|
||||||
|
@ -8,6 +8,7 @@ use ratatui::{
|
||||||
pub trait FloatContent {
|
pub trait FloatContent {
|
||||||
fn draw(&mut self, frame: &mut Frame, area: Rect, theme: &Theme);
|
fn draw(&mut self, frame: &mut Frame, area: Rect, theme: &Theme);
|
||||||
fn handle_key_event(&mut self, key: &KeyEvent) -> bool;
|
fn handle_key_event(&mut self, key: &KeyEvent) -> bool;
|
||||||
|
fn handle_mouse_event(&mut self, key: &MouseEvent) -> bool;
|
||||||
fn is_finished(&self) -> bool;
|
fn is_finished(&self) -> bool;
|
||||||
fn get_shortcut_list(&self) -> (&str, Box<[Shortcut]>);
|
fn get_shortcut_list(&self) -> (&str, Box<[Shortcut]>);
|
||||||
}
|
}
|
||||||
|
@ -52,6 +53,10 @@ impl<Content: FloatContent + ?Sized> Float<Content> {
|
||||||
self.content.draw(frame, popup_area, theme);
|
self.content.draw(frame, popup_area, theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn handle_mouse_event(&mut self, event: &MouseEvent) {
|
||||||
|
self.content.handle_mouse_event(event);
|
||||||
|
}
|
||||||
|
|
||||||
// Returns true if the floating window is finished.
|
// Returns true if the floating window is finished.
|
||||||
pub fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
pub fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
||||||
match key.code {
|
match key.code {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::{float::FloatContent, hint::Shortcut, theme::Theme};
|
use crate::{float::FloatContent, hint::Shortcut, theme::Theme};
|
||||||
use linutil_core::Command;
|
use linutil_core::Command;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
crossterm::event::{KeyCode, KeyEvent},
|
crossterm::event::{KeyCode, KeyEvent, MouseEvent, MouseEventKind},
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
style::{Color, Style, Stylize},
|
style::{Color, Style, Stylize},
|
||||||
text::{Line, Span, Text},
|
text::{Line, Span, Text},
|
||||||
|
@ -200,6 +200,17 @@ impl<'a> FloatContent for FloatingText<'a> {
|
||||||
frame.render_widget(paragraph, inner_area);
|
frame.render_widget(paragraph, 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 {
|
fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
||||||
use KeyCode::{Char, Down, Left, Right, Up};
|
use KeyCode::{Char, Down, Left, Right, Up};
|
||||||
match key.code {
|
match key.code {
|
||||||
|
|
|
@ -3,6 +3,7 @@ mod filter;
|
||||||
mod float;
|
mod float;
|
||||||
mod floating_text;
|
mod floating_text;
|
||||||
mod hint;
|
mod hint;
|
||||||
|
mod root;
|
||||||
mod running_command;
|
mod running_command;
|
||||||
pub mod state;
|
pub mod state;
|
||||||
mod theme;
|
mod theme;
|
||||||
|
@ -12,7 +13,7 @@ use clap::Parser;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
backend::CrosstermBackend,
|
backend::CrosstermBackend,
|
||||||
crossterm::{
|
crossterm::{
|
||||||
event::{self, DisableMouseCapture, Event, KeyEventKind},
|
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyEventKind},
|
||||||
style::ResetColor,
|
style::ResetColor,
|
||||||
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
||||||
ExecutableCommand,
|
ExecutableCommand,
|
||||||
|
@ -61,6 +62,8 @@ fn main() -> io::Result<()> {
|
||||||
);
|
);
|
||||||
|
|
||||||
stdout().execute(EnterAlternateScreen)?;
|
stdout().execute(EnterAlternateScreen)?;
|
||||||
|
stdout().execute(EnableMouseCapture)?;
|
||||||
|
|
||||||
enable_raw_mode()?;
|
enable_raw_mode()?;
|
||||||
let mut terminal = Terminal::new(CrosstermBackend::new(stdout()))?;
|
let mut terminal = Terminal::new(CrosstermBackend::new(stdout()))?;
|
||||||
terminal.clear()?;
|
terminal.clear()?;
|
||||||
|
@ -90,15 +93,22 @@ fn run(
|
||||||
|
|
||||||
// It's guaranteed that the `read()` won't block when the `poll()`
|
// It's guaranteed that the `read()` won't block when the `poll()`
|
||||||
// function returns `true`
|
// function returns `true`
|
||||||
if let Event::Key(key) = event::read()? {
|
match event::read()? {
|
||||||
// We are only interested in Press and Repeat events
|
Event::Key(key) => {
|
||||||
if key.kind != KeyEventKind::Press && key.kind != KeyEventKind::Repeat {
|
if key.kind != KeyEventKind::Press && key.kind != KeyEventKind::Repeat {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !state.handle_key(&key) {
|
if !state.handle_key(&key) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Event::Mouse(mouse_event) => {
|
||||||
|
if !state.handle_mouse(&mouse_event) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
17
tui/src/root.rs
Normal file
17
tui/src/root.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
use crate::floating_text::FloatingText;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
use nix::unistd::Uid;
|
||||||
|
|
||||||
|
const ROOT_WARNING: &str = "WARNING: You are running this utility as root!\n
|
||||||
|
This means you have full system access and commands can potentially damage your system if used incorrectly.\n
|
||||||
|
Please proceed with caution and make sure you understand what each script does before executing it.";
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
pub fn check_root_status<'a>() -> Option<FloatingText<'a>> {
|
||||||
|
(Uid::effective().is_root()).then_some(FloatingText::new(
|
||||||
|
ROOT_WARNING.into(),
|
||||||
|
"Root User Warning",
|
||||||
|
true,
|
||||||
|
))
|
||||||
|
}
|
|
@ -5,10 +5,10 @@ use portable_pty::{
|
||||||
ChildKiller, CommandBuilder, ExitStatus, MasterPty, NativePtySystem, PtySize, PtySystem,
|
ChildKiller, CommandBuilder, ExitStatus, MasterPty, NativePtySystem, PtySize, PtySystem,
|
||||||
};
|
};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
crossterm::event::{KeyCode, KeyEvent, KeyModifiers},
|
crossterm::event::{KeyCode, KeyEvent, KeyModifiers, MouseEvent, MouseEventKind},
|
||||||
layout::{Rect, Size},
|
layout::{Rect, Size},
|
||||||
style::{Style, Stylize},
|
style::{Style, Stylize},
|
||||||
text::{Line, Span},
|
text::Line,
|
||||||
widgets::{Block, Borders},
|
widgets::{Block, Borders},
|
||||||
Frame,
|
Frame,
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@ use std::{
|
||||||
};
|
};
|
||||||
use time::{macros::format_description, OffsetDateTime};
|
use time::{macros::format_description, OffsetDateTime};
|
||||||
use tui_term::{
|
use tui_term::{
|
||||||
vt100::{self, Screen},
|
vt100::{Parser, Screen},
|
||||||
widget::PseudoTerminal,
|
widget::PseudoTerminal,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,12 +44,6 @@ pub struct RunningCommand {
|
||||||
|
|
||||||
impl FloatContent for RunningCommand {
|
impl FloatContent for RunningCommand {
|
||||||
fn draw(&mut self, frame: &mut Frame, area: Rect, theme: &Theme) {
|
fn draw(&mut self, frame: &mut Frame, area: Rect, theme: &Theme) {
|
||||||
// Calculate the inner size of the terminal area, considering borders
|
|
||||||
let inner_size = Size {
|
|
||||||
width: area.width - 2, // Adjust for border width
|
|
||||||
height: area.height - 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Define the block for the terminal display
|
// Define the block for the terminal display
|
||||||
let block = if !self.is_finished() {
|
let block = if !self.is_finished() {
|
||||||
// Display a block indicating the command is running
|
// Display a block indicating the command is running
|
||||||
|
@ -61,42 +55,33 @@ impl FloatContent for RunningCommand {
|
||||||
.title_bottom(Line::from("Press Ctrl-C to KILL the command"))
|
.title_bottom(Line::from("Press Ctrl-C to KILL the command"))
|
||||||
} else {
|
} else {
|
||||||
// Display a block with the command's exit status
|
// Display a block with the command's exit status
|
||||||
let mut title_line = if self.get_exit_status().success() {
|
let title_line = if self.get_exit_status().success() {
|
||||||
Line::from(
|
Line::styled(
|
||||||
Span::default()
|
"SUCCESS! Press <ENTER> to close this window",
|
||||||
.content("SUCCESS!")
|
Style::default().fg(theme.success_color()).reversed(),
|
||||||
.style(Style::default().fg(theme.success_color()).reversed()),
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Line::from(
|
Line::styled(
|
||||||
Span::default()
|
"FAILED! Press <ENTER> to close this window",
|
||||||
.content("FAILED!")
|
Style::default().fg(theme.fail_color()).reversed(),
|
||||||
.style(Style::default().fg(theme.fail_color()).reversed()),
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
title_line.push_span(
|
let log_path = if let Some(log_path) = &self.log_path {
|
||||||
Span::default()
|
Line::from(format!(" Log saved: {} ", log_path)).centered()
|
||||||
.content(" Press <ENTER> to close this window ")
|
} else {
|
||||||
.style(Style::default()),
|
Line::from(" Press 'l' to save command log ").centered()
|
||||||
);
|
};
|
||||||
|
|
||||||
let mut block = Block::default()
|
Block::default()
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_set(ratatui::symbols::border::ROUNDED)
|
.border_set(ratatui::symbols::border::ROUNDED)
|
||||||
.title_top(title_line.centered());
|
.title_top(title_line.centered())
|
||||||
|
.title_bottom(log_path)
|
||||||
if let Some(log_path) = &self.log_path {
|
|
||||||
block =
|
|
||||||
block.title_bottom(Line::from(format!(" Log saved: {} ", log_path)).centered());
|
|
||||||
} else {
|
|
||||||
block =
|
|
||||||
block.title_bottom(Line::from(" Press 'l' to save command log ").centered());
|
|
||||||
}
|
|
||||||
|
|
||||||
block
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Calculate the inner size of the terminal area, considering borders
|
||||||
|
let inner_size = block.inner(area).as_size();
|
||||||
// Process the buffer and create the pseudo-terminal widget
|
// Process the buffer and create the pseudo-terminal widget
|
||||||
let screen = self.screen(inner_size);
|
let screen = self.screen(inner_size);
|
||||||
let pseudo_term = PseudoTerminal::new(&screen).block(block);
|
let pseudo_term = PseudoTerminal::new(&screen).block(block);
|
||||||
|
@ -105,6 +90,18 @@ impl FloatContent for RunningCommand {
|
||||||
frame.render_widget(pseudo_term, area);
|
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
|
/// Handle key events of the running command "window". Returns true when the "window" should be
|
||||||
/// closed
|
/// closed
|
||||||
fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
||||||
|
@ -168,7 +165,7 @@ impl FloatContent for RunningCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RunningCommand {
|
impl RunningCommand {
|
||||||
pub fn new(commands: Vec<Command>) -> Self {
|
pub fn new(commands: &[&Command]) -> Self {
|
||||||
let pty_system = NativePtySystem::default();
|
let pty_system = NativePtySystem::default();
|
||||||
|
|
||||||
// Build the command based on the provided Command enum variant
|
// Build the command based on the provided Command enum variant
|
||||||
|
@ -188,10 +185,10 @@ impl RunningCommand {
|
||||||
if let Some(parent_directory) = file.parent() {
|
if let Some(parent_directory) = file.parent() {
|
||||||
script.push_str(&format!("cd {}\n", parent_directory.display()));
|
script.push_str(&format!("cd {}\n", parent_directory.display()));
|
||||||
}
|
}
|
||||||
script.push_str(&executable);
|
script.push_str(executable);
|
||||||
for arg in args {
|
for arg in args {
|
||||||
script.push(' ');
|
script.push(' ');
|
||||||
script.push_str(&arg);
|
script.push_str(arg);
|
||||||
}
|
}
|
||||||
script.push('\n'); // Ensures that each command is properly separated for execution preventing directory errors
|
script.push('\n'); // Ensures that each command is properly separated for execution preventing directory errors
|
||||||
}
|
}
|
||||||
|
@ -274,7 +271,7 @@ impl RunningCommand {
|
||||||
// Process the buffer with a parser with the current screen size
|
// Process the buffer with a parser with the current screen size
|
||||||
// We don't actually need to create a new parser every time, but it is so much easier this
|
// We don't actually need to create a new parser every time, but it is so much easier this
|
||||||
// way, and doesn't cost that much
|
// way, and doesn't cost that much
|
||||||
let mut parser = vt100::Parser::new(size.height, size.width, 1000);
|
let mut parser = Parser::new(size.height, size.width, 1000);
|
||||||
let mutex = self.buffer.lock();
|
let mutex = self.buffer.lock();
|
||||||
let buffer = mutex.as_ref().unwrap();
|
let buffer = mutex.as_ref().unwrap();
|
||||||
parser.process(buffer);
|
parser.process(buffer);
|
||||||
|
|
|
@ -4,16 +4,17 @@ use crate::{
|
||||||
float::{Float, FloatContent},
|
float::{Float, FloatContent},
|
||||||
floating_text::FloatingText,
|
floating_text::FloatingText,
|
||||||
hint::{create_shortcut_list, Shortcut},
|
hint::{create_shortcut_list, Shortcut},
|
||||||
|
root::check_root_status,
|
||||||
running_command::RunningCommand,
|
running_command::RunningCommand,
|
||||||
theme::Theme,
|
theme::Theme,
|
||||||
};
|
};
|
||||||
|
|
||||||
use linutil_core::{ego_tree::NodeId, Config, ListNode, TabList};
|
use linutil_core::{ego_tree::NodeId, Command, Config, ListNode, TabList};
|
||||||
#[cfg(feature = "tips")]
|
#[cfg(feature = "tips")]
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers},
|
crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers, MouseEvent, MouseEventKind},
|
||||||
layout::{Alignment, Constraint, Direction, Flex, Layout},
|
layout::{Alignment, Constraint, Direction, Flex, Layout, Position, Rect},
|
||||||
style::{Style, Stylize},
|
style::{Style, Stylize},
|
||||||
text::{Line, Span, Text},
|
text::{Line, Span, Text},
|
||||||
widgets::{Block, Borders, List, ListState, Paragraph},
|
widgets::{Block, Borders, List, ListState, Paragraph},
|
||||||
|
@ -41,6 +42,8 @@ P* - privileged *
|
||||||
";
|
";
|
||||||
|
|
||||||
pub struct AppState {
|
pub struct AppState {
|
||||||
|
/// Areas of tabs
|
||||||
|
areas: Option<Areas>,
|
||||||
/// Selected theme
|
/// Selected theme
|
||||||
theme: Theme,
|
theme: Theme,
|
||||||
/// Currently focused area
|
/// Currently focused area
|
||||||
|
@ -79,6 +82,11 @@ pub struct ListEntry {
|
||||||
pub has_children: bool,
|
pub has_children: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct Areas {
|
||||||
|
tab_list: Rect,
|
||||||
|
list: Rect,
|
||||||
|
}
|
||||||
|
|
||||||
enum SelectedItem {
|
enum SelectedItem {
|
||||||
UpDir,
|
UpDir,
|
||||||
Directory,
|
Directory,
|
||||||
|
@ -100,6 +108,7 @@ impl AppState {
|
||||||
let auto_execute_commands = config_path.map(|path| Config::from_file(&path).auto_execute);
|
let auto_execute_commands = config_path.map(|path| Config::from_file(&path).auto_execute);
|
||||||
|
|
||||||
let mut state = Self {
|
let mut state = Self {
|
||||||
|
areas: None,
|
||||||
theme,
|
theme,
|
||||||
focus: Focus::List,
|
focus: Focus::List,
|
||||||
tabs,
|
tabs,
|
||||||
|
@ -116,6 +125,11 @@ impl AppState {
|
||||||
skip_confirmation,
|
skip_confirmation,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
if let Some(root_warning) = check_root_status() {
|
||||||
|
state.spawn_float(root_warning, 60, 40);
|
||||||
|
}
|
||||||
|
|
||||||
state.update_items();
|
state.update_items();
|
||||||
if let Some(auto_execute_commands) = auto_execute_commands {
|
if let Some(auto_execute_commands) = auto_execute_commands {
|
||||||
state.handle_initial_auto_execute(&auto_execute_commands);
|
state.handle_initial_auto_execute(&auto_execute_commands);
|
||||||
|
@ -315,6 +329,11 @@ impl AppState {
|
||||||
.split(horizontal[0]);
|
.split(horizontal[0]);
|
||||||
frame.render_widget(label, left_chunks[0]);
|
frame.render_widget(label, left_chunks[0]);
|
||||||
|
|
||||||
|
self.areas = Some(Areas {
|
||||||
|
tab_list: left_chunks[1],
|
||||||
|
list: horizontal[1],
|
||||||
|
});
|
||||||
|
|
||||||
let tabs = self
|
let tabs = self
|
||||||
.tabs
|
.tabs
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -469,6 +488,59 @@ impl AppState {
|
||||||
frame.render_widget(keybind_para, vertical[1]);
|
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 {
|
pub fn handle_key(&mut self, key: &KeyEvent) -> bool {
|
||||||
// This should be defined first to allow closing
|
// This should be defined first to allow closing
|
||||||
// the application even when not drawable ( If terminal is small )
|
// the application even when not drawable ( If terminal is small )
|
||||||
|
@ -805,13 +877,13 @@ impl AppState {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_confirm_command(&mut self) {
|
fn handle_confirm_command(&mut self) {
|
||||||
let commands = self
|
let commands: Vec<&Command> = self
|
||||||
.selected_commands
|
.selected_commands
|
||||||
.iter()
|
.iter()
|
||||||
.map(|node| node.command.clone())
|
.map(|node| &node.command)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let command = RunningCommand::new(commands);
|
let command = RunningCommand::new(&commands);
|
||||||
self.spawn_float(command, 80, 80);
|
self.spawn_float(command, 80, 80);
|
||||||
self.selected_commands.clear();
|
self.selected_commands.clear();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user