diff --git a/.github/SECURITY.md b/.github/SECURITY.md
index 1a258e69..374f09aa 100644
--- a/.github/SECURITY.md
+++ b/.github/SECURITY.md
@@ -2,13 +2,20 @@
## Supported Versions
-It is recommended that you run the stable version as this is more tested and used by most. The dev branch is bleed-edge commits that are not well tested and aren't meant to be used in production environments
+It is recommended that you use the stable branch as it's tested and used by most. The dev branch may contain bleeding-edge commits that are not well tested and are not meant to be used in production environments.
+Version tags lower than the [latest stable release](https://github.com/ChrisTitusTech/linutil/releases/latest) are **not** supported.
-| Version | Supported |
-| ------- | ------------------ |
-| latest | :white_check_mark: |
-| dev | :x: |
+| Branch | Supported |
+| ------- | ---------------------- |
+| Stable | :white_check_mark: YES |
+| Dev | :x: NO |
+
+| Version | Supported |
+| -------------------------------------------------- | ---------------------- |
+| [![LATEST](https://img.shields.io/github/v/release/ChrisTitusTech/linutil?color=%230567ff&label=Latest&style=for-the-badge)](https://github.com/ChrisTitusTech/linutil/releases/latest) | :white_check_mark: YES |
+| Below LATEST | :x: NO |
+| Above LATEST | :x: NO |
## Reporting a Vulnerability
-I'd recommend making an Issue for reporting a bug. If you would like privately submit the bug you can email me at contact@christitus.com
+If you have any reason to believe there are security vulnerabilities in Linutil, fill out the [report form](https://github.com/christitustech/linutil/security/advisories/new) or e-mail [contact@christitus.com](mailto:contact@christitus.com).
diff --git a/.github/release.yml b/.github/release.yml
index 51218dc9..8668f1c3 100644
--- a/.github/release.yml
+++ b/.github/release.yml
@@ -2,19 +2,34 @@ changelog:
categories:
- title: '🚀 Features'
labels:
- - 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- - 'fix'
- - 'bugfix'
- 'bug'
+ - title: '⚙️ Refactoring'
+ labels:
+ - 'refactor'
+ - title: '🧩 UI/UX'
+ labels:
+ - 'UI/UX'
- title: '📚 Documentation'
- label: 'documentation'
+ labels:
+ - 'documentation'
- title: '🔒 Security'
- label: 'security'
+ labels:
+ - 'security'
- title: '🧰 GitHub Actions'
- label: 'github actions'
+ labels:
+ - 'github_actions'
+ - title: '🦀 Rust'
+ labels:
+ - 'rust'
+ - title: '📃 Scripting'
+ labels:
+ - 'script'
+ - title: 'Other Changes'
+ labels:
+ - "*"
exclude:
labels:
- - 'skip-changelog'
\ No newline at end of file
+ - 'skip-changelog'
diff --git a/.github/workflows/bashisms.yml b/.github/workflows/bashisms.yml
index 7ce39ef1..ffbe983b 100644
--- a/.github/workflows/bashisms.yml
+++ b/.github/workflows/bashisms.yml
@@ -3,7 +3,7 @@ name: Check for bashisms
on:
pull_request:
paths:
- - core/tabs/**
+ - 'core/tabs/**/*.sh'
merge_group:
workflow_dispatch:
@@ -15,31 +15,33 @@ jobs:
- uses: actions/checkout@v4
- run: git fetch origin ${{ github.base_ref }}
- - name: Get a list of changed script files
- id: get_sh_files
- run: |
- sh_files=$(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs | grep '\.sh$' || true)
- 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
- 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 -y devscripts
+
+ - name: Get changed .sh files (PR only)
+ id: changed-sh-files
+ if: github.event_name == 'pull_request'
+ uses: tj-actions/changed-files@v45
+ with:
+ files: '**/*.sh'
+
+ - name: Get all .sh files (if workflow dispatched)
+ id: sh-files
+ if: github.event_name != 'pull_request'
+ run: |
+ files=$(find . -type f -name "*.sh" | tr '\n' ' ')
+ echo "files=${files:-none}" >> $GITHUB_ENV
+
+ - name: Set FILES for bashism check
+ id: set-files
+ run: |
+ if [[ "${{ steps.changed-sh-files.outputs.any_changed }}" == 'true' ]]; then
+ echo "FILES=${{ steps.changed-sh-files.outputs.all_changed_files }}" >> $GITHUB_ENV
+ else
+ echo "FILES=${{ env.files }}" >> $GITHUB_ENV
+ fi
- name: Check for bashisms
- if: steps.get_sh_files.outputs.changed == 1
run: |
- echo "Running for:\n$(cat changed_files)\n"
- for file in $(cat changed_files); do
- if [[ -f "$file" ]]; then
- checkbashisms "$file"
- fi
- done
-
- - name: Remove the created file
- if: steps.get_sh_files.outputs.changed == 1
- run: rm changed_files
+ IFS=' ' read -r -a file_array <<< "$FILES"
+ checkbashisms "${file_array[@]}"
diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml
index 30e992d4..94ca5e3c 100644
--- a/.github/workflows/github-pages.yml
+++ b/.github/workflows/github-pages.yml
@@ -13,6 +13,10 @@ on:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
+ environment: linutil_env
+ permissions:
+ contents: write
+ pull-requests: write
steps:
- name: Checkout Repository
@@ -24,11 +28,17 @@ jobs:
run: |
echo -e "\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md'
- - uses: stefanzweifel/git-auto-commit-action@v5
+ - name: Create Pull Request
+ uses: peter-evans/create-pull-request@v6
with:
- commit_message: Commit Contributing Guidelines
- file_pattern: "docs/contributing.md"
- add_options: '--force'
+ commit-message: Update Contributing Guidelines
+ title: 'docs: Update Contributing Guidelines'
+ body: 'Automated update of Contributing Guidelines from .github/CONTRIBUTING.md'
+ branch: update-contributing-guidelines
+ delete-branch: true
+ base: main
+ labels: documentation
+ token: ${{ secrets.PAT_TOKEN }}
if: success()
- name: Setup Python
diff --git a/.github/workflows/linutil.yml b/.github/workflows/linutil.yml
index 53c43d02..187f1e54 100644
--- a/.github/workflows/linutil.yml
+++ b/.github/workflows/linutil.yml
@@ -46,19 +46,9 @@ jobs:
run: cargo build --target-dir=build --release --verbose --target=x86_64-unknown-linux-musl --all-features
- name: Build aarch64 binary
- run: cross build --target-dir=build --release --verbose --target=aarch64-unknown-linux-musl --all-features
-
- - name: Move binaries to build directory
run: |
- mv build/x86_64-unknown-linux-musl/release/linutil build/linutil
- mv build/aarch64-unknown-linux-musl/release/linutil build/linutil-aarch64
-
- - uses: stefanzweifel/git-auto-commit-action@v5
- with:
- commit_message: Commit Linutil
- file_pattern: "build/linutil build/linutil-aarch64"
- add_options: '--force'
- if: success()
+ cross build --target-dir=build --release --verbose --target=aarch64-unknown-linux-musl --all-features
+ mv ./build/aarch64-unknown-linux-musl/release/linutil ./build/aarch64-unknown-linux-musl/release/linutil-aarch64
- name: Extract Version
id: extract_version
@@ -80,32 +70,11 @@ jobs:
append_body: true
generate_release_notes: true
files: |
- ./build/linutil
- ./build/linutil-aarch64
+ ./build/x86_64-unknown-linux-musl/release/linutil
+ ./build/aarch64-unknown-linux-musl/release/linutil-aarch64
./start.sh
./startdev.sh
prerelease: true
env:
version: ${{ env.version }}
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()
\ No newline at end of file
diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml
new file mode 100644
index 00000000..4967eeef
--- /dev/null
+++ b/.github/workflows/preview.yml
@@ -0,0 +1,78 @@
+name: LinUtil Preview
+
+on:
+ workflow_dispatch:
+ inputs:
+ tag_name:
+ description: 'Tag name'
+ required: true
+ workflow_run:
+ workflows: ["LinUtil Release"]
+ types:
+ - completed
+
+jobs:
+ generate_preview:
+ runs-on: ubuntu-latest
+ environment: linutil_env
+ permissions:
+ contents: write
+ pull-requests: write
+
+ steps:
+ - name: Checkout source
+ uses: actions/checkout@v4
+
+ - name: Get tag name ( Workflow Run )
+ id: latest_tag
+ uses: actions/github-script@v7
+ if: github.event_name == 'workflow_run'
+ with:
+ script: |
+ const releases = await github.rest.repos.listReleases({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ per_page: 1
+ });
+ core.setOutput('result', releases.data[0].tag_name);
+ result-encoding: string
+
+ - name: Set tag name ( Workflow Run )
+ if: github.event_name == 'workflow_run'
+ run: echo "tag_name=${{ steps.latest_tag.outputs.result }}" >> $GITHUB_ENV
+
+ - name: Set tag name ( Workflow Dispatch )
+ if: ${{ github.event_name }} == 'workflow_dispatch'
+ run: echo "tag_name=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
+
+ - name: Download binary
+ run: |
+ curl -LO "https://github.com/${{ github.repository }}/releases/download/${{ env.tag_name }}/linutil"
+
+ - name: Set env
+ run: |
+ chmod +x linutil
+ mkdir -p build
+ mv linutil build/linutil
+ echo "${{ github.workspace }}/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: Create PR
+ uses: peter-evans/create-pull-request@v7.0.5
+ with:
+ commit-message: Preview for ${{ env.tag_name }}
+ file-pattern: "docs/assets/preview.gif"
+ add-options: "--force"
+ token: ${{ secrets.PAT_TOKEN }}
+ branch: feature/preview-${{ env.tag_name }}
+ title: "Update preview for ${{ env.tag_name }}"
+ body: |
+ Automated PR to update preview gif for version ${{ env.tag_name }}
+ if: success()
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index fd9e190e..88657c59 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -5,7 +5,7 @@ on:
branches: ["main"]
paths:
- '**/*.rs'
- - 'Cargo.toml'
+ - '**/Cargo.toml'
- 'Cargo.lock'
env:
diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml
index 6b1ad429..bfcc3bc8 100644
--- a/.github/workflows/shellcheck.yml
+++ b/.github/workflows/shellcheck.yml
@@ -1,9 +1,9 @@
-name: ShellCheck
+name: Script Checks
on:
pull_request:
paths:
- - 'core/tabs/**/*.sh'
+ - '**/*.sh'
workflow_dispatch:
jobs:
@@ -11,45 +11,25 @@ jobs:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
- - run: git fetch origin ${{ github.base_ref }}
+ - name: Checkout sources
+ uses: actions/checkout@v4
- - name: Download, setup, and run ShellCheck
- shell: bash {0}
- run : |
- SC_URL="https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.x86_64.tar.xz"
- curl -fsSL "$SC_URL" | tar -Jx
- chmod +x "./shellcheck-v0.10.0/shellcheck"
+ - name: Run ShellCheck
+ uses: reviewdog/action-shellcheck@v1
+ with:
+ shellcheck_flags: '--source-path=${{ github.workspace }}/.shellcheckrc'
+ reviewdog_flags: '-fail-level=any'
- error=0
- files_to_check=$(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs)
+ shfmt:
+ name: Shell Fomatting
+ runs-on: ubuntu-latest
+ needs: shellcheck
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v4
- for file in $files_to_check; do
- if [[ "$file" == *.sh ]] && [[ -f "$file" ]]; then
- 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
- done
-
- exit $error
+ - name: Run shfmt
+ uses: reviewdog/action-shfmt@v1
+ with:
+ shfmt_flags: '-i 4 -ci'
+ reviewdog_flags: '-fail-level=any'
diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml
index 901d5e71..864dfc3b 100644
--- a/.github/workflows/typos.yml
+++ b/.github/workflows/typos.yml
@@ -12,4 +12,4 @@ jobs:
- run: git fetch origin ${{ github.base_ref }}
- name: Run spellcheck
- uses: crate-ci/typos@v1.25.0
+ uses: crate-ci/typos@v1.26.0
diff --git a/.shellcheckrc b/.shellcheckrc
new file mode 100644
index 00000000..0b882066
--- /dev/null
+++ b/.shellcheckrc
@@ -0,0 +1,2 @@
+external-sources=true
+source=core/tabs/common-script.sh
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index 266ed837..e6f5151f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -29,26 +29,11 @@ version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
-[[package]]
-name = "android-tzdata"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
-
-[[package]]
-name = "android_system_properties"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
-dependencies = [
- "libc",
-]
-
[[package]]
name = "ansi-to-tui"
-version = "6.0.0"
+version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00c4af0bef1b514c9b6a32a773caf604c1390fa7913f4eaa23bfe76f251d6a42"
+checksum = "67555e1f1ece39d737e28c8a017721287753af3f93225e4a445b29ccb0f5912c"
dependencies = [
"nom",
"ratatui",
@@ -136,12 +121,6 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
-[[package]]
-name = "bumpalo"
-version = "3.16.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
-
[[package]]
name = "byteorder"
version = "1.5.0"
@@ -178,25 +157,11 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-[[package]]
-name = "chrono"
-version = "0.4.38"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
-dependencies = [
- "android-tzdata",
- "iana-time-zone",
- "js-sys",
- "num-traits",
- "wasm-bindgen",
- "windows-targets",
-]
-
[[package]]
name = "clap"
-version = "4.5.19"
+version = "4.5.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615"
+checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8"
dependencies = [
"clap_builder",
"clap_derive",
@@ -204,9 +169,9 @@ dependencies = [
[[package]]
name = "clap_builder"
-version = "4.5.19"
+version = "4.5.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b"
+checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54"
dependencies = [
"anstream",
"anstyle",
@@ -252,12 +217,6 @@ dependencies = [
"static_assertions",
]
-[[package]]
-name = "core-foundation-sys"
-version = "0.8.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
-
[[package]]
name = "crossterm"
version = "0.28.1"
@@ -370,29 +329,6 @@ dependencies = [
"windows-sys",
]
-[[package]]
-name = "iana-time-zone"
-version = "0.1.60"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
-dependencies = [
- "android_system_properties",
- "core-foundation-sys",
- "iana-time-zone-haiku",
- "js-sys",
- "wasm-bindgen",
- "windows-core",
-]
-
-[[package]]
-name = "iana-time-zone-haiku"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
-dependencies = [
- "cc",
-]
-
[[package]]
name = "include_dir"
version = "0.7.4"
@@ -422,6 +358,12 @@ dependencies = [
"hashbrown",
]
+[[package]]
+name = "indoc"
+version = "2.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
+
[[package]]
name = "instability"
version = "0.3.2"
@@ -462,15 +404,6 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
-[[package]]
-name = "js-sys"
-version = "0.3.70"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
-dependencies = [
- "wasm-bindgen",
-]
-
[[package]]
name = "lazy_static"
version = "1.5.0"
@@ -501,7 +434,6 @@ version = "24.9.28"
dependencies = [
"ansi-to-tui",
"anstyle",
- "chrono",
"clap",
"crossterm",
"ego-tree",
@@ -511,6 +443,7 @@ dependencies = [
"rand",
"ratatui",
"temp-dir",
+ "textwrap",
"tree-sitter-bash",
"tree-sitter-highlight",
"tui-term",
@@ -607,15 +540,6 @@ dependencies = [
"minimal-lexical",
]
-[[package]]
-name = "num-traits"
-version = "0.2.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
-dependencies = [
- "autocfg",
-]
-
[[package]]
name = "once_cell"
version = "1.19.0"
@@ -743,23 +667,23 @@ dependencies = [
[[package]]
name = "ratatui"
-version = "0.28.1"
+version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fdef7f9be5c0122f890d58bdf4d964349ba6a6161f705907526d891efabba57d"
+checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b"
dependencies = [
"bitflags 2.6.0",
"cassowary",
"compact_str",
"crossterm",
+ "indoc",
"instability",
"itertools",
"lru",
"paste",
"strum",
- "strum_macros",
"unicode-segmentation",
"unicode-truncate",
- "unicode-width 0.1.14",
+ "unicode-width 0.2.0",
]
[[package]]
@@ -966,6 +890,12 @@ version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+[[package]]
+name = "smawk"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
+
[[package]]
name = "static_assertions"
version = "1.1.0"
@@ -1032,6 +962,17 @@ dependencies = [
"libc",
]
+[[package]]
+name = "textwrap"
+version = "0.16.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9"
+dependencies = [
+ "smawk",
+ "unicode-linebreak",
+ "unicode-width 0.1.14",
+]
+
[[package]]
name = "thiserror"
version = "1.0.64"
@@ -1088,9 +1029,9 @@ dependencies = [
[[package]]
name = "tree-sitter"
-version = "0.24.2"
+version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23b84f60031bf8245b563a80c92c1034e557a914f7958f474bc0afa2eed78b98"
+checksum = "f9871f16d6cf5c4757dcf30d5d2172a2df6987c510c017bbb7abfb7f9aa24d06"
dependencies = [
"cc",
"regex",
@@ -1111,9 +1052,9 @@ dependencies = [
[[package]]
name = "tree-sitter-highlight"
-version = "0.24.2"
+version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c727fb31f816c09fc54dc0e971d101318926866f7261b2acb820e84a61bf52d"
+checksum = "48859aa39513716018d81904220960f415dbb72e071234a721304d20bf245e4c"
dependencies = [
"lazy_static",
"regex",
@@ -1130,9 +1071,9 @@ checksum = "2545046bd1473dac6c626659cc2567c6c0ff302fc8b84a56c4243378276f7f57"
[[package]]
name = "tui-term"
-version = "0.1.13"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d07f0233f0d4795d2dc6663cfc3ce56b87bebcee66d6bcc088aa6aff5c072361"
+checksum = "72af159125ce32b02ceaced6cffae6394b0e6b6dfd4dc164a6c59a2db9b3c0b0"
dependencies = [
"ratatui",
"vt100",
@@ -1144,6 +1085,12 @@ version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
+[[package]]
+name = "unicode-linebreak"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"
+
[[package]]
name = "unicode-segmentation"
version = "1.11.0"
@@ -1223,61 +1170,6 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
-[[package]]
-name = "wasm-bindgen"
-version = "0.2.93"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
-dependencies = [
- "cfg-if",
- "once_cell",
- "wasm-bindgen-macro",
-]
-
-[[package]]
-name = "wasm-bindgen-backend"
-version = "0.2.93"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
-dependencies = [
- "bumpalo",
- "log",
- "once_cell",
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-macro"
-version = "0.2.93"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
-dependencies = [
- "quote",
- "wasm-bindgen-macro-support",
-]
-
-[[package]]
-name = "wasm-bindgen-macro-support"
-version = "0.2.93"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-backend",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-shared"
-version = "0.2.93"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
-
[[package]]
name = "which"
version = "6.0.3"
@@ -1312,15 +1204,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-[[package]]
-name = "windows-core"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
-dependencies = [
- "windows-targets",
-]
-
[[package]]
name = "windows-sys"
version = "0.52.0"
diff --git a/core/src/inner.rs b/core/src/inner.rs
index a2274dfa..9d2e7162 100644
--- a/core/src/inner.rs
+++ b/core/src/inner.rs
@@ -1,6 +1,7 @@
use std::{
fs::File,
io::{BufRead, BufReader, Read},
+ ops::{Deref, DerefMut},
os::unix::fs::PermissionsExt,
path::{Path, PathBuf},
rc::Rc,
@@ -14,8 +15,34 @@ use temp_dir::TempDir;
const TAB_DATA: Dir = include_dir!("$CARGO_MANIFEST_DIR/tabs");
-pub fn get_tabs(validate: bool) -> (TempDir, Vec) {
- let (temp_dir, tab_files) = TabList::get_tabs();
+// Allow the unused TempDir to be stored for later destructor call
+#[allow(dead_code)]
+pub struct TabList(pub Vec, TempDir);
+
+// Implement deref to allow Vec methods to be called on TabList
+impl Deref for TabList {
+ type Target = Vec;
+
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+impl DerefMut for TabList {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+impl IntoIterator for TabList {
+ type Item = Tab;
+ type IntoIter = std::vec::IntoIter;
+
+ fn into_iter(self) -> Self::IntoIter {
+ self.0.into_iter()
+ }
+}
+
+pub fn get_tabs(validate: bool) -> TabList {
+ let (temp_dir, tab_files) = TabDirectories::get_tabs();
let tabs: Vec<_> = tab_files
.into_iter()
@@ -33,40 +60,28 @@ pub fn get_tabs(validate: bool) -> (TempDir, Vec) {
let tabs: Vec = tabs
.into_iter()
- .map(
- |(
- TabEntry {
- name,
- data,
- multi_selectable,
- },
- directory,
- )| {
- let mut tree = Tree::new(Rc::new(ListNode {
- name: "root".to_string(),
- description: String::new(),
- command: Command::None,
- task_list: String::new(),
- }));
- let mut root = tree.root_mut();
- create_directory(data, &mut root, &directory, validate);
- Tab {
- name,
- tree,
- multi_selectable,
- }
- },
- )
+ .map(|(TabEntry { name, data }, directory)| {
+ let mut tree = Tree::new(Rc::new(ListNode {
+ name: "root".to_string(),
+ description: String::new(),
+ command: Command::None,
+ task_list: String::new(),
+ multi_select: false,
+ }));
+ let mut root = tree.root_mut();
+ create_directory(data, &mut root, &directory, validate, true);
+ Tab { name, tree }
+ })
.collect();
if tabs.is_empty() {
panic!("No tabs found");
}
- (temp_dir, tabs)
+ TabList(tabs, temp_dir)
}
#[derive(Deserialize)]
-struct TabList {
+struct TabDirectories {
directories: Vec,
}
@@ -74,12 +89,6 @@ struct TabList {
struct TabEntry {
name: String,
data: Vec,
- #[serde(default = "default_multi_selectable")]
- multi_selectable: bool,
-}
-
-fn default_multi_selectable() -> bool {
- true
}
#[derive(Deserialize)]
@@ -94,6 +103,12 @@ struct Entry {
entry_type: EntryType,
#[serde(default)]
task_list: String,
+ #[serde(default = "default_true")]
+ multi_select: bool,
+}
+
+fn default_true() -> bool {
+ true
}
#[derive(Deserialize)]
@@ -174,8 +189,11 @@ fn create_directory(
node: &mut NodeMut>,
command_dir: &Path,
validate: bool,
+ parent_multi_select: bool,
) {
for entry in data {
+ let multi_select = parent_multi_select && entry.multi_select;
+
match entry.entry_type {
EntryType::Entries(entries) => {
let mut node = node.append(Rc::new(ListNode {
@@ -183,8 +201,9 @@ fn create_directory(
description: entry.description,
command: Command::None,
task_list: String::new(),
+ multi_select,
}));
- create_directory(entries, &mut node, command_dir, validate);
+ create_directory(entries, &mut node, command_dir, validate, multi_select);
}
EntryType::Command(command) => {
node.append(Rc::new(ListNode {
@@ -192,6 +211,7 @@ fn create_directory(
description: entry.description,
command: Command::Raw(command),
task_list: String::new(),
+ multi_select,
}));
}
EntryType::Script(script) => {
@@ -210,6 +230,7 @@ fn create_directory(
file: script,
},
task_list: entry.task_list,
+ multi_select,
}));
}
}
@@ -252,9 +273,9 @@ fn is_executable(path: &Path) -> bool {
.unwrap_or(false)
}
-impl TabList {
+impl TabDirectories {
fn get_tabs() -> (TempDir, Vec) {
- let temp_dir = TempDir::new().unwrap();
+ let temp_dir = TempDir::with_prefix("linutil_scripts").unwrap();
TAB_DATA
.extract(&temp_dir)
.expect("Failed to extract the saved directory");
diff --git a/core/src/lib.rs b/core/src/lib.rs
index b7cd631e..891d8e84 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -5,7 +5,7 @@ use std::rc::Rc;
use ego_tree::Tree;
use std::path::PathBuf;
-pub use inner::get_tabs;
+pub use inner::{get_tabs, TabList};
#[derive(Clone, Hash, Eq, PartialEq)]
pub enum Command {
@@ -23,7 +23,6 @@ pub enum Command {
pub struct Tab {
pub name: String,
pub tree: Tree>,
- pub multi_selectable: bool,
}
#[derive(Clone, Hash, Eq, PartialEq)]
@@ -32,4 +31,5 @@ pub struct ListNode {
pub description: String,
pub command: Command,
pub task_list: String,
+ pub multi_select: bool,
}
diff --git a/core/tabs/applications-setup/Developer-tools/jetbrains-toolbox.sh b/core/tabs/applications-setup/Developer-tools/jetbrains-toolbox.sh
new file mode 100644
index 00000000..79ce360e
--- /dev/null
+++ b/core/tabs/applications-setup/Developer-tools/jetbrains-toolbox.sh
@@ -0,0 +1,48 @@
+#!/bin/sh -e
+
+. ../../common-script.sh
+
+manualInstall() {
+ JETBRAINS_TOOLBOX_DIR="/opt/jetbrains-toolbox"
+
+ case "$ARCH" in
+ x86_64) ARCHIVE_URL=$(curl -s "https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release" | jq -r ".TBA[0].downloads.linux.link") ;;
+ aarch64) ARCHIVE_URL=$(curl -s "https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release" | jq -r ".TBA[0].downloads.linuxARM64.link") ;;
+ esac
+
+ curl -fSL "$ARCHIVE_URL" -o "jetbrains-toolbox.tar.gz"
+
+ if [ -d "$JETBRAINS_TOOLBOX_DIR" ]; then
+ "$ESCALATION_TOOL" rm -rf "$JETBRAINS_TOOLBOX_DIR"
+ fi
+
+ "$ESCALATION_TOOL" mkdir -p "$JETBRAINS_TOOLBOX_DIR"
+ "$ESCALATION_TOOL" tar -xzf "jetbrains-toolbox.tar.gz" -C "$JETBRAINS_TOOLBOX_DIR" --strip-components=1
+ "$ESCALATION_TOOL" ln -sf "$JETBRAINS_TOOLBOX_DIR/jetbrains-toolbox" "/usr/bin/jetbrains-toolbox"
+}
+
+installJetBrainsToolBox() {
+ if ! command_exists jetbrains-toolbox; then
+ printf "%b\n" "${YELLOW}Installing Jetbrains Toolbox...${RC}"
+ case "$PACKAGER" in
+ pacman)
+ "$AUR_HELPER" -S --needed --noconfirm jetbrains-toolbox
+ ;;
+ dnf)
+ manualInstall
+ ;;
+ *)
+ "$ESCALATION_TOOL" "$PACKAGER" install -y libfuse2
+ manualInstall
+ ;;
+ esac
+ printf "%b\n" "${GREEN}Successfully installed Jetbrains Toolbox.${RC}"
+ else
+ printf "%b\n" "${GREEN}Jetbrains toolbox is already installed.${RC}"
+ fi
+}
+
+checkEnv
+checkEscalationTool
+checkAURHelper
+installJetBrainsToolBox
diff --git a/core/tabs/applications-setup/Developer-tools/meld-setup.sh b/core/tabs/applications-setup/Developer-tools/meld-setup.sh
index bd0bb3c2..031a09ae 100644
--- a/core/tabs/applications-setup/Developer-tools/meld-setup.sh
+++ b/core/tabs/applications-setup/Developer-tools/meld-setup.sh
@@ -3,7 +3,7 @@
. ../../common-script.sh
installMeld() {
- if ! command_exists meld; then
+ if ! command_exists org.gnome.meld && ! command_exists meld; then
printf "%b\n" "${YELLOW}Installing Meld...${RC}"
case "$PACKAGER" in
pacman)
@@ -13,7 +13,7 @@ installMeld() {
"$ESCALATION_TOOL" "$PACKAGER" -y install meld
;;
*)
- . ../setup-flatpak.sh
+ checkFlatpak
flatpak install -y flathub org.gnome.meld
;;
esac
diff --git a/core/tabs/applications-setup/bottles-setup.sh b/core/tabs/applications-setup/bottles-setup.sh
index 02fef60b..0b29bedb 100755
--- a/core/tabs/applications-setup/bottles-setup.sh
+++ b/core/tabs/applications-setup/bottles-setup.sh
@@ -3,14 +3,9 @@
. ../common-script.sh
installBottles() {
- if ! command_exists flatpak; then
- printf "%b\n" "${YELLOW}Installing Bottles...${RC}"
- case "$PACKAGER" in
- *)
- . ./setup-flatpak.sh
- flatpak install -y flathub com.usebottles.bottles
- ;;
- esac
+ if ! command_exists com.usebottles.bottles; then
+ printf "%b\n" "${YELLOW}Installing Bottles...${RC}"
+ flatpak install -y flathub com.usebottles.bottles
else
printf "%b\n" "${GREEN}Bottles is already installed.${RC}"
fi
@@ -18,4 +13,5 @@ installBottles() {
checkEnv
checkEscalationTool
+checkFlatpak
installBottles
\ No newline at end of file
diff --git a/core/tabs/applications-setup/browsers/vivaldi.sh b/core/tabs/applications-setup/browsers/vivaldi.sh
index 002ff7e3..311816d0 100644
--- a/core/tabs/applications-setup/browsers/vivaldi.sh
+++ b/core/tabs/applications-setup/browsers/vivaldi.sh
@@ -2,22 +2,39 @@
. ../../common-script.sh
-installLynx() {
- if ! command_exists lynx; then
- printf "%b\n" "${YELLOW}Installing Lynx...${RC}"
+installVivaldi() {
+ if ! command_exists vivaldi; then
+ printf "%b\n" "${YELLOW}Installing Vivaldi...${RC}"
case "$PACKAGER" in
+ apt-get|nala)
+ "$ESCALATION_TOOL" "$PACKAGER" install -y curl
+ "$ESCALATION_TOOL" curl -fsSL https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor | sudo dd of=/usr/share/keyrings/vivaldi-browser.gpg
+ "$ESCALATION_TOOL" echo "deb [signed-by=/usr/share/keyrings/vivaldi-browser.gpg arch=$(dpkg --print-architecture)] https://repo.vivaldi.com/archive/deb/ stable main" | sudo dd of=/etc/apt/sources.list.d/vivaldi-archive.list
+ "$ESCALATION_TOOL" "$PACKAGER" update
+ "$ESCALATION_TOOL" "$PACKAGER" install -y vivaldi-stable
+ ;;
+ dnf)
+ "$ESCALATION_TOOL" "$PACKAGER" install -y dnf-plugins-core
+ "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://repo.vivaldi.com/stable/vivaldi-fedora.repo
+ "$ESCALATION_TOOL" "$PACKAGER" install -y vivaldi-stable
+ ;;
+ zypper)
+ "$ESCALATION_TOOL" zypper ar https://repo.vivaldi.com/archive/vivaldi-suse.repo
+ "$ESCALATION_TOOL" zypper --non-interactive --gpg-auto-import-keys in vivaldi-stable
+ ;;
pacman)
- "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm lynx
+ "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm vivaldi
;;
*)
- "$ESCALATION_TOOL" "$PACKAGER" install -y lynx
+ printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
+ exit 1
;;
esac
else
- printf "%b\n" "${GREEN}Lynx TUI Browser is already installed.${RC}"
+ printf "%b\n" "${GREEN}Vivaldi Browser is already installed.${RC}"
fi
}
checkEnv
checkEscalationTool
-installLynx
\ No newline at end of file
+installVivaldi
diff --git a/core/tabs/applications-setup/browsers/waterfox.sh b/core/tabs/applications-setup/browsers/waterfox.sh
new file mode 100644
index 00000000..3cef5106
--- /dev/null
+++ b/core/tabs/applications-setup/browsers/waterfox.sh
@@ -0,0 +1,25 @@
+#!/bin/sh -e
+
+. ../../common-script.sh
+
+installWaterfox() {
+ if ! command_exists waterfox; then
+ printf "%b\n" "${YELLOW}Installing waterfox...${RC}"
+ case "$PACKAGER" in
+ pacman)
+ "$AUR_HELPER" -S --needed --noconfirm waterfox-bin
+ ;;
+ *)
+ . ../setup-flatpak.sh
+ flatpak install -y flathub net.waterfox.waterfox
+ ;;
+ esac
+ else
+ printf "%b\n" "${GREEN}Waterfox is already installed.${RC}"
+ fi
+}
+
+checkEnv
+checkEscalationTool
+checkAURHelper
+installWaterfox
diff --git a/core/tabs/applications-setup/communication-apps/signal-setup.sh b/core/tabs/applications-setup/communication-apps/signal-setup.sh
index 7f5d70fc..cdd71b55 100644
--- a/core/tabs/applications-setup/communication-apps/signal-setup.sh
+++ b/core/tabs/applications-setup/communication-apps/signal-setup.sh
@@ -3,7 +3,7 @@
. ../../common-script.sh
installSignal() {
- if ! command_exists signal; then
+ if ! command_exists org.signal.Signal && ! command_exists signal; then
printf "%b\n" "${YELLOW}Installing Signal...${RC}"
case "$PACKAGER" in
apt-get|nala)
@@ -20,8 +20,8 @@ installSignal() {
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm signal-desktop
;;
dnf)
- "$ESCALATION_TOOL" "$PACKAGER" copr enable luminoso/Signal-Desktop
- "$ESCALATION_TOOL" "$PACKAGER" install -y signal-desktop
+ checkFlatpak
+ flatpak install -y flathub org.signal.Signal
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
diff --git a/core/tabs/applications-setup/communication-apps/slack-setup.sh b/core/tabs/applications-setup/communication-apps/slack-setup.sh
index e4bf3719..24d6e532 100644
--- a/core/tabs/applications-setup/communication-apps/slack-setup.sh
+++ b/core/tabs/applications-setup/communication-apps/slack-setup.sh
@@ -3,14 +3,14 @@
. ../../common-script.sh
installSlack() {
- if ! command_exists slack; then
+ if ! command_exists com.slack.Slack && ! command_exists slack; then
printf "%b\n" "${YELLOW}Installing Slack...${RC}"
case "$PACKAGER" in
pacman)
"$AUR_HELPER" -S --needed --noconfirm slack-desktop
;;
*)
- . ../setup-flatpak.sh
+ checkFlatpak
flatpak install -y flathub com.slack.Slack
;;
esac
diff --git a/core/tabs/applications-setup/communication-apps/zoom-setup.sh b/core/tabs/applications-setup/communication-apps/zoom-setup.sh
index acd5b180..19d7e407 100644
--- a/core/tabs/applications-setup/communication-apps/zoom-setup.sh
+++ b/core/tabs/applications-setup/communication-apps/zoom-setup.sh
@@ -3,14 +3,14 @@
. ../../common-script.sh
installZoom() {
- if ! command_exists zoom; then
+ if ! command_exists us.zoom.Zoom && ! command_exists zoom; then
printf "%b\n" "${YELLOW}Installing Zoom...${RC}"
case "$PACKAGER" in
pacman)
"$AUR_HELPER" -S --needed --noconfirm zoom
;;
*)
- . ../setup-flatpak.sh
+ checkFlatpak
flatpak install -y flathub us.zoom.Zoom
;;
esac
diff --git a/core/tabs/applications-setup/docker-setup.sh b/core/tabs/applications-setup/docker-setup.sh
index afcd1572..4844d10e 100755
--- a/core/tabs/applications-setup/docker-setup.sh
+++ b/core/tabs/applications-setup/docker-setup.sh
@@ -26,6 +26,12 @@ install_docker() {
apt-get|nala)
curl -fsSL https://get.docker.com | sh
;;
+ dnf)
+ "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
+ "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
+ "$ESCALATION_TOOL" "$PACKAGER" -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
+ "$ESCALATION_TOOL" systemctl enable --now docker
+ ;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install docker
"$ESCALATION_TOOL" systemctl enable docker
@@ -49,6 +55,11 @@ install_docker_compose() {
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y docker-compose-plugin
;;
+ dnf)
+ "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
+ "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
+ "$ESCALATION_TOOL" "$PACKAGER" install -y docker-compose-plugin
+ ;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install docker-compose
;;
diff --git a/core/tabs/applications-setup/dwmtitus-setup.sh b/core/tabs/applications-setup/dwmtitus-setup.sh
index 01ec0ef1..a4a5295e 100755
--- a/core/tabs/applications-setup/dwmtitus-setup.sh
+++ b/core/tabs/applications-setup/dwmtitus-setup.sh
@@ -214,10 +214,28 @@ setupDisplayManager() {
printf "%b\n" "${YELLOW}3. GDM ${RC}"
printf "%b\n" "${YELLOW} ${RC}"
printf "%b" "${YELLOW}Please select one: ${RC}"
- read -r DM
+ read -r choice
+ case "$choice" in
+ 1)
+ DM="sddm"
+ ;;
+ 2)
+ DM="lightdm"
+ ;;
+ 3)
+ DM="gdm"
+ ;;
+ *)
+ printf "%b\n" "${RED}Invalid selection! Please choose 1, 2, or 3.${RC}"
+ exit 1
+ ;;
+ esac
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$DM"
+ if [ "$DM" = "lightdm" ]; then
+ "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm lightdm-gtk-greeter
+ fi
;;
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DM"
diff --git a/core/tabs/applications-setup/mybash-setup.sh b/core/tabs/applications-setup/mybash-setup.sh
index 7cda9942..c09df01e 100644
--- a/core/tabs/applications-setup/mybash-setup.sh
+++ b/core/tabs/applications-setup/mybash-setup.sh
@@ -5,16 +5,16 @@
gitpath="$HOME/.local/share/mybash"
installDepend() {
- if ! command_exists bash bash-completion tar bat tree unzip fontconfig git; then
- printf "%b\n" "${YELLOW}Installing Bash...${RC}"
- case "$PACKAGER" in
- pacman)
- "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git
- ;;
- *)
- "$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
- ;;
- esac
+ if [ ! -f "/usr/share/bash-completion/bash_completion" ] || ! command_exists bash tar bat tree unzip fc-list git; then
+ printf "%b\n" "${YELLOW}Installing Bash...${RC}"
+ case "$PACKAGER" in
+ pacman)
+ "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git
+ ;;
+ *)
+ "$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
+ ;;
+ esac
fi
}
diff --git a/core/tabs/applications-setup/office-suites/freeoffice.sh b/core/tabs/applications-setup/office-suites/freeoffice.sh
index 7effa3fb..d289165e 100644
--- a/core/tabs/applications-setup/office-suites/freeoffice.sh
+++ b/core/tabs/applications-setup/office-suites/freeoffice.sh
@@ -1,6 +1,6 @@
#!/bin/sh -e
-. ../common-script.sh
+. ../../common-script.sh
installFreeOffice() {
if ! command_exists softmaker-freeoffice-2024 freeoffice softmaker; then
diff --git a/core/tabs/applications-setup/office-suites/libreoffice.sh b/core/tabs/applications-setup/office-suites/libreoffice.sh
index a9850fdc..f389abd8 100644
--- a/core/tabs/applications-setup/office-suites/libreoffice.sh
+++ b/core/tabs/applications-setup/office-suites/libreoffice.sh
@@ -1,16 +1,16 @@
#!/bin/sh -e
-. ../common-script.sh
+. ../../common-script.sh
installLibreOffice() {
- if ! command_exists libreoffice; then
+ if ! command_exists org.libreoffice.LibreOffice && ! 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
+ checkFlatpak
flatpak install -y flathub org.libreoffice.LibreOffice
;;
pacman)
diff --git a/core/tabs/applications-setup/office-suites/onlyoffice.sh b/core/tabs/applications-setup/office-suites/onlyoffice.sh
index aaea7547..f6fb97f6 100644
--- a/core/tabs/applications-setup/office-suites/onlyoffice.sh
+++ b/core/tabs/applications-setup/office-suites/onlyoffice.sh
@@ -1,9 +1,9 @@
#!/bin/sh -e
-. ../common-script.sh
+. ../../common-script.sh
installOnlyOffice() {
- if ! command_exists onlyoffice-desktopeditors; then
+ if ! command_exists org.onlyoffice.desktopeditors && ! command_exists onlyoffice-desktopeditors; then
printf "%b\n" "${YELLOW}Installing Only Office..${RC}."
case "$PACKAGER" in
apt-get|nala)
@@ -11,7 +11,7 @@ installOnlyOffice() {
"$ESCALATION_TOOL" "$PACKAGER" install -y ./onlyoffice-desktopeditors_amd64.deb
;;
zypper|dnf)
- . ./setup-flatpak.sh
+ checkFlatpak
flatpak install -y flathub org.onlyoffice.desktopeditors
;;
pacman)
diff --git a/core/tabs/applications-setup/office-suites/wpsoffice.sh b/core/tabs/applications-setup/office-suites/wpsoffice.sh
index ce1bbc72..4ce1f5c5 100644
--- a/core/tabs/applications-setup/office-suites/wpsoffice.sh
+++ b/core/tabs/applications-setup/office-suites/wpsoffice.sh
@@ -1,16 +1,16 @@
#!/bin/sh -e
-. ../common-script.sh
+. ../../common-script.sh
installWpsOffice() {
- if ! command_exists com.wps.Office; then
+ if ! command_exists com.wps.Office && ! command_exists wps; then
printf "%b\n" "${YELLOW}Installing WPS Office...${RC}"
case "$PACKAGER" in
pacman)
"$AUR_HELPER" -S --needed --noconfirm wps-office
;;
*)
- . ./setup-flatpak.sh
+ checkFlatpak
flatpak install flathub com.wps.Office
;;
esac
diff --git a/core/tabs/applications-setup/pdf-suites/evince.sh b/core/tabs/applications-setup/pdf-suites/evince.sh
index 9e0d8da0..9118d36d 100644
--- a/core/tabs/applications-setup/pdf-suites/evince.sh
+++ b/core/tabs/applications-setup/pdf-suites/evince.sh
@@ -1,6 +1,6 @@
#!/bin/sh -e
-. ../common-script.sh
+. ../../common-script.sh
installEvince() {
if ! command_exists evince; then
diff --git a/core/tabs/applications-setup/pdf-suites/okular.sh b/core/tabs/applications-setup/pdf-suites/okular.sh
index 6ed8d4d1..785d512c 100644
--- a/core/tabs/applications-setup/pdf-suites/okular.sh
+++ b/core/tabs/applications-setup/pdf-suites/okular.sh
@@ -1,6 +1,6 @@
#!/bin/sh -e
-. ../common-script.sh
+. ../../common-script.sh
installOkular() {
if ! command_exists okular; then
diff --git a/core/tabs/applications-setup/pdf-suites/pdfstudio.sh b/core/tabs/applications-setup/pdf-suites/pdfstudio.sh
index 03ba05f4..5dd5fbf9 100644
--- a/core/tabs/applications-setup/pdf-suites/pdfstudio.sh
+++ b/core/tabs/applications-setup/pdf-suites/pdfstudio.sh
@@ -1,6 +1,6 @@
#!/bin/sh -e
-. ../common-script.sh
+. ../../common-script.sh
installPdfstudio() {
if ! command_exists pdfstudio2024; then
diff --git a/core/tabs/applications-setup/pdf-suites/pdfstudioviewer.sh b/core/tabs/applications-setup/pdf-suites/pdfstudioviewer.sh
index 72013a11..e0ab27cf 100644
--- a/core/tabs/applications-setup/pdf-suites/pdfstudioviewer.sh
+++ b/core/tabs/applications-setup/pdf-suites/pdfstudioviewer.sh
@@ -1,6 +1,6 @@
#!/bin/sh -e
-. ../common-script.sh
+. ../../common-script.sh
installPdfstudioviewer() {
if ! command_exists pdfstudioviewer2024; then
diff --git a/core/tabs/applications-setup/podman-compose-setup.sh b/core/tabs/applications-setup/podman-compose-setup.sh
new file mode 100644
index 00000000..02db3ed7
--- /dev/null
+++ b/core/tabs/applications-setup/podman-compose-setup.sh
@@ -0,0 +1,33 @@
+#!/bin/sh -e
+
+. ../common-script.sh
+
+installPodmanCompose() {
+ if ! command_exists podman-compose; then
+ printf "%b\n" "${YELLOW}Installing Podman Compose...${RC}"
+ case "$PACKAGER" in
+ apt-get|nala)
+ "$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose
+ ;;
+ zypper)
+ "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install podman-compose
+ ;;
+ pacman)
+ "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed podman-compose
+ ;;
+ dnf)
+ "$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose
+ ;;
+ *)
+ printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
+ exit 1
+ ;;
+ esac
+ else
+ printf "%b\n" "${GREEN}Podman Compose is already installed.${RC}"
+ fi
+}
+
+checkEnv
+checkEscalationTool
+installPodmanCompose
diff --git a/core/tabs/applications-setup/podman-setup.sh b/core/tabs/applications-setup/podman-setup.sh
new file mode 100644
index 00000000..07a0b5f6
--- /dev/null
+++ b/core/tabs/applications-setup/podman-setup.sh
@@ -0,0 +1,33 @@
+#!/bin/sh -e
+
+. ../common-script.sh
+
+installPodman() {
+ if ! command_exists podman; then
+ printf "%b\n" "${YELLOW}Installing Podman...${RC}"
+ case "$PACKAGER" in
+ apt-get|nala)
+ "$ESCALATION_TOOL" "$PACKAGER" install -y podman
+ ;;
+ zypper)
+ "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install podman
+ ;;
+ pacman)
+ "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed podman
+ ;;
+ dnf)
+ "$ESCALATION_TOOL" "$PACKAGER" install -y podman
+ ;;
+ *)
+ printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
+ exit 1
+ ;;
+ esac
+ else
+ printf "%b\n" "${GREEN}Podman is already installed.${RC}"
+ fi
+}
+
+checkEnv
+checkEscalationTool
+installPodman
diff --git a/core/tabs/applications-setup/setup-flatpak.sh b/core/tabs/applications-setup/setup-flatpak.sh
index 75da28af..379467a6 100755
--- a/core/tabs/applications-setup/setup-flatpak.sh
+++ b/core/tabs/applications-setup/setup-flatpak.sh
@@ -2,9 +2,7 @@
. ../common-script.sh
-# Used to detect the desktop environment, Only used for the If statement in the setup_flatpak function.
-# Perhaps this should be moved to common-script.sh later on?
-detect_de() {
+checkDE() {
if [ -n "$XDG_CURRENT_DESKTOP" ]; then
case "$XDG_CURRENT_DESKTOP" in
*GNOME*)
@@ -17,42 +15,11 @@ detect_de() {
fi
}
-# Install Flatpak if not already installed.
-setup_flatpak() {
- if ! command_exists flatpak; then
- printf "%b\n" "${YELLOW}Installing Flatpak...${RC}"
- case "$PACKAGER" in
- pacman)
- "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak
- ;;
- *)
- "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
- ;;
- esac
- printf "%b\n" "Adding Flathub remote..."
- "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- else
- if command_exists flatpak; then
- if ! flatpak remotes | grep -q "flathub"; then
- printf "%b" "${YELLOW}Detected Flatpak package manager but Flathub remote is not added. Would you like to add it? (y/N): ${RC}"
- read -r add_remote
- case "$add_remote" in
- [Yy]*)
- printf "%b\n" "Adding Flathub remote..."
- "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- ;;
- esac
- else
- # Needed mostly for systems without a polkit agent running (Error: updating: Unable to connect to system bus)
- printf "%b\n" "${GREEN}Flathub already setup. You can quit.${RC}"
- fi
- fi
- fi
-
+installExtra() {
if [ "$PACKAGER" = "apt-get" ] || [ "$PACKAGER" = "nala" ]; then
- detect_de
+ checkDE
# Only used for Ubuntu GNOME. Ubuntu GNOME doesnt allow flathub to be added as a remote to their store.
- # So in case the user wants to use a GUI siftware manager they can setup it here
+ # So in case the user wants to use a GUI software manager they can setup it here
if [ "$DE" = "GNOME" ]; then
printf "%b" "${YELLOW}Detected GNOME desktop environment. Would you like to install GNOME Software plugin for Flatpak? (y/N): ${RC}"
read -r install_gnome
@@ -72,4 +39,5 @@ setup_flatpak() {
checkEnv
checkEscalationTool
-setup_flatpak
+checkFlatpak
+installExtra
\ No newline at end of file
diff --git a/core/tabs/applications-setup/tab_data.toml b/core/tabs/applications-setup/tab_data.toml
index ef6af7de..20233a92 100644
--- a/core/tabs/applications-setup/tab_data.toml
+++ b/core/tabs/applications-setup/tab_data.toml
@@ -1,50 +1,5 @@
name = "Applications Setup"
-[[data]]
-name = "Developer Tools"
-
-[[data.entries]]
-name = "Github Desktop"
-description = "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."
-script = "Developer-tools/githubdesktop-setup.sh"
-task_list = "I"
-
-[[data.entries]]
-name = "Neovim"
-description = "Neovim is a refactor, and sometimes redactor, in the tradition of Vim.\nIt is not a rewrite but a continuation and extension of Vim.\nThis command configures neovim from CTT's neovim configuration.\nhttps://github.com/ChrisTitusTech/neovim"
-script = "Developer-tools/neovim-setup.sh"
-task_list = "I FM"
-
-[[data.entries]]
-name = "Sublime Text"
-description = "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."
-script = "Developer-tools/sublime-setup.sh"
-task_list = "I"
-
-[[data.entries]]
-name = "VS Code"
-description = "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."
-script = "Developer-tools/vscode-setup.sh"
-task_list = "I"
-
-[[data.entries]]
-name = "VS Codium"
-description = "VSCodium is a free, open-source version of Visual Studio Code (VS Code) that removes Microsoft-specific telemetry and branding."
-script = "Developer-tools/vscodium-setup.sh"
-task_list = "I"
-
-[[data.entries]]
-name = "Meld"
-description = "Meld is a visual diff and merge tool that helps compare files, directories, and version-controlled projects."
-script = "Developer-tools/meld-setup.sh"
-task_list = "I FI"
-
-[[data.entries]]
-name = "Ngrok"
-description = "Ngrok is a tool that creates secure, temporary tunnels to expose local servers to the internet for testing and development."
-script = "Developer-tools/ngrok-setup.sh"
-task_list = "I"
-
[[data]]
name = "Communication Apps"
@@ -78,21 +33,77 @@ description = "Telegram is a cloud-based messaging app known for its speed and s
script = "communication-apps/telegram-setup.sh"
task_list = "I"
-[[data.entries]]
-name = "Zoom"
-description = "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."
-script = "communication-apps/zoom-setup.sh"
-task_list = "I"
-
[[data.entries]]
name = "Thunderbird"
description = "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."
script = "communication-apps/thunderbird-setup.sh"
task_list = "I"
+[[data.entries]]
+name = "Zoom"
+description = "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."
+script = "communication-apps/zoom-setup.sh"
+task_list = "I"
+
+[[data]]
+name = "Developer Tools"
+
+[[data.entries]]
+name = "Github Desktop"
+description = "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."
+script = "Developer-tools/githubdesktop-setup.sh"
+task_list = "I"
+
+[[data.entries]]
+name = "JetBrains Toolbox"
+description = "JetBrains Toolbox is a collection of tools and an app that help developers work with JetBrains products."
+script = "Developer-tools/jetbrains-toolbox.sh"
+task_list = "I"
+
+[[data.entries]]
+name = "Meld"
+description = "Meld is a visual diff and merge tool that helps compare files, directories, and version-controlled projects."
+script = "Developer-tools/meld-setup.sh"
+task_list = "I FI"
+
+[[data.entries]]
+name = "Neovim"
+description = "Neovim is a refactor, and sometimes redactor, in the tradition of Vim.\nIt is not a rewrite but a continuation and extension of Vim.\nThis command configures neovim from CTT's neovim configuration.\nhttps://github.com/ChrisTitusTech/neovim"
+script = "Developer-tools/neovim-setup.sh"
+task_list = "I FM"
+
+[[data.entries]]
+name = "Ngrok"
+description = "Ngrok is a tool that creates secure, temporary tunnels to expose local servers to the internet for testing and development."
+script = "Developer-tools/ngrok-setup.sh"
+task_list = "I"
+
+[[data.entries]]
+name = "Sublime Text"
+description = "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."
+script = "Developer-tools/sublime-setup.sh"
+task_list = "I"
+
+[[data.entries]]
+name = "VS Code"
+description = "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."
+script = "Developer-tools/vscode-setup.sh"
+task_list = "I"
+
+[[data.entries]]
+name = "VS Codium"
+description = "VSCodium is a free, open-source version of Visual Studio Code (VS Code) that removes Microsoft-specific telemetry and branding."
+script = "Developer-tools/vscodium-setup.sh"
+task_list = "I"
+
[[data]]
name = "Office Suites"
+[[data.entries]]
+name = "FreeOffice"
+script = "office-suites/freeoffice.sh"
+task_list = "I"
+
[[data.entries]]
name = "LibreOffice"
script = "office-suites/libreoffice.sh"
@@ -103,11 +114,6 @@ 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"
@@ -186,9 +192,15 @@ description = "Vivaldi is a freeware, cross-platform web browser developed by Vi
script = "browsers/vivaldi.sh"
task_list = "I"
+[[data.entries]]
+name = "waterfox"
+description = "Waterfox is the privacy-focused web browser engineered to give you speed, control, and peace of mind on the internet."
+script = "browsers/waterfox.sh"
+task_list = "FI"
+
[[data]]
name = "Alacritty"
-description = "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.\nThis command installs and condifures alacritty terminal emulator."
+description = "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 configures alacritty terminal emulator."
script = "alacritty-setup.sh"
task_list = "I FM"
@@ -200,37 +212,49 @@ task_list = "I"
[[data]]
name = "Bash Prompt"
-description = "The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems.\nIt is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful.\nThis command configures the key sections and functionalities defined in the .bashrc file from CTT's mybash repository.\nhttps://github.com/ChrisTitusTech/mybash"
+description = "The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems. It is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful. This command configures the key sections and functionalities defined in the .bashrc file from CTT's mybash repository. https://github.com/ChrisTitusTech/mybash"
script = "mybash-setup.sh"
task_list = "I FM"
[[data]]
name = "Bottles"
-description = "Bottles allows Windows software, like applications and games, to run on Linux.\nBottles also provides tools to categorize, organize and optimize your applications."
+description = "Bottles allows Windows software, like applications and games, to run on Linux. Bottles also provides tools to categorize, organize and optimize your applications."
script = "bottles-setup.sh"
task_list = "FI"
-[[data]]
-name = "DWM-Titus"
-description = "DWM is a dynamic window manager for X.\nIt manages windows in tiled, monocle and floating layouts.\nAll of the layouts can be applied dynamically, optimising the environment for the application in use and the task performed.\nThis command installs and configures DWM and a desktop manager.\nThe list of patches applied can be found in CTT's DWM repository\nhttps://github.com/ChrisTitusTech/dwm-titus"
-script = "dwmtitus-setup.sh"
-task_list = "I PFM SS"
-
[[data]]
name = "Docker"
description = "Docker is an open platform that uses OS-level virtualization to deliver software in packages called containers."
script = "docker-setup.sh"
task_list = "I SS"
+[[data]]
+name = "Podman"
+description = "Podman is a daemon-less open platform that uses OS-level virtualization to deliver software in packages called containers."
+script = "podman-setup.sh"
+task_list = "I SS"
+
+[[data]]
+name = "Podman-compose"
+description = "Podman Compose is a tool for defining and running multi-container applications using Podman."
+script = "podman-compose-setup.sh"
+task_list = "I SS"
+
+[[data]]
+name = "DWM-Titus"
+description = "DWM is a dynamic window manager for X.\nIt manages windows in tiled, monocle and floating layouts.\nAll of the layouts can be applied dynamically, optimising the environment for the application in use and the task performed.\nThis command installs and configures DWM and a desktop manager.\nThe list of patches applied can be found in CTT's DWM repository\nhttps://github.com/ChrisTitusTech/dwm-titus"
+script = "dwmtitus-setup.sh"
+task_list = "I PFM SS"
+
[[data]]
name = "Fastfetch"
-description = "Fastfetch is a neofetch-like tool for fetching system information and displaying it prettily.\nIt is written mainly in C, with performance and customizability in mind.\nThis command installs fastfetch and configures from CTT's mybash repository.\nhttps://github.com/ChrisTitusTech/mybash"
+description = "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"
script = "fastfetch-setup.sh"
task_list = "I FM"
[[data]]
name = "Flatpak / Flathub"
-description = "Flatpak is a universal application sandbox for Linux that uses isolated packages from Flathub to prevent conflicts and system alterations, while alleviating dependency concerns.\nThis command installs Flatpak and adds the Flathub repository"
+description = "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"
script = "setup-flatpak.sh"
task_list = "I"
@@ -242,7 +266,7 @@ task_list = "PFM"
[[data]]
name = "Kitty"
-description = "kitty is a free and open-source GPU-accelerated terminal emulator for Linux, macOS, and some BSD distributions, focused on performance and features.\nkitty is written in a mix of C and Python programming languages.\n This command installs and configures kitty."
+description = "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."
script = "kitty-setup.sh"
task_list = "I FM"
@@ -270,7 +294,7 @@ values = [ "linutil" ]
[[data]]
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. This command installs and configures rofi with configuration from CTT's DWM repo. https://github.com/ChrisTitusTech/dwm-titus"
script = "rofi-setup.sh"
task_list = "I FM"
@@ -286,6 +310,6 @@ values = [ "wayland", "Wayland" ]
[[data]]
name = "ZSH Prompt"
-description = "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.\nThis command installs ZSH prompt and provides basic configuration."
+description = "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."
script = "zsh-setup.sh"
-task_list = "I FM"
+task_list = "I FM"
\ No newline at end of file
diff --git a/core/tabs/applications-setup/waydroid-setup.sh b/core/tabs/applications-setup/waydroid-setup.sh
index 255a4cbe..8cac399f 100755
--- a/core/tabs/applications-setup/waydroid-setup.sh
+++ b/core/tabs/applications-setup/waydroid-setup.sh
@@ -15,10 +15,17 @@ installWaydroid() {
case "$PACKAGER" in
pacman)
"$AUR_HELPER" -S --needed --noconfirm waydroid
- if command_exists dkms; then
- "$AUR_HELPER" -S --needed --noconfirm binder_linux-dkms
- "$ESCALATION_TOOL" modprobe binder-linux device=binder,hwbinder,vndbinder
+ if ! command_exists dkms; then
+ installed_kernels=$("$PACKAGER" -Q | grep -E '^linux(| |-rt|-rt-lts|-hardened|-zen|-lts)[^-headers]' | cut -d ' ' -f 1)
+ for kernel in $installed_kernels; do
+ header="${kernel}-headers"
+ printf "%b\n" "${CYAN}Installing headers for $kernel...${RC}"
+ "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$header"
+ done
+ "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm dkms
fi
+ "$AUR_HELPER" -S --needed --noconfirm binder_linux-dkms
+ "$ESCALATION_TOOL" modprobe binder-linux device=binder,hwbinder,vndbinder
;;
apt-get|nala)
curl https://repo.waydro.id | "$ESCALATION_TOOL" sh
diff --git a/core/tabs/common-script.sh b/core/tabs/common-script.sh
index 12ab1146..d431c488 100644
--- a/core/tabs/common-script.sh
+++ b/core/tabs/common-script.sh
@@ -9,7 +9,48 @@ CYAN='\033[36m'
GREEN='\033[32m'
command_exists() {
- command -v "$1" >/dev/null 2>&1
+for cmd in "$@"; do
+ export PATH="$HOME/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH"
+ command -v "$cmd" >/dev/null 2>&1 || return 1
+done
+return 0
+}
+
+checkFlatpak() {
+ if ! command_exists flatpak; then
+ printf "%b\n" "${YELLOW}Installing Flatpak...${RC}"
+ case "$PACKAGER" in
+ pacman)
+ "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak
+ ;;
+ apk)
+ "$ESCALATION_TOOL" "$PACKAGER" add flatpak
+ ;;
+ *)
+ "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
+ ;;
+ esac
+ printf "%b\n" "${YELLOW}Adding Flathub remote...${RC}"
+ "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
+ printf "%b\n" "${YELLOW}Applications installed by Flatpak may not appear on your desktop until the user session is restarted...${RC}"
+ else
+ if ! flatpak remotes | grep -q "flathub"; then
+ printf "%b\n" "${YELLOW}Adding Flathub remote...${RC}"
+ "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
+ else
+ printf "%b\n" "${CYAN}Flatpak is installed${RC}"
+ fi
+ fi
+}
+
+checkArch() {
+ case "$(uname -m)" in
+ x86_64 | amd64) ARCH="x86_64" ;;
+ aarch64 | arm64) ARCH="aarch64" ;;
+ *) printf "%b\n" "${RED}Unsupported architecture: $(uname -m)${RC}" && exit 1 ;;
+ esac
+
+ printf "%b\n" "${CYAN}System architecture: ${ARCH}${RC}"
}
checkAURHelper() {
@@ -125,6 +166,7 @@ checkDistro() {
}
checkEnv() {
+ checkArch
checkEscalationTool
checkCommandRequirements "curl groups $ESCALATION_TOOL"
checkPackageManager 'nala apt-get dnf pacman zypper'
diff --git a/core/tabs/gaming/tab_data.toml b/core/tabs/gaming/tab_data.toml
index 14eebd51..869a4180 100644
--- a/core/tabs/gaming/tab_data.toml
+++ b/core/tabs/gaming/tab_data.toml
@@ -5,6 +5,6 @@ name = "Diablo II Resurrected"
[[data.entries]]
name = "Loot Filter"
-description = "This is a loot filter for Diablo II Resurrected.\nIt's designed to be a simple, clean, and easy to read loot filter that highlights the most important items.\nWorks on battle.net and single player.\nNo frills, no config, just highlights high runes and other valuable items.\nFor more information visit: https://github.com/ChrisTitusTech/d2r-loot-filter"
+description = "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"
script = "diablo-ii/d2r-loot-filters.sh"
task_list = "FM"
diff --git a/core/tabs/security/tab_data.toml b/core/tabs/security/tab_data.toml
index 34de8174..ce8d7ac4 100644
--- a/core/tabs/security/tab_data.toml
+++ b/core/tabs/security/tab_data.toml
@@ -2,6 +2,6 @@ name = "Security"
[[data]]
name = "Firewall Baselines (CTT)"
-description = "Developed to ease iptables firewall configuration, UFW provides a user friendly way to create an IPv4 or IPv6 host-based firewall.\nThis command installs UFW and configures UFW based on CTT's recommended rules.\nFor more information visit: https://christitus.com/linux-security-mistakes"
+description = "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"
script = "firewall-baselines.sh"
task_list = "I SS"
diff --git a/core/tabs/system-setup/arch/paru-setup.sh b/core/tabs/system-setup/arch/paru-setup.sh
index fba445ef..c08e5d8d 100755
--- a/core/tabs/system-setup/arch/paru-setup.sh
+++ b/core/tabs/system-setup/arch/paru-setup.sh
@@ -8,8 +8,8 @@ installDepend() {
if ! command_exists paru; then
printf "%b\n" "${YELLOW}Installing paru as AUR helper...${RC}"
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel git
- cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/paru.git && "$ESCALATION_TOOL" chown -R "$USER": ./paru
- cd paru && makepkg --noconfirm -si
+ cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/paru-bin.git && "$ESCALATION_TOOL" chown -R "$USER": ./paru-bin
+ cd paru-bin && makepkg --noconfirm -si
printf "%b\n" "${GREEN}Paru installed${RC}"
else
printf "%b\n" "${GREEN}Paru already installed${RC}"
diff --git a/core/tabs/system-setup/arch/server-setup.sh b/core/tabs/system-setup/arch/server-setup.sh
index 3a385df5..913d5f61 100755
--- a/core/tabs/system-setup/arch/server-setup.sh
+++ b/core/tabs/system-setup/arch/server-setup.sh
@@ -130,7 +130,7 @@ echo -ne "
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
------------------------------------------------------------------------
- Please select presetup settings for your system
+ Please select presetup settings for your system
------------------------------------------------------------------------
"
}
@@ -146,7 +146,7 @@ filesystem () {
case $? in
0) export FS=btrfs;;
1) export FS=ext4;;
- 2)
+ 2)
set_password "LUKS_PASSWORD"
export FS=luks
;;
@@ -155,14 +155,14 @@ filesystem () {
esac
}
-# @description Detects and sets timezone.
+# @description Detects and sets timezone.
timezone () {
# Added this from arch wiki https://wiki.archlinux.org/title/System_time
time_zone="$(curl --fail https://ipapi.co/timezone)"
echo -ne "
System detected your timezone to be '$time_zone' \n"
echo -ne "Is this correct?
- "
+ "
options=("Yes" "No")
select_option "${options[@]}"
@@ -171,14 +171,14 @@ timezone () {
echo "${time_zone} set as timezone"
export TIMEZONE=$time_zone;;
n|N|no|NO|No)
- echo "Please enter your desired timezone e.g. Europe/London :"
+ echo "Please enter your desired timezone e.g. Europe/London :"
read -r new_timezone
echo "${new_timezone} set as timezone"
export TIMEZONE=$new_timezone;;
*) echo "Wrong option. Try again";timezone;;
esac
}
-# @description Set user's keyboard mapping.
+# @description Set user's keyboard mapping.
keymap () {
echo -ne "
Please select key board layout from this list"
@@ -236,18 +236,18 @@ echo -ne "
drivessd
}
-# @description Gather username and password to be used for installation.
+# @description Gather username and password to be used for installation.
userinfo () {
# Loop through user input until the user gives a valid username
while true
- do
+ do
read -r -p "Please enter username: " username
if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]
- then
+ then
break
- fi
+ fi
echo "Incorrect username."
- done
+ done
export USERNAME=$username
while true
@@ -264,22 +264,22 @@ userinfo () {
done
export PASSWORD=$PASSWORD1
- # Loop through user input until the user gives a valid hostname, but allow the user to force save
+ # Loop through user input until the user gives a valid hostname, but allow the user to force save
while true
- do
+ do
read -r -p "Please name your machine: " name_of_machine
# hostname regex (!!couldn't find spec for computer name!!)
if [[ "${name_of_machine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]
- then
- break
- fi
+ then
+ break
+ fi
# if validation fails allow the user to force saving of the hostname
- read -r -p "Hostname doesn't seem correct. Do you still want to save it? (y/n)" force
+ read -r -p "Hostname doesn't seem correct. Do you still want to save it? (y/n)" force
if [[ "${force,,}" = "y" ]]
- then
- break
- fi
- done
+ then
+ break
+ fi
+ done
export NAME_OF_MACHINE=$name_of_machine
}
@@ -351,7 +351,7 @@ echo -ne "
Creating Filesystems
-------------------------------------------------------------------------
"
-# @description Creates the btrfs subvolumes.
+# @description Creates the btrfs subvolumes.
createsubvolumes () {
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
@@ -362,11 +362,11 @@ mountallsubvol () {
mount -o "${MOUNT_OPTIONS}",subvol=@home "${partition3}" /mnt/home
}
-# @description BTRFS subvolulme creation and mounting.
+# @description BTRFS subvolulme creation and mounting.
subvolumesetup () {
# create nonroot subvolumes
- createsubvolumes
-# unmount root to remount with subvolume
+ createsubvolumes
+# unmount root to remount with subvolume
umount /mnt
# mount @ subvolume
mount -o "${MOUNT_OPTIONS}",subvol=@ "${partition3}" /mnt
@@ -386,33 +386,36 @@ fi
if [[ "${FS}" == "btrfs" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" "${partition2}"
- mkfs.btrfs -L ROOT "${partition3}" -f
+ mkfs.btrfs -f "${partition3}"
mount -t btrfs "${partition3}" /mnt
subvolumesetup
elif [[ "${FS}" == "ext4" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" "${partition2}"
- mkfs.ext4 -L ROOT "${partition3}"
+ mkfs.ext4 "${partition3}"
mount -t ext4 "${partition3}" /mnt
elif [[ "${FS}" == "luks" ]]; then
- mkfs.vfat -F32 -n "EFIBOOT" "${partition2}"
+ mkfs.vfat -F32 "${partition2}"
# enter luks password to cryptsetup and format root partition
echo -n "${LUKS_PASSWORD}" | cryptsetup -y -v luksFormat "${partition3}" -
-# open luks container and ROOT will be place holder
+# open luks container and ROOT will be place holder
echo -n "${LUKS_PASSWORD}" | cryptsetup open "${partition3}" ROOT -
# now format that container
- mkfs.btrfs -L ROOT "${partition3}"
+ mkfs.btrfs "${partition3}"
# create subvolumes for btrfs
mount -t btrfs "${partition3}" /mnt
subvolumesetup
+ ENCRYPTED_PARTITION_UUID=$(blkid -s UUID -o value "${partition3}")
fi
+BOOT_UUID=$(blkid -s UUID -o value "${partition2}")
+
sync
if ! mountpoint -q /mnt; then
echo "ERROR! Failed to mount ${partition3} to /mnt after multiple attempts."
exit 1
fi
mkdir -p /mnt/boot/efi
-mount -t vfat -L EFIBOOT /mnt/boot/
+mount -t vfat -U "${BOOT_UUID}" /mnt/boot/
if ! grep -qs '/mnt' /proc/mounts; then
echo "Drive is not mounted can not continue"
@@ -435,8 +438,8 @@ fi
echo "keyserver hkp://keyserver.ubuntu.com" >> /mnt/etc/pacman.d/gnupg/gpg.conf
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
-genfstab -L /mnt >> /mnt/etc/fstab
-echo "
+genfstab -U /mnt >> /mnt/etc/fstab
+echo "
Generated /etc/fstab:
"
cat /mnt/etc/fstab
@@ -475,14 +478,14 @@ arch-chroot /mnt /bin/bash -c "KEYMAP='${KEYMAP}' /bin/bash" < /dev/null
+ echo 'echo "rmmod tpm"' | "$ESCALATION_TOOL" tee -a /etc/grub.d/02_tpm > /dev/null
+ "$ESCALATION_TOOL" chmod +x /etc/grub.d/02_tpm # makes the file executable
+ "$ESCALATION_TOOL" grub2-mkconfig -o /boot/grub2/grub.cfg # updates grub config
+ printf "%b\n" "${GREEN}Mitigation applied and grub config updated.${RC}"
+ break
+ ;;
+ [nN]*)
+ printf "%b\n" "${GREEN}Skipping TPM error mitigation.${RC}"
+ break
+ ;;
+ *)
+ printf "%b\n" "${RED}Invalid input. Please enter 'y' for yes or 'n' for no.${RC}"
+ ;;
+ esac
+ done
+}
+
+# Post install information
+someNotices() {
+ printf "%b\n" "${YELLOW}================================NOTICES================================${RC}"
+ printf "%b\n" "${YELLOW}Notice: You can manage snapshots from GUI with Btrfs Assistant or CLI with snapper.${RC}"
+ printf "%b\n" "${YELLOW}Notice: You may change (Hourly, daily, weekly, monthly, yearly) timeline settings with Btrfs Assistant GUI.${RC}"
+ printf "%b\n" "${RED}Notice: If you used the default Fedora disk partitioning during OS installation, the /boot configured as an separate EXT4 partition. Therefore, it cannot be included in root snapshots. Backup separately...${RC}"
+ printf "%b\n" "${YELLOW}================================NOTICES================================${RC}"
+ printf "%b\n" "${GREEN}Setup process completed.${RC}"
+}
+
+checkEnv
+checkEscalationTool
+installBtrfsStack
+configureSnapper
+serviceStartEnable
+askInstallGrubBtrfs
+someNotices
diff --git a/core/tabs/system-setup/fedora/fedora-upgrade.sh b/core/tabs/system-setup/fedora/fedora-upgrade.sh
new file mode 100644
index 00000000..47f1e061
--- /dev/null
+++ b/core/tabs/system-setup/fedora/fedora-upgrade.sh
@@ -0,0 +1,83 @@
+#!/bin/sh -e
+
+. ../../common-script.sh
+
+current_version=$(rpm -E '%{fedora}')
+next_version=$((current_version + 1))
+
+update() {
+ printf "%b\n" "${YELLOW}Make sure your system is fully updated; if not, update it first and reboot once.${RC}"
+ printf "%b\n" "${CYAN}Your current Fedora version is $current_version.${RC}"
+ printf "%b\n" "${CYAN}The next available version is $next_version.${RC}"
+
+ printf "%b\n" "${YELLOW}Do you want to update to $next_version? (y/n): ${RC}"
+ read -r response
+
+ case "$response" in
+ y|Y)
+ printf "%b\n" "${CYAN}Preparing to update to $next_version...${RC}"
+
+ if ! "$ESCALATION_TOOL" "$PACKAGER" install dnf-plugin-system-upgrade -y; then
+ printf "%b\n" "${RED}Failed to install dnf-plugin-system-upgrade.${RC}"
+ exit 1
+ fi
+
+ if ! "$ESCALATION_TOOL" "$PACKAGER" system-upgrade download --releasever="$next_version" -y ; then
+ printf "%b\n" "${RED}Failed to download the upgrade packages.${RC}"
+ exit 1
+ fi
+
+ printf "%b\n" "${YELLOW}Do you want to reboot now to apply the upgrade? (y/n): ${RC}"
+ read -r reboot_response
+
+ case "$reboot_response" in
+ y|Y)
+ printf "%b\n" "${YELLOW}Rebooting to apply the upgrade...${RC}"
+ "$ESCALATION_TOOL" "$PACKAGER" system-upgrade reboot
+ ;;
+ *)
+ printf "%b\n" "${YELLOW}You can reboot later to apply the upgrade.${RC}"
+ ;;
+ esac
+ ;;
+ *)
+ printf "%b\n" "${RED}No upgrade performed.${RC}"
+ ;;
+ esac
+}
+
+post_upgrade() {
+ printf "%b\n" "${YELLOW}Running post-upgrade tasks...${RC}"
+
+ case "$PACKAGER" in
+ dnf)
+ "$ESCALATION_TOOL" "$PACKAGER" autoremove
+ "$ESCALATION_TOOL" "$PACKAGER" distro-sync -y
+ ;;
+ *)
+ printf "%b\n" "${RED}Unsupported package manager: $PACKAGER.${RC}"
+ exit 1
+ ;;
+ esac
+}
+
+checkEnv
+checkEscalationTool
+
+printf "%b\n" "${YELLOW}Select an option:${RC}"
+printf "%b\n" "${GREEN}1. Upgrade to the next Fedora version${RC}"
+printf "%b\n" "${GREEN}2. Run post-upgrade tasks${RC}"
+read -r choice
+
+case "$choice" in
+ 1)
+ update
+ ;;
+ 2)
+ post_upgrade
+ ;;
+ *)
+ printf "%b\n" "${RED}Invalid option. Please select 1 or 2.${RC}"
+ exit 1
+ ;;
+esac
diff --git a/core/tabs/system-setup/gaming-setup.sh b/core/tabs/system-setup/gaming-setup.sh
index 92c666c7..07673952 100755
--- a/core/tabs/system-setup/gaming-setup.sh
+++ b/core/tabs/system-setup/gaming-setup.sh
@@ -21,12 +21,12 @@ installDepend() {
alsa-utils alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib giflib lib32-giflib libpng lib32-libpng \
libldap lib32-libldap openal lib32-openal libxcomposite lib32-libxcomposite libxinerama lib32-libxinerama \
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 lib32-sdl2 v4l-utils lib32-v4l-utils sqlite lib32-sqlite"
$AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS
;;
apt-get|nala)
- DISTRO_DEPS="libasound2 libsdl2 wine64 wine32"
+ DISTRO_DEPS="libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386 wine64 wine32"
"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" dpkg --add-architecture i386
@@ -36,7 +36,7 @@ installDepend() {
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS
;;
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 -y $DEPENDENCIES
else
@@ -69,7 +69,7 @@ installAdditionalDepend() {
version_no_v=$(echo "$version" | tr -d v)
curl -sSLo "lutris_${version_no_v}_all.deb" "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb"
-
+
printf "%b\n" "${YELLOW}Installing Lutris...${RC}"
"$ESCALATION_TOOL" "$PACKAGER" install ./lutris_"${version_no_v}"_all.deb
diff --git a/core/tabs/system-setup/system-cleanup.sh b/core/tabs/system-setup/system-cleanup.sh
index 2641a14f..57b827b9 100755
--- a/core/tabs/system-setup/system-cleanup.sh
+++ b/core/tabs/system-setup/system-cleanup.sh
@@ -7,10 +7,8 @@ cleanup_system() {
case "$PACKAGER" in
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" clean
- "$ESCALATION_TOOL" "$PACKAGER" autoremove -y
- "$ESCALATION_TOOL" "$PACKAGER" autoclean
+ "$ESCALATION_TOOL" "$PACKAGER" autoremove -y
"$ESCALATION_TOOL" du -h /var/cache/apt
- "$ESCALATION_TOOL" "$PACKAGER" clean
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" clean -a
diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml
index da2e780b..74f7f1d7 100644
--- a/core/tabs/system-setup/tab_data.toml
+++ b/core/tabs/system-setup/tab_data.toml
@@ -1,5 +1,4 @@
name = "System Setup"
-multi_selectable = false
[[data]]
name = "Arch Linux"
@@ -14,6 +13,7 @@ name = "Arch Server Setup"
description = "This command installs a minimal arch server setup under 5 minutes."
script = "arch/server-setup.sh"
task_list = "SI D"
+multi_select = false
[[data.entries]]
name ="Linux Neptune for SteamDeck"
@@ -28,13 +28,13 @@ values = [ "Valve" ]
[[data.entries]]
name = "Paru AUR Helper"
-description = "Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
+description = "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"
script = "arch/paru-setup.sh"
task_list = "I"
[[data.entries]]
name = "Yay AUR Helper"
-description = "Yet Another Yogurt - An AUR Helper Written in Go.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
+description = "Yet Another Yogurt - An AUR Helper Written in Go. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
script = "arch/yay-setup.sh"
task_list = "I"
@@ -66,16 +66,33 @@ task_list = "I"
[[data.entries]]
name = "RPM Fusion"
-description = "RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship.\nThat 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.\nFor more information visit: https://rpmfusion.org/"
+description = "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/"
script = "fedora/rpm-fusion-setup.sh"
task_list = "MP"
+[[data.entries]]
+name = "Upgrade to a New Fedora Release"
+description = "Upgrades system to the next Fedora release"
+script = "fedora/fedora-upgrade.sh"
+task_list = "MP"
+
[[data.entries]]
name = "Virtualization"
description = "Enables Virtualization through dnf"
script = "fedora/virtualization.sh"
task_list = "I"
+[[data.entries]]
+name = "Btrfs Assistant, Snapper Config, grub-btrfs"
+description = "Installs Btrfs Assistant, Snapper, dnf snapper plugin and takes the first root(/) and /home snapshots. Enables snapper-timeline and snapper-cleanup services. Installs Grub-Btrfs. Notice: To perform a system recovery via grub-btrfs, perform a restore operation with Btrfs Assistant GUI after booting into the snapshot. Notice: If you used the default Fedora disk partitioning during OS installation, the /boot configured as an separate EXT4 partition. Therefore, it cannot be included in root snapshots. Backup separately."
+script = "fedora/fedora-btrfs-assistant.sh"
+task_list = "I PFM SS"
+
+[[data.preconditions]]
+matches = true
+data = "command_exists"
+values = [ "btrfs" ]
+
[[data]]
name = "Build Prerequisites"
description = "This script is designed to handle the installation of various software dependencies across different Linux distributions"
@@ -87,12 +104,14 @@ 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"
task_list = "RP PFM"
+multi_select = false
[[data]]
name = "Full System Update"
description = "This command updates your system to the latest packages available for your distro"
script = "system-update.sh"
task_list = "PFM"
+multi_select = false
[[data]]
name = "Gaming Dependencies"
diff --git a/core/tabs/utils/create-bootable-usb.sh b/core/tabs/utils/create-bootable-usb.sh
index 0e59440d..f05830d3 100644
--- a/core/tabs/utils/create-bootable-usb.sh
+++ b/core/tabs/utils/create-bootable-usb.sh
@@ -2,12 +2,7 @@
. ../common-script.sh
-# Function to display usage instructions
-usage() {
- printf "%b\n" "${RED} Usage: $0 ${RC}"
- printf "%b\n" "No arguments needed. The script will prompt for ISO path and USB device."
- exit 1
-}
+CONFIGURATION_URL="https://github.com/quickemu-project/quickget_configs/releases/download/daily/quickget_data.json"
# Function to display all available block devices
list_devices() {
@@ -17,53 +12,23 @@ list_devices() {
printf "\n"
}
-# Function to fetch the latest Arch Linux ISO
-fetch_arch_latest_iso() {
- ARCH_BASE_URL="https://archive.archlinux.org/iso/"
- ARCH_LATEST=$(curl -s "$ARCH_BASE_URL" | grep -oP '(?<=href=")[0-9]{4}\.[0-9]{2}\.[0-9]{2}(?=/)' | sort -V | tail -1)
- ARCH_URL="${ARCH_BASE_URL}${ARCH_LATEST}/archlinux-${ARCH_LATEST}-x86_64.iso"
- printf "%b\n" "${GREEN} Selected Arch Linux (latest) ISO URL: ${RC} $ARCH_URL"
-}
-
-# Function to fetch older Arch Linux ISOs and display in a table format
-fetch_arch_older_isos() {
- ARCH_BASE_URL="https://archive.archlinux.org/iso/"
- ARCH_VERSIONS=$(curl -s "$ARCH_BASE_URL" | grep -oP '(?<=href=")[0-9]{4}\.[0-9]{2}\.[0-9]{2}(?=/)' | sort -V)
-
- # Filter versions to include only those from 2017-04-01 and later
- MIN_DATE="2017.04.01"
- ARCH_VERSIONS=$(echo "$ARCH_VERSIONS" | awk -v min_date="$MIN_DATE" '$0 >= min_date')
-
- if [ -z "$ARCH_VERSIONS" ]; then
- printf "%b\n" "${RED}No Arch Linux versions found from ${MIN_DATE} onwards.${RC}"
- exit 1
+installDependencies() {
+ DEPENDENCIES="xz gzip bzip2 jq"
+ if ! command_exists ${DEPENDENCIES}; then
+ printf "%b\n" "${YELLOW}Installing dependencies...${RC}"
+ case "${PACKAGER}" in
+ apt-get|nala)
+ "${ESCALATION_TOOL}" "${PACKAGER}" install -y xz-utils gzip bzip2 jq;;
+ dnf|zypper)
+ "${ESCALATION_TOOL}" "${PACKAGER}" install -y ${DEPENDENCIES};;
+ pacman)
+ "${ESCALATION_TOOL}" "${PACKAGER}" -S --noconfirm --needed ${DEPENDENCIES};;
+ *)
+ printf "%b\n" "${RED}Unsupported package manager.${RC}"
+ exit 1
+ ;;
+ esac
fi
-
- printf "%b\n" "${YELLOW}Available Arch Linux versions from ${MIN_DATE} onwards:${RC}"
-
- COUNTER=1
- ROW_ITEMS=6 # Number of versions to show per row
- for VERSION in $ARCH_VERSIONS; do
- printf "%-5s${YELLOW}%-15s ${RC}" "$COUNTER)" "$VERSION"
-
- if [ $(( COUNTER % ROW_ITEMS )) -eq 0 ]; then
- printf "\n" # New line after every 6 versions
- fi
-
- COUNTER=$((COUNTER + 1))
- done
- printf "\n" # New line after the last row
- printf "%b" "Select an Arch Linux version (1-$((COUNTER - 1))): "
- read -r ARCH_OPTION
- ARCH_DIR=$(echo "$ARCH_VERSIONS" | sed -n "${ARCH_OPTION}p")
- ARCH_URL="${ARCH_BASE_URL}${ARCH_DIR}/archlinux-${ARCH_DIR}-x86_64.iso"
- printf "%b\n" "${GREEN}Selected Arch Linux (older) ISO URL: $ARCH_URL${RC}"
-}
-
-# Function to fetch the latest Debian Linux ISO
-fetch_debian_latest_iso() {
- DEBIAN_URL=$(curl -s https://www.debian.org/distrib/netinst | grep -oP '(?<=href=")[^"]+debian-[0-9.]+-amd64-netinst.iso(?=")' | head -1)
- printf "%b\n" "${GREEN} Selected Debian Linux (latest) ISO URL: ${RC} $DEBIAN_URL"
}
# Function to ask whether to use local or online ISO
@@ -77,7 +42,7 @@ choose_iso_source() {
case $ISO_SOURCE_OPTION in
1)
- fetch_iso_urls # Call the function to fetch online ISO URLs
+ get_online_iso
;;
2)
printf "Enter the path to the already downloaded ISO file: "
@@ -94,45 +59,156 @@ choose_iso_source() {
esac
}
-# Function to fetch ISO URLs
-fetch_iso_urls() {
- clear
- printf "%b\n" "${YELLOW}Available ISOs for download:${RC}"
- printf "%b\n" "1) Arch Linux (latest)"
- printf "%b\n" "2) Arch Linux (older versions)"
- printf "%b\n" "3) Debian Linux (latest)"
- printf "\n"
- printf "%b" "Select the ISO you want to download (1-3): "
- read -r ISO_OPTION
-
- case $ISO_OPTION in
- 1)
- fetch_arch_latest_iso
- ISO_URL=$ARCH_URL
- ;;
- 2)
- fetch_arch_older_isos
- ISO_URL=$ARCH_URL
- ;;
- 3)
- fetch_debian_latest_iso
- ISO_URL=$DEBIAN_URL
- ;;
- *)
- printf "%b\n" "${RED}Invalid option selected.${RC}"
+decompress_iso() {
+ printf "%b\n" "${YELLOW}Decompressing ISO file...${RC}"
+ case "${ISO_ARCHIVE_FORMAT}" in
+ xz)
+ xz -d "${ISO_PATH}"
+ ISO_PATH="$(echo "${ISO_PATH}" | sed 's/\.xz//')";;
+ gz)
+ gzip -d "${ISO_PATH}"
+ ISO_PATH="$(echo "${ISO_PATH}" | sed 's/\.gz//')";;
+ bz2)
+ bzip2 -d "${ISO_PATH}"
+ ISO_PATH="$(echo "${ISO_PATH}" | sed 's/\.bz2//')";;
+ *)
+ printf "%b\n" "${RED}Unsupported archive format. Try manually decompressing the ISO and choosing it as a local file instead.${RC}"
exit 1
;;
esac
- ISO_PATH=$(basename "$ISO_URL")
- printf "%b\n" "${YELLOW}Downloading ISO...${RC}"
- curl -L -o "$ISO_PATH" "$ISO_URL"
- if [ $? -ne 0 ]; then
+ printf "%b\n" "${GREEN}ISO file decompressed successfully.${RC}"
+}
+
+check_hash() {
+ case "${#ISO_CHECKSUM}" in
+ 32) HASH_ALGO="md5sum";;
+ 40) HASH_ALGO="sha1sum";;
+ 64) HASH_ALGO="sha256sum";;
+ 128) HASH_ALGO="sha512sum";;
+ *) printf "%b\n" "${RED}Invalid checksum length. Skipping checksum verification.${RC}"
+ return;;
+ esac
+ printf "%b\n" "Checking ISO integrity using ${HASH_ALGO}..."
+ if ! echo "${ISO_CHECKSUM} ${ISO_PATH}" | "${HASH_ALGO}" --check --status; then
+ printf "%b\n" "${RED}Checksum verification failed.${RC}"
+ exit 1
+ else
+ printf "%b\n" "${GREEN}Checksum verification successful.${RC}"
+ fi
+}
+
+download_iso() {
+ printf "\n%b\n" "${YELLOW}Found URL: ${ISO_URL}${RC}"
+ printf "%b\n" "${YELLOW}Downloading ISO to ${ISO_PATH}...${RC}"
+ if ! curl -L -o "$ISO_PATH" "$ISO_URL"; then
printf "%b\n" "${RED}Failed to download the ISO file.${RC}"
exit 1
fi
}
+get_architecture() {
+ printf "%b\n" "${YELLOW}Select the architecture of the ISO to flash${RC}"
+ printf "%b\n" "1) x86_64"
+ printf "%b\n" "2) AArch64"
+ printf "%b\n" "3) riscv64"
+ printf "%b" "Select an option (1-3): "
+ read -r ARCH
+ case "${ARCH}" in
+ 1) ARCH="x86_64";;
+ 2) ARCH="aarch64";;
+ 3) ARCH="riscv64";;
+ *)
+ printf "%b\n" "${RED}Invalid architecture selected. ${RC}"
+ exit 1
+ ;;
+ esac
+}
+
+comma_delimited_list() {
+ echo "${1}" | tr '\n' ',' | sed 's/,/, /g; s/, $//'
+}
+
+get_online_iso() {
+ get_architecture
+ printf "%b\n" "${YELLOW}Fetching available operating systems...${RC}"
+ clear
+
+ # Download available operating systems, filter to to those that match requirements
+ # Remove entries with more than 1 ISO or any other medium, they could cause issues
+ OS_JSON="$(curl -L -s "$CONFIGURATION_URL" | jq -c "[.[] | \
+ .releases |= map(select( \
+ (.arch // \"x86_64\") == "\"${ARCH}\"" \
+ and (.iso | length == 1) and (.iso[0] | has(\"web\")) \
+ and .img == null and .fixed_iso == null and .floppy == null and .disk_images == null)) \
+ | select(.releases | length > 0)]")"
+
+ if echo "${OS_JSON}" | jq -e 'length == 0' >/dev/null; then
+ printf "%b\n" "${RED}No operating systems found.${RC}"
+ exit 1
+ fi
+
+ printf "%b\n" "${YELLOW}Available Operating Systems:${RC}"
+ comma_delimited_list "$(echo "${OS_JSON}" | jq -r '.[].name')"
+ printf "\n%b" "Select an operating system: "
+ read -r OS
+
+ OS_JSON="$(echo "${OS_JSON}" | jq --arg os "${OS}" -c '.[] | select(.name == $os)')"
+ if [ -z "${OS_JSON}" ]; then
+ printf "%b\n" "${RED}Invalid operating system selected.${RC}"
+ exit 1
+ fi
+ PRETTY_NAME="$(echo "${OS_JSON}" | jq -r '.pretty_name')"
+
+ printf "\n%b\n" "${YELLOW}Available releases for ${PRETTY_NAME}:${RC}"
+ comma_delimited_list "$(echo "${OS_JSON}" | jq -r '.releases[].release' | sort -Vur)"
+ printf "\n%b" "Select a release: "
+ read -r RELEASE
+ printf "\n"
+
+ OS_JSON="$(echo "${OS_JSON}" | jq --arg release "${RELEASE}" -c '.releases |= map(select(.release == $release))')"
+ if echo "${OS_JSON}" | jq -e '.releases | length == 0' >/dev/null; then
+ printf "%b\n" "${RED}Invalid release selected.${RC}"
+ exit 1
+ fi
+
+ if echo "${OS_JSON}" | jq -e '.releases[] | select(.edition != null) | any' >/dev/null; then
+ printf "%b\n" "${YELLOW}Available editions for ${PRETTY_NAME} ${RELEASE}:${RC}"
+ comma_delimited_list "$(echo "${OS_JSON}" | jq -r '.releases[].edition' | sort -Vur)"
+ printf "\n%b" "Select an edition: "
+ read -r EDITION
+ ENTRY="$(echo "${OS_JSON}" | jq --arg edition "${EDITION}" -c '.releases[] | select(.edition == $edition)')"
+ else
+ ENTRY="$(echo "${OS_JSON}" | jq -c '.releases[0]')"
+ fi
+
+ if [ -z "${ENTRY}" ]; then
+ printf "%b\n" "${RED}Invalid edition selected.${RC}"
+ exit 1
+ fi
+
+ WEB_DATA="$(echo "${ENTRY}" | jq -c '.iso[0].web')"
+
+ ISO_URL="$(echo "${WEB_DATA}" | jq -r '.url')"
+ ISO_CHECKSUM="$(echo "${WEB_DATA}" | jq -r '.checksum')"
+ ISO_ARCHIVE_FORMAT="$(echo "${WEB_DATA}" | jq -r '.archive_format')"
+
+ ISO_FILENAME="$(echo "${WEB_DATA}" | jq -r '.file_name')"
+ if [ "${ISO_FILENAME}" = "null" ]; then
+ ISO_FILENAME="$(basename "${ISO_URL}")"
+ fi
+
+ ISO_PATH="${HOME}/Downloads/${ISO_FILENAME}"
+ download_iso
+
+ if [ "${ISO_CHECKSUM}" != "null" ]; then
+ check_hash
+ fi
+ if [ "${ISO_ARCHIVE_FORMAT}" != "null" ]; then
+ decompress_iso
+ fi
+}
+
write_iso(){
clear
@@ -191,4 +267,5 @@ write_iso(){
checkEnv
checkEscalationTool
-write_iso
\ No newline at end of file
+installDependencies
+write_iso
diff --git a/core/tabs/utils/encrypt_decrypt_tool.sh b/core/tabs/utils/encrypt_decrypt_tool.sh
index 0db4a49b..46fead9d 100644
--- a/core/tabs/utils/encrypt_decrypt_tool.sh
+++ b/core/tabs/utils/encrypt_decrypt_tool.sh
@@ -8,7 +8,7 @@ printf "%b\n" "${YELLOW}Ensuring OpenSSL is installed...${RC}"
if ! command_exists openssl; then
case "$PACKAGER" in
pacman)
- "$ESCALATION_TOOL" "$PACKAGER" -Syu --noconfirm openssl
+ "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed openssl
;;
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y openssl
diff --git a/core/tabs/utils/monitor-control/set_brightness.sh b/core/tabs/utils/monitor-control/set_brightness.sh
old mode 100644
new mode 100755
index db745ab8..0b7a2a83
--- a/core/tabs/utils/monitor-control/set_brightness.sh
+++ b/core/tabs/utils/monitor-control/set_brightness.sh
@@ -6,8 +6,6 @@
adjust_monitor_brightness() {
while true; do
monitor_list=$(detect_connected_monitors)
- monitor_array=$(echo "$monitor_list" | tr '\n' ' ')
- set -- "$monitor_array"
count=1
clear
@@ -15,7 +13,7 @@ adjust_monitor_brightness() {
printf "%b\n" "${YELLOW} Adjust Monitor Brightness${RC}"
printf "%b\n" "${YELLOW}=========================================${RC}"
printf "%b\n" "${YELLOW}Choose a monitor to adjust brightness:${RC}"
- for monitor in "$@"; do
+ echo "$monitor_list" | while IFS= read -r monitor; do
echo "$count. $monitor"
count=$((count + 1))
done
@@ -35,18 +33,18 @@ adjust_monitor_brightness() {
continue
fi
- if [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$#" ]; then
+ monitor_count=$(echo "$monitor_list" | wc -l)
+ if [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$monitor_count" ]; then
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
printf "Press [Enter] to continue..."
read -r dummy
continue
fi
- monitor_name=$(eval echo "\${$monitor_choice}")
+ monitor_name=$(echo "$monitor_list" | sed -n "${monitor_choice}p")
current_brightness=$(get_current_brightness "$monitor_name")
- # Correctly calculate the brightness percentage
- current_brightness_percentage=$(awk "BEGIN {printf \"%.0f\", $current_brightness * 100}")
+ current_brightness_percentage=$(awk -v brightness="$current_brightness" 'BEGIN {printf "%.0f", brightness * 100}')
printf "%b\n" "${YELLOW}Current brightness for $monitor_name${RC}: ${GREEN}$current_brightness_percentage%${RC}"
while true; do
diff --git a/core/tabs/utils/numlock.sh b/core/tabs/utils/numlock.sh
index 742ceeb7..f80ba3fb 100755
--- a/core/tabs/utils/numlock.sh
+++ b/core/tabs/utils/numlock.sh
@@ -2,11 +2,6 @@
. ../common-script.sh
-# setleds can be used in all distros
-# This method works by calling a script using systemd service
-
-# Create a script to toggle numlock
-
create_file() {
printf "%b\n" "Creating script..."
"$ESCALATION_TOOL" tee "/usr/local/bin/numlock" >/dev/null <<'EOF'
@@ -21,7 +16,6 @@ EOF
"$ESCALATION_TOOL" chmod +x /usr/local/bin/numlock
}
-# Create a systemd service to run the script on boot
create_service() {
printf "%b\n" "Creating service..."
"$ESCALATION_TOOL" tee "/etc/systemd/system/numlock.service" >/dev/null <<'EOF'
@@ -39,7 +33,6 @@ EOF
}
numlockSetup() {
- # Check if the script and service files exists
if [ ! -f "/usr/local/bin/numlock" ]; then
create_file
fi
diff --git a/core/tabs/utils/ssh.sh b/core/tabs/utils/ssh.sh
index 1e402546..e5a899ef 100644
--- a/core/tabs/utils/ssh.sh
+++ b/core/tabs/utils/ssh.sh
@@ -4,14 +4,15 @@
# Check if ~/.ssh/config exists, if not, create it
if [ ! -f ~/.ssh/config ]; then
- touch ~/.ssh/config
- chmod 600 ~/.ssh/config
+ mkdir -p "$HOME/.ssh"
+ touch "$HOME/.ssh/config"
+ chmod 600 "$HOME/.ssh/config"
fi
# Function to show available hosts from ~/.ssh/config
show_available_hosts() {
printf "%b\n" "Available Systems:"
- grep -E "^Host " ~/.ssh/config | awk '{print $2}'
+ grep -E "^Host " "$HOME/.ssh/config" | awk '{print $2}'
printf "%b\n" "-------------------"
}
diff --git a/core/tabs/utils/tab_data.toml b/core/tabs/utils/tab_data.toml
index ba7c0e1b..56ade826 100644
--- a/core/tabs/utils/tab_data.toml
+++ b/core/tabs/utils/tab_data.toml
@@ -1,8 +1,8 @@
name = "Utilities"
-multi_selectable = false
[[data]]
name = "Monitor Control"
+multi_select = false
[[data.preconditions]]
matches = true
@@ -78,6 +78,7 @@ script = "monitor-control/set_resolutions.sh"
[[data]]
name = "User Account Manager"
+multi_select = false
[[data.entries]]
name = "Add User"
@@ -104,6 +105,7 @@ name = "Auto Mount Drive"
description = "This utility is designed to help with automating the process of mounting a drive on to your system."
script = "auto-mount.sh"
task_list = "PFM"
+multi_select = false
[[data]]
name = "Auto Login"
@@ -120,6 +122,7 @@ name = "Bluetooth Manager"
description = "This utility is designed to manage bluetooth in your system"
script = "bluetooth-control.sh"
task_list = "I SS"
+multi_select = false
[[data]]
name = "Bootable USB Creator"
@@ -133,7 +136,7 @@ task_list = "I FM"
[[data]]
name = "Numlock on Startup"
-description = "This utility is designed to configure auto enabling of numlock on boot"
+description = "This utility is designed to enable Num Lock at boot, rather than within desktop environments like KDE or GNOME"
script = "numlock.sh"
task_list = "PFM SS"
@@ -164,6 +167,11 @@ name = "Timeshift Backup"
script = "timeshift.sh"
task_list = "I"
+[[data.preconditions]]
+matches = false
+data = "command_exists"
+values = [ "dnf" ]
+
[[data]]
name = "WiFi Manager"
description = "This utility is designed to manage wifi in your system"
diff --git a/docs/assets/preview.gif b/docs/assets/preview.gif
index c8e49da1..77091ac4 100644
Binary files a/docs/assets/preview.gif and b/docs/assets/preview.gif differ
diff --git a/docs/roadmap.md b/docs/roadmap.md
index 8f41056e..cc334348 100644
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@ -5,19 +5,23 @@
## Goals
- [ ] Focus on tasks that take time in Linux and automate them. (Example: Removing a user, adding a user, etc. - but mostly BASH scripts with POSIX compliance.)
-- [ ] Remove Binary linutil from being tracked in git and make it a github action.
+- [x] Remove Binary linutil from being tracked in git and make it a github action.
- [ ] Document every function and feature of linutil. (Preview panel description addition)
- [x] Create a discord server for linutil and invite the community.
-- [ ] Power Optimizations for Laptops
+- [x] Power Optimizations for Laptops
## Milestones
-### Q3 2024
-- [ ] Finish the foundation of the project in CLI mode.
-- [ ] DENY ALL GUI Pull Requests while CLI and foundation is being established.
-
### Q4 2024
+- [x] Finish the foundation of the project's CLI
+- [ ] Implement CLI arguments and configuration support
+- [ ] Add an option for logging script executions
+
+### Q1 2025
- [ ] GUI Brainstorming and Planning
-- [ ] GUI Implementation towards the end of Q4
+- [ ] Basic GUI Implementation
+
+### Q2 2025
+- [ ] Full GUI Implementation
## Community Feedback
- Encourage community input and suggestions for future development.
diff --git a/docs/userguide.md b/docs/userguide.md
index 2180a24e..48bd9973 100644
--- a/docs/userguide.md
+++ b/docs/userguide.md
@@ -4,19 +4,6 @@
## Applications Setup
-### Developer Tools
-
-- **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.
-- **Neovim**: Neovim is a refactor, and sometimes redactor, in the tradition of Vim.
-It is not a rewrite but a continuation and extension of Vim.
-This command configures neovim from CTT's neovim configuration.
-https://github.com/ChrisTitusTech/neovim
-- **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.
-- **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.
-
### Communication Apps
- **Discord**: Discord is a versatile communication platform for gamers and communities, offering voice, video, and text chat features.
@@ -24,8 +11,22 @@ https://github.com/ChrisTitusTech/neovim
- **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.
+- **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.
+
+### Developer Tools
+
+- **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.
+- **JetBrains Toolbox**: JetBrains Toolbox is a collection of tools and an app that help developers work with JetBrains products.
+- **Meld**: Meld is a visual diff and merge tool that helps compare files, directories, and version-controlled projects.
+- **Neovim**: Neovim is a refactor, and sometimes redactor, in the tradition of Vim.
+It is not a rewrite but a continuation and extension of Vim.
+This command configures neovim from CTT's neovim configuration.
+https://github.com/ChrisTitusTech/neovim
+- **Ngrok**: Ngrok is a tool that creates secure, temporary tunnels to expose local servers to the internet for testing and development.
+- **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.
+- **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.
### Office Suites
@@ -43,15 +44,12 @@ https://github.com/ChrisTitusTech/neovim
- **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.
+- **waterfox**: Waterfox is the privacy-focused web browser engineered to give you speed, control, and peace of mind on the internet.
+- **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 configures 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.
+- **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.
+- **Docker**: Docker is an open platform that uses OS-level virtualization to deliver software in packages called containers.
- **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.
@@ -59,41 +57,28 @@ 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
+- **Podman**: Podman is a daemon-less open platform that uses OS-level virtualization to deliver software in packages called containers.
+- **Podman-compose**: Podman Compose is a tool for defining and running multi-container applications using Podman.
+- **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.
+- **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
+- **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.
+- **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
+- **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
+- **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
@@ -102,20 +87,18 @@ For more information visit: https://christitus.com/linux-security-mistakes
- **Arch Server Setup**: This command installs a minimal arch server setup under 5 minutes.
- **Linux Neptune for SteamDeck**: Valve's fork of Linux Kernel for the SteamDeck
-- **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
+- **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/
+- **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/
+- **Upgrade to a New Fedora Release**: Upgrades system to the next Fedora release
- **Virtualization**: Enables Virtualization through dnf
+- **Btrfs Assistant, Snapper Config, grub-btrfs**: Installs Btrfs Assistant, Snapper, dnf snapper plugin and takes the first root(/) and /home snapshots. Enables snapper-timeline and snapper-cleanup services. Installs Grub-Btrfs. Notice: To perform a system recovery via grub-btrfs, perform a restore operation with Btrfs Assistant GUI after booting into the snapshot. Notice: If you used the default Fedora disk partitioning during OS installation, the /boot configured as an separate EXT4 partition. Therefore, it cannot be included in root snapshots. Backup separately.
- **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
@@ -146,7 +129,7 @@ For more information visit: https://rpmfusion.org/
- **Auto Mount Drive**: This utility is designed to help with automating the process of mounting a drive on to your system.
- **Bluetooth Manager**: This utility is designed to manage bluetooth in your system
-- **Numlock on Startup**: This utility is designed to configure auto enabling of numlock on boot
+- **Numlock on Startup**: This utility is designed to enable Num Lock at boot, rather than within desktop environments like KDE or GNOME
- **Ollama**: This utility is designed to manage ollama in your system
- **Service Manager**: This utility is designed to manage services in your system
- **WiFi Manager**: This utility is designed to manage wifi in your system
diff --git a/man/linutil.1 b/man/linutil.1
index d31cf879..a85bee96 100644
--- a/man/linutil.1
+++ b/man/linutil.1
@@ -36,6 +36,10 @@ Defaults to \fIdefault\fR.
\fB\-\-override\-validation\fR
Show all available entries, disregarding compatibility checks. (\fBUNSAFE\fR)
+.TP
+\fB\-\-size\-bypass\fR
+Bypass the terminal size limit
+
.TP
\fB\-h\fR, \fB\-\-help\fR
Print help.
diff --git a/tui/Cargo.toml b/tui/Cargo.toml
index 40d3c357..b411fb2d 100644
--- a/tui/Cargo.toml
+++ b/tui/Cargo.toml
@@ -7,34 +7,31 @@ edition = "2021"
license.workspace = true
repository = "https://github.com/ChrisTitusTech/linutil/tree/main/tui"
version.workspace = true
-include = ["src/*.rs", "Cargo.toml", "build.rs", "cool_tips.txt", "../man/linutil.1"]
-build = "build.rs"
+include = ["src/*.rs", "Cargo.toml", "cool_tips.txt", "../man/linutil.1"]
[features]
default = ["tips"]
tips = ["rand"]
[dependencies]
-clap = { version = "4.5.19", features = ["derive"] }
+clap = { version = "4.5.20", features = ["derive"] }
crossterm = "0.28.1"
ego-tree = { workspace = true }
oneshot = "0.1.8"
portable-pty = "0.8.1"
-ratatui = "0.28.1"
-tui-term = "0.1.12"
+ratatui = "0.29.0"
+tui-term = "0.2.0"
temp-dir = "0.1.14"
unicode-width = "0.2.0"
rand = { version = "0.8.5", optional = true }
linutil_core = { path = "../core", version = "24.9.28" }
-tree-sitter-highlight = "0.24.2"
+tree-sitter-highlight = "0.24.3"
tree-sitter-bash = "0.23.1"
+textwrap = "0.16.1"
anstyle = "1.0.8"
-ansi-to-tui = "6.0.0"
+ansi-to-tui = "7.0.0"
zips = "0.1.7"
-[build-dependencies]
-chrono = "0.4.33"
-
[[bin]]
name = "linutil"
path = "src/main.rs"
diff --git a/tui/build.rs b/tui/build.rs
deleted file mode 100644
index 121931c1..00000000
--- a/tui/build.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() {
- // Add current date as a variable to be displayed in the 'Linux Toolbox' text.
- println!(
- "cargo:rustc-env=BUILD_DATE={}",
- chrono::Local::now().format("%Y-%m-%d")
- );
-}
diff --git a/tui/src/confirmation.rs b/tui/src/confirmation.rs
index 28732e35..91d86c28 100644
--- a/tui/src/confirmation.rs
+++ b/tui/src/confirmation.rs
@@ -60,6 +60,7 @@ impl FloatContent for ConfirmPrompt {
fn draw(&mut self, frame: &mut Frame, area: Rect) {
let block = Block::default()
.borders(Borders::ALL)
+ .border_set(ratatui::symbols::border::ROUNDED)
.title(" Confirm selections ")
.title_bottom(" [y] to continue, [n] to abort ")
.title_alignment(Alignment::Center)
@@ -88,7 +89,7 @@ impl FloatContent for ConfirmPrompt {
use KeyCode::*;
self.status = match key.code {
Char('y') | Char('Y') => ConfirmStatus::Confirm,
- Char('n') | Char('N') | Esc => ConfirmStatus::Abort,
+ Char('n') | Char('N') | Esc | Char('q') => ConfirmStatus::Abort,
Char('j') => {
self.scroll_down();
ConfirmStatus::None
@@ -116,10 +117,10 @@ impl FloatContent for ConfirmPrompt {
"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"]),
+ Shortcut::new("Abort", ["N", "n", "q", "Esc"]),
+ Shortcut::new("Scroll up", ["k"]),
+ Shortcut::new("Scroll down", ["j"]),
+ Shortcut::new("Close linutil", ["CTRL-c"]),
]),
)
}
diff --git a/tui/src/filter.rs b/tui/src/filter.rs
index 984d5d68..0d9920de 100644
--- a/tui/src/filter.rs
+++ b/tui/src/filter.rs
@@ -4,7 +4,7 @@ use ego_tree::NodeId;
use linutil_core::Tab;
use ratatui::{
layout::{Position, Rect},
- style::Style,
+ style::{Color, Style},
text::Span,
widgets::{Block, Borders, Paragraph},
Frame,
@@ -22,6 +22,7 @@ pub struct Filter {
in_search_mode: bool,
input_position: usize,
items: Vec,
+ completion_preview: Option,
}
impl Filter {
@@ -31,17 +32,23 @@ impl Filter {
in_search_mode: false,
input_position: 0,
items: vec![],
+ completion_preview: None,
}
}
+
pub fn item_list(&self) -> &[ListEntry] {
&self.items
}
+
pub fn activate_search(&mut self) {
self.in_search_mode = true;
}
+
pub fn deactivate_search(&mut self) {
self.in_search_mode = false;
+ self.completion_preview = None;
}
+
pub fn update_items(&mut self, tabs: &[Tab], current_tab: usize, node: NodeId) {
if self.search_input.is_empty() {
let curr = tabs[current_tab].tree.get(node).unwrap();
@@ -78,13 +85,34 @@ impl Filter {
}
self.items.sort_by(|a, b| a.node.name.cmp(&b.node.name));
}
+
+ self.update_completion_preview();
}
+
+ fn update_completion_preview(&mut self) {
+ if self.search_input.is_empty() {
+ self.completion_preview = None;
+ return;
+ }
+
+ let input = self.search_input.iter().collect::().to_lowercase();
+ self.completion_preview = self.items.iter().find_map(|item| {
+ let item_name_lower = item.node.name.to_lowercase();
+ if item_name_lower.starts_with(&input) {
+ Some(item_name_lower[input.len()..].to_string())
+ } else {
+ None
+ }
+ });
+ }
+
pub fn draw_searchbar(&self, frame: &mut Frame, area: Rect, theme: &Theme) {
//Set the search bar text (If empty use the placeholder)
let display_text = if !self.in_search_mode && self.search_input.is_empty() {
Span::raw("Press / to search")
} else {
- Span::raw(self.search_input.iter().collect::())
+ let input_text = self.search_input.iter().collect::();
+ Span::styled(input_text, Style::default().fg(theme.focused_color()))
};
let search_color = if self.in_search_mode {
@@ -95,7 +123,12 @@ impl Filter {
//Create the search bar widget
let search_bar = Paragraph::new(display_text)
- .block(Block::default().borders(Borders::ALL).title("Search"))
+ .block(
+ Block::default()
+ .borders(Borders::ALL)
+ .border_set(ratatui::symbols::border::ROUNDED)
+ .title(" Search "),
+ )
.style(Style::default().fg(search_color));
//Render the search bar (First chunk of the screen)
@@ -110,11 +143,22 @@ impl Filter {
let x = area.x + cursor_position as u16 + 1;
let y = area.y + 1;
frame.set_cursor_position(Position::new(x, y));
+
+ if let Some(preview) = &self.completion_preview {
+ let preview_span = Span::styled(preview, Style::default().fg(Color::DarkGray));
+ let preview_paragraph = Paragraph::new(preview_span).style(Style::default());
+ let preview_area = Rect::new(
+ x,
+ y,
+ (preview.len() as u16).min(area.width - cursor_position as u16 - 1),
+ 1,
+ );
+ frame.render_widget(preview_paragraph, preview_area);
+ }
}
}
// Handles key events. Returns true if search must be exited
pub fn handle_key(&mut self, event: &KeyEvent) -> SearchAction {
- //Insert user input into the search bar
match event.code {
KeyCode::Char('c') if event.modifiers.contains(KeyModifiers::CONTROL) => {
return self.exit_search()
@@ -124,10 +168,17 @@ impl Filter {
KeyCode::Delete => self.remove_next(),
KeyCode::Left => return self.cursor_left(),
KeyCode::Right => return self.cursor_right(),
+ KeyCode::Tab => return self.complete_search(),
+ KeyCode::Esc => {
+ self.input_position = 0;
+ self.search_input.clear();
+ self.completion_preview = None;
+ return SearchAction::Exit;
+ }
KeyCode::Enter => return SearchAction::Exit,
- KeyCode::Esc => return self.exit_search(),
_ => return SearchAction::None,
};
+ self.update_completion_preview();
SearchAction::Update
}
@@ -141,16 +192,19 @@ impl Filter {
self.input_position = self.input_position.saturating_sub(1);
SearchAction::None
}
+
fn cursor_right(&mut self) -> SearchAction {
if self.input_position < self.search_input.len() {
self.input_position += 1;
}
SearchAction::None
}
+
fn insert_char(&mut self, input: char) {
self.search_input.insert(self.input_position, input);
self.cursor_right();
}
+
fn remove_previous(&mut self) {
let current = self.input_position;
if current > 0 {
@@ -158,10 +212,27 @@ impl Filter {
self.cursor_left();
}
}
+
fn remove_next(&mut self) {
let current = self.input_position;
if current < self.search_input.len() {
self.search_input.remove(current);
}
}
+
+ fn complete_search(&mut self) -> SearchAction {
+ if let Some(completion) = self.completion_preview.take() {
+ self.search_input.extend(completion.chars());
+ self.input_position = self.search_input.len();
+ self.update_completion_preview();
+ SearchAction::Update
+ } else {
+ SearchAction::None
+ }
+ }
+
+ pub fn clear_search(&mut self) {
+ self.search_input.clear();
+ self.input_position = 0;
+ }
}
diff --git a/tui/src/floating_text.rs b/tui/src/floating_text.rs
index 879fcbc5..a43361af 100644
--- a/tui/src/floating_text.rs
+++ b/tui/src/floating_text.rs
@@ -20,16 +20,20 @@ use ratatui::{
use ansi_to_tui::IntoText;
+use textwrap::wrap;
use tree_sitter_bash as hl_bash;
use tree_sitter_highlight::{self as hl, HighlightEvent};
use zips::zip_result;
pub struct FloatingText {
- pub src: Vec,
+ pub src: String,
+ wrapped_lines: Vec,
max_line_width: usize,
v_scroll: usize,
h_scroll: usize,
mode_title: String,
+ wrap_words: bool,
+ frame_height: usize,
}
macro_rules! style {
@@ -107,12 +111,6 @@ fn get_highlighted_string(s: &str) -> Option {
Some(output)
}
-macro_rules! max_width {
- ($($lines:tt)+) => {{
- $($lines)+.iter().fold(0, |accum, val| accum.max(val.len()))
- }}
-}
-
#[inline]
fn get_lines(s: &str) -> Vec<&str> {
s.lines().collect::>()
@@ -124,54 +122,56 @@ fn get_lines_owned(s: &str) -> Vec {
}
impl FloatingText {
- pub fn new(text: String, title: &str) -> Self {
- let src = get_lines(&text)
- .into_iter()
- .map(|s| s.to_string())
- .collect::>();
+ pub fn new(text: String, title: &str, wrap_words: bool) -> Self {
+ let max_line_width = 80;
+ let wrapped_lines = if wrap_words {
+ wrap(&text, max_line_width)
+ .into_iter()
+ .map(|cow| cow.into_owned())
+ .collect()
+ } else {
+ get_lines_owned(&text)
+ };
- let max_line_width = max_width!(src);
Self {
- src,
+ src: text,
+ wrapped_lines,
mode_title: title.to_string(),
max_line_width,
v_scroll: 0,
h_scroll: 0,
+ wrap_words,
+ frame_height: 0,
}
}
pub fn from_command(command: &Command, title: String) -> Option {
- let (max_line_width, src) = match command {
- Command::Raw(cmd) => {
- // just apply highlights directly
- (max_width!(get_lines(cmd)), Some(cmd.clone()))
- }
- Command::LocalFile { file, .. } => {
- // have to read from tmp dir to get cmd src
- let raw = std::fs::read_to_string(file)
- .map_err(|_| format!("File not found: {:?}", file))
- .unwrap();
+ let src = match command {
+ Command::Raw(cmd) => Some(cmd.clone()),
+ Command::LocalFile { file, .. } => std::fs::read_to_string(file)
+ .map_err(|_| format!("File not found: {:?}", file))
+ .ok(),
+ Command::None => None,
+ }?;
- (max_width!(get_lines(&raw)), Some(raw))
- }
-
- // If command is a folder, we don't display a preview
- Command::None => (0usize, None),
- };
-
- let src = get_lines_owned(&get_highlighted_string(&src?)?);
+ let max_line_width = 80;
+ let wrapped_lines = get_lines_owned(&get_highlighted_string(&src)?);
Some(Self {
src,
+ wrapped_lines,
mode_title: title,
max_line_width,
h_scroll: 0,
v_scroll: 0,
+ wrap_words: false,
+ frame_height: 0,
})
}
fn scroll_down(&mut self) {
- if self.v_scroll + 1 < self.src.len() {
+ let visible_lines = self.frame_height.saturating_sub(2);
+ if self.v_scroll + visible_lines < self.src.len() {
self.v_scroll += 1;
}
}
@@ -193,30 +193,57 @@ impl FloatingText {
self.h_scroll += 1;
}
}
+
+ fn update_wrapping(&mut self, width: usize) {
+ if self.max_line_width != width {
+ self.max_line_width = width;
+ self.wrapped_lines = if self.wrap_words {
+ wrap(&self.src, width)
+ .into_iter()
+ .map(|cow| cow.into_owned())
+ .collect()
+ } else {
+ get_lines_owned(&get_highlighted_string(&self.src).unwrap_or(self.src.clone()))
+ };
+ }
+ }
}
impl FloatContent for FloatingText {
fn draw(&mut self, frame: &mut Frame, area: Rect) {
+ self.frame_height = area.height as usize;
+
// Define the Block with a border and background color
let block = Block::default()
.borders(Borders::ALL)
+ .border_set(ratatui::symbols::border::ROUNDED)
.title(self.mode_title.clone())
.title_alignment(ratatui::layout::Alignment::Center)
.title_style(Style::default().reversed())
.style(Style::default());
- // Draw the Block first
+ frame.render_widget(Clear, area);
+
frame.render_widget(block.clone(), area);
// Calculate the inner area to ensure text is not drawn over the border
let inner_area = block.inner(area);
- let Rect { height, .. } = inner_area;
+ let Rect { width, height, .. } = inner_area;
+
+ self.update_wrapping(width as usize);
+
let lines = self
- .src
+ .wrapped_lines
.iter()
.skip(self.v_scroll)
.take(height as usize)
- .flat_map(|l| l.into_text().unwrap())
+ .flat_map(|l| {
+ if self.wrap_words {
+ vec![Line::raw(l.clone())]
+ } else {
+ l.into_text().unwrap().lines
+ }
+ })
.map(|line| {
let mut skipped = 0;
let mut spans = line
@@ -253,9 +280,6 @@ impl FloatContent for FloatingText {
.block(Block::default())
.highlight_style(Style::default().reversed());
- // Clear the text underneath the floats rendered area
- frame.render_widget(Clear, inner_area);
-
// Render the list inside the bordered area
frame.render_widget(list, inner_area);
}
diff --git a/tui/src/hint.rs b/tui/src/hint.rs
index 8e16e749..b5f096ca 100644
--- a/tui/src/hint.rs
+++ b/tui/src/hint.rs
@@ -27,41 +27,33 @@ pub fn create_shortcut_list(
shortcuts: impl IntoIterator- ,
render_width: u16,
) -> Box<[Line<'static>]> {
- let hints = shortcuts.into_iter().collect::>();
+ let shortcut_spans: Vec>> =
+ shortcuts.into_iter().map(|h| h.to_spans()).collect();
- let mut shortcut_spans: Vec>> = hints.iter().map(|h| h.to_spans()).collect();
+ let max_shortcut_width = shortcut_spans
+ .iter()
+ .map(|s| span_vec_len(s))
+ .max()
+ .unwrap_or(0);
- let mut lines: Vec> = vec![];
+ let columns = (render_width as usize / (max_shortcut_width + 4)).max(1);
+ let rows = (shortcut_spans.len() + columns - 1) / columns;
- loop {
- let split_idx = shortcut_spans
- .iter()
- .scan(0usize, |total_len, s| {
- // take at least one so that we guarantee that we drain the list
- // otherwise, this might lock up if there's a shortcut that exceeds the window width
- if *total_len == 0 {
- *total_len += span_vec_len(s) + 4;
- Some(())
- } else {
- *total_len += span_vec_len(s);
- if *total_len > render_width as usize {
- None
- } else {
- *total_len += 4;
- Some(())
- }
- }
+ let mut lines: Vec> = Vec::new();
+
+ for row in 0..rows {
+ let row_spans: Vec<_> = (0..columns)
+ .filter_map(|col| {
+ let index = row * columns + col;
+ shortcut_spans.get(index).map(|span| {
+ let padding = max_shortcut_width - span_vec_len(span);
+ let mut span_clone = span.clone();
+ span_clone.push(Span::raw(" ".repeat(padding)));
+ span_clone
+ })
})
- .count();
-
- let rest = shortcut_spans.split_off(split_idx);
- lines.push(add_spacing(shortcut_spans));
-
- if rest.is_empty() {
- break;
- } else {
- shortcut_spans = rest;
- }
+ .collect();
+ lines.push(add_spacing(row_spans));
}
lines.into_boxed_slice()
diff --git a/tui/src/main.rs b/tui/src/main.rs
index 801e3b1d..df20e733 100644
--- a/tui/src/main.rs
+++ b/tui/src/main.rs
@@ -33,12 +33,15 @@ struct Args {
#[arg(long, default_value_t = false)]
#[clap(help = "Show all available options, disregarding compatibility checks (UNSAFE)")]
override_validation: bool,
+ #[arg(long, default_value_t = false)]
+ #[clap(help = "Bypass the terminal size limit")]
+ size_bypass: bool,
}
fn main() -> io::Result<()> {
let args = Args::parse();
- let mut state = AppState::new(args.theme, args.override_validation);
+ let mut state = AppState::new(args.theme, args.override_validation, args.size_bypass);
stdout().execute(EnterAlternateScreen)?;
enable_raw_mode()?;
diff --git a/tui/src/running_command.rs b/tui/src/running_command.rs
index 89daa755..e55690fe 100644
--- a/tui/src/running_command.rs
+++ b/tui/src/running_command.rs
@@ -53,6 +53,7 @@ impl FloatContent for RunningCommand {
// Display a block indicating the command is running
Block::default()
.borders(Borders::ALL)
+ .border_set(ratatui::symbols::border::ROUNDED)
.title_top(Line::from("Running the command....").centered())
.title_style(Style::default().reversed())
.title_bottom(Line::from("Press Ctrl-C to KILL the command"))
@@ -74,12 +75,13 @@ impl FloatContent for RunningCommand {
title_line.push_span(
Span::default()
- .content(" press to close this window ")
+ .content(" Press to close this window ")
.style(Style::default()),
);
Block::default()
.borders(Borders::ALL)
+ .border_set(ratatui::symbols::border::ROUNDED)
.title_top(title_line.centered())
};
diff --git a/tui/src/state.rs b/tui/src/state.rs
index 2391a294..ac584070 100644
--- a/tui/src/state.rs
+++ b/tui/src/state.rs
@@ -9,7 +9,7 @@ use crate::{
};
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
use ego_tree::NodeId;
-use linutil_core::{ListNode, Tab};
+use linutil_core::{ListNode, TabList};
#[cfg(feature = "tips")]
use rand::Rng;
use ratatui::{
@@ -20,11 +20,10 @@ use ratatui::{
Frame,
};
use std::rc::Rc;
-use temp_dir::TempDir;
-const MIN_WIDTH: u16 = 77;
-const MIN_HEIGHT: u16 = 19;
-const TITLE: &str = concat!("Linux Toolbox - ", env!("BUILD_DATE"));
+const MIN_WIDTH: u16 = 100;
+const MIN_HEIGHT: u16 = 25;
+const TITLE: &str = concat!(" Linux Toolbox - ", env!("CARGO_PKG_VERSION"), " ");
const ACTIONS_GUIDE: &str = "List of important tasks performed by commands' names:
D - disk modifications (ex. partitioning) (privileged)
@@ -41,19 +40,17 @@ P* - privileged *
";
pub struct AppState {
- /// This must be passed to retain the temp dir until the end of the program
- _temp_dir: TempDir,
/// Selected theme
theme: Theme,
/// Currently focused area
pub focus: Focus,
/// List of tabs
- tabs: Vec,
+ tabs: TabList,
/// Current tab
current_tab: ListState,
/// 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 .."
- visit_stack: Vec,
+ visit_stack: Vec<(NodeId, usize)>,
/// This is the state associated with the list widget, used to display the selection in the
/// widget
selection: ListState,
@@ -62,7 +59,8 @@ pub struct AppState {
selected_commands: Vec>,
drawable: bool,
#[cfg(feature = "tips")]
- tip: &'static str,
+ tip: String,
+ size_bypass: bool,
}
pub enum Focus {
@@ -79,18 +77,24 @@ pub struct ListEntry {
pub has_children: bool,
}
+enum SelectedItem {
+ UpDir,
+ Directory,
+ Command,
+ None,
+}
+
impl AppState {
- pub fn new(theme: Theme, override_validation: bool) -> Self {
- let (temp_dir, tabs) = linutil_core::get_tabs(!override_validation);
+ pub fn new(theme: Theme, override_validation: bool, size_bypass: bool) -> Self {
+ let tabs = linutil_core::get_tabs(!override_validation);
let root_id = tabs[0].tree.root().id();
let mut state = Self {
- _temp_dir: temp_dir,
theme,
focus: Focus::List,
tabs,
current_tab: ListState::default().with_selected(Some(0)),
- visit_stack: vec![root_id],
+ visit_stack: vec![(root_id, 0usize)],
selection: ListState::default().with_selected(Some(0)),
filter: Filter::new(),
multi_select: false,
@@ -98,6 +102,7 @@ impl AppState {
drawable: false,
#[cfg(feature = "tips")]
tip: get_random_tip(),
+ size_bypass,
};
state.update_items();
@@ -147,12 +152,10 @@ impl AppState {
hints.push(Shortcut::new("Select item below", ["j", "Down"]));
hints.push(Shortcut::new("Next theme", ["t"]));
hints.push(Shortcut::new("Previous theme", ["T"]));
-
- if self.is_current_tab_multi_selectable() {
- hints.push(Shortcut::new("Toggle multi-selection mode", ["v"]));
+ hints.push(Shortcut::new("Multi-selection mode", ["v"]));
+ if self.multi_select {
hints.push(Shortcut::new("Select multiple commands", ["Space"]));
}
-
hints.push(Shortcut::new("Next tab", ["Tab"]));
hints.push(Shortcut::new("Previous tab", ["Shift-Tab"]));
hints.push(Shortcut::new("Important actions guide", ["g"]));
@@ -182,7 +185,9 @@ impl AppState {
pub fn draw(&mut self, frame: &mut Frame) {
let terminal_size = frame.area();
- if terminal_size.width < MIN_WIDTH || terminal_size.height < MIN_HEIGHT {
+ if !self.size_bypass
+ && (terminal_size.height < MIN_HEIGHT || terminal_size.width < MIN_WIDTH)
+ {
let warning = Paragraph::new(format!(
"Terminal size too small:\nWidth = {} Height = {}\n\nMinimum size:\nWidth = {} Height = {}",
terminal_size.width,
@@ -209,19 +214,19 @@ impl AppState {
self.drawable = true;
}
- let label_block =
- Block::default()
- .borders(Borders::all())
- .border_set(ratatui::symbols::border::Set {
- top_left: " ",
- top_right: " ",
- bottom_left: " ",
- bottom_right: " ",
- vertical_left: " ",
- vertical_right: " ",
- horizontal_top: "*",
- horizontal_bottom: "*",
- });
+ let label_block = Block::default()
+ .borders(Borders::ALL)
+ .border_set(ratatui::symbols::border::ROUNDED)
+ .border_set(ratatui::symbols::border::Set {
+ top_left: " ",
+ top_right: " ",
+ bottom_left: " ",
+ bottom_right: " ",
+ vertical_left: " ",
+ vertical_right: " ",
+ horizontal_top: "*",
+ horizontal_bottom: "*",
+ });
let str1 = "Linutil ";
let str2 = "by Chris Titus";
let label = Paragraph::new(Line::from(vec![
@@ -245,7 +250,8 @@ impl AppState {
let keybinds_block = Block::default()
.title(format!(" {} ", keybind_scope))
- .borders(Borders::all());
+ .borders(Borders::ALL)
+ .border_set(ratatui::symbols::border::ROUNDED);
let keybinds = create_shortcut_list(shortcuts, keybind_render_width);
let n_lines = keybinds.len() as u16;
@@ -289,7 +295,11 @@ impl AppState {
};
let list = List::new(tabs)
- .block(Block::default().borders(Borders::ALL))
+ .block(
+ Block::default()
+ .borders(Borders::ALL)
+ .border_set(ratatui::symbols::border::ROUNDED),
+ )
.highlight_style(tab_hl_style)
.highlight_symbol(self.theme.tab_icon());
frame.render_stateful_widget(list, left_chunks[1], &mut self.current_tab);
@@ -324,7 +334,12 @@ impl AppState {
let (indicator, style) = if is_selected {
(self.theme.multi_select_icon(), Style::default().bold())
} else {
- ("", Style::new())
+ let ms_style = if self.multi_select && !node.multi_select {
+ Style::default().fg(self.theme.multi_select_disabled_color())
+ } else {
+ Style::new()
+ };
+ ("", ms_style)
};
if *has_children {
Line::from(format!(
@@ -334,6 +349,7 @@ impl AppState {
indicator
))
.style(self.theme.dir_color())
+ .patch_style(style)
} else {
Line::from(format!(
"{} {} {}",
@@ -351,13 +367,21 @@ impl AppState {
|ListEntry {
node, has_children, ..
}| {
+ let ms_style = if self.multi_select && !node.multi_select {
+ Style::default().fg(self.theme.multi_select_disabled_color())
+ } else {
+ Style::new()
+ };
if *has_children {
- Line::from(" ").style(self.theme.dir_color())
+ Line::from(" ")
+ .style(self.theme.dir_color())
+ .patch_style(ms_style)
} else {
Line::from(format!("{} ", node.task_list))
.alignment(Alignment::Right)
.style(self.theme.cmd_color())
.bold()
+ .patch_style(ms_style)
}
},
));
@@ -369,17 +393,17 @@ impl AppState {
};
let title = if self.multi_select {
- &format!("{} [Multi-Select]", TITLE)
+ &format!("{}[Multi-Select] ", TITLE)
} else {
TITLE
};
#[cfg(feature = "tips")]
- let bottom_title = Line::from(self.tip.bold().blue()).right_aligned();
+ let bottom_title = Line::from(self.tip.as_str().bold().blue()).right_aligned();
#[cfg(not(feature = "tips"))]
let bottom_title = "";
- let task_list_title = Line::from("Important Actions ").right_aligned();
+ let task_list_title = Line::from(" Important Actions ").right_aligned();
// Create the list widget with items
let list = List::new(items)
@@ -387,6 +411,7 @@ impl AppState {
.block(
Block::default()
.borders(Borders::ALL & !Borders::RIGHT)
+ .border_set(ratatui::symbols::border::ROUNDED)
.title(title)
.title_bottom(bottom_title),
)
@@ -396,6 +421,7 @@ impl AppState {
let disclaimer_list = List::new(task_items).highlight_style(style).block(
Block::default()
.borders(Borders::ALL & !Borders::LEFT)
+ .border_set(ratatui::symbols::border::ROUNDED)
.title(task_list_title),
);
@@ -414,11 +440,15 @@ impl AppState {
// This should be defined first to allow closing
// the application even when not drawable ( If terminal is small )
// Exit on 'q' or 'Ctrl-c' input
- if matches!(
- self.focus,
- Focus::TabList | Focus::List | Focus::ConfirmationPrompt(_)
- ) && (key.code == KeyCode::Char('q')
- || key.modifiers.contains(KeyModifiers::CONTROL) && key.code == KeyCode::Char('c'))
+ if matches!(self.focus, Focus::TabList | Focus::List)
+ && (key.code == KeyCode::Char('q')
+ || key.modifiers.contains(KeyModifiers::CONTROL) && key.code == KeyCode::Char('c'))
+ {
+ return false;
+ }
+
+ if matches!(self.focus, Focus::ConfirmationPrompt(_))
+ && (key.modifiers.contains(KeyModifiers::CONTROL) && key.code == KeyCode::Char('c'))
{
return false;
}
@@ -469,6 +499,13 @@ impl AppState {
// enabled, need to clear it to prevent state corruption
if !self.multi_select {
self.selected_commands.clear()
+ } else {
+ // Prevents non multi_selectable cmd from being pushed into the selected list
+ if let Some(node) = self.get_selected_node() {
+ if !node.multi_select {
+ self.selected_commands.retain(|cmd| cmd.name != node.name);
+ }
+ }
}
}
ConfirmStatus::Confirm => self.handle_confirm_command(),
@@ -485,17 +522,9 @@ impl AppState {
Focus::TabList => match key.code {
KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right => self.focus = Focus::List,
- KeyCode::Char('j') | KeyCode::Down
- if self.current_tab.selected().unwrap() + 1 < self.tabs.len() =>
- {
- self.current_tab.select_next();
- self.refresh_tab();
- }
+ KeyCode::Char('j') | KeyCode::Down => self.scroll_tab_down(),
- KeyCode::Char('k') | KeyCode::Up => {
- self.current_tab.select_previous();
- self.refresh_tab();
- }
+ KeyCode::Char('k') | KeyCode::Up => self.scroll_tab_up(),
KeyCode::Char('/') => self.enter_search(),
KeyCode::Char('t') => self.theme.next(),
@@ -505,8 +534,8 @@ impl AppState {
},
Focus::List if key.kind != KeyEventKind::Release => match key.code {
- KeyCode::Char('j') | KeyCode::Down => self.selection.select_next(),
- KeyCode::Char('k') | KeyCode::Up => self.selection.select_previous(),
+ KeyCode::Char('j') | KeyCode::Down => self.scroll_down(),
+ KeyCode::Char('k') | KeyCode::Up => self.scroll_up(),
KeyCode::Char('p') | KeyCode::Char('P') => self.enable_preview(),
KeyCode::Char('d') | KeyCode::Char('D') => self.enable_description(),
KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right => self.handle_enter(),
@@ -525,41 +554,66 @@ impl AppState {
true
}
+ fn scroll_down(&mut self) {
+ let len = self.filter.item_list().len();
+ if len == 0 {
+ return;
+ }
+ let current = self.selection.selected().unwrap_or(0);
+ let max_index = if self.at_root() { len - 1 } else { len };
+ let next = if current + 1 > max_index {
+ 0
+ } else {
+ current + 1
+ };
+
+ self.selection.select(Some(next));
+ }
+
+ fn scroll_up(&mut self) {
+ let len = self.filter.item_list().len();
+ if len == 0 {
+ return;
+ }
+ let current = self.selection.selected().unwrap_or(0);
+ let max_index = if self.at_root() { len - 1 } else { len };
+ let next = if current == 0 { max_index } else { current - 1 };
+
+ self.selection.select(Some(next));
+ }
+
fn toggle_multi_select(&mut self) {
- if self.is_current_tab_multi_selectable() {
- self.multi_select = !self.multi_select;
- if !self.multi_select {
- self.selected_commands.clear();
- }
+ self.multi_select = !self.multi_select;
+ if !self.multi_select {
+ self.selected_commands.clear();
}
}
fn toggle_selection(&mut self) {
- if let Some(command) = self.get_selected_node() {
- if self.selected_commands.contains(&command) {
- self.selected_commands.retain(|c| c != &command);
- } else {
- self.selected_commands.push(command);
+ if let Some(node) = self.get_selected_node() {
+ if node.multi_select {
+ if self.selected_commands.contains(&node) {
+ self.selected_commands.retain(|c| c != &node);
+ } else {
+ self.selected_commands.push(node);
+ }
}
}
}
- pub fn is_current_tab_multi_selectable(&self) -> bool {
- let index = self.current_tab.selected().unwrap_or(0);
- self.tabs
- .get(index)
- .map_or(false, |tab| tab.multi_selectable)
- }
-
fn update_items(&mut self) {
self.filter.update_items(
&self.tabs,
self.current_tab.selected().unwrap(),
- *self.visit_stack.last().unwrap(),
+ self.visit_stack.last().unwrap().0,
);
- if !self.is_current_tab_multi_selectable() {
- self.multi_select = false;
- self.selected_commands.clear();
+
+ let len = self.filter.item_list().len();
+ if len > 0 {
+ let current = self.selection.selected().unwrap_or(0);
+ self.selection.select(Some(current.min(len - 1)));
+ } else {
+ self.selection.select(None);
}
}
@@ -579,9 +633,10 @@ impl AppState {
}
fn enter_parent_directory(&mut self) {
- self.visit_stack.pop();
- self.selection.select(Some(0));
- self.update_items();
+ if let Some((_, previous_position)) = self.visit_stack.pop() {
+ self.selection.select(Some(previous_position));
+ self.update_items();
+ }
}
fn get_selected_node(&self) -> Option> {
@@ -608,20 +663,22 @@ impl AppState {
}
pub fn go_to_selected_dir(&mut self) {
- let mut selected_index = self.selection.selected().unwrap_or(0);
+ let selected_index = self.selection.selected().unwrap_or(0);
if !self.at_root() && selected_index == 0 {
self.enter_parent_directory();
return;
}
- if !self.at_root() {
- selected_index = selected_index.saturating_sub(1);
- }
+ let actual_index = if self.at_root() {
+ selected_index
+ } else {
+ selected_index - 1
+ };
- if let Some(item) = self.filter.item_list().get(selected_index) {
+ if let Some(item) = self.filter.item_list().get(actual_index) {
if item.has_children {
- self.visit_stack.push(item.id);
+ self.visit_stack.push((item.id, selected_index));
self.selection.select(Some(0));
self.update_items();
}
@@ -653,7 +710,6 @@ impl AppState {
pub fn selected_item_is_up_dir(&self) -> bool {
let selected_index = self.selection.selected().unwrap_or(0);
-
!self.at_root() && selected_index == 0
}
@@ -669,29 +725,47 @@ impl AppState {
fn enable_description(&mut self) {
if let Some(command_description) = self.get_selected_description() {
- let description = FloatingText::new(command_description, "Command Description");
- self.spawn_float(description, 80, 80);
+ if !command_description.is_empty() {
+ let description =
+ FloatingText::new(command_description, "Command Description", true);
+ self.spawn_float(description, 80, 80);
+ }
+ }
+ }
+
+ fn get_selected_item_type(&self) -> SelectedItem {
+ if self.selected_item_is_up_dir() {
+ SelectedItem::UpDir
+ } else if self.selected_item_is_dir() {
+ SelectedItem::Directory
+ } else if self.selected_item_is_cmd() {
+ SelectedItem::Command
+ } else {
+ SelectedItem::None
}
}
fn handle_enter(&mut self) {
- if self.selected_item_is_cmd() {
- if self.selected_commands.is_empty() {
- if let Some(node) = self.get_selected_node() {
- self.selected_commands.push(node);
+ match self.get_selected_item_type() {
+ SelectedItem::UpDir => self.enter_parent_directory(),
+ SelectedItem::Directory => self.go_to_selected_dir(),
+ SelectedItem::Command => {
+ if self.selected_commands.is_empty() {
+ if let Some(node) = self.get_selected_node() {
+ self.selected_commands.push(node);
+ }
}
+
+ let cmd_names = self
+ .selected_commands
+ .iter()
+ .map(|node| node.name.as_str())
+ .collect::>();
+
+ let prompt = ConfirmPrompt::new(&cmd_names[..]);
+ self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40));
}
-
- let cmd_names = self
- .selected_commands
- .iter()
- .map(|node| node.name.as_str())
- .collect::>();
-
- let prompt = ConfirmPrompt::new(&cmd_names[..]);
- self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40));
- } else {
- self.go_to_selected_dir();
+ SelectedItem::None => {}
}
}
@@ -725,34 +799,56 @@ impl AppState {
}
fn refresh_tab(&mut self) {
- self.visit_stack = vec![self.tabs[self.current_tab.selected().unwrap()]
- .tree
- .root()
- .id()];
+ self.visit_stack = vec![(
+ self.tabs[self.current_tab.selected().unwrap()]
+ .tree
+ .root()
+ .id(),
+ 0usize,
+ )];
self.selection.select(Some(0));
+ self.filter.clear_search();
self.update_items();
}
fn toggle_task_list_guide(&mut self) {
self.spawn_float(
- FloatingText::new(ACTIONS_GUIDE.to_string(), "Important Actions Guide"),
+ FloatingText::new(ACTIONS_GUIDE.to_string(), "Important Actions Guide", true),
80,
80,
);
}
+
+ fn scroll_tab_down(&mut self) {
+ let len = self.tabs.len();
+ let current = self.current_tab.selected().unwrap_or(0);
+ let next = if current + 1 >= len { 0 } else { current + 1 };
+
+ self.current_tab.select(Some(next));
+ self.refresh_tab();
+ }
+
+ fn scroll_tab_up(&mut self) {
+ let len = self.tabs.len();
+ let current = self.current_tab.selected().unwrap_or(0);
+ let next = if current == 0 { len - 1 } else { current - 1 };
+
+ self.current_tab.select(Some(next));
+ self.refresh_tab();
+ }
}
#[cfg(feature = "tips")]
const TIPS: &str = include_str!("../cool_tips.txt");
#[cfg(feature = "tips")]
-fn get_random_tip() -> &'static str {
+fn get_random_tip() -> String {
let tips: Vec<&str> = TIPS.lines().collect();
if tips.is_empty() {
- return "";
+ return "".to_string();
}
let mut rng = rand::thread_rng();
let random_index = rng.gen_range(0..tips.len());
- tips[random_index]
+ format!(" {} ", tips[random_index])
}
diff --git a/tui/src/theme.rs b/tui/src/theme.rs
index 8337645a..d87e87ee 100644
--- a/tui/src/theme.rs
+++ b/tui/src/theme.rs
@@ -28,6 +28,13 @@ impl Theme {
}
}
+ pub fn multi_select_disabled_color(&self) -> Color {
+ match self {
+ Theme::Default => Color::DarkGray,
+ Theme::Compatible => Color::DarkGray,
+ }
+ }
+
pub fn tab_color(&self) -> Color {
match self {
Theme::Default => Color::Rgb(255, 255, 85),
diff --git a/xtask/src/docgen.rs b/xtask/src/docgen.rs
index 992b83aa..385c1134 100644
--- a/xtask/src/docgen.rs
+++ b/xtask/src/docgen.rs
@@ -11,7 +11,7 @@ pub fn userguide() -> Result {
let mut md = String::new();
md.push_str("\n# Walkthrough\n");
- let tabs = linutil_core::get_tabs(false).1;
+ let tabs = linutil_core::get_tabs(false);
for tab in tabs {
#[cfg(debug_assertions)]
@@ -24,7 +24,7 @@ pub fn userguide() -> Result {
#[cfg(debug_assertions)]
println!(" Directory: {}", entry.name);
- if entry.name != "root".to_string() {
+ if entry.name != "root" {
md.push_str(&format!("\n### {}\n\n", entry.name));
}
@@ -36,18 +36,16 @@ pub fn userguide() -> Result {
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);
+ } 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
- }
+ md.push_str(&format!("- **{}**: {}\n", entry.name, entry.description));
+ } /* else {
+ md.push_str(&format!("- **{}**\n", entry.name));
+ } */ // https://github.com/ChrisTitusTech/linutil/pull/753
}
}