mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-22 05:12:27 +00:00
Compare commits
65 Commits
e82e1deb6c
...
7c61020621
Author | SHA1 | Date | |
---|---|---|---|
|
7c61020621 | ||
|
e3688e9b3d | ||
|
51631a16cb | ||
|
d39ffad527 | ||
|
c0982a787f | ||
|
4f7de594a6 | ||
|
fa2f838b63 | ||
|
79eb752552 | ||
|
3c40bb9a84 | ||
|
e9d2e88bc3 | ||
|
55b5838cb5 | ||
|
01d571fc9e | ||
|
e6172ccec7 | ||
|
cab73530fe | ||
|
1e92f48c61 | ||
|
f75184a963 | ||
|
c45b0dce68 | ||
|
e31eccd38d | ||
|
d823e5e9e7 | ||
|
75f066f2d5 | ||
|
64c34f54c5 | ||
|
abebe9bee1 | ||
|
49379a7ede | ||
|
f1ee0569c3 | ||
|
c02bee8a85 | ||
|
af9453cc17 | ||
|
976d708c7f | ||
|
d462f41c8c | ||
|
0e14d3a9db | ||
|
34ffbc5e8d | ||
|
26d0adc829 | ||
|
73f6e24396 | ||
|
6bec5f8283 | ||
|
ec72005036 | ||
|
2f4f703fe6 | ||
|
e8fbd9e56e | ||
|
1c775048cb | ||
|
a911fe1c16 | ||
|
05d869ef74 | ||
|
3c4a5dcecd | ||
|
d5c05c94bb | ||
|
2f3c49ed0f | ||
|
9ffa35249b | ||
|
d3a801d49b | ||
|
476dbf3a12 | ||
|
6c08422615 | ||
|
f85074f065 | ||
|
5eeeec0443 | ||
|
2d4c9aa8e3 | ||
|
fd2d9ad700 | ||
|
7cc38df7e1 | ||
|
6a8987b35a | ||
|
8096a45e58 | ||
|
4d2c2d3ab7 | ||
|
adb838c729 | ||
|
d922017068 | ||
|
b023f105ac | ||
|
66b92c84b0 | ||
|
df4f44461e | ||
|
e39d679e38 | ||
|
b549510895 | ||
|
8111649c8c | ||
|
c3312dcc74 | ||
|
89bbc52712 | ||
|
77962e2a5c |
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[alias]
|
||||||
|
xtask = "run --package xtask --"
|
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
@ -16,6 +16,7 @@ cd linutil
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3. Make your changes
|
## 3. Make your changes
|
||||||
|
|
||||||
- **Edit the files you want to change**: Make your changes to the relevant files.
|
- **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.
|
- **Test your changes**: Run `cargo run` to test your modifications in a local environment and ensure everything works as expected.
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ cd linutil
|
||||||
## 11. Documentation
|
## 11. Documentation
|
||||||
|
|
||||||
- **Update the documentation**: If your change affects the functionality, please update the relevant documentation files to reflect this.
|
- **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
|
## 12. License
|
||||||
|
|
||||||
|
|
2
.github/mkdocs.yml
vendored
2
.github/mkdocs.yml
vendored
|
@ -6,7 +6,7 @@ nav:
|
||||||
- Introduction: 'index.md'
|
- Introduction: 'index.md'
|
||||||
- User Guide: 'userguide.md'
|
- User Guide: 'userguide.md'
|
||||||
- Contributing:
|
- Contributing:
|
||||||
- Contributing Guide: 'contribute.md'
|
- Contributing Guide: 'contributing.md'
|
||||||
- Roadmap: 'roadmap.md'
|
- Roadmap: 'roadmap.md'
|
||||||
- Documentation:
|
- Documentation:
|
||||||
- Known Issues: 'KnownIssues.md'
|
- Known Issues: 'KnownIssues.md'
|
||||||
|
|
18
.github/workflows/bashisms.yml
vendored
18
.github/workflows/bashisms.yml
vendored
|
@ -19,17 +19,27 @@ jobs:
|
||||||
id: get_sh_files
|
id: get_sh_files
|
||||||
run: |
|
run: |
|
||||||
sh_files=$(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs | grep '\.sh$' || true)
|
sh_files=$(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs | grep '\.sh$' || true)
|
||||||
echo "::set-output name=sh_files::$sh_files"
|
if [ -n "$sh_files" ]; then
|
||||||
|
echo "$sh_files" > changed_files
|
||||||
|
echo "changed=1" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "changed=0" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Install devscripts
|
- name: Install devscripts
|
||||||
if: steps.get_sh_files.outputs.sh_files != ''
|
if: steps.get_sh_files.outputs.changed == 1
|
||||||
run: sudo apt-get update && sudo apt-get install devscripts
|
run: sudo apt-get update && sudo apt-get install devscripts
|
||||||
|
|
||||||
- name: Check for bashisms
|
- name: Check for bashisms
|
||||||
if: steps.get_sh_files.outputs.sh_files != ''
|
if: steps.get_sh_files.outputs.changed == 1
|
||||||
run: |
|
run: |
|
||||||
for file in ${{ steps.get_sh_files.outputs.sh_files }}; do
|
echo "Running for:\n$(cat changed_files)\n"
|
||||||
|
for file in $(cat changed_files); do
|
||||||
if [[ -f "$file" ]]; then
|
if [[ -f "$file" ]]; then
|
||||||
checkbashisms "$file"
|
checkbashisms "$file"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
- name: Remove the created file
|
||||||
|
if: steps.get_sh_files.outputs.changed == 1
|
||||||
|
run: rm changed_files
|
||||||
|
|
11
.github/workflows/github-pages.yml
vendored
11
.github/workflows/github-pages.yml
vendored
|
@ -20,6 +20,17 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: '0' # Fetch all commit history for all branches as well as tags.
|
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'
|
||||||
|
|
||||||
|
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
|
with:
|
||||||
|
commit_message: Commit Contributing Guidelines
|
||||||
|
file_pattern: "docs/contributing.md"
|
||||||
|
add_options: '--force'
|
||||||
|
if: success()
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
|
|
21
.github/workflows/linutil.yml
vendored
21
.github/workflows/linutil.yml
vendored
|
@ -88,3 +88,24 @@ jobs:
|
||||||
env:
|
env:
|
||||||
version: ${{ env.version }}
|
version: ${{ env.version }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Setup Preview
|
||||||
|
run: |
|
||||||
|
echo "$(pwd)/build" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Generate preview
|
||||||
|
uses: charmbracelet/vhs-action@v2.1.0
|
||||||
|
with:
|
||||||
|
path: "docs/assets/preview.tape"
|
||||||
|
|
||||||
|
- name: Move preview
|
||||||
|
run: |
|
||||||
|
mv preview.gif docs/assets/preview.gif
|
||||||
|
|
||||||
|
- name: Upload preview
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
|
with:
|
||||||
|
commit_message: Preview for ${{ env.version }}
|
||||||
|
file_pattern: "docs/assets/preview.gif"
|
||||||
|
add_options: "--force"
|
||||||
|
if: success()
|
43
.github/workflows/shellcheck.yml
vendored
43
.github/workflows/shellcheck.yml
vendored
|
@ -14,17 +14,42 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: git fetch origin ${{ github.base_ref }}
|
- run: git fetch origin ${{ github.base_ref }}
|
||||||
|
|
||||||
- name: Download and set up shellcheck
|
- name: Download, setup, and run ShellCheck
|
||||||
|
shell: bash {0}
|
||||||
run : |
|
run : |
|
||||||
wget https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.x86_64.tar.xz
|
SC_URL="https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.x86_64.tar.xz"
|
||||||
tar -xf shellcheck-v0.10.0.linux.x86_64.tar.xz
|
curl -fsSL "$SC_URL" | tar -Jx
|
||||||
cd shellcheck-v0.10.0
|
chmod +x "./shellcheck-v0.10.0/shellcheck"
|
||||||
chmod +x shellcheck
|
|
||||||
|
|
||||||
- name: Run shellcheck
|
error=0
|
||||||
run: |
|
files_to_check=$(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs)
|
||||||
for file in $(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs); do
|
|
||||||
|
for file in $files_to_check; do
|
||||||
if [[ "$file" == *.sh ]] && [[ -f "$file" ]]; then
|
if [[ "$file" == *.sh ]] && [[ -f "$file" ]]; then
|
||||||
./shellcheck-v0.10.0/shellcheck -S error "$file"
|
sc_output=$(./shellcheck-v0.10.0/shellcheck -fgcc -Serror "$file")
|
||||||
|
iter_safe_parsed_errors=$(echo -e "$sc_output" | sed -n 's/\(.\+\)\:\([0-9]\+\)\:\([0-9]\+\)\: \(.*\)/::error file=\1,line=\2,col=\3::\4/p' | sed 's/ /:space:/g')
|
||||||
|
|
||||||
|
for error in $iter_safe_parsed_errors; do
|
||||||
|
echo "$error" | sed 's/:space:/ /g'
|
||||||
|
error=1
|
||||||
|
done
|
||||||
|
|
||||||
|
tabs_detected=$(grep -nP '^\t+\S+' "$file")
|
||||||
|
|
||||||
|
# fast fail on the action runner would fail immediately if there weren't any tabs found
|
||||||
|
# this check makes sure that we don't continue if there's something really weird going on
|
||||||
|
if [ "$?" = "2" ]; then
|
||||||
|
echo "::error file=$file::There was a critical error while grepping $file, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
iter_safe_parsed_tabs_detected=$(echo "$tabs_detected" | sed -n 's,\([0-9]\+\).*,::error file='"$file"'\,line=\1::Found tab indentations,p' | sed 's/ /:space:/g')
|
||||||
|
|
||||||
|
for error in $iter_safe_parsed_tabs_detected; do
|
||||||
|
echo "$error" | sed 's/:space:/ /g'
|
||||||
|
error=1
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
exit $error
|
||||||
|
|
15
.github/workflows/typos.yml
vendored
Normal file
15
.github/workflows/typos.yml
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
name: Check for typos
|
||||||
|
|
||||||
|
on:
|
||||||
|
[push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-typos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: git fetch origin ${{ github.base_ref }}
|
||||||
|
|
||||||
|
- name: Run spellcheck
|
||||||
|
uses: crate-ci/typos@v1.25.0
|
58
.github/workflows/xtask.yml
vendored
Normal file
58
.github/workflows/xtask.yml
vendored
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
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)
|
143
Cargo.lock
generated
143
Cargo.lock
generated
|
@ -165,9 +165,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.1.18"
|
version = "1.1.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476"
|
checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"shlex",
|
"shlex",
|
||||||
]
|
]
|
||||||
|
@ -194,9 +194,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.17"
|
version = "4.5.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac"
|
checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
|
@ -204,9 +204,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.17"
|
version = "4.5.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73"
|
checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
|
@ -216,9 +216,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "4.5.13"
|
version = "4.5.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0"
|
checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -328,12 +328,6 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fuchsia-cprng"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.15"
|
version = "0.2.15"
|
||||||
|
@ -491,19 +485,19 @@ checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linutil_core"
|
name = "linutil_core"
|
||||||
version = "24.9.23"
|
version = "24.9.28"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ego-tree",
|
"ego-tree",
|
||||||
"include_dir",
|
"include_dir",
|
||||||
"serde",
|
"serde",
|
||||||
"tempdir",
|
"temp-dir",
|
||||||
"toml",
|
"toml",
|
||||||
"which",
|
"which",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linutil_tui"
|
name = "linutil_tui"
|
||||||
version = "24.9.23"
|
version = "24.9.28"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi-to-tui",
|
"ansi-to-tui",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
|
@ -514,12 +508,13 @@ dependencies = [
|
||||||
"linutil_core",
|
"linutil_core",
|
||||||
"oneshot",
|
"oneshot",
|
||||||
"portable-pty",
|
"portable-pty",
|
||||||
"rand 0.8.5",
|
"rand",
|
||||||
"ratatui",
|
"ratatui",
|
||||||
|
"temp-dir",
|
||||||
"tree-sitter-bash",
|
"tree-sitter-bash",
|
||||||
"tree-sitter-highlight",
|
"tree-sitter-highlight",
|
||||||
"tui-term",
|
"tui-term",
|
||||||
"unicode-width",
|
"unicode-width 0.2.0",
|
||||||
"zips",
|
"zips",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -716,19 +711,6 @@ dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand"
|
|
||||||
version = "0.4.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
|
||||||
dependencies = [
|
|
||||||
"fuchsia-cprng",
|
|
||||||
"libc",
|
|
||||||
"rand_core 0.3.1",
|
|
||||||
"rdrand",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.8.5"
|
version = "0.8.5"
|
||||||
|
@ -737,7 +719,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"rand_chacha",
|
"rand_chacha",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -747,24 +729,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ppv-lite86",
|
"ppv-lite86",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_core"
|
|
||||||
version = "0.3.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
|
||||||
dependencies = [
|
|
||||||
"rand_core 0.4.2",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_core"
|
|
||||||
version = "0.4.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_core"
|
name = "rand_core"
|
||||||
version = "0.6.4"
|
version = "0.6.4"
|
||||||
|
@ -792,16 +759,7 @@ dependencies = [
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"unicode-truncate",
|
"unicode-truncate",
|
||||||
"unicode-width",
|
"unicode-width 0.1.14",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rdrand"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
|
||||||
dependencies = [
|
|
||||||
"rand_core 0.3.1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -842,15 +800,6 @@ version = "0.8.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "remove_dir_all"
|
|
||||||
version = "0.5.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
|
||||||
dependencies = [
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "0.38.37"
|
version = "0.38.37"
|
||||||
|
@ -1023,6 +972,12 @@ version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "streaming-iterator"
|
||||||
|
version = "0.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.11.1"
|
version = "0.11.1"
|
||||||
|
@ -1063,14 +1018,10 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tempdir"
|
name = "temp-dir"
|
||||||
version = "0.3.7"
|
version = "0.1.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
|
checksum = "bc1ee6eef34f12f765cb94725905c6312b6610ab2b0940889cfe58dae7bc3c72"
|
||||||
dependencies = [
|
|
||||||
"rand 0.4.6",
|
|
||||||
"remove_dir_all",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termios"
|
name = "termios"
|
||||||
|
@ -1083,18 +1034,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.63"
|
version = "1.0.64"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
|
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.63"
|
version = "1.0.64"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
|
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -1137,13 +1088,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tree-sitter"
|
name = "tree-sitter"
|
||||||
version = "0.23.0"
|
version = "0.24.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "20f4cd3642c47a85052a887d86704f4eac272969f61b686bdd3f772122aabaff"
|
checksum = "23b84f60031bf8245b563a80c92c1034e557a914f7958f474bc0afa2eed78b98"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"regex",
|
"regex",
|
||||||
"regex-syntax",
|
"regex-syntax",
|
||||||
|
"streaming-iterator",
|
||||||
"tree-sitter-language",
|
"tree-sitter-language",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1159,12 +1111,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tree-sitter-highlight"
|
name = "tree-sitter-highlight"
|
||||||
version = "0.23.0"
|
version = "0.24.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "395d7a477a4504fd7d5e4d003e0dd41bd5b9c4985d53592a943a8354ec452dae"
|
checksum = "5c727fb31f816c09fc54dc0e971d101318926866f7261b2acb820e84a61bf52d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"regex",
|
"regex",
|
||||||
|
"streaming-iterator",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tree-sitter",
|
"tree-sitter",
|
||||||
]
|
]
|
||||||
|
@ -1205,14 +1158,20 @@ checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"unicode-width",
|
"unicode-width 0.1.14",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.13"
|
version = "0.1.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
|
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-width"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf8parse"
|
name = "utf8parse"
|
||||||
|
@ -1229,12 +1188,11 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vt100"
|
name = "vt100"
|
||||||
version = "0.15.2"
|
version = "0.15.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/ChrisTitusTech/vt100-rust#e41fb3d8fb5fd01dd2d076c9a25823a31656012f"
|
||||||
checksum = "84cd863bf0db7e392ba3bd04994be3473491b31e66340672af5d11943c6274de"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"log",
|
"log",
|
||||||
"unicode-width",
|
"unicode-width 0.1.14",
|
||||||
"vte",
|
"vte",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1460,6 +1418,13 @@ version = "0.0.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"
|
checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "xtask"
|
||||||
|
version = "24.9.28"
|
||||||
|
dependencies = [
|
||||||
|
"linutil_core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zerocopy"
|
||||||
version = "0.7.35"
|
version = "0.7.35"
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
version = "24.9.23"
|
version = "24.9.28"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
ego-tree = "0.6.2"
|
ego-tree = "0.6.2"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["tui", "core"]
|
members = ["tui", "core", "xtask"]
|
||||||
|
default-members = ["tui", "core"]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
vt100 = { git = "https://github.com/ChrisTitusTech/vt100-rust" }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
debug = false
|
debug = false
|
||||||
|
|
|
@ -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.png)
|
![Preview](docs/assets/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.
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ makepkg -si
|
||||||
|
|
||||||
Replace `<package>` with your preferred package.
|
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 simplier:
|
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
|
```bash
|
||||||
paru -S linutil
|
paru -S linutil
|
||||||
|
|
7
_typos.toml
Normal file
7
_typos.toml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[files]
|
||||||
|
extend-exclude = ["tui/cool_tips.txt"]
|
||||||
|
|
||||||
|
[default]
|
||||||
|
extend-ignore-identifiers-re = [
|
||||||
|
"ratatui",
|
||||||
|
]
|
|
@ -1,5 +0,0 @@
|
||||||
What to do when you have a Cargo.lock merge conflict?
|
|
||||||
1. `git checkout origin/main -- Cargo.lock` to get the original Cargo.lock
|
|
||||||
2. `cargo build` to update Cargo.lock
|
|
||||||
3. `git add Cargo.lock`
|
|
||||||
4. continue the merge as normal
|
|
|
@ -13,7 +13,7 @@ include = [
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
include_dir = "0.7.4"
|
include_dir = "0.7.4"
|
||||||
tempdir = "0.3.7"
|
temp-dir = "0.1.14"
|
||||||
serde = { version = "1.0.205", features = ["derive"], default-features = false }
|
serde = { version = "1.0.205", features = ["derive"], default-features = false }
|
||||||
toml = { version = "0.8.19", features = ["parse"], default-features = false }
|
toml = { version = "0.8.19", features = ["parse"], default-features = false }
|
||||||
which = "6.0.3"
|
which = "6.0.3"
|
||||||
|
|
|
@ -1,20 +1,25 @@
|
||||||
use crate::{Command, ListNode, Tab};
|
|
||||||
use ego_tree::{NodeMut, Tree};
|
|
||||||
use include_dir::{include_dir, Dir};
|
|
||||||
use serde::Deserialize;
|
|
||||||
use std::{
|
use std::{
|
||||||
fs::File,
|
fs::File,
|
||||||
io::{BufRead, BufReader, Read},
|
io::{BufRead, BufReader, Read},
|
||||||
os::unix::fs::PermissionsExt,
|
os::unix::fs::PermissionsExt,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
rc::Rc,
|
||||||
};
|
};
|
||||||
use tempdir::TempDir;
|
|
||||||
|
use crate::{Command, ListNode, Tab};
|
||||||
|
use ego_tree::{NodeMut, Tree};
|
||||||
|
use include_dir::{include_dir, Dir};
|
||||||
|
use serde::Deserialize;
|
||||||
|
use temp_dir::TempDir;
|
||||||
|
|
||||||
const TAB_DATA: Dir = include_dir!("$CARGO_MANIFEST_DIR/tabs");
|
const TAB_DATA: Dir = include_dir!("$CARGO_MANIFEST_DIR/tabs");
|
||||||
|
|
||||||
pub fn get_tabs(validate: bool) -> Vec<Tab> {
|
pub fn get_tabs(validate: bool) -> (TempDir, Vec<Tab>) {
|
||||||
let tab_files = TabList::get_tabs();
|
let (temp_dir, tab_files) = TabList::get_tabs();
|
||||||
let tabs = tab_files.into_iter().map(|path| {
|
|
||||||
|
let tabs: Vec<_> = tab_files
|
||||||
|
.into_iter()
|
||||||
|
.map(|path| {
|
||||||
let directory = path.parent().unwrap().to_owned();
|
let directory = path.parent().unwrap().to_owned();
|
||||||
let data = std::fs::read_to_string(path).expect("Failed to read tab data");
|
let data = std::fs::read_to_string(path).expect("Failed to read tab data");
|
||||||
let mut tab_data: TabEntry = toml::from_str(&data).expect("Failed to parse tab data");
|
let mut tab_data: TabEntry = toml::from_str(&data).expect("Failed to parse tab data");
|
||||||
|
@ -23,9 +28,11 @@ pub fn get_tabs(validate: bool) -> Vec<Tab> {
|
||||||
filter_entries(&mut tab_data.data);
|
filter_entries(&mut tab_data.data);
|
||||||
}
|
}
|
||||||
(tab_data, directory)
|
(tab_data, directory)
|
||||||
});
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
let tabs: Vec<Tab> = tabs
|
let tabs: Vec<Tab> = tabs
|
||||||
|
.into_iter()
|
||||||
.map(
|
.map(
|
||||||
|(
|
|(
|
||||||
TabEntry {
|
TabEntry {
|
||||||
|
@ -35,12 +42,12 @@ pub fn get_tabs(validate: bool) -> Vec<Tab> {
|
||||||
},
|
},
|
||||||
directory,
|
directory,
|
||||||
)| {
|
)| {
|
||||||
let mut tree = Tree::new(ListNode {
|
let mut tree = Tree::new(Rc::new(ListNode {
|
||||||
name: "root".to_string(),
|
name: "root".to_string(),
|
||||||
description: String::new(),
|
description: String::new(),
|
||||||
command: Command::None,
|
command: Command::None,
|
||||||
task_list: String::new(),
|
task_list: String::new(),
|
||||||
});
|
}));
|
||||||
let mut root = tree.root_mut();
|
let mut root = tree.root_mut();
|
||||||
create_directory(data, &mut root, &directory, validate);
|
create_directory(data, &mut root, &directory, validate);
|
||||||
Tab {
|
Tab {
|
||||||
|
@ -55,7 +62,7 @@ pub fn get_tabs(validate: bool) -> Vec<Tab> {
|
||||||
if tabs.is_empty() {
|
if tabs.is_empty() {
|
||||||
panic!("No tabs found");
|
panic!("No tabs found");
|
||||||
}
|
}
|
||||||
tabs
|
(temp_dir, tabs)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -164,28 +171,28 @@ fn filter_entries(entries: &mut Vec<Entry>) {
|
||||||
|
|
||||||
fn create_directory(
|
fn create_directory(
|
||||||
data: Vec<Entry>,
|
data: Vec<Entry>,
|
||||||
node: &mut NodeMut<ListNode>,
|
node: &mut NodeMut<Rc<ListNode>>,
|
||||||
command_dir: &Path,
|
command_dir: &Path,
|
||||||
validate: bool,
|
validate: bool,
|
||||||
) {
|
) {
|
||||||
for entry in data {
|
for entry in data {
|
||||||
match entry.entry_type {
|
match entry.entry_type {
|
||||||
EntryType::Entries(entries) => {
|
EntryType::Entries(entries) => {
|
||||||
let mut node = node.append(ListNode {
|
let mut node = node.append(Rc::new(ListNode {
|
||||||
name: entry.name,
|
name: entry.name,
|
||||||
description: entry.description,
|
description: entry.description,
|
||||||
command: Command::None,
|
command: Command::None,
|
||||||
task_list: String::new(),
|
task_list: String::new(),
|
||||||
});
|
}));
|
||||||
create_directory(entries, &mut node, command_dir, validate);
|
create_directory(entries, &mut node, command_dir, validate);
|
||||||
}
|
}
|
||||||
EntryType::Command(command) => {
|
EntryType::Command(command) => {
|
||||||
node.append(ListNode {
|
node.append(Rc::new(ListNode {
|
||||||
name: entry.name,
|
name: entry.name,
|
||||||
description: entry.description,
|
description: entry.description,
|
||||||
command: Command::Raw(command),
|
command: Command::Raw(command),
|
||||||
task_list: String::new(),
|
task_list: String::new(),
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
EntryType::Script(script) => {
|
EntryType::Script(script) => {
|
||||||
let script = command_dir.join(script);
|
let script = command_dir.join(script);
|
||||||
|
@ -194,7 +201,7 @@ fn create_directory(
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some((executable, args)) = get_shebang(&script, validate) {
|
if let Some((executable, args)) = get_shebang(&script, validate) {
|
||||||
node.append(ListNode {
|
node.append(Rc::new(ListNode {
|
||||||
name: entry.name,
|
name: entry.name,
|
||||||
description: entry.description,
|
description: entry.description,
|
||||||
command: Command::LocalFile {
|
command: Command::LocalFile {
|
||||||
|
@ -203,7 +210,7 @@ fn create_directory(
|
||||||
file: script,
|
file: script,
|
||||||
},
|
},
|
||||||
task_list: entry.task_list,
|
task_list: entry.task_list,
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,19 +253,20 @@ fn is_executable(path: &Path) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TabList {
|
impl TabList {
|
||||||
fn get_tabs() -> Vec<PathBuf> {
|
fn get_tabs() -> (TempDir, Vec<PathBuf>) {
|
||||||
let temp_dir = TempDir::new("linutil_scripts").unwrap().into_path();
|
let temp_dir = TempDir::new().unwrap();
|
||||||
TAB_DATA
|
TAB_DATA
|
||||||
.extract(&temp_dir)
|
.extract(&temp_dir)
|
||||||
.expect("Failed to extract the saved directory");
|
.expect("Failed to extract the saved directory");
|
||||||
|
|
||||||
let tab_files =
|
let tab_files = std::fs::read_to_string(temp_dir.path().join("tabs.toml"))
|
||||||
std::fs::read_to_string(temp_dir.join("tabs.toml")).expect("Failed to read tabs.toml");
|
.expect("Failed to read tabs.toml");
|
||||||
let data: Self = toml::from_str(&tab_files).expect("Failed to parse tabs.toml");
|
let data: Self = toml::from_str(&tab_files).expect("Failed to parse tabs.toml");
|
||||||
|
let tab_paths = data
|
||||||
data.directories
|
.directories
|
||||||
.iter()
|
.iter()
|
||||||
.map(|path| temp_dir.join(path).join("tab_data.toml"))
|
.map(|path| temp_dir.path().join(path).join("tab_data.toml"))
|
||||||
.collect()
|
.collect();
|
||||||
|
(temp_dir, tab_paths)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
mod inner;
|
mod inner;
|
||||||
|
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
use ego_tree::Tree;
|
use ego_tree::Tree;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
@ -20,7 +22,7 @@ pub enum Command {
|
||||||
#[derive(Clone, Hash, Eq, PartialEq)]
|
#[derive(Clone, Hash, Eq, PartialEq)]
|
||||||
pub struct Tab {
|
pub struct Tab {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub tree: Tree<ListNode>,
|
pub tree: Tree<Rc<ListNode>>,
|
||||||
pub multi_selectable: bool,
|
pub multi_selectable: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,23 @@
|
||||||
. ../../common-script.sh
|
. ../../common-script.sh
|
||||||
|
|
||||||
installMeld() {
|
installMeld() {
|
||||||
cd "$HOME" && git clone https://gitlab.gnome.org/GNOME/meld.git
|
if ! command_exists meld; then
|
||||||
echo "PATH=\$PATH:$HOME/meld/bin" | "$ESCALATION_TOOL" tee -a /etc/environment
|
printf "%b\n" "${YELLOW}Installing Meld...${RC}"
|
||||||
|
case "$PACKAGER" in
|
||||||
|
pacman)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm meld
|
||||||
|
;;
|
||||||
|
apt-get|nala)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" -y install meld
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
. ../setup-flatpak.sh
|
||||||
|
flatpak install -y flathub org.gnome.meld
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}Meld is already installed.${RC}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
|
|
|
@ -4,15 +4,6 @@
|
||||||
|
|
||||||
gitpath="$HOME/.local/share/neovim"
|
gitpath="$HOME/.local/share/neovim"
|
||||||
|
|
||||||
checkNeovimVer() {
|
|
||||||
# lazy.nvim requires nvim >= 0.8.0
|
|
||||||
nvim_version=$(nvim --version | head -n 1 | awk '{print $2}')
|
|
||||||
if [ "$(printf "%s\n" "$nvim_version" "0.8.0" | sort -V | head -n 1)" != "0.8.0" ]; then
|
|
||||||
printf "%b\n" "${RED}Neovim version $nvim_version not supported.${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
cloneNeovim() {
|
cloneNeovim() {
|
||||||
# Check if the dir exists before attempting to clone into it.
|
# Check if the dir exists before attempting to clone into it.
|
||||||
if [ -d "$gitpath" ]; then
|
if [ -d "$gitpath" ]; then
|
||||||
|
@ -30,7 +21,10 @@ installNeovim() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git
|
||||||
;;
|
;;
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fd-find python3-venv luarocks golang-go shellcheck git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y ripgrep fd-find python3-venv luarocks golang-go shellcheck git
|
||||||
|
curl -sSLo /tmp/nvim.appimage https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
|
||||||
|
chmod u+x /tmp/nvim.appimage
|
||||||
|
"$ESCALATION_TOOL" mv /tmp/nvim.appimage /usr/local/bin/nvim
|
||||||
;;
|
;;
|
||||||
dnf|zypper)
|
dnf|zypper)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
|
||||||
|
@ -60,7 +54,6 @@ linkNeovimConfig() {
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
installNeovim
|
installNeovim
|
||||||
checkNeovimVer
|
|
||||||
cloneNeovim
|
cloneNeovim
|
||||||
backupNeovimConfig
|
backupNeovimConfig
|
||||||
linkNeovimConfig
|
linkNeovimConfig
|
||||||
|
|
|
@ -17,7 +17,6 @@ installVsCodium() {
|
||||||
printf "%b\n" "[gitlab.com_paulcarroty_vscodium_repo]\nname=gitlab.com_paulcarroty_vscodium_repo\nbaseurl=https://download.vscodium.com/rpms/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg\nmetadata_expire=1h" | "$ESCALATION_TOOL" tee -a /etc/zypp/repos.d/vscodium.repo
|
printf "%b\n" "[gitlab.com_paulcarroty_vscodium_repo]\nname=gitlab.com_paulcarroty_vscodium_repo\nbaseurl=https://download.vscodium.com/rpms/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg\nmetadata_expire=1h" | "$ESCALATION_TOOL" tee -a /etc/zypp/repos.d/vscodium.repo
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" refresh
|
"$ESCALATION_TOOL" "$PACKAGER" refresh
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install codium
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install codium
|
||||||
|
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
"$AUR_HELPER" -S --noconfirm vscodium-bin
|
"$AUR_HELPER" -S --noconfirm vscodium-bin
|
||||||
|
|
|
@ -10,7 +10,7 @@ installSlack() {
|
||||||
"$AUR_HELPER" -S --needed --noconfirm slack-desktop
|
"$AUR_HELPER" -S --needed --noconfirm slack-desktop
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
. ./setup-flatpak.sh
|
. ../setup-flatpak.sh
|
||||||
flatpak install -y flathub com.slack.Slack
|
flatpak install -y flathub com.slack.Slack
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -10,7 +10,7 @@ installZoom() {
|
||||||
"$AUR_HELPER" -S --needed --noconfirm zoom
|
"$AUR_HELPER" -S --needed --noconfirm zoom
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
. ./setup-flatpak.sh
|
. ../setup-flatpak.sh
|
||||||
flatpak install -y flathub us.zoom.Zoom
|
flatpak install -y flathub us.zoom.Zoom
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -4,8 +4,12 @@
|
||||||
|
|
||||||
themeinstall(){
|
themeinstall(){
|
||||||
mkdir -p "$HOME/.local/share"
|
mkdir -p "$HOME/.local/share"
|
||||||
cd "$HOME/.local/share" && git clone "https://github.com/ChrisTitusTech/Top-5-Bootloader-Themes"
|
cd "$HOME/.local/share"
|
||||||
cd "$HOME/.local/share/Top-5-Bootloader-Themes"
|
if [ -d 'Top-5-Bootloader-Themes' ]; then
|
||||||
|
rm -rf 'Top-5-Bootloader-Themes'
|
||||||
|
fi
|
||||||
|
git clone "https://github.com/ChrisTitusTech/Top-5-Bootloader-Themes"
|
||||||
|
cd "Top-5-Bootloader-Themes"
|
||||||
"$ESCALATION_TOOL" ./install.sh
|
"$ESCALATION_TOOL" ./install.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@ installLinutil() {
|
||||||
printf "%b" "Enter your choice: "
|
printf "%b" "Enter your choice: "
|
||||||
read -r choice
|
read -r choice
|
||||||
case $choice in
|
case $choice in
|
||||||
1) "$AUR_HELPER" -S --noconfirm linutil ;;
|
1) "$AUR_HELPER" -S --needed --noconfirm linutil ;;
|
||||||
2) "$AUR_HELPER" -S --noconfirm linutil-bin ;;
|
2) "$AUR_HELPER" -S --needed --noconfirm linutil-bin ;;
|
||||||
3) "$AUR_HELPER" -S --noconfirm linutil-git ;;
|
3) "$AUR_HELPER" -S --needed --noconfirm linutil-git ;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Invalid choice:${RC} $choice"
|
printf "%b\n" "${RED}Invalid choice:${RC} $choice"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -35,10 +35,10 @@ installLinutil() {
|
||||||
printf "%b\n" "${YELLOW}Installing rustup...${RC}"
|
printf "%b\n" "${YELLOW}Installing rustup...${RC}"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rustup
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm curl rustup man-db
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y rustup
|
"$ESCALATION_TOOL" "$PACKAGER" install -y curl rustup man-pages man-db man
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
|
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
|
||||||
|
@ -54,12 +54,23 @@ installLinutil() {
|
||||||
rustup default stable
|
rustup default stable
|
||||||
cargo install --force linutil_tui
|
cargo install --force linutil_tui
|
||||||
printf "%b\n" "${GREEN}Installed successfully.${RC}"
|
printf "%b\n" "${GREEN}Installed successfully.${RC}"
|
||||||
|
installExtra
|
||||||
;;
|
;;
|
||||||
*) printf "%b\n" "${RED}Linutil not installed.${RC}" ;;
|
*) printf "%b\n" "${RED}Linutil not installed.${RC}" ;;
|
||||||
esac
|
esac
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
installExtra() {
|
||||||
|
printf "%b\n" "${YELLOW}Installing the manpage...${RC}"
|
||||||
|
"$ESCALATION_TOOL" mkdir -p /usr/share/man/man1
|
||||||
|
curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/man/linutil.1' | "$ESCALATION_TOOL" tee '/usr/share/man/man1/linutil.1' > /dev/null
|
||||||
|
printf "%b\n" "${YELLOW}Creating a Desktop Entry...${RC}"
|
||||||
|
"$ESCALATION_TOOL" mkdir -p /usr/share/applications
|
||||||
|
curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/linutil.desktop' | "$ESCALATION_TOOL" tee /usr/share/applications/linutil.desktop > /dev/null
|
||||||
|
printf "%b\n" "${GREEN}Done.${RC}"
|
||||||
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
checkAURHelper
|
checkAURHelper
|
||||||
|
|
|
@ -1,203 +0,0 @@
|
||||||
#!/bin/sh -e
|
|
||||||
|
|
||||||
. ../common-script.sh
|
|
||||||
|
|
||||||
install_onlyoffice() {
|
|
||||||
if ! command_exists onlyoffice-desktopeditors; then
|
|
||||||
printf "%b\n" "${YELLOW}Installing Only Office..${RC}."
|
|
||||||
case "$PACKAGER" in
|
|
||||||
apt-get|nala)
|
|
||||||
curl -O https://download.onlyoffice.com/install/desktop/editors/linux/onlyoffice-desktopeditors_amd64.deb
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y ./onlyoffice-desktopeditors_amd64.deb
|
|
||||||
;;
|
|
||||||
zypper|dnf)
|
|
||||||
. ./setup-flatpak.sh
|
|
||||||
flatpak install -y flathub org.onlyoffice.desktopeditors
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
"$AUR_HELPER" -S --needed --noconfirm onlyoffice
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
printf "%b\n" "${GREEN}Only Office is already installed.${RC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_libreoffice() {
|
|
||||||
if ! command_exists libreoffice; then
|
|
||||||
printf "%b\n" "${YELLOW}Installing Libre Office...${RC}"
|
|
||||||
case "$PACKAGER" in
|
|
||||||
apt-get|nala)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core
|
|
||||||
;;
|
|
||||||
zypper|dnf)
|
|
||||||
. ./setup-flatpak.sh
|
|
||||||
flatpak install -y flathub org.libreoffice.LibreOffice
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libreoffice-fresh
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
printf "%b\n" "${GREEN}Libre Office is already installed.${RC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_wpsoffice() {
|
|
||||||
if ! command_exists com.wps.Office; then
|
|
||||||
printf "%b\n" "${YELLOW}Installing WPS Office...${RC}"
|
|
||||||
case "$PACKAGER" in
|
|
||||||
pacman)
|
|
||||||
"$AUR_HELPER" -S --noconfirm wps-office
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
. ./setup-flatpak.sh
|
|
||||||
flatpak install flathub com.wps.Office
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
printf "%b\n" "${GREEN}WPS Office is already installed.${RC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# needs to be updated every year for latest version
|
|
||||||
install_freeoffice() {
|
|
||||||
if ! command_exists softmaker-freeoffice-2024 freeoffice softmaker; then
|
|
||||||
printf "%b\n" "${YELLOW}Installing Free Office...${RC}"
|
|
||||||
case "$PACKAGER" in
|
|
||||||
apt-get|nala)
|
|
||||||
curl -O https://www.softmaker.net/down/softmaker-freeoffice-2024_1218-01_amd64.deb
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y ./softmaker-freeoffice-2024_1218-01_amd64.deb
|
|
||||||
;;
|
|
||||||
zypper)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" addrepo -f https://shop.softmaker.com/repo/rpm SoftMaker
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" --gpg-auto-import-keys refresh
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install softmaker-freeoffice-2024
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
"$AUR_HELPER" -S --noconfirm freeoffice
|
|
||||||
;;
|
|
||||||
dnf)
|
|
||||||
"$ESCALATION_TOOL" curl -O -qO /etc/yum.repos.d/softmaker.repo https://shop.softmaker.com/repo/softmaker.repo
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y softmaker-freeoffice-2024
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
printf "%b\n" "${GREEN}Free Office is already installed.${RC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_evince() {
|
|
||||||
if ! command_exists evince; then
|
|
||||||
printf "%b\n" "${YELLOW}Installing Evince...${RC}"
|
|
||||||
case "$PACKAGER" in
|
|
||||||
pacman)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm evince
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y evince
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
printf "%b\n" "${GREEN}Evince is already installed.${RC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_okular() {
|
|
||||||
if ! command_exists okular; then
|
|
||||||
printf "%b\n" "${YELLOW}Installing Okular...${RC}"
|
|
||||||
case "$PACKAGER" in
|
|
||||||
pacman)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm okular
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y okular
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
printf "%b\n" "${GREEN}Okular is already installed.${RC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_pdfstudioviewer() {
|
|
||||||
if ! command_exists pdfstudioviewer2024/pdfstudioviewer2024; then
|
|
||||||
printf "%b\n" "${YELLOW}Installing PDF Studio Viewer...${RC}"
|
|
||||||
curl -O https://download.qoppa.com/pdfstudioviewer/PDFStudioViewer_linux64.sh
|
|
||||||
"$ESCALATION_TOOL" chmod +x PDFStudioViewer_linux64.sh
|
|
||||||
if sh PDFStudioViewer_linux64.sh; then
|
|
||||||
printf "%b\n" "${GREEN}PDF Studio Viewer installed successfully!${RC}"
|
|
||||||
else
|
|
||||||
printf "%b\n" "${RED}Installation failed!${RC}"
|
|
||||||
fi
|
|
||||||
rm PDFStudioViewer_linux64.sh
|
|
||||||
else
|
|
||||||
printf "%b\n" "${GREEN}PDF Studio Viewer is already installed.${RC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_pdfstudio() {
|
|
||||||
if ! command_exists pdfstudio2024/pdfstudio2024; then
|
|
||||||
printf "%b\n" "${YELLOW}Installing PDF Studio...${RC}"
|
|
||||||
curl -O https://download.qoppa.com/pdfstudio/PDFStudio_linux64.sh
|
|
||||||
"$ESCALATION_TOOL" chmod +x PDFStudio_linux64.sh
|
|
||||||
if sh PDFStudio_linux64.sh; then
|
|
||||||
printf "%b\n" "${GREEN}PDF Studio installed successfully!${RC}"
|
|
||||||
else
|
|
||||||
printf "%b\n" "${RED}PDF Studio installation failed!${RC}"
|
|
||||||
fi
|
|
||||||
rm PDFStudio_linux64.sh
|
|
||||||
else
|
|
||||||
printf "%b\n" "${GREEN}PDF Studio is already installed.${RC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
officeSuiteSetup() {
|
|
||||||
clear
|
|
||||||
printf "%b\n" "Office Suite Setup Script"
|
|
||||||
printf "%b\n" "----------------------------"
|
|
||||||
printf "%b\n" "Select the suite you want to install:"
|
|
||||||
printf "%b\n" "1. OnlyOffice"
|
|
||||||
printf "%b\n" "2. LibreOffice"
|
|
||||||
printf "%b\n" "3. WPS Office"
|
|
||||||
printf "%b\n" "4. Free Office"
|
|
||||||
printf "%b\n" "Select the PDF Suite you want to install:"
|
|
||||||
printf "%b\n" "----------------------------"
|
|
||||||
printf "%b\n" "5. Evince"
|
|
||||||
printf "%b\n" "6. Okular"
|
|
||||||
printf "%b\n" "7. PDF Studio Viewer"
|
|
||||||
printf "%b\n" "8. PDF Studio (Paid Software)"
|
|
||||||
printf "%b\n" "----------------------------"
|
|
||||||
printf "%b" "Enter your choices (e.g., 1 3 5): "
|
|
||||||
read -r choice
|
|
||||||
for ch in $choice; do
|
|
||||||
case $ch in
|
|
||||||
1) install_onlyoffice ;;
|
|
||||||
2) install_libreoffice ;;
|
|
||||||
3) install_wpsoffice ;;
|
|
||||||
4) install_freeoffice ;;
|
|
||||||
5) install_evince ;;
|
|
||||||
6) install_okular ;;
|
|
||||||
7) install_pdfstudioviewer ;;
|
|
||||||
8) install_pdfstudio ;;
|
|
||||||
*) printf "%b\n" "${RED}Invalid option: $ch ${RC}" ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
printf "%b\n" "${GREEN}Installation complete!${RC}"
|
|
||||||
}
|
|
||||||
|
|
||||||
checkEnv
|
|
||||||
checkEscalationTool
|
|
||||||
checkAURHelper
|
|
||||||
officeSuiteSetup
|
|
38
core/tabs/applications-setup/office-suites/freeoffice.sh
Normal file
38
core/tabs/applications-setup/office-suites/freeoffice.sh
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. ../common-script.sh
|
||||||
|
|
||||||
|
installFreeOffice() {
|
||||||
|
if ! command_exists softmaker-freeoffice-2024 freeoffice softmaker; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing Free Office...${RC}"
|
||||||
|
case "$PACKAGER" in
|
||||||
|
apt-get|nala)
|
||||||
|
curl -O https://www.softmaker.net/down/softmaker-freeoffice-2024_1218-01_amd64.deb
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y ./softmaker-freeoffice-2024_1218-01_amd64.deb
|
||||||
|
;;
|
||||||
|
zypper)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" addrepo -f https://shop.softmaker.com/repo/rpm SoftMaker
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" --gpg-auto-import-keys refresh
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install softmaker-freeoffice-2024
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
"$AUR_HELPER" -S --needed --noconfirm freeoffice
|
||||||
|
;;
|
||||||
|
dnf)
|
||||||
|
"$ESCALATION_TOOL" curl -O -qO /etc/yum.repos.d/softmaker.repo https://shop.softmaker.com/repo/softmaker.repo
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y softmaker-freeoffice-2024
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}Free Office is already installed.${RC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
checkEscalationTool
|
||||||
|
checkAurHelper
|
||||||
|
installFreeOffice
|
31
core/tabs/applications-setup/office-suites/libreoffice.sh
Normal file
31
core/tabs/applications-setup/office-suites/libreoffice.sh
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. ../common-script.sh
|
||||||
|
|
||||||
|
installLibreOffice() {
|
||||||
|
if ! command_exists libreoffice; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing Libre Office...${RC}"
|
||||||
|
case "$PACKAGER" in
|
||||||
|
apt-get|nala)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core
|
||||||
|
;;
|
||||||
|
zypper|dnf)
|
||||||
|
. ./setup-flatpak.sh
|
||||||
|
flatpak install -y flathub org.libreoffice.LibreOffice
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libreoffice-fresh
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}Libre Office is already installed.${RC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
checkEscalationTool
|
||||||
|
installLibreOffice
|
33
core/tabs/applications-setup/office-suites/onlyoffice.sh
Normal file
33
core/tabs/applications-setup/office-suites/onlyoffice.sh
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. ../common-script.sh
|
||||||
|
|
||||||
|
installOnlyOffice() {
|
||||||
|
if ! command_exists onlyoffice-desktopeditors; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing Only Office..${RC}."
|
||||||
|
case "$PACKAGER" in
|
||||||
|
apt-get|nala)
|
||||||
|
curl -O https://download.onlyoffice.com/install/desktop/editors/linux/onlyoffice-desktopeditors_amd64.deb
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y ./onlyoffice-desktopeditors_amd64.deb
|
||||||
|
;;
|
||||||
|
zypper|dnf)
|
||||||
|
. ./setup-flatpak.sh
|
||||||
|
flatpak install -y flathub org.onlyoffice.desktopeditors
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
"$AUR_HELPER" -S --needed --noconfirm onlyoffice
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}Only Office is already installed.${RC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
checkEscalationTool
|
||||||
|
checkAurHelper
|
||||||
|
installOnlyOffice
|
25
core/tabs/applications-setup/office-suites/wpsoffice.sh
Normal file
25
core/tabs/applications-setup/office-suites/wpsoffice.sh
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. ../common-script.sh
|
||||||
|
|
||||||
|
installWpsOffice() {
|
||||||
|
if ! command_exists com.wps.Office; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing WPS Office...${RC}"
|
||||||
|
case "$PACKAGER" in
|
||||||
|
pacman)
|
||||||
|
"$AUR_HELPER" -S --needed --noconfirm wps-office
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
. ./setup-flatpak.sh
|
||||||
|
flatpak install flathub com.wps.Office
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}WPS Office is already installed.${RC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
checkEscalationTool
|
||||||
|
checkAurHelper
|
||||||
|
installWpsOffice
|
23
core/tabs/applications-setup/pdf-suites/evince.sh
Normal file
23
core/tabs/applications-setup/pdf-suites/evince.sh
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. ../common-script.sh
|
||||||
|
|
||||||
|
installEvince() {
|
||||||
|
if ! command_exists evince; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing Evince...${RC}"
|
||||||
|
case "$PACKAGER" in
|
||||||
|
pacman)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm evince
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y evince
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}Evince is already installed.${RC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
checkEscalationTool
|
||||||
|
installEvince
|
23
core/tabs/applications-setup/pdf-suites/okular.sh
Normal file
23
core/tabs/applications-setup/pdf-suites/okular.sh
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. ../common-script.sh
|
||||||
|
|
||||||
|
installOkular() {
|
||||||
|
if ! command_exists okular; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing Okular...${RC}"
|
||||||
|
case "$PACKAGER" in
|
||||||
|
pacman)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm okular
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y okular
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}Okular is already installed.${RC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
checkEscalationTool
|
||||||
|
installOkular
|
23
core/tabs/applications-setup/pdf-suites/pdfstudio.sh
Normal file
23
core/tabs/applications-setup/pdf-suites/pdfstudio.sh
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. ../common-script.sh
|
||||||
|
|
||||||
|
installPdfstudio() {
|
||||||
|
if ! command_exists pdfstudio2024; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing PDF Studio...${RC}"
|
||||||
|
curl -O https://download.qoppa.com/pdfstudio/PDFStudio_linux64.sh
|
||||||
|
"$ESCALATION_TOOL" chmod +x PDFStudio_linux64.sh
|
||||||
|
if sh PDFStudio_linux64.sh; then
|
||||||
|
printf "%b\n" "${GREEN}PDF Studio installed successfully!${RC}"
|
||||||
|
else
|
||||||
|
printf "%b\n" "${RED}PDF Studio installation failed!${RC}"
|
||||||
|
fi
|
||||||
|
rm PDFStudio_linux64.sh
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}PDF Studio is already installed.${RC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
checkEscalationTool
|
||||||
|
installPdfstudio
|
23
core/tabs/applications-setup/pdf-suites/pdfstudioviewer.sh
Normal file
23
core/tabs/applications-setup/pdf-suites/pdfstudioviewer.sh
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. ../common-script.sh
|
||||||
|
|
||||||
|
installPdfstudioviewer() {
|
||||||
|
if ! command_exists pdfstudioviewer2024; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing PDF Studio Viewer...${RC}"
|
||||||
|
curl -O https://download.qoppa.com/pdfstudioviewer/PDFStudioViewer_linux64.sh
|
||||||
|
"$ESCALATION_TOOL" chmod +x PDFStudioViewer_linux64.sh
|
||||||
|
if sh PDFStudioViewer_linux64.sh; then
|
||||||
|
printf "%b\n" "${GREEN}PDF Studio Viewer installed successfully!${RC}"
|
||||||
|
else
|
||||||
|
printf "%b\n" "${RED}Installation failed!${RC}"
|
||||||
|
fi
|
||||||
|
rm PDFStudioViewer_linux64.sh
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}PDF Studio Viewer is already installed.${RC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
checkEscalationTool
|
||||||
|
installPdfstudioviewer
|
|
@ -37,7 +37,7 @@ task_list = "I"
|
||||||
name = "Meld"
|
name = "Meld"
|
||||||
description = "Meld is a visual diff and merge tool that helps compare files, directories, and version-controlled projects."
|
description = "Meld is a visual diff and merge tool that helps compare files, directories, and version-controlled projects."
|
||||||
script = "Developer-tools/meld-setup.sh"
|
script = "Developer-tools/meld-setup.sh"
|
||||||
task_list = "I"
|
task_list = "I FI"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Ngrok"
|
name = "Ngrok"
|
||||||
|
@ -90,6 +90,51 @@ description = "Thunderbird is a free, open-source email client that offers power
|
||||||
script = "communication-apps/thunderbird-setup.sh"
|
script = "communication-apps/thunderbird-setup.sh"
|
||||||
task_list = "I"
|
task_list = "I"
|
||||||
|
|
||||||
|
[[data]]
|
||||||
|
name = "Office Suites"
|
||||||
|
|
||||||
|
[[data.entries]]
|
||||||
|
name = "LibreOffice"
|
||||||
|
script = "office-suites/libreoffice.sh"
|
||||||
|
task_list = "I"
|
||||||
|
|
||||||
|
[[data.entries]]
|
||||||
|
name = "OnlyOffice"
|
||||||
|
script = "office-suites/onlyoffice.sh"
|
||||||
|
task_list = "I"
|
||||||
|
|
||||||
|
[[data.entries]]
|
||||||
|
name = "FreeOffice"
|
||||||
|
script = "office-suites/freeoffice.sh"
|
||||||
|
task_list = "I"
|
||||||
|
|
||||||
|
[[data.entries]]
|
||||||
|
name = "WPS Office"
|
||||||
|
script = "office-suites/wpsoffice.sh"
|
||||||
|
task_list = "I"
|
||||||
|
|
||||||
|
[[data]]
|
||||||
|
name = "PDF Suites"
|
||||||
|
|
||||||
|
[[data.entries]]
|
||||||
|
name = "Evince"
|
||||||
|
script = "pdf-suites/evince.sh"
|
||||||
|
task_list = "I"
|
||||||
|
|
||||||
|
[[data.entries]]
|
||||||
|
name = "Okular"
|
||||||
|
script = "pdf-suites/okular.sh"
|
||||||
|
task_list = "I"
|
||||||
|
|
||||||
|
[[data.entries]]
|
||||||
|
name = "PDF Studio"
|
||||||
|
script = "pdf-suites/pdfstudio.sh"
|
||||||
|
task_list = "I"
|
||||||
|
|
||||||
|
[[data.entries]]
|
||||||
|
name = "PDF Studio Viewer"
|
||||||
|
script = "pdf-suites/pdfstudioviewer.sh"
|
||||||
|
|
||||||
[[data]]
|
[[data]]
|
||||||
name = "Web Browsers"
|
name = "Web Browsers"
|
||||||
|
|
||||||
|
@ -223,12 +268,6 @@ matches = true
|
||||||
data = "command_exists"
|
data = "command_exists"
|
||||||
values = [ "linutil" ]
|
values = [ "linutil" ]
|
||||||
|
|
||||||
[[data]]
|
|
||||||
name = "Office Suite"
|
|
||||||
description = "An office suite installer is a software package that installs productivity tools such as word processing, spreadsheets, presentations, and pdf viewers for business and personal use."
|
|
||||||
script = "office-suite-setup.sh"
|
|
||||||
task_list = "I"
|
|
||||||
|
|
||||||
[[data]]
|
[[data]]
|
||||||
name = "Rofi"
|
name = "Rofi"
|
||||||
description = "Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport.\nThis command installs and configures rofi with configuration from CTT's DWM repo.\nhttps://github.com/ChrisTitusTech/dwm-titus"
|
description = "Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport.\nThis command installs and configures rofi with configuration from CTT's DWM repo.\nhttps://github.com/ChrisTitusTech/dwm-titus"
|
||||||
|
|
|
@ -44,6 +44,7 @@ RPROMPT='%F{15}(%F{166}%D{%H:%M}%F{15})%f'
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
# Ensure /etc/zsh/zshenv sets ZDOTDIR to the user's config directory
|
# Ensure /etc/zsh/zshenv sets ZDOTDIR to the user's config directory
|
||||||
|
[ ! -f /etc/zsh/zshenv ] && "$ESCALATION_TOOL" mkdir -p /etc/zsh && "$ESCALATION_TOOL" touch /etc/zsh/zshenv
|
||||||
echo "export ZDOTDIR=\"$HOME/.config/zsh\"" | "$ESCALATION_TOOL" tee -a /etc/zsh/zshenv
|
echo "export ZDOTDIR=\"$HOME/.config/zsh\"" | "$ESCALATION_TOOL" tee -a /etc/zsh/zshenv
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ configureUFW() {
|
||||||
printf "%b\n" "${YELLOW}Allowing port 80/tcp (UFW)${RC}"
|
printf "%b\n" "${YELLOW}Allowing port 80/tcp (UFW)${RC}"
|
||||||
"$ESCALATION_TOOL" ufw allow 80/tcp
|
"$ESCALATION_TOOL" ufw allow 80/tcp
|
||||||
|
|
||||||
printf "%b\n" "${YELLO}Allowing port 443/tcp (UFW)${RC}"
|
printf "%b\n" "${YELLOW}Allowing port 443/tcp (UFW)${RC}"
|
||||||
"$ESCALATION_TOOL" ufw allow 443/tcp
|
"$ESCALATION_TOOL" ufw allow 443/tcp
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Denying Incoming Packets by Default(UFW)${RC}"
|
printf "%b\n" "${YELLOW}Denying Incoming Packets by Default(UFW)${RC}"
|
||||||
|
|
|
@ -216,7 +216,7 @@ echo -ne "
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK
|
THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK
|
||||||
Please make sure you know what you are doing because
|
Please make sure you know what you are doing because
|
||||||
after formating your disk there is no way to get data back
|
after formatting your disk there is no way to get data back
|
||||||
*****BACKUP YOUR DATA BEFORE CONTINUING*****
|
*****BACKUP YOUR DATA BEFORE CONTINUING*****
|
||||||
***I AM NOT RESPONSIBLE FOR ANY DATA LOSS***
|
***I AM NOT RESPONSIBLE FOR ANY DATA LOSS***
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
@ -328,7 +328,7 @@ echo -ne "
|
||||||
pacman -S --noconfirm --needed gptfdisk btrfs-progs glibc
|
pacman -S --noconfirm --needed gptfdisk btrfs-progs glibc
|
||||||
echo -ne "
|
echo -ne "
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
Formating Disk
|
Formatting Disk
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
"
|
"
|
||||||
umount -A --recursive /mnt # make sure everything is unmounted before we start
|
umount -A --recursive /mnt # make sure everything is unmounted before we start
|
||||||
|
|
|
@ -15,30 +15,30 @@ installDepend() {
|
||||||
else
|
else
|
||||||
printf "%b\n" "${GREEN}Multilib is already enabled.${RC}"
|
printf "%b\n" "${GREEN}Multilib is already enabled.${RC}"
|
||||||
fi
|
fi
|
||||||
"$AUR_HELPER" -S --needed --noconfirm "$DEPENDENCIES"
|
"$AUR_HELPER" -S --needed --noconfirm $DEPENDENCIES
|
||||||
;;
|
;;
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
COMPILEDEPS='build-essential'
|
COMPILEDEPS='build-essential'
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
"$ESCALATION_TOOL" dpkg --add-architecture i386
|
"$ESCALATION_TOOL" dpkg --add-architecture i386
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES" "$COMPILEDEPS"
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
COMPILEDEPS='@development-tools'
|
COMPILEDEPS='@development-tools'
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --set-enabled powertools
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager --set-enabled powertools
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
|
"$ESCALATION_TOOL" "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
COMPILEDEPS='patterns-devel-base-devel_basis'
|
COMPILEDEPS='patterns-devel-base-devel_basis'
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" refresh
|
"$ESCALATION_TOOL" "$PACKAGER" refresh
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install "$DEPENDENCIES" "$COMPILEDEPS"
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install $DEPENDENCIES $COMPILEDEPS
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES"
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ configureDNF() {
|
||||||
echo "fastestmirror=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null
|
echo "fastestmirror=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null
|
||||||
echo "defaultyes=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null
|
echo "defaultyes=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
|
"$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
|
||||||
printf "%b\n" "${GREEN}DNF Configured Succesfully...${RC}"
|
printf "%b\n" "${GREEN}DNF Configured Successfully.${RC}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported distribution: $DTYPE${RC}"
|
printf "%b\n" "${RED}Unsupported distribution: $DTYPE${RC}"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
. ../../common-script.sh
|
. ../../common-script.sh
|
||||||
# This script allows user to download proprietary drivers for nvidia in fedora
|
# This script allows user to download proprietary drivers for nvidia in fedora
|
||||||
|
|
||||||
# It also disables noveau nvidia drivers
|
# It also disables nouveau nvidia drivers
|
||||||
|
|
||||||
# Installation guide link: https://rpmfusion.org/Howto/NVIDIA
|
# Installation guide link: https://rpmfusion.org/Howto/NVIDIA
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ installDepend() {
|
||||||
ncurses lib32-ncurses vulkan-icd-loader lib32-vulkan-icd-loader ocl-icd lib32-ocl-icd libva lib32-libva \
|
ncurses lib32-ncurses vulkan-icd-loader lib32-vulkan-icd-loader ocl-icd lib32-ocl-icd libva lib32-libva \
|
||||||
gst-plugins-base-libs lib32-gst-plugins-base-libs sdl2"
|
gst-plugins-base-libs lib32-gst-plugins-base-libs sdl2"
|
||||||
|
|
||||||
$AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES" "$DISTRO_DEPS"
|
$AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS
|
||||||
;;
|
;;
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
DISTRO_DEPS="libasound2 libsdl2 wine64 wine32"
|
DISTRO_DEPS="libasound2 libsdl2 wine64 wine32"
|
||||||
|
@ -33,24 +33,24 @@ installDepend() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common
|
"$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common
|
||||||
"$ESCALATION_TOOL" apt-add-repository contrib -y
|
"$ESCALATION_TOOL" apt-add-repository contrib -y
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES" "$DISTRO_DEPS"
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
if [ "$(rpm -E %fedora)" -le 41 ]; then
|
if [ "$(rpm -E %fedora)" -le 41 ]; then
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install ffmpeg ffmpeg-libs -y
|
"$ESCALATION_TOOL" "$PACKAGER" install ffmpeg ffmpeg-libs -y
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES"
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
||||||
else
|
else
|
||||||
printf "%b\n" "${CYAN}Fedora < 41 detected. Installing rpmfusion repos.${RC}"
|
printf "%b\n" "${CYAN}Fedora < 41 detected. Installing rpmfusion repos.${RC}"
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-"$(rpm -E %fedora)".noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm -y
|
"$ESCALATION_TOOL" "$PACKAGER" install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-"$(rpm -E %fedora)".noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm -y
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --enable fedora-cisco-openh264 -y
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager --enable fedora-cisco-openh264 -y
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES"
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -n install "$DEPENDENCIES"
|
"$ESCALATION_TOOL" "$PACKAGER" -n install $DEPENDENCIES
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES"
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ installAdditionalDepend() {
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
DISTRO_DEPS='steam lutris goverlay'
|
DISTRO_DEPS='steam lutris goverlay'
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$DISTRO_DEPS"
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS
|
||||||
;;
|
;;
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris |
|
version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris |
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
. ../common-script.sh
|
. ../common-script.sh
|
||||||
|
|
||||||
removeSnaps() {
|
removeSnaps() {
|
||||||
|
if command_exists snap; then
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -Rns snapd
|
"$ESCALATION_TOOL" "$PACKAGER" -Rns snapd
|
||||||
|
@ -13,10 +14,7 @@ removeSnaps() {
|
||||||
"$ESCALATION_TOOL" apt-mark hold snapd
|
"$ESCALATION_TOOL" apt-mark hold snapd
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf|zypper)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
|
|
||||||
;;
|
|
||||||
zypper)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
|
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -24,6 +22,10 @@ removeSnaps() {
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
printf "%b\n" "${GREEN}Successfully removed snaps.${RC}"
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}Snapd is not installed.${RC}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
|
|
15
core/tabs/system-setup/system-cleanup.sh
Normal file → Executable file
15
core/tabs/system-setup/system-cleanup.sh
Normal file → Executable file
|
@ -23,19 +23,24 @@ cleanup_system() {
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm
|
"$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -Rns "$(pacman -Qtdq)" --noconfirm
|
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}. Skipping.${RC}"
|
||||||
return 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
common_cleanup() {
|
common_cleanup() {
|
||||||
|
if [ -d /var/tmp ]; then
|
||||||
"$ESCALATION_TOOL" find /var/tmp -type f -atime +5 -delete
|
"$ESCALATION_TOOL" find /var/tmp -type f -atime +5 -delete
|
||||||
|
fi
|
||||||
|
if [ -d /tmp ]; then
|
||||||
"$ESCALATION_TOOL" find /tmp -type f -atime +5 -delete
|
"$ESCALATION_TOOL" find /tmp -type f -atime +5 -delete
|
||||||
|
fi
|
||||||
|
if [ -d /var/log ]; then
|
||||||
"$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
|
"$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
|
||||||
|
fi
|
||||||
"$ESCALATION_TOOL" journalctl --vacuum-time=3d
|
"$ESCALATION_TOOL" journalctl --vacuum-time=3d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +50,12 @@ clean_data() {
|
||||||
case $clean_response in
|
case $clean_response in
|
||||||
y|Y)
|
y|Y)
|
||||||
printf "%b\n" "${YELLOW}Cleaning up old cache files and emptying trash...${RC}"
|
printf "%b\n" "${YELLOW}Cleaning up old cache files and emptying trash...${RC}"
|
||||||
|
if [ -d "$HOME/.cache" ]; then
|
||||||
find "$HOME/.cache/" -type f -atime +5 -delete
|
find "$HOME/.cache/" -type f -atime +5 -delete
|
||||||
|
fi
|
||||||
|
if [ -d "$HOME/.local/share/Trash" ]; then
|
||||||
find "$HOME/.local/share/Trash" -mindepth 1 -delete
|
find "$HOME/.local/share/Trash" -mindepth 1 -delete
|
||||||
|
fi
|
||||||
printf "%b\n" "${GREEN}Cache and trash cleanup completed.${RC}"
|
printf "%b\n" "${GREEN}Cache and trash cleanup completed.${RC}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -59,7 +59,7 @@ updateSystem() {
|
||||||
printf "%b\n" "${GREEN}Updating system${RC}"
|
printf "%b\n" "${GREEN}Updating system${RC}"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" update -y
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
|
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
|
|
|
@ -43,11 +43,13 @@ task_list = "PFM"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Multimedia Codecs"
|
name = "Multimedia Codecs"
|
||||||
|
description = "This script is designed to install multimedia codecs, and to ensure RPM Fusion repositories are installed."
|
||||||
script = "fedora/multimedia-codecs.sh"
|
script = "fedora/multimedia-codecs.sh"
|
||||||
task_list = "I"
|
task_list = "I"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Nvidia Proprietary Drivers"
|
name = "Nvidia Proprietary Drivers"
|
||||||
|
description = "This script is designed to download the proprietary NVIDIA drivers in Fedora."
|
||||||
script = "fedora/nvidia-proprietary-driver-setup.sh"
|
script = "fedora/nvidia-proprietary-driver-setup.sh"
|
||||||
task_list = "I"
|
task_list = "I"
|
||||||
|
|
||||||
|
@ -71,6 +73,7 @@ task_list = "I"
|
||||||
|
|
||||||
[[data]]
|
[[data]]
|
||||||
name = "Full System Cleanup"
|
name = "Full System Cleanup"
|
||||||
|
description = "This script is designed to remove unnecessary packages, clean old cache files, remove temporary files, and to empty the trash."
|
||||||
script = "system-cleanup.sh"
|
script = "system-cleanup.sh"
|
||||||
task_list = "RP PFM"
|
task_list = "RP PFM"
|
||||||
|
|
||||||
|
@ -97,3 +100,9 @@ name = "Remove Snaps"
|
||||||
description = "This script is designed to remove snap"
|
description = "This script is designed to remove snap"
|
||||||
script = "remove-snaps.sh"
|
script = "remove-snaps.sh"
|
||||||
task_list = "RP"
|
task_list = "RP"
|
||||||
|
|
||||||
|
[[data]]
|
||||||
|
name = "TTY Fonts"
|
||||||
|
description = "This Script will set the default TTY font to Terminus size 32 Bold"
|
||||||
|
script = "terminus-tty.sh"
|
||||||
|
task_list = "I PFM"
|
||||||
|
|
66
core/tabs/system-setup/terminus-tty.sh
Executable file
66
core/tabs/system-setup/terminus-tty.sh
Executable file
|
@ -0,0 +1,66 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. ../common-script.sh
|
||||||
|
InstallTermiusFonts() {
|
||||||
|
if [ ! -f "/usr/share/kbd/consolefonts/ter-c18b.psf.gz" ] &&
|
||||||
|
[ ! -f "/usr/share/consolefonts/Uni3-TerminusBold18x10.psf.gz" ] &&
|
||||||
|
[ ! -f "/usr/lib/kbd/consolefonts/ter-p32n.psf.gz" ]; then
|
||||||
|
printf "%b\n" "${YELLOW}Installing Terminus Fonts...${RC}"
|
||||||
|
case "$PACKAGER" in
|
||||||
|
pacman)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm terminus-font
|
||||||
|
;;
|
||||||
|
apt-get|nala)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y fonts-terminus
|
||||||
|
;;
|
||||||
|
dnf)
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y terminus-fonts-console
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
printf "%b\n" "${GREEN}Terminus Fonts is already installed.${RC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTermiusFonts() {
|
||||||
|
case "$DTYPE" in
|
||||||
|
arch)
|
||||||
|
printf "%b\n" "${YELLOW}Updating FONT= line in /etc/vconsole.conf...${RC}"
|
||||||
|
"$ESCALATION_TOOL" sed -i 's/^FONT=.*/FONT=ter-v32b/' /etc/vconsole.conf
|
||||||
|
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||||
|
"$ESCALATION_TOOL" setfont -C /dev/tty1 ter-v32b
|
||||||
|
fi
|
||||||
|
printf "%b\n" "${GREEN}Terminus font set for TTY.${RC}"
|
||||||
|
;;
|
||||||
|
debian)
|
||||||
|
|
||||||
|
printf "%b\n" "${YELLOW}Updating console-setup configuration...${RC}"
|
||||||
|
"$ESCALATION_TOOL" sed -i 's/^CODESET=.*/CODESET="guess"/' /etc/default/console-setup
|
||||||
|
"$ESCALATION_TOOL" sed -i 's/^FONTFACE=.*/FONTFACE="TerminusBold"/' /etc/default/console-setup
|
||||||
|
"$ESCALATION_TOOL" sed -i 's/^FONTSIZE=.*/FONTSIZE="16x32"/' /etc/default/console-setup
|
||||||
|
printf "%b\n" "${GREEN}Console-setup configuration updated for Terminus font.${RC}"
|
||||||
|
# Editing console-setup requires initramfs to be regenerated
|
||||||
|
"$ESCALATION_TOOL" update-initramfs -u
|
||||||
|
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||||
|
"$ESCALATION_TOOL" setfont -C /dev/tty1 /usr/share/consolefonts/Uni3-TerminusBold32x16.psf.gz
|
||||||
|
fi
|
||||||
|
printf "%b\n" "${GREEN}Terminus font has been set for TTY.${RC}"
|
||||||
|
;;
|
||||||
|
fedora)
|
||||||
|
printf "%b\n" "${YELLOW}Updating FONT= line in /etc/vconsole.conf...${RC}"
|
||||||
|
"$ESCALATION_TOOL" sed -i 's/^FONT=.*/FONT=ter-v32b/' /etc/vconsole.conf
|
||||||
|
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||||
|
"$ESCALATION_TOOL" setfont -C /dev/tty1 ter-v32b
|
||||||
|
fi
|
||||||
|
printf "%b\n" "${GREEN}Terminus font has been set for TTY.${RC}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
InstallTermiusFonts
|
||||||
|
SetTermiusFonts
|
|
@ -21,7 +21,7 @@ select_drive() {
|
||||||
|
|
||||||
# Function to get UUID and FSTYPE of the selected drive
|
# Function to get UUID and FSTYPE of the selected drive
|
||||||
get_uuid_fstype() {
|
get_uuid_fstype() {
|
||||||
UUID=$(blkid -s UUID -o value "${partition}")
|
UUID=$("$ESCALATION_TOOL" blkid -s UUID -o value "${partition}")
|
||||||
FSTYPE=$(lsblk -no FSTYPE "${partition}")
|
FSTYPE=$(lsblk -no FSTYPE "${partition}")
|
||||||
NAME=$(lsblk -no NAME "${partition}")
|
NAME=$(lsblk -no NAME "${partition}")
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ change_orientation() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Change Monitor Orientation${RC}"
|
printf "%b\n" "${YELLOW} Change Monitor Orientation${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b" "${YELLOW}Choose a monitor to configure: ${RC}"
|
printf "%b\n" "${YELLOW}Choose a monitor to configure: ${RC}"
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||||
|
|
|
@ -13,7 +13,7 @@ disable_monitor() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Disable Monitor${RC}"
|
printf "%b\n" "${YELLOW} Disable Monitor${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b" "Choose a monitor to disable: "
|
printf "%b\n" "Choose a monitor to disable: "
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||||
|
|
|
@ -13,7 +13,7 @@ enable_monitor() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Enable Monitor${RC}"
|
printf "%b\n" "${YELLOW} Enable Monitor${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b" "${YELLOW}Choose a monitor to enable: ${RC}"
|
printf "%b\n" "${YELLOW}Choose a monitor to enable: ${RC}"
|
||||||
|
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
. ./utility_functions.sh
|
. ../utility_functions.sh
|
||||||
|
|
||||||
. ../../common-script.sh
|
. ../../common-script.sh
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ manage_arrangement() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Manage Monitor Arrangement${RC}"
|
printf "%b\n" "${YELLOW} Manage Monitor Arrangement${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b" "${YELLOW}Choose the monitor to arrange: ${RC}"
|
printf "%b\n" "${YELLOW}Choose the monitor to arrange: ${RC}"
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${YELLOW}$monitor${RC}"
|
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ set_primary_monitor() {
|
||||||
printf "%b\n" "${YELLOW}Choose a monitor to set as primary:${RC}"
|
printf "%b\n" "${YELLOW}Choose a monitor to set as primary:${RC}"
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${YELLOW}$monitor${RC}"
|
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -16,60 +16,66 @@ values = [":0", ":1", ":2", ":3", ":4", ":5", ":6", ":7", ":8", ":9"]
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Auto Detect Displays"
|
name = "Auto Detect Displays"
|
||||||
description = "This utility is designed to detect and apply recommended configuration for monitors connected with your system"
|
description = "This script is designed to detect and apply recommended configuration for monitors connected with your system"
|
||||||
script = "monitor-control/auto_detect_displays.sh"
|
script = "monitor-control/auto_detect_displays.sh"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Change Orientation"
|
name = "Change Orientation"
|
||||||
description = "This utility is designed to change the orientation of monitors in your system"
|
description = "This script is designed to change the orientation of monitors in your system"
|
||||||
script = "monitor-control/change_orientation.sh"
|
script = "monitor-control/change_orientation.sh"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Disable Monitor"
|
name = "Disable Monitor"
|
||||||
description = "This utility is designed to disable a monitor in your system"
|
description = "This script is designed to disable a monitor in your system"
|
||||||
script = "monitor-control/disable_monitor.sh"
|
script = "monitor-control/disable_monitor.sh"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Duplicate Displays"
|
name = "Duplicate Displays"
|
||||||
description = "This utility is designed to duplicate display among multi-monitor setup in your system"
|
description = "This script is designed to duplicate display among multi-monitor setup in your system"
|
||||||
script = "monitor-control/duplicate_displays.sh"
|
script = "monitor-control/duplicate_displays.sh"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Enable Monitor"
|
name = "Enable Monitor"
|
||||||
description = "This utility is designed to enable a monitor in your system"
|
description = "This script is designed to enable a monitor in your system"
|
||||||
script = "monitor-control/enable_monitor.sh"
|
script = "monitor-control/enable_monitor.sh"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Extend Displays"
|
name = "Extend Displays"
|
||||||
description = "This utility is designed to extend display among multi-monitor setup in your system"
|
description = "This script is designed to extend display among multi-monitor setup in your system"
|
||||||
script = "monitor-control/extend_displays.sh"
|
script = "monitor-control/extend_displays.sh"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Manage Arrangement"
|
name = "Manage Arrangement"
|
||||||
description = "This utility is designed to arrange monitors in multi-monitor setup in your system"
|
description = "This script is designed to arrange monitors in multi-monitor setup in your system"
|
||||||
script = "monitor-control/manage_arrangement.sh"
|
script = "monitor-control/manage_arrangement.sh"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Reset Scaling"
|
name = "Reset Scaling"
|
||||||
description = "This utility is designed to reset scaling of a monitor in your system"
|
description = "This script is designed to reset scaling of a monitor in your system"
|
||||||
script = "monitor-control/reset_scaling.sh"
|
script = "monitor-control/reset_scaling.sh"
|
||||||
matches = true
|
matches = true
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Scale Monitors"
|
name = "Scale Monitors"
|
||||||
description = "This utility is designed to change the scaling of monitors in your system"
|
description = "This script is designed to change the scaling of monitors in your system"
|
||||||
script = "monitor-control/scale_monitor.sh"
|
script = "monitor-control/scale_monitor.sh"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Set Brightness"
|
name = "Set Brightness"
|
||||||
script = "monitor-control/set_brightness.sh"
|
script = "monitor-control/set_brightness.sh"
|
||||||
|
description = "This script is designed to change the Brightness of monitors connected to your system"
|
||||||
matches = true
|
matches = true
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Set Primary Monitor"
|
name = "Set Primary Monitor"
|
||||||
description = "This utility is designed to set a Primary monitor in your system"
|
description = "This script is designed to set a Primary monitor in your system"
|
||||||
script = "monitor-control/set_primary_monitor.sh"
|
script = "monitor-control/set_primary_monitor.sh"
|
||||||
|
|
||||||
|
[[data.entries]]
|
||||||
|
name = "Set Resolution"
|
||||||
|
description = "This script is designed to change the resolution of monitors connected to your system"
|
||||||
|
script = "monitor-control/set_resolutions.sh"
|
||||||
|
|
||||||
[[data]]
|
[[data]]
|
||||||
name = "User Account Manager"
|
name = "User Account Manager"
|
||||||
|
|
||||||
|
|
BIN
docs/assets/preview.gif
Normal file
BIN
docs/assets/preview.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 MiB |
Binary file not shown.
Before Width: | Height: | Size: 66 KiB |
89
docs/assets/preview.tape
Normal file
89
docs/assets/preview.tape
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
# 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,4 +1,6 @@
|
||||||
# How to Contribute?
|
<!-- 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:
|
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:
|
||||||
|
|
||||||
|
@ -16,6 +18,7 @@ cd linutil
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3. Make your changes
|
## 3. Make your changes
|
||||||
|
|
||||||
- **Edit the files you want to change**: Make your changes to the relevant files.
|
- **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.
|
- **Test your changes**: Run `cargo run` to test your modifications in a local environment and ensure everything works as expected.
|
||||||
|
|
||||||
|
@ -40,22 +43,29 @@ cd linutil
|
||||||
- **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.
|
- **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.
|
- **Avoid combining unrelated changes**: PRs that tackle multiple unrelated issues are harder to review and might be rejected because of a single problem.
|
||||||
|
|
||||||
## 8. Code Review and Feedback
|
## 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.
|
- **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.
|
- **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.
|
||||||
|
|
||||||
## 9. Contributing Is More Than Just Code
|
## 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.
|
- **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.
|
- **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.
|
- **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.
|
||||||
|
|
||||||
## 10. Documentation
|
## 11. Documentation
|
||||||
|
|
||||||
- **Update the documentation**: If your change affects the functionality, please update the relevant documentation files to reflect this.
|
- **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`.
|
||||||
|
|
||||||
## 11. License
|
## 12. License
|
||||||
|
|
||||||
- **Agree to the license**: By contributing to Linutil, you agree that your contributions will be licensed under the project's MIT license.
|
- **Agree to the license**: By contributing to Linutil, you agree that your contributions will be licensed under the project's MIT license.
|
||||||
|
|
|
@ -69,7 +69,7 @@ Note that crates installed using `cargo install` require manual updating with `c
|
||||||
|
|
||||||
After you've ran the command, you should see a GUI on your screen; It will look something like this:
|
After you've ran the command, you should see a GUI on your screen; It will look something like this:
|
||||||
|
|
||||||
![preview](assets/preview.png)
|
![preview](assets/preview.gif)
|
||||||
|
|
||||||
!!! info
|
!!! info
|
||||||
|
|
||||||
|
|
|
@ -1,80 +1,151 @@
|
||||||
|
<!-- THIS FILE IS GENERATED BY cargo xtask docgen -->
|
||||||
# Walkthrough
|
# Walkthrough
|
||||||
---
|
|
||||||
|
|
||||||
## System Setup
|
|
||||||
|
|
||||||
- **System Update**: Starts a system-wide update.
|
|
||||||
- **Compile Setup**: Installs tools and dependencies for compiling software.
|
|
||||||
- **Gaming Setup**: Configures Steam, Lutris, etc.
|
|
||||||
- **Global Theming**: Sets up and manages global themes.
|
|
||||||
- **Remove Snaps**: Removes snap packages.
|
|
||||||
|
|
||||||
### Arch Setup
|
|
||||||
|
|
||||||
- **Paru Setup**: Installs the Paru AUR helper.
|
|
||||||
- **Yay Setup**: Installs the Yay AUR helper.
|
|
||||||
- **Server Setup**: Installs Arch Linux.
|
|
||||||
|
|
||||||
### Fedora Setup
|
|
||||||
|
|
||||||
- **RPM Fusion Setup**: Adds RPM Fusion free and nonfree repositories.
|
|
||||||
- **Multimedia Codecs**: Installs multimedia codecs and updates multimedia-related packages. Requires RPM Fusion repositories to be set up first.
|
|
||||||
- **NVIDIA Proprietary Driver Setup**: Installs proprietary NVIDIA drivers for GPUs from 2014 or later.
|
|
||||||
- **Virtualization Setup**: Installs virtualization tools.
|
|
||||||
- **Configure DNF**: Optimizes DNF for better speeds.
|
|
||||||
|
|
||||||
## Applications Setup
|
## Applications Setup
|
||||||
|
|
||||||
- **Flathub**: Installs Flatpak and Flathub.
|
|
||||||
- **Alacritty Setup**: Installs and configures Alacritty for you.
|
|
||||||
- **DwmTitus Setup**: Sets up the Dwm window manager.
|
|
||||||
- **Kitty Setup**: Installs and configures Kitty for you.
|
|
||||||
- **Rofi Setup**: Installs the Rofi application/script launcher.
|
|
||||||
- **Zsh Setup**: Installs and configures Zsh for you.
|
|
||||||
- **Fastfetch Setup**: Installs and configures Fastfetch.
|
|
||||||
- **Linutil Updater**: Updates the Linutil AUR / Crates.io Package.
|
|
||||||
- **Linutil Installer**: Installs Linutil via Crates.io or AUR.
|
|
||||||
- **Office Suite Setup**: Installs various office suites and PDF viewers (OnlyOffice, LibreOffice, WPS Office, FreeOffice, Evince, Okular, PDF Studio Viewer, PDF Studio).
|
|
||||||
|
|
||||||
### Developer Tools
|
### Developer Tools
|
||||||
|
|
||||||
- **Meld Setup**: Installs Meld, a visual diff and merge tool.
|
- **Github Desktop**: GitHub Desktop is a user-friendly application that simplifies the process of managing Git repositories and interacting with GitHub, providing a graphical interface for tasks like committing, branching, and syncing changes.
|
||||||
- **Ngrok Setup**: Installs Ngrok, a tool for creating secure tunnels to localhost.
|
- **Neovim**: Neovim is a refactor, and sometimes redactor, in the tradition of Vim.
|
||||||
- **Neovim Setup**: Installs and configures Neovim, a Vim-based text editor.
|
It is not a rewrite but a continuation and extension of Vim.
|
||||||
- **VS Code Setup**: Installs Visual Studio Code, a popular text editor.
|
This command configures neovim from CTT's neovim configuration.
|
||||||
- **Sublime Setup**: Installs Sublime Text, a nice text editor for code and markup.
|
https://github.com/ChrisTitusTech/neovim
|
||||||
- **VS Codium Setup**: Installs VS Codium, an open-source build of VS Code.
|
- **Sublime Text**: Sublime Text is a fast, lightweight, and customizable text editor known for its simplicity, powerful features, and wide range of plugins for various programming languages.
|
||||||
- **GitHub Desktop Setup**: Installs GitHub Desktop, a GUI for Git and GitHub.
|
- **VS Code**: Visual Studio Code (VS Code) is a lightweight, open-source code editor with built-in support for debugging, version control, and extensions for various programming languages and frameworks.
|
||||||
|
- **VS Codium**: VSCodium is a free, open-source version of Visual Studio Code (VS Code) that removes Microsoft-specific telemetry and branding.
|
||||||
|
- **Meld**: Meld is a visual diff and merge tool that helps compare files, directories, and version-controlled projects.
|
||||||
|
- **Ngrok**: Ngrok is a tool that creates secure, temporary tunnels to expose local servers to the internet for testing and development.
|
||||||
|
|
||||||
## Security Features
|
### Communication Apps
|
||||||
|
|
||||||
- **Firewall Baselines**: Sets up firewall rules.
|
- **Discord**: Discord is a versatile communication platform for gamers and communities, offering voice, video, and text chat features.
|
||||||
|
- **Jitsi**: Jitsi Meet is an open-source video conferencing tool that allows users to host and join secure meetings directly from their web browsers without the need for downloads.
|
||||||
|
- **Signal**: Signal is a privacy-focused messaging app that provides end-to-end encryption for secure text, voice, and video communication.
|
||||||
|
- **Slack**: Slack is a collaboration platform designed for team communication, featuring channels, direct messaging, file sharing, and integrations with various productivity tools.
|
||||||
|
- **Telegram**: Telegram is a cloud-based messaging app known for its speed and security, offering features like group chats, channels, and end-to-end encrypted calls.
|
||||||
|
- **Zoom**: Zoom is a widely-used video conferencing platform that allows users to host virtual meetings, webinars, and online collaboration with features like screen sharing and recording.
|
||||||
|
- **Thunderbird**: Thunderbird is a free, open-source email client that offers powerful features like customizable email management, a built-in calendar, and extensive add-ons for enhanced functionality.
|
||||||
|
|
||||||
|
### Office Suites
|
||||||
|
|
||||||
|
|
||||||
|
### PDF Suites
|
||||||
|
|
||||||
|
|
||||||
|
### Web Browsers
|
||||||
|
|
||||||
|
- **Brave**: Brave is a free and open-source web browser developed by Brave Software, Inc. based on the Chromium web browser.
|
||||||
|
- **Chromium**: Chromium is an open-source web browser project started by Google, to provide the source code for the proprietary Google Chrome browser.
|
||||||
|
- **Google Chrome**: Google Chrome is a fast, secure, and free web browser, built for the modern web.
|
||||||
|
- **LibreWolf**: LibreWolf is a fork of Firefox, focused on privacy, security, and freedom.
|
||||||
|
- **Lynx**: Lynx is a highly configurable text-based web browser for use on cursor-addressable character cell terminals.
|
||||||
|
- **Mozilla Firefox**: Mozilla Firefox is a free and open-source web browser developed by the Mozilla Foundation.
|
||||||
|
- **Thorium**: Thorium is a Chromium-based browser focused on privacy and performance.
|
||||||
|
- **Vivaldi**: Vivaldi is a freeware, cross-platform web browser developed by Vivaldi Technologies.
|
||||||
|
- **Alacritty**: Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows.
|
||||||
|
This command installs and condifures alacritty terminal emulator.
|
||||||
|
- **Android Debloater**: Universal Android Debloater (UAD) is a tool designed to help users remove bloatware and unnecessary pre-installed applications from Android devices, enhancing performance and user experience.
|
||||||
|
- **Bash Prompt**: 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
|
||||||
|
- **Bottles**: Bottles allows Windows software, like applications and games, to run on Linux.
|
||||||
|
Bottles also provides tools to categorize, organize and optimize your applications.
|
||||||
|
- **DWM-Titus**: DWM is a dynamic window manager for X.
|
||||||
|
It manages windows in tiled, monocle and floating layouts.
|
||||||
|
All of the layouts can be applied dynamically, optimising the environment for the application in use and the task performed.
|
||||||
|
This command installs and configures DWM and a desktop manager.
|
||||||
|
The list of patches applied can be found in CTT's DWM repository
|
||||||
|
https://github.com/ChrisTitusTech/dwm-titus
|
||||||
|
- **Docker**: Docker is an open platform that uses OS-level virtualization to deliver software in packages called containers.
|
||||||
|
- **Fastfetch**: Fastfetch is a neofetch-like tool for fetching system information and displaying it prettily.
|
||||||
|
It is written mainly in C, with performance and customizability in mind.
|
||||||
|
This command installs fastfetch and configures from CTT's mybash repository.
|
||||||
|
https://github.com/ChrisTitusTech/mybash
|
||||||
|
- **Flatpak / Flathub**: Flatpak is a universal application sandbox for Linux that uses isolated packages from Flathub to prevent conflicts and system alterations, while alleviating dependency concerns.
|
||||||
|
This command installs Flatpak and adds the Flathub repository
|
||||||
|
- **Grub Theme**: Installs ChrisTitusTech's Top 5 Bootloader Themes script to allow for easy customization of GRUB.
|
||||||
|
- **Kitty**: kitty is a free and open-source GPU-accelerated terminal emulator for Linux, macOS, and some BSD distributions, focused on performance and features.
|
||||||
|
kitty is written in a mix of C and Python programming languages.
|
||||||
|
This command installs and configures kitty.
|
||||||
|
- **Linutil Installer**: Installs a distro-specific Linutil package locally.
|
||||||
|
- **Linutil Updater**: Updates your local Linutil crate installation.
|
||||||
|
- **Rofi**: Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport.
|
||||||
|
This command installs and configures rofi with configuration from CTT's DWM repo.
|
||||||
|
https://github.com/ChrisTitusTech/dwm-titus
|
||||||
|
- **Waydroid**: Waydroid is an emulator that allows you to run Android apps and games on Linux.
|
||||||
|
- **ZSH Prompt**: The Z shell is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.
|
||||||
|
This command installs ZSH prompt and provides basic configuration.
|
||||||
|
|
||||||
|
## Gaming
|
||||||
|
|
||||||
|
|
||||||
|
### Diablo II Resurrected
|
||||||
|
|
||||||
|
- **Loot Filter**: This is a loot filter for Diablo II Resurrected.
|
||||||
|
It's designed to be a simple, clean, and easy to read loot filter that highlights the most important items.
|
||||||
|
Works on battle.net and single player.
|
||||||
|
No frills, no config, just highlights high runes and other valuable items.
|
||||||
|
For more information visit: https://github.com/ChrisTitusTech/d2r-loot-filter
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
- **Firewall Baselines (CTT)**: Developed to ease iptables firewall configuration, UFW provides a user friendly way to create an IPv4 or IPv6 host-based firewall.
|
||||||
|
This command installs UFW and configures UFW based on CTT's recommended rules.
|
||||||
|
For more information visit: https://christitus.com/linux-security-mistakes
|
||||||
|
|
||||||
|
## System Setup
|
||||||
|
|
||||||
|
|
||||||
|
### Arch Linux
|
||||||
|
|
||||||
|
- **Arch Server Setup**: This command installs a minimal arch server setup under 5 minutes.
|
||||||
|
- **Paru AUR Helper**: Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction.
|
||||||
|
To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers
|
||||||
|
- **Yay AUR Helper**: Yet Another Yogurt - An AUR Helper Written in Go.
|
||||||
|
To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers
|
||||||
|
|
||||||
|
### Fedora
|
||||||
|
|
||||||
|
- **Configure DNF**: Optimizes DNF for parallel downloads
|
||||||
|
- **Multimedia Codecs**: This script is designed to install multimedia codecs, and to ensure RPM Fusion repositories are installed.
|
||||||
|
- **Nvidia Proprietary Drivers**: This script is designed to download the proprietary NVIDIA drivers in Fedora.
|
||||||
|
- **RPM Fusion**: RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship.
|
||||||
|
That software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions; you can use the RPM Fusion repositories with tools like yum and PackageKit.
|
||||||
|
For more information visit: https://rpmfusion.org/
|
||||||
|
- **Virtualization**: Enables Virtualization through dnf
|
||||||
|
- **Build Prerequisites**: This script is designed to handle the installation of various software dependencies across different Linux distributions
|
||||||
|
- **Full System Cleanup**: This script is designed to remove unnecessary packages, clean old cache files, remove temporary files, and to empty the trash.
|
||||||
|
- **Full System Update**: This command updates your system to the latest packages available for your distro
|
||||||
|
- **Gaming Dependencies**: This script is designed to handle the installation of gaming dependencies across different Linux distributions
|
||||||
|
- **Global Theme**: This script is designed to handle the installation and configuration of global theming
|
||||||
|
- **Remove Snaps**: This script is designed to remove snap
|
||||||
|
- **TTY Fonts**: This Script will set the default TTY font to Terminus size 32 Bold
|
||||||
|
|
||||||
## Utilities
|
## Utilities
|
||||||
|
|
||||||
- **Wifi Control**: Controls WiFi settings.
|
|
||||||
- **Numlock Control**: Sets up Numlock on boot.
|
|
||||||
- **Bluetooth Control**: Controls Bluetooth settings.
|
|
||||||
|
|
||||||
### Monitor control
|
### Monitor Control
|
||||||
|
|
||||||
- **Reset Scaling**: Resets monitor scaling to native resolution.
|
- **Auto Detect Displays**: This script is designed to detect and apply recommended configuration for monitors connected with your system
|
||||||
- **Scale Monitor**: Scales smaller monitors to the highest resolution of a bigger monitor.
|
- **Change Orientation**: This script is designed to change the orientation of monitors in your system
|
||||||
- **Enable Monitor**: Enables a selected monitor.
|
- **Disable Monitor**: This script is designed to disable a monitor in your system
|
||||||
- **Disable Monitor**: Disables a selected monitor.
|
- **Duplicate Displays**: This script is designed to duplicate display among multi-monitor setup in your system
|
||||||
- **Set Brightness**: Adjusts brightness for a selected monitor.
|
- **Enable Monitor**: This script is designed to enable a monitor in your system
|
||||||
- **Set Resolutions**: Sets resolutions for connected monitors.
|
- **Extend Displays**: This script is designed to extend display among multi-monitor setup in your system
|
||||||
- **Change Orientation**: Changes the orientation of a selected monitor.
|
- **Manage Arrangement**: This script is designed to arrange monitors in multi-monitor setup in your system
|
||||||
- **Extend Displays**: Extends displays to the right.
|
- **Reset Scaling**: This script is designed to reset scaling of a monitor in your system
|
||||||
- **Duplicate Displays**: Duplicates displays.
|
- **Scale Monitors**: This script is designed to change the scaling of monitors in your system
|
||||||
- **Manage Arrangement**: Manages the arrangement of multiple monitors.
|
- **Set Brightness**: This script is designed to change the Brightness of monitors connected to your system
|
||||||
- **Set Primary Monitor**: Sets a selected monitor as the main display.
|
- **Set Primary Monitor**: This script is designed to set a Primary monitor in your system
|
||||||
- **Auto Detect Displays**: Sets common resolution.
|
- **Set Resolution**: This script is designed to change the resolution of monitors connected to your system
|
||||||
|
|
||||||
### User Account Manager
|
### User Account Manager
|
||||||
|
|
||||||
- **Add User**: Creates a new user account.
|
- **Auto Mount Drive**: This utility is designed to help with automating the process of mounting a drive on to your system.
|
||||||
- **Delete User**: Deletes an existing user account.
|
- **Bluetooth Manager**: This utility is designed to manage bluetooth in your system
|
||||||
- **Add to Group**: Adds a user to specified groups.
|
- **Numlock on Startup**: This utility is designed to configure auto enabling of numlock on boot
|
||||||
- **Remove from Group**: Removes a user from specified groups.
|
- **Ollama**: This utility is designed to manage ollama in your system
|
||||||
- **Change Password**: Changes the password for a user account.
|
- **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,6 +1,7 @@
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Name=Linutil
|
Name=Linutil
|
||||||
Exec=sh -c "$HOME/.local/bin/linutil"
|
Comment=Distro-agnostic toolbox designed to simplify everyday Linux tasks
|
||||||
|
Exec=sh -c '/usr/bin/linutil || $HOME/.cargo/bin/linutil || linutil'
|
||||||
Icon=utilities-terminal
|
Icon=utilities-terminal
|
||||||
Type=Application
|
Type=Application
|
||||||
Terminal=true
|
Terminal=true
|
||||||
|
|
65
man/linutil.1
Normal file
65
man/linutil.1
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
.\" manpage for Linutil
|
||||||
|
.TH "linutil" "1" "October 2024" "" "Linutil Manual"
|
||||||
|
|
||||||
|
.SH NAME
|
||||||
|
linutil \- Chris Titus Tech's Linux Toolbox
|
||||||
|
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBlinutil [OPTIONS]\fR
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Linutil is a distro-agnostic toolbox designed to simplify everyday Linux tasks.
|
||||||
|
.br
|
||||||
|
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.
|
||||||
|
|
||||||
|
.SH LIVE VERSION
|
||||||
|
To get started with the live version, pick which branch you would like to use, then run the command in your terminal:
|
||||||
|
.TP
|
||||||
|
\fBStable Branch\fR
|
||||||
|
curl -fsSL https://christitus.com/linux | sh
|
||||||
|
.TP
|
||||||
|
\fBDevelopement branch\fR
|
||||||
|
curl -fsSL https://christitus.com/linuxdev | sh
|
||||||
|
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\fB\-t\fR, \fB\-\-theme\fR \fI<theme>\fR
|
||||||
|
Set the theme to use in the TUI.
|
||||||
|
.br
|
||||||
|
Possible values:
|
||||||
|
\fIdefault\fR,
|
||||||
|
\fIcompatible\fR.
|
||||||
|
.br
|
||||||
|
Defaults to \fIdefault\fR.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-\-override\-validation\fR
|
||||||
|
Show all available entries, disregarding compatibility checks. (\fBUNSAFE\fR)
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-h\fR, \fB\-\-help\fR
|
||||||
|
Print help.
|
||||||
|
|
||||||
|
.SH SUPPORT
|
||||||
|
If you find Linutil helpful, please consider giving it a star on GitHub to show your support!
|
||||||
|
https://github.com/ChrisTitusTech/linutil
|
||||||
|
|
||||||
|
.SH DOCUMENTATION
|
||||||
|
For comprehensive information on how to use Linutil, visit the Official Linutil Documentation.
|
||||||
|
https://christitustech.github.io/linutil
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Written by Adam Perkowski.
|
||||||
|
<adas1per@protonmail.com>
|
||||||
|
|
||||||
|
.SH REPORTING BUGS
|
||||||
|
Since the project is still in active development, you may encounter some issues.
|
||||||
|
.br
|
||||||
|
Please consider submitting feedback if you do.
|
||||||
|
https://github.com/ChrisTitusTech/linutil/issues
|
||||||
|
|
||||||
|
.SH COPYRIGHT
|
||||||
|
Copyright (c) 2024 Chris Titus.
|
||||||
|
.br
|
||||||
|
MIT License.
|
||||||
|
https://opensource.org/license/MIT
|
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository = "https://github.com/ChrisTitusTech/linutil/tree/main/tui"
|
repository = "https://github.com/ChrisTitusTech/linutil/tree/main/tui"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
include = ["src/*.rs", "Cargo.toml", "build.rs", "cool_tips.txt"]
|
include = ["src/*.rs", "Cargo.toml", "build.rs", "cool_tips.txt", "../man/linutil.1"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -15,17 +15,18 @@ default = ["tips"]
|
||||||
tips = ["rand"]
|
tips = ["rand"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.5.16", features = ["derive"] }
|
clap = { version = "4.5.19", features = ["derive"] }
|
||||||
crossterm = "0.28.1"
|
crossterm = "0.28.1"
|
||||||
ego-tree = { workspace = true }
|
ego-tree = { workspace = true }
|
||||||
oneshot = "0.1.8"
|
oneshot = "0.1.8"
|
||||||
portable-pty = "0.8.1"
|
portable-pty = "0.8.1"
|
||||||
ratatui = "0.28.1"
|
ratatui = "0.28.1"
|
||||||
tui-term = "0.1.12"
|
tui-term = "0.1.12"
|
||||||
unicode-width = "0.1.13"
|
temp-dir = "0.1.14"
|
||||||
|
unicode-width = "0.2.0"
|
||||||
rand = { version = "0.8.5", optional = true }
|
rand = { version = "0.8.5", optional = true }
|
||||||
linutil_core = { path = "../core", version = "24.9.23" }
|
linutil_core = { path = "../core", version = "24.9.28" }
|
||||||
tree-sitter-highlight = "0.23.0"
|
tree-sitter-highlight = "0.24.2"
|
||||||
tree-sitter-bash = "0.23.1"
|
tree-sitter-bash = "0.23.1"
|
||||||
anstyle = "1.0.8"
|
anstyle = "1.0.8"
|
||||||
ansi-to-tui = "6.0.0"
|
ansi-to-tui = "6.0.0"
|
||||||
|
|
126
tui/src/confirmation.rs
Normal file
126
tui/src/confirmation.rs
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
use crate::{float::FloatContent, hint::Shortcut};
|
||||||
|
|
||||||
|
use crossterm::event::{KeyCode, KeyEvent};
|
||||||
|
use ratatui::{
|
||||||
|
layout::Alignment,
|
||||||
|
prelude::*,
|
||||||
|
widgets::{Block, Borders, Clear, List},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub enum ConfirmStatus {
|
||||||
|
Confirm,
|
||||||
|
Abort,
|
||||||
|
None,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ConfirmPrompt {
|
||||||
|
pub names: Box<[String]>,
|
||||||
|
pub status: ConfirmStatus,
|
||||||
|
scroll: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ConfirmPrompt {
|
||||||
|
pub fn new(names: &[&str]) -> Self {
|
||||||
|
let max_count_str = format!("{}", names.len());
|
||||||
|
let names = names
|
||||||
|
.iter()
|
||||||
|
.zip(1..)
|
||||||
|
.map(|(name, n)| {
|
||||||
|
let count_str = format!("{n}");
|
||||||
|
let space_str = (0..(max_count_str.len() - count_str.len()))
|
||||||
|
.map(|_| ' ')
|
||||||
|
.collect::<String>();
|
||||||
|
format!("{space_str}{n}. {name}")
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
Self {
|
||||||
|
names,
|
||||||
|
status: ConfirmStatus::None,
|
||||||
|
scroll: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn scroll_down(&mut self) {
|
||||||
|
if self.scroll < self.names.len() - 1 {
|
||||||
|
self.scroll += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn scroll_up(&mut self) {
|
||||||
|
if self.scroll > 0 {
|
||||||
|
self.scroll -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FloatContent for ConfirmPrompt {
|
||||||
|
fn draw(&mut self, frame: &mut Frame, area: Rect) {
|
||||||
|
let block = Block::default()
|
||||||
|
.borders(Borders::ALL)
|
||||||
|
.title(" Confirm selections ")
|
||||||
|
.title_bottom(" [y] to continue, [n] to abort ")
|
||||||
|
.title_alignment(Alignment::Center)
|
||||||
|
.title_style(Style::default().bold())
|
||||||
|
.style(Style::default());
|
||||||
|
|
||||||
|
frame.render_widget(block.clone(), area);
|
||||||
|
|
||||||
|
let inner_area = block.inner(area);
|
||||||
|
|
||||||
|
let paths_text = self
|
||||||
|
.names
|
||||||
|
.iter()
|
||||||
|
.skip(self.scroll)
|
||||||
|
.map(|p| {
|
||||||
|
let span = Span::from(Cow::<'_, str>::Borrowed(p));
|
||||||
|
Line::from(span).style(Style::default())
|
||||||
|
})
|
||||||
|
.collect::<Text>();
|
||||||
|
|
||||||
|
frame.render_widget(Clear, inner_area);
|
||||||
|
frame.render_widget(List::new(paths_text), inner_area);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_key_event(&mut self, key: &KeyEvent) -> bool {
|
||||||
|
use KeyCode::*;
|
||||||
|
self.status = match key.code {
|
||||||
|
Char('y') | Char('Y') => ConfirmStatus::Confirm,
|
||||||
|
Char('n') | Char('N') | Esc => ConfirmStatus::Abort,
|
||||||
|
Char('j') => {
|
||||||
|
self.scroll_down();
|
||||||
|
ConfirmStatus::None
|
||||||
|
}
|
||||||
|
Char('k') => {
|
||||||
|
self.scroll_up();
|
||||||
|
ConfirmStatus::None
|
||||||
|
}
|
||||||
|
_ => ConfirmStatus::None,
|
||||||
|
};
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_finished(&self) -> bool {
|
||||||
|
use ConfirmStatus::*;
|
||||||
|
match self.status {
|
||||||
|
Confirm | Abort => true,
|
||||||
|
None => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_shortcut_list(&self) -> (&str, Box<[Shortcut]>) {
|
||||||
|
(
|
||||||
|
"Confirmation prompt",
|
||||||
|
Box::new([
|
||||||
|
Shortcut::new("Continue", ["Y", "y"]),
|
||||||
|
Shortcut::new("Abort", ["N", "n"]),
|
||||||
|
Shortcut::new("Scroll up", ["j"]),
|
||||||
|
Shortcut::new("Scroll down", ["k"]),
|
||||||
|
Shortcut::new("Close linutil", ["CTRL-c", "q"]),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{state::ListEntry, theme::Theme};
|
use crate::{state::ListEntry, theme::Theme};
|
||||||
use crossterm::event::{KeyCode, KeyEvent};
|
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||||
use ego_tree::NodeId;
|
use ego_tree::NodeId;
|
||||||
use linutil_core::Tab;
|
use linutil_core::Tab;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
@ -116,21 +116,27 @@ impl Filter {
|
||||||
pub fn handle_key(&mut self, event: &KeyEvent) -> SearchAction {
|
pub fn handle_key(&mut self, event: &KeyEvent) -> SearchAction {
|
||||||
//Insert user input into the search bar
|
//Insert user input into the search bar
|
||||||
match event.code {
|
match event.code {
|
||||||
|
KeyCode::Char('c') if event.modifiers.contains(KeyModifiers::CONTROL) => {
|
||||||
|
return self.exit_search()
|
||||||
|
}
|
||||||
KeyCode::Char(c) => self.insert_char(c),
|
KeyCode::Char(c) => self.insert_char(c),
|
||||||
KeyCode::Backspace => self.remove_previous(),
|
KeyCode::Backspace => self.remove_previous(),
|
||||||
KeyCode::Delete => self.remove_next(),
|
KeyCode::Delete => self.remove_next(),
|
||||||
KeyCode::Left => return self.cursor_left(),
|
KeyCode::Left => return self.cursor_left(),
|
||||||
KeyCode::Right => return self.cursor_right(),
|
KeyCode::Right => return self.cursor_right(),
|
||||||
KeyCode::Esc => {
|
|
||||||
self.input_position = 0;
|
|
||||||
self.search_input.clear();
|
|
||||||
return SearchAction::Exit;
|
|
||||||
}
|
|
||||||
KeyCode::Enter => return SearchAction::Exit,
|
KeyCode::Enter => return SearchAction::Exit,
|
||||||
|
KeyCode::Esc => return self.exit_search(),
|
||||||
_ => return SearchAction::None,
|
_ => return SearchAction::None,
|
||||||
};
|
};
|
||||||
SearchAction::Update
|
SearchAction::Update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn exit_search(&mut self) -> SearchAction {
|
||||||
|
self.input_position = 0;
|
||||||
|
self.search_input.clear();
|
||||||
|
SearchAction::Exit
|
||||||
|
}
|
||||||
|
|
||||||
fn cursor_left(&mut self) -> SearchAction {
|
fn cursor_left(&mut self) -> SearchAction {
|
||||||
self.input_position = self.input_position.saturating_sub(1);
|
self.input_position = self.input_position.saturating_sub(1);
|
||||||
SearchAction::None
|
SearchAction::None
|
||||||
|
|
|
@ -13,14 +13,14 @@ pub trait FloatContent {
|
||||||
fn get_shortcut_list(&self) -> (&str, Box<[Shortcut]>);
|
fn get_shortcut_list(&self) -> (&str, Box<[Shortcut]>);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Float {
|
pub struct Float<Content: FloatContent + ?Sized> {
|
||||||
content: Box<dyn FloatContent>,
|
pub content: Box<Content>,
|
||||||
width_percent: u16,
|
width_percent: u16,
|
||||||
height_percent: u16,
|
height_percent: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Float {
|
impl<Content: FloatContent + ?Sized> Float<Content> {
|
||||||
pub fn new(content: Box<dyn FloatContent>, width_percent: u16, height_percent: u16) -> Self {
|
pub fn new(content: Box<Content>, width_percent: u16, height_percent: u16) -> Self {
|
||||||
Self {
|
Self {
|
||||||
content,
|
content,
|
||||||
width_percent,
|
width_percent,
|
||||||
|
@ -60,6 +60,7 @@ impl Float {
|
||||||
| KeyCode::Char('p')
|
| KeyCode::Char('p')
|
||||||
| KeyCode::Char('d')
|
| KeyCode::Char('d')
|
||||||
| KeyCode::Char('g')
|
| KeyCode::Char('g')
|
||||||
|
| KeyCode::Char('q')
|
||||||
| KeyCode::Esc
|
| KeyCode::Esc
|
||||||
if self.content.is_finished() =>
|
if self.content.is_finished() =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,18 +24,12 @@ use tree_sitter_bash as hl_bash;
|
||||||
use tree_sitter_highlight::{self as hl, HighlightEvent};
|
use tree_sitter_highlight::{self as hl, HighlightEvent};
|
||||||
use zips::zip_result;
|
use zips::zip_result;
|
||||||
|
|
||||||
pub enum FloatingTextMode {
|
|
||||||
Preview,
|
|
||||||
Description,
|
|
||||||
ActionsGuide,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct FloatingText {
|
pub struct FloatingText {
|
||||||
pub src: Vec<String>,
|
pub src: Vec<String>,
|
||||||
max_line_width: usize,
|
max_line_width: usize,
|
||||||
v_scroll: usize,
|
v_scroll: usize,
|
||||||
h_scroll: usize,
|
h_scroll: usize,
|
||||||
mode_title: &'static str,
|
mode_title: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! style {
|
macro_rules! style {
|
||||||
|
@ -130,7 +124,7 @@ fn get_lines_owned(s: &str) -> Vec<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FloatingText {
|
impl FloatingText {
|
||||||
pub fn new(text: String, mode: FloatingTextMode) -> Self {
|
pub fn new(text: String, title: &str) -> Self {
|
||||||
let src = get_lines(&text)
|
let src = get_lines(&text)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|s| s.to_string())
|
.map(|s| s.to_string())
|
||||||
|
@ -139,14 +133,14 @@ impl FloatingText {
|
||||||
let max_line_width = max_width!(src);
|
let max_line_width = max_width!(src);
|
||||||
Self {
|
Self {
|
||||||
src,
|
src,
|
||||||
mode_title: Self::get_mode_title(mode),
|
mode_title: title.to_string(),
|
||||||
max_line_width,
|
max_line_width,
|
||||||
v_scroll: 0,
|
v_scroll: 0,
|
||||||
h_scroll: 0,
|
h_scroll: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_command(command: &Command, mode: FloatingTextMode) -> Option<Self> {
|
pub fn from_command(command: &Command, title: String) -> Option<Self> {
|
||||||
let (max_line_width, src) = match command {
|
let (max_line_width, src) = match command {
|
||||||
Command::Raw(cmd) => {
|
Command::Raw(cmd) => {
|
||||||
// just apply highlights directly
|
// just apply highlights directly
|
||||||
|
@ -169,21 +163,13 @@ impl FloatingText {
|
||||||
|
|
||||||
Some(Self {
|
Some(Self {
|
||||||
src,
|
src,
|
||||||
mode_title: Self::get_mode_title(mode),
|
mode_title: title,
|
||||||
max_line_width,
|
max_line_width,
|
||||||
h_scroll: 0,
|
h_scroll: 0,
|
||||||
v_scroll: 0,
|
v_scroll: 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_mode_title(mode: FloatingTextMode) -> &'static str {
|
|
||||||
match mode {
|
|
||||||
FloatingTextMode::Preview => "Command Preview",
|
|
||||||
FloatingTextMode::Description => "Command Description",
|
|
||||||
FloatingTextMode::ActionsGuide => "Important Actions Guide",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn scroll_down(&mut self) {
|
fn scroll_down(&mut self) {
|
||||||
if self.v_scroll + 1 < self.src.len() {
|
if self.v_scroll + 1 < self.src.len() {
|
||||||
self.v_scroll += 1;
|
self.v_scroll += 1;
|
||||||
|
@ -214,7 +200,7 @@ impl FloatContent for FloatingText {
|
||||||
// Define the Block with a border and background color
|
// Define the Block with a border and background color
|
||||||
let block = Block::default()
|
let block = Block::default()
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.title(self.mode_title)
|
.title(self.mode_title.clone())
|
||||||
.title_alignment(ratatui::layout::Alignment::Center)
|
.title_alignment(ratatui::layout::Alignment::Center)
|
||||||
.title_style(Style::default().reversed())
|
.title_style(Style::default().reversed())
|
||||||
.style(Style::default());
|
.style(Style::default());
|
||||||
|
@ -292,13 +278,13 @@ impl FloatContent for FloatingText {
|
||||||
|
|
||||||
fn get_shortcut_list(&self) -> (&str, Box<[Shortcut]>) {
|
fn get_shortcut_list(&self) -> (&str, Box<[Shortcut]>) {
|
||||||
(
|
(
|
||||||
self.mode_title,
|
&self.mode_title,
|
||||||
Box::new([
|
Box::new([
|
||||||
Shortcut::new("Scroll down", ["j", "Down"]),
|
Shortcut::new("Scroll down", ["j", "Down"]),
|
||||||
Shortcut::new("Scroll up", ["k", "Up"]),
|
Shortcut::new("Scroll up", ["k", "Up"]),
|
||||||
Shortcut::new("Scroll left", ["h", "Left"]),
|
Shortcut::new("Scroll left", ["h", "Left"]),
|
||||||
Shortcut::new("Scroll right", ["l", "Right"]),
|
Shortcut::new("Scroll right", ["l", "Right"]),
|
||||||
Shortcut::new("Close window", ["Enter", "p", "d", "g"]),
|
Shortcut::new("Close window", ["Enter", "p", "q", "d", "g"]),
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
mod confirmation;
|
||||||
mod filter;
|
mod filter;
|
||||||
mod float;
|
mod float;
|
||||||
mod floating_text;
|
mod floating_text;
|
||||||
|
|
|
@ -37,6 +37,7 @@ pub struct RunningCommand {
|
||||||
writer: Box<dyn Write + Send>,
|
writer: Box<dyn Write + Send>,
|
||||||
/// Only set after the process has ended
|
/// Only set after the process has ended
|
||||||
status: Option<ExitStatus>,
|
status: Option<ExitStatus>,
|
||||||
|
scroll_offset: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FloatContent for RunningCommand {
|
impl FloatContent for RunningCommand {
|
||||||
|
@ -102,6 +103,12 @@ impl FloatContent for RunningCommand {
|
||||||
KeyCode::Enter if self.is_finished() => {
|
KeyCode::Enter if self.is_finished() => {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
KeyCode::PageUp => {
|
||||||
|
self.scroll_offset = self.scroll_offset.saturating_add(10);
|
||||||
|
}
|
||||||
|
KeyCode::PageDown => {
|
||||||
|
self.scroll_offset = self.scroll_offset.saturating_sub(10);
|
||||||
|
}
|
||||||
// Pass other key events to the terminal
|
// Pass other key events to the terminal
|
||||||
_ => self.handle_passthrough_key_event(key),
|
_ => self.handle_passthrough_key_event(key),
|
||||||
}
|
}
|
||||||
|
@ -121,12 +128,20 @@ impl FloatContent for RunningCommand {
|
||||||
if self.is_finished() {
|
if self.is_finished() {
|
||||||
(
|
(
|
||||||
"Finished command",
|
"Finished command",
|
||||||
Box::new([Shortcut::new("Close window", ["Enter", "q"])]),
|
Box::new([
|
||||||
|
Shortcut::new("Close window", ["Enter", "q"]),
|
||||||
|
Shortcut::new("Scroll up", ["Page up"]),
|
||||||
|
Shortcut::new("Scroll down", ["Page down"]),
|
||||||
|
]),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(
|
(
|
||||||
"Running command",
|
"Running command",
|
||||||
Box::new([Shortcut::new("Kill the command", ["CTRL-c"])]),
|
Box::new([
|
||||||
|
Shortcut::new("Kill the command", ["CTRL-c"]),
|
||||||
|
Shortcut::new("Scroll up", ["Page up"]),
|
||||||
|
Shortcut::new("Scroll down", ["Page down"]),
|
||||||
|
]),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,6 +235,7 @@ impl RunningCommand {
|
||||||
pty_master: pair.master,
|
pty_master: pair.master,
|
||||||
writer,
|
writer,
|
||||||
status: None,
|
status: None,
|
||||||
|
scroll_offset: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,10 +253,12 @@ 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, 0);
|
let mut parser = vt100::Parser::new(size.height, size.width, 200);
|
||||||
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);
|
||||||
|
// Adjust the screen content based on the scroll offset
|
||||||
|
parser.screen_mut().set_scrollback(self.scroll_offset);
|
||||||
parser.screen().clone()
|
parser.screen().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,8 +315,6 @@ impl RunningCommand {
|
||||||
KeyCode::Tab => vec![9],
|
KeyCode::Tab => vec![9],
|
||||||
KeyCode::Home => vec![27, 91, 72],
|
KeyCode::Home => vec![27, 91, 72],
|
||||||
KeyCode::End => vec![27, 91, 70],
|
KeyCode::End => vec![27, 91, 70],
|
||||||
KeyCode::PageUp => vec![27, 91, 53, 126],
|
|
||||||
KeyCode::PageDown => vec![27, 91, 54, 126],
|
|
||||||
KeyCode::BackTab => vec![27, 91, 90],
|
KeyCode::BackTab => vec![27, 91, 90],
|
||||||
KeyCode::Delete => vec![27, 91, 51, 126],
|
KeyCode::Delete => vec![27, 91, 51, 126],
|
||||||
KeyCode::Insert => vec![27, 91, 50, 126],
|
KeyCode::Insert => vec![27, 91, 50, 126],
|
||||||
|
|
117
tui/src/state.rs
117
tui/src/state.rs
|
@ -1,14 +1,15 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
|
confirmation::{ConfirmPrompt, ConfirmStatus},
|
||||||
filter::{Filter, SearchAction},
|
filter::{Filter, SearchAction},
|
||||||
float::{Float, FloatContent},
|
float::{Float, FloatContent},
|
||||||
floating_text::{FloatingText, FloatingTextMode},
|
floating_text::FloatingText,
|
||||||
hint::{create_shortcut_list, Shortcut},
|
hint::{create_shortcut_list, Shortcut},
|
||||||
running_command::RunningCommand,
|
running_command::RunningCommand,
|
||||||
theme::Theme,
|
theme::Theme,
|
||||||
};
|
};
|
||||||
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
|
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
|
||||||
use ego_tree::NodeId;
|
use ego_tree::NodeId;
|
||||||
use linutil_core::{Command, ListNode, Tab};
|
use linutil_core::{ListNode, Tab};
|
||||||
#[cfg(feature = "tips")]
|
#[cfg(feature = "tips")]
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
@ -18,6 +19,8 @@ use ratatui::{
|
||||||
widgets::{Block, Borders, List, ListState, Paragraph},
|
widgets::{Block, Borders, List, ListState, Paragraph},
|
||||||
Frame,
|
Frame,
|
||||||
};
|
};
|
||||||
|
use std::rc::Rc;
|
||||||
|
use temp_dir::TempDir;
|
||||||
|
|
||||||
const MIN_WIDTH: u16 = 77;
|
const MIN_WIDTH: u16 = 77;
|
||||||
const MIN_HEIGHT: u16 = 19;
|
const MIN_HEIGHT: u16 = 19;
|
||||||
|
@ -37,6 +40,8 @@ P* - privileged *
|
||||||
";
|
";
|
||||||
|
|
||||||
pub struct AppState {
|
pub struct AppState {
|
||||||
|
/// This must be passed to retain the temp dir until the end of the program
|
||||||
|
_temp_dir: TempDir,
|
||||||
/// Selected theme
|
/// Selected theme
|
||||||
theme: Theme,
|
theme: Theme,
|
||||||
/// Currently focused area
|
/// Currently focused area
|
||||||
|
@ -48,12 +53,12 @@ pub struct AppState {
|
||||||
/// This stack keeps track of our "current directory". You can think of it as `pwd`. but not
|
/// This stack keeps track of our "current directory". You can think of it as `pwd`. but not
|
||||||
/// just the current directory, all paths that took us here, so we can "cd .."
|
/// just the current directory, all paths that took us here, so we can "cd .."
|
||||||
visit_stack: Vec<NodeId>,
|
visit_stack: Vec<NodeId>,
|
||||||
/// This is the state asociated with the list widget, used to display the selection in the
|
/// This is the state associated with the list widget, used to display the selection in the
|
||||||
/// widget
|
/// widget
|
||||||
selection: ListState,
|
selection: ListState,
|
||||||
filter: Filter,
|
filter: Filter,
|
||||||
multi_select: bool,
|
multi_select: bool,
|
||||||
selected_commands: Vec<Command>,
|
selected_commands: Vec<Rc<ListNode>>,
|
||||||
drawable: bool,
|
drawable: bool,
|
||||||
#[cfg(feature = "tips")]
|
#[cfg(feature = "tips")]
|
||||||
tip: &'static str,
|
tip: &'static str,
|
||||||
|
@ -63,21 +68,23 @@ pub enum Focus {
|
||||||
Search,
|
Search,
|
||||||
TabList,
|
TabList,
|
||||||
List,
|
List,
|
||||||
FloatingWindow(Float),
|
FloatingWindow(Float<dyn FloatContent>),
|
||||||
|
ConfirmationPrompt(Float<ConfirmPrompt>),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ListEntry {
|
pub struct ListEntry {
|
||||||
pub node: ListNode,
|
pub node: Rc<ListNode>,
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub has_children: bool,
|
pub has_children: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppState {
|
impl AppState {
|
||||||
pub fn new(theme: Theme, override_validation: bool) -> Self {
|
pub fn new(theme: Theme, override_validation: bool) -> Self {
|
||||||
let tabs = linutil_core::get_tabs(!override_validation);
|
let (temp_dir, tabs) = linutil_core::get_tabs(!override_validation);
|
||||||
let root_id = tabs[0].tree.root().id();
|
let root_id = tabs[0].tree.root().id();
|
||||||
|
|
||||||
let mut state = Self {
|
let mut state = Self {
|
||||||
|
_temp_dir: temp_dir,
|
||||||
theme,
|
theme,
|
||||||
focus: Focus::List,
|
focus: Focus::List,
|
||||||
tabs,
|
tabs,
|
||||||
|
@ -112,7 +119,10 @@ impl AppState {
|
||||||
match self.focus {
|
match self.focus {
|
||||||
Focus::Search => (
|
Focus::Search => (
|
||||||
"Search bar",
|
"Search bar",
|
||||||
Box::new([Shortcut::new("Finish search", ["Enter"])]),
|
Box::new([
|
||||||
|
Shortcut::new("Abort search", ["Esc", "CTRL-c"]),
|
||||||
|
Shortcut::new("Search", ["Enter"]),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
|
|
||||||
Focus::List => {
|
Focus::List => {
|
||||||
|
@ -164,6 +174,7 @@ impl AppState {
|
||||||
),
|
),
|
||||||
|
|
||||||
Focus::FloatingWindow(ref float) => float.get_shortcut_list(),
|
Focus::FloatingWindow(ref float) => float.get_shortcut_list(),
|
||||||
|
Focus::ConfirmationPrompt(ref prompt) => prompt.get_shortcut_list(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +319,7 @@ impl AppState {
|
||||||
|ListEntry {
|
|ListEntry {
|
||||||
node, has_children, ..
|
node, has_children, ..
|
||||||
}| {
|
}| {
|
||||||
let is_selected = self.selected_commands.contains(&node.command);
|
let is_selected = self.selected_commands.contains(node);
|
||||||
let (indicator, style) = if is_selected {
|
let (indicator, style) = if is_selected {
|
||||||
(self.theme.multi_select_icon(), Style::default().bold())
|
(self.theme.multi_select_icon(), Style::default().bold())
|
||||||
} else {
|
} else {
|
||||||
|
@ -389,8 +400,10 @@ impl AppState {
|
||||||
|
|
||||||
frame.render_stateful_widget(disclaimer_list, list_chunks[1], &mut self.selection);
|
frame.render_stateful_widget(disclaimer_list, list_chunks[1], &mut self.selection);
|
||||||
|
|
||||||
if let Focus::FloatingWindow(float) = &mut self.focus {
|
match &mut self.focus {
|
||||||
float.draw(frame, chunks[1]);
|
Focus::FloatingWindow(float) => float.draw(frame, chunks[1]),
|
||||||
|
Focus::ConfirmationPrompt(prompt) => prompt.draw(frame, chunks[1]),
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame.render_widget(keybind_para, vertical[1]);
|
frame.render_widget(keybind_para, vertical[1]);
|
||||||
|
@ -400,8 +413,10 @@ impl AppState {
|
||||||
// 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 )
|
||||||
// Exit on 'q' or 'Ctrl-c' input
|
// Exit on 'q' or 'Ctrl-c' input
|
||||||
if matches!(self.focus, Focus::TabList | Focus::List)
|
if matches!(
|
||||||
&& (key.code == KeyCode::Char('q')
|
self.focus,
|
||||||
|
Focus::TabList | Focus::List | Focus::ConfirmationPrompt(_)
|
||||||
|
) && (key.code == KeyCode::Char('q')
|
||||||
|| key.modifiers.contains(KeyModifiers::CONTROL) && key.code == KeyCode::Char('c'))
|
|| key.modifiers.contains(KeyModifiers::CONTROL) && key.code == KeyCode::Char('c'))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -444,6 +459,22 @@ impl AppState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Focus::ConfirmationPrompt(confirm) => {
|
||||||
|
confirm.content.handle_key_event(key);
|
||||||
|
match confirm.content.status {
|
||||||
|
ConfirmStatus::Abort => {
|
||||||
|
self.focus = Focus::List;
|
||||||
|
// selected command was pushed to selection list if multi-select was
|
||||||
|
// enabled, need to clear it to prevent state corruption
|
||||||
|
if !self.multi_select {
|
||||||
|
self.selected_commands.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ConfirmStatus::Confirm => self.handle_confirm_command(),
|
||||||
|
ConfirmStatus::None => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Focus::Search => match self.filter.handle_key(key) {
|
Focus::Search => match self.filter.handle_key(key) {
|
||||||
SearchAction::Exit => self.exit_search(),
|
SearchAction::Exit => self.exit_search(),
|
||||||
SearchAction::Update => self.update_items(),
|
SearchAction::Update => self.update_items(),
|
||||||
|
@ -503,7 +534,7 @@ impl AppState {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toggle_selection(&mut self) {
|
fn toggle_selection(&mut self) {
|
||||||
if let Some(command) = self.get_selected_command() {
|
if let Some(command) = self.get_selected_node() {
|
||||||
if self.selected_commands.contains(&command) {
|
if self.selected_commands.contains(&command) {
|
||||||
self.selected_commands.retain(|c| c != &command);
|
self.selected_commands.retain(|c| c != &command);
|
||||||
} else {
|
} else {
|
||||||
|
@ -552,7 +583,7 @@ impl AppState {
|
||||||
self.update_items();
|
self.update_items();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_selected_node(&self) -> Option<&ListNode> {
|
fn get_selected_node(&self) -> Option<Rc<ListNode>> {
|
||||||
let mut selected_index = self.selection.selected().unwrap_or(0);
|
let mut selected_index = self.selection.selected().unwrap_or(0);
|
||||||
|
|
||||||
if !self.at_root() && selected_index == 0 {
|
if !self.at_root() && selected_index == 0 {
|
||||||
|
@ -564,18 +595,17 @@ impl AppState {
|
||||||
|
|
||||||
if let Some(item) = self.filter.item_list().get(selected_index) {
|
if let Some(item) = self.filter.item_list().get(selected_index) {
|
||||||
if !item.has_children {
|
if !item.has_children {
|
||||||
return Some(&item.node);
|
return Some(item.node.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
pub fn get_selected_command(&self) -> Option<Command> {
|
|
||||||
self.get_selected_node().map(|node| node.command.clone())
|
|
||||||
}
|
|
||||||
fn get_selected_description(&self) -> Option<String> {
|
fn get_selected_description(&self) -> Option<String> {
|
||||||
self.get_selected_node()
|
self.get_selected_node()
|
||||||
.map(|node| node.description.clone())
|
.map(|node| node.description.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn go_to_selected_dir(&mut self) {
|
pub fn go_to_selected_dir(&mut self) {
|
||||||
let mut selected_index = self.selection.selected().unwrap_or(0);
|
let mut selected_index = self.selection.selected().unwrap_or(0);
|
||||||
|
|
||||||
|
@ -596,6 +626,7 @@ impl AppState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn selected_item_is_dir(&self) -> bool {
|
pub fn selected_item_is_dir(&self) -> bool {
|
||||||
let mut selected_index = self.selection.selected().unwrap_or(0);
|
let mut selected_index = self.selection.selected().unwrap_or(0);
|
||||||
|
|
||||||
|
@ -615,23 +646,29 @@ impl AppState {
|
||||||
|
|
||||||
pub fn selected_item_is_cmd(&self) -> bool {
|
pub fn selected_item_is_cmd(&self) -> bool {
|
||||||
// Any item that is not a directory or up directory (..) must be a command
|
// Any item that is not a directory or up directory (..) must be a command
|
||||||
!(self.selected_item_is_up_dir() || self.selected_item_is_dir())
|
self.selection.selected().is_some()
|
||||||
|
&& !(self.selected_item_is_up_dir() || self.selected_item_is_dir())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn selected_item_is_up_dir(&self) -> bool {
|
pub fn selected_item_is_up_dir(&self) -> bool {
|
||||||
let selected_index = self.selection.selected().unwrap_or(0);
|
let selected_index = self.selection.selected().unwrap_or(0);
|
||||||
|
|
||||||
!self.at_root() && selected_index == 0
|
!self.at_root() && selected_index == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn enable_preview(&mut self) {
|
fn enable_preview(&mut self) {
|
||||||
if let Some(command) = self.get_selected_command() {
|
if let Some(list_node) = self.get_selected_node() {
|
||||||
if let Some(preview) = FloatingText::from_command(&command, FloatingTextMode::Preview) {
|
let mut preview_title = "[Preview] - ".to_string();
|
||||||
|
preview_title.push_str(list_node.name.as_str());
|
||||||
|
if let Some(preview) = FloatingText::from_command(&list_node.command, preview_title) {
|
||||||
self.spawn_float(preview, 80, 80);
|
self.spawn_float(preview, 80, 80);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn enable_description(&mut self) {
|
fn enable_description(&mut self) {
|
||||||
if let Some(command_description) = self.get_selected_description() {
|
if let Some(command_description) = self.get_selected_description() {
|
||||||
let description = FloatingText::new(command_description, FloatingTextMode::Description);
|
let description = FloatingText::new(command_description, "Command Description");
|
||||||
self.spawn_float(description, 80, 80);
|
self.spawn_float(description, 80, 80);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -639,31 +676,53 @@ impl AppState {
|
||||||
fn handle_enter(&mut self) {
|
fn handle_enter(&mut self) {
|
||||||
if self.selected_item_is_cmd() {
|
if self.selected_item_is_cmd() {
|
||||||
if self.selected_commands.is_empty() {
|
if self.selected_commands.is_empty() {
|
||||||
if let Some(cmd) = self.get_selected_command() {
|
if let Some(node) = self.get_selected_node() {
|
||||||
self.selected_commands.push(cmd);
|
self.selected_commands.push(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let command = RunningCommand::new(self.selected_commands.clone());
|
|
||||||
self.spawn_float(command, 80, 80);
|
let cmd_names = self
|
||||||
self.selected_commands.clear();
|
.selected_commands
|
||||||
|
.iter()
|
||||||
|
.map(|node| node.name.as_str())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
let prompt = ConfirmPrompt::new(&cmd_names[..]);
|
||||||
|
self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40));
|
||||||
} else {
|
} else {
|
||||||
self.go_to_selected_dir();
|
self.go_to_selected_dir();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_confirm_command(&mut self) {
|
||||||
|
let commands = self
|
||||||
|
.selected_commands
|
||||||
|
.iter()
|
||||||
|
.map(|node| node.command.clone())
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
let command = RunningCommand::new(commands);
|
||||||
|
self.spawn_float(command, 80, 80);
|
||||||
|
self.selected_commands.clear();
|
||||||
|
}
|
||||||
|
|
||||||
fn spawn_float<T: FloatContent + 'static>(&mut self, float: T, width: u16, height: u16) {
|
fn spawn_float<T: FloatContent + 'static>(&mut self, float: T, width: u16, height: u16) {
|
||||||
self.focus = Focus::FloatingWindow(Float::new(Box::new(float), width, height));
|
self.focus = Focus::FloatingWindow(Float::new(Box::new(float), width, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn enter_search(&mut self) {
|
fn enter_search(&mut self) {
|
||||||
self.focus = Focus::Search;
|
self.focus = Focus::Search;
|
||||||
self.filter.activate_search();
|
self.filter.activate_search();
|
||||||
self.selection.select(None);
|
self.selection.select(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exit_search(&mut self) {
|
fn exit_search(&mut self) {
|
||||||
self.selection.select(Some(0));
|
self.selection.select(Some(0));
|
||||||
self.focus = Focus::List;
|
self.focus = Focus::List;
|
||||||
self.filter.deactivate_search();
|
self.filter.deactivate_search();
|
||||||
self.update_items();
|
self.update_items();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn refresh_tab(&mut self) {
|
fn refresh_tab(&mut self) {
|
||||||
self.visit_stack = vec![self.tabs[self.current_tab.selected().unwrap()]
|
self.visit_stack = vec![self.tabs[self.current_tab.selected().unwrap()]
|
||||||
.tree
|
.tree
|
||||||
|
@ -675,7 +734,7 @@ impl AppState {
|
||||||
|
|
||||||
fn toggle_task_list_guide(&mut self) {
|
fn toggle_task_list_guide(&mut self) {
|
||||||
self.spawn_float(
|
self.spawn_float(
|
||||||
FloatingText::new(ACTIONS_GUIDE.to_string(), FloatingTextMode::ActionsGuide),
|
FloatingText::new(ACTIONS_GUIDE.to_string(), "Important Actions Guide"),
|
||||||
80,
|
80,
|
||||||
80,
|
80,
|
||||||
);
|
);
|
||||||
|
|
8
xtask/Cargo.toml
Normal file
8
xtask/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "xtask"
|
||||||
|
version.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
linutil_core = { path = "../core" }
|
60
xtask/src/docgen.rs
Normal file
60
xtask/src/docgen.rs
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
use std::fs;
|
||||||
|
|
||||||
|
use linutil_core::Command;
|
||||||
|
|
||||||
|
use crate::path;
|
||||||
|
use crate::DynError;
|
||||||
|
|
||||||
|
pub const USER_GUIDE: &str = "userguide.md";
|
||||||
|
|
||||||
|
pub fn userguide() -> Result<String, DynError> {
|
||||||
|
let mut md = String::new();
|
||||||
|
md.push_str("<!-- THIS FILE IS GENERATED BY cargo xtask docgen -->\n# Walkthrough\n");
|
||||||
|
|
||||||
|
let tabs = linutil_core::get_tabs(false).1;
|
||||||
|
|
||||||
|
for tab in tabs {
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
println!("Tab: {}", tab.name);
|
||||||
|
|
||||||
|
md.push_str(&format!("\n## {}\n\n", tab.name));
|
||||||
|
|
||||||
|
for entry in tab.tree {
|
||||||
|
if entry.command == Command::None {
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
println!(" Directory: {}", entry.name);
|
||||||
|
|
||||||
|
if entry.name != "root".to_string() {
|
||||||
|
md.push_str(&format!("\n### {}\n\n", entry.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* let current_dir = &entry.name;
|
||||||
|
|
||||||
|
if *current_dir != "root".to_string() {
|
||||||
|
md.push_str(&format!(
|
||||||
|
"\n<details><summary>{}</summary>\n\n",
|
||||||
|
current_dir
|
||||||
|
));
|
||||||
|
} */ // Commenting this for now, might be a good idea later
|
||||||
|
} else {
|
||||||
|
if !entry.description.is_empty() {
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
println!(" Entry: {}", entry.name);
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
println!(" Description: {}", entry.description);
|
||||||
|
|
||||||
|
md.push_str(&format!("- **{}**: {}\n", entry.name, entry.description));
|
||||||
|
} /* else {
|
||||||
|
md.push_str(&format!("- **{}**\n", entry.name));
|
||||||
|
} */ // https://github.com/ChrisTitusTech/linutil/pull/753
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(md)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn write(file: &str, data: &str) {
|
||||||
|
let path = path::docs().join(file);
|
||||||
|
fs::write(path, data).unwrap_or_else(|_| panic!("Could not write to {}", file));
|
||||||
|
}
|
40
xtask/src/main.rs
Normal file
40
xtask/src/main.rs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
mod docgen;
|
||||||
|
mod path;
|
||||||
|
|
||||||
|
use std::{env, error::Error};
|
||||||
|
|
||||||
|
type DynError = Box<dyn Error>;
|
||||||
|
|
||||||
|
pub mod tasks {
|
||||||
|
use crate::docgen::USER_GUIDE;
|
||||||
|
use crate::docgen::{userguide, write};
|
||||||
|
use crate::DynError;
|
||||||
|
|
||||||
|
pub fn docgen() -> Result<(), DynError> {
|
||||||
|
write(USER_GUIDE, &userguide()?);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn print_help() {
|
||||||
|
println!(
|
||||||
|
"
|
||||||
|
Usage: `cargo xtask <task>`
|
||||||
|
|
||||||
|
Tasks:
|
||||||
|
docgen: Generate Markdown files.
|
||||||
|
"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() -> Result<(), DynError> {
|
||||||
|
let task = env::args().nth(1);
|
||||||
|
match task {
|
||||||
|
None => tasks::print_help(),
|
||||||
|
Some(t) => match t.as_str() {
|
||||||
|
"docgen" => tasks::docgen()?,
|
||||||
|
invalid => return Err(format!("Invalid task: {}", invalid).into()),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
Ok(())
|
||||||
|
}
|
12
xtask/src/path.rs
Normal file
12
xtask/src/path.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
pub fn project_root() -> PathBuf {
|
||||||
|
Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.parent()
|
||||||
|
.unwrap()
|
||||||
|
.to_path_buf()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn docs() -> PathBuf {
|
||||||
|
project_root().join("docs/")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user