Compare commits

..

No commits in common. "46329c4077014f05dd9016ad687bf3765b53c9d3" and "27a00ca506e1492c52e7bca26509fb1db4c898b6" have entirely different histories.

100 changed files with 864 additions and 1693 deletions

View File

@ -8,3 +8,10 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "weekly" interval: "weekly"
ignore:
- dependency-name: "actions/stale"
versions: '>= 9'
- dependency-name: "actions/setup-python"
versions: '> 4'
- dependency-name: "crossterm"
versions: '> 0.27.0'

89
.github/mkdocs.yml vendored Normal file
View File

@ -0,0 +1,89 @@
site_name: Chris Titus LinUtil Official Documentation
repo_url: https://github.com/ChrisTitusTech/linutil
docs_dir: '../docs'
nav:
- Introduction: 'index.md'
- User Guide: 'userguide.md'
- Contributing:
- Contributing Guide: 'contributing.md'
- Roadmap: 'roadmap.md'
- Documentation:
- Known Issues: 'KnownIssues.md'
- FAQ: 'faq.md'
theme:
name: material
custom_dir: '../overrides'
features:
- navigation.tabs
- navigation.sections
- toc.integrate
- navigation.top
- search.suggest
- search.highlight
- content.tabs.link
- content.code.annotation
- content.code.copy
language: en
logo: assets/favicon.png
favicon: assets/favicon.png
palette:
# Palette toggle for automatic mode
- media: "(prefers-color-scheme)"
toggle:
icon: material/brightness-auto
name: Switch to light mode
# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
accent: blue
toggle:
icon: material/brightness-7
name: Switch to dark mode
# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: black
accent: blue
toggle:
icon: material/weather-night
name: Switch to light mode
markdown_extensions:
- admonition
- pymdownx.details
- pymdownx.superfences
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
- abbr
- attr_list
- pymdownx.snippets
- md_in_html
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- def_list
- pymdownx.tasklist:
custom_checkbox: true
- toc:
permalink: true
plugins:
- search
- awesome-pages
- git-revision-date-localized
- minify:
minify_html: true
htmlmin_opts:
remove_comments: true
cache_safe: true

56
.github/workflows/github-pages.yml vendored Normal file
View File

@ -0,0 +1,56 @@
name: GitHub Pages Deploy
on:
push:
paths:
- '.github/mkdocs.yml'
- '.github/requirements.txt'
- 'docs/**'
- 'overrides/**'
- '.github/CONTRIBUTING.md'
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: linutil_env
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: '0' # Fetch all commit history for all branches as well as tags.
- name: Copy Contributing Guidelines
run: |
echo -e "<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md'
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update Contributing Guidelines
title: 'docs: Update Contributing Guidelines'
body: 'Automated update of Contributing Guidelines from .github/CONTRIBUTING.md'
branch: update-contributing-guidelines
delete-branch: true
base: main
labels: documentation
token: ${{ secrets.PAT_TOKEN }}
if: success()
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x # Install latest Stable release of Python 3
cache: 'pip' # Caching pip dependencies
- name: Install Necessary Dependencies
run: pip install -r .github/requirements.txt
- name: Build & Deploy using mkdocs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mkdocs gh-deploy --force -f .github/mkdocs.yml

View File

@ -58,10 +58,10 @@ jobs:
- name: Generate preview - name: Generate preview
uses: charmbracelet/vhs-action@v2.1.0 uses: charmbracelet/vhs-action@v2.1.0
with: with:
path: ".github/preview.tape" path: "docs/assets/preview.tape"
- name: Move preview - name: Move preview
run: mv preview.gif .github/preview.gif run: mv preview.gif docs/assets/preview.gif
- name: Create PR - name: Create PR
uses: peter-evans/create-pull-request@v7.0.5 uses: peter-evans/create-pull-request@v7.0.5
@ -72,5 +72,5 @@ jobs:
title: "Update preview for ${{ env.tag_name }}" title: "Update preview for ${{ env.tag_name }}"
body: | body: |
Automated PR to update preview gif for version ${{ env.tag_name }} Automated PR to update preview gif for version ${{ env.tag_name }}
![preview](https://raw.githubusercontent.com/${{ github.repository }}/feature/preview-${{ env.tag_name }}/.github/preview.gif) ![preview](https://raw.githubusercontent.com/${{ github.repository }}/feature/preview-${{ env.tag_name }}/docs/assets/preview.gif)
if: success() if: success()

58
.github/workflows/xtask.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: XTasks
on:
pull_request:
paths:
- "xtask"
- "Cargo.toml"
- "Cargo.lock"
- ".cargo"
- "core/tabs"
- "docs"
push:
paths:
- "xtask"
- "Cargo.toml"
- "Cargo.lock"
- ".cargo"
- "core/tabs"
- "docs"
env:
CARGO_TERM_COLOR: always
jobs:
docgen:
name: DocGen
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-registry-
- name: Cache Cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-index-
- name: Run cargo xtask docgen
run: cargo xtask docgen
- name: Check uncommitted documentation changes
run: |
git diff
git diff-files --quiet \
|| (echo "Run 'cargo xtask docgen' and push the changes" \
&& exit 1)

View File

@ -1,3 +1,2 @@
external-sources=true external-sources=true
source=core/tabs/common-script.sh source=core/tabs/common-script.sh
source=core/tabs/common-service-script.sh

102
Cargo.lock generated
View File

@ -242,15 +242,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "deranged"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
"powerfmt",
]
[[package]] [[package]]
name = "downcast-rs" name = "downcast-rs"
version = "1.2.1" version = "1.2.1"
@ -259,9 +250,9 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]] [[package]]
name = "ego-tree" name = "ego-tree"
version = "0.9.0" version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c6ba7d4eec39eaa9ab24d44a0e73a7949a1095a8b3f3abb11eddf27dbb56a53" checksum = "12a0bb14ac04a9fcf170d0bbbef949b44cc492f4452bd20c095636956f653642"
[[package]] [[package]]
name = "either" name = "either"
@ -421,9 +412,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.161" version = "0.2.158"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
[[package]] [[package]]
name = "linutil_core" name = "linutil_core"
@ -444,14 +435,14 @@ dependencies = [
"ansi-to-tui", "ansi-to-tui",
"anstyle", "anstyle",
"clap", "clap",
"crossterm",
"ego-tree",
"linutil_core", "linutil_core",
"oneshot", "oneshot",
"portable-pty", "portable-pty",
"rand", "rand",
"ratatui", "ratatui",
"temp-dir", "temp-dir",
"textwrap",
"time",
"tree-sitter-bash", "tree-sitter-bash",
"tree-sitter-highlight", "tree-sitter-highlight",
"tui-term", "tui-term",
@ -548,21 +539,6 @@ dependencies = [
"minimal-lexical", "minimal-lexical",
] ]
[[package]]
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num_threads"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.19.0" version = "1.19.0"
@ -631,12 +607,6 @@ dependencies = [
"winreg", "winreg",
] ]
[[package]]
name = "powerfmt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.20" version = "0.2.20"
@ -755,9 +725,9 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.38.38" version = "0.38.37"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"errno", "errno",
@ -919,12 +889,6 @@ version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "smawk"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
[[package]] [[package]]
name = "static_assertions" name = "static_assertions"
version = "1.1.0" version = "1.1.0"
@ -991,17 +955,6 @@ dependencies = [
"libc", "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]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.64" version = "1.0.64"
@ -1022,39 +975,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "time"
version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [
"deranged",
"itoa",
"libc",
"num-conv",
"num_threads",
"powerfmt",
"serde",
"time-core",
"time-macros",
]
[[package]]
name = "time-core"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "time-macros"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [
"num-conv",
"time-core",
]
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.8.19" version = "0.8.19"
@ -1147,12 +1067,6 @@ version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
[[package]]
name = "unicode-linebreak"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.11.0" version = "1.11.0"

View File

@ -3,6 +3,9 @@ license = "MIT"
version = "24.9.28" version = "24.9.28"
edition = "2021" edition = "2021"
[workspace.dependencies]
ego-tree = "0.6.2"
[workspace] [workspace]
members = ["tui", "core", "xtask"] members = ["tui", "core", "xtask"]
default-members = ["tui", "core"] default-members = ["tui", "core"]

View File

@ -7,7 +7,7 @@
<!-- TODO: crates.io package here + <br> --> <!-- TODO: crates.io package here + <br> -->
[![Crates.io Version](https://img.shields.io/crates/v/linutil_tui?style=for-the-badge&color=%23af3a03)](https://crates.io/crates/linutil_tui) [![linutil AUR Version](https://img.shields.io/aur/version/linutil?style=for-the-badge&label=%5BAUR%5D%20linutil&color=%23230567ff)](https://aur.archlinux.org/packages/linutil) [![linutil-bin AUR Version](https://img.shields.io/aur/version/linutil-bin?style=for-the-badge&label=%5BAUR%5D%20linutil-bin&color=%23230567ff)](https://aur.archlinux.org/packages/linutil-bin) [![Crates.io Version](https://img.shields.io/crates/v/linutil_tui?style=for-the-badge&color=%23af3a03)](https://crates.io/crates/linutil_tui) [![linutil AUR Version](https://img.shields.io/aur/version/linutil?style=for-the-badge&label=%5BAUR%5D%20linutil&color=%23230567ff)](https://aur.archlinux.org/packages/linutil) [![linutil-bin AUR Version](https://img.shields.io/aur/version/linutil-bin?style=for-the-badge&label=%5BAUR%5D%20linutil-bin&color=%23230567ff)](https://aur.archlinux.org/packages/linutil-bin)
![Preview](/.github/preview.gif) ![Preview](docs/assets/preview.gif)
**Linutil** is a distro-agnostic toolbox designed to simplify everyday Linux tasks. It helps you set up applications and optimize your system for specific use cases. The utility is actively developed in Rust 🦀, providing performance and reliability. **Linutil** is a distro-agnostic toolbox designed to simplify everyday Linux tasks. It helps you set up applications and optimize your system for specific use cases. The utility is actively developed in Rust 🦀, providing performance and reliability.
@ -24,26 +24,6 @@ curl -fsSL https://christitus.com/linux | sh
```bash ```bash
curl -fsSL https://christitus.com/linuxdev | sh curl -fsSL https://christitus.com/linuxdev | sh
``` ```
<details>
<summary>CLI arguments</summary>
Linutil supports various command-line arguments to customize its behavior. Here are some common arguments you can use:
- `-t, --theme <THEME>` : Set the theme to use in the application [default: default] [possible values: default, compatible].
- `--override-validation` : Show all available options, disregarding compatibility checks (UNSAFE).
- `-h, --help` : Print help.
For more detailed usage, run:
```bash
curl -fsSL https://christitus.com/linux | sh -s -- --help
```
```bash
linutil --help
```
</details>
## ⬇️ Installation ## ⬇️ Installation
Linutil is also available as a package in various repositories: Linutil is also available as a package in various repositories:
@ -78,15 +58,7 @@ paru -S linutil
Replace `paru` with your preferred helper and `linutil` with your preferred package. Replace `paru` with your preferred helper and `linutil` with your preferred package.
</details> </details>
<details>
<summary>OpenSUSE</summary>
Linutil can be installed on OpenSUSE with:
```bash
sudo zypper install linutil
```
</details>
<details> <details>
<summary>Cargo</summary> <summary>Cargo</summary>
@ -100,43 +72,19 @@ Note that crates installed using `cargo install` require manual updating with `c
</details> </details>
## Configuration
Linutil supports configuration through a TOML config file. Path to the file can be specified with `--config` (or `-c`).
Available options:
- `auto_execute` - a list of commands to execute automatically (can be combined with `--skip-confirmation`)
Example config:
```toml
# example_config.toml
auto_execute = [
"Fastfetch",
"Alacritty",
"Kitty"
]
```
```bash
linutil --config /path/to/example_config.toml
```
## 💖 Support ## 💖 Support
If you find Linutil helpful, please consider giving it a ⭐️ to show your support! If you find Linutil helpful, please consider giving it a ⭐️ to show your support!
## 🎓 Documentation ## 🎓 Documentation
For comprehensive information on how to use Linutil, visit the [Linutil Official Documentation](https://chris-titus-docs.github.io/linutil-docs/). For comprehensive information on how to use Linutil, visit the [Linutil Official Documentation](https://christitustech.github.io/linutil/).
## 🛠 Contributing ## 🛠 Contributing
We welcome contributions from the community! Before you start, please review our [Contributing Guidelines](.github/CONTRIBUTING.md) to understand how to make the most effective and efficient contributions. We welcome contributions from the community! Before you start, please review our [Contributing Guidelines](.github/CONTRIBUTING.md) to understand how to make the most effective and efficient contributions.
[Official LinUtil Roadmap](https://chris-titus-docs.github.io/linutil-docs/roadmap/) [Official LinUtil Roadmap](https://christitustech.github.io/linutil/roadmap)
Docs are now [here](https://github.com/Chris-Titus-Docs/linutil-docs)
## 🏅 Thanks to All Contributors ## 🏅 Thanks to All Contributors

View File

@ -5,7 +5,11 @@ repository = "https://github.com/ChrisTitusTech/linutil/tree/main/core"
edition = "2021" edition = "2021"
version.workspace = true version.workspace = true
license.workspace = true license.workspace = true
include = ["src/*.rs", "Cargo.toml", "tabs/**"] include = [
"src/*.rs",
"Cargo.toml",
"tabs/**",
]
[dependencies] [dependencies]
include_dir = "0.7.4" include_dir = "0.7.4"
@ -13,4 +17,4 @@ temp-dir = "0.1.14"
serde = { version = "1.0.205", features = ["derive"], default-features = false } serde = { version = "1.0.205", features = ["derive"], default-features = false }
toml = { version = "0.8.19", features = ["parse"], default-features = false } toml = { version = "0.8.19", features = ["parse"], default-features = false }
which = "6.0.3" which = "6.0.3"
ego-tree = "0.9.0" ego-tree = { workspace = true }

View File

@ -1,28 +0,0 @@
use serde::Deserialize;
use std::path::Path;
use std::process;
#[derive(Deserialize)]
pub struct Config {
pub auto_execute: Vec<String>,
}
impl Config {
pub fn from_file(path: &Path) -> Self {
let content = match std::fs::read_to_string(path) {
Ok(content) => content,
Err(e) => {
eprintln!("Failed to read config file {}: {}", path.display(), e);
process::exit(1);
}
};
match toml::from_str(&content) {
Ok(config) => config,
Err(e) => {
eprintln!("Failed to parse config file: {}", e);
process::exit(1);
}
}
}
}

View File

@ -1,7 +1,6 @@
use std::{ use std::{
fs::File, fs::File,
io::{BufRead, BufReader, Read}, io::{BufRead, BufReader, Read},
ops::{Deref, DerefMut},
os::unix::fs::PermissionsExt, os::unix::fs::PermissionsExt,
path::{Path, PathBuf}, path::{Path, PathBuf},
rc::Rc, rc::Rc,
@ -15,34 +14,8 @@ use temp_dir::TempDir;
const TAB_DATA: Dir = include_dir!("$CARGO_MANIFEST_DIR/tabs"); const TAB_DATA: Dir = include_dir!("$CARGO_MANIFEST_DIR/tabs");
// Allow the unused TempDir to be stored for later destructor call pub fn get_tabs(validate: bool) -> (TempDir, Vec<Tab>) {
#[allow(dead_code)] let (temp_dir, tab_files) = TabList::get_tabs();
pub struct TabList(pub Vec<Tab>, TempDir);
// Implement deref to allow Vec<Tab> methods to be called on TabList
impl Deref for TabList {
type Target = Vec<Tab>;
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<Self::Item>;
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 let tabs: Vec<_> = tab_files
.into_iter() .into_iter()
@ -60,28 +33,40 @@ pub fn get_tabs(validate: bool) -> TabList {
let tabs: Vec<Tab> = tabs let tabs: Vec<Tab> = tabs
.into_iter() .into_iter()
.map(|(TabEntry { name, data }, directory)| { .map(
|(
TabEntry {
name,
data,
multi_selectable,
},
directory,
)| {
let mut tree = Tree::new(Rc::new(ListNode { let mut tree = Tree::new(Rc::new(ListNode {
name: "root".to_string(), name: "root".to_string(),
description: String::new(), description: String::new(),
command: Command::None, command: Command::None,
task_list: String::new(), task_list: String::new(),
multi_select: false,
})); }));
let mut root = tree.root_mut(); let mut root = tree.root_mut();
create_directory(data, &mut root, &directory, validate, true); create_directory(data, &mut root, &directory, validate);
Tab { name, tree } Tab {
}) name,
tree,
multi_selectable,
}
},
)
.collect(); .collect();
if tabs.is_empty() { if tabs.is_empty() {
panic!("No tabs found"); panic!("No tabs found");
} }
TabList(tabs, temp_dir) (temp_dir, tabs)
} }
#[derive(Deserialize)] #[derive(Deserialize)]
struct TabDirectories { struct TabList {
directories: Vec<PathBuf>, directories: Vec<PathBuf>,
} }
@ -89,6 +74,12 @@ struct TabDirectories {
struct TabEntry { struct TabEntry {
name: String, name: String,
data: Vec<Entry>, data: Vec<Entry>,
#[serde(default = "default_multi_selectable")]
multi_selectable: bool,
}
fn default_multi_selectable() -> bool {
true
} }
#[derive(Deserialize)] #[derive(Deserialize)]
@ -103,12 +94,6 @@ struct Entry {
entry_type: EntryType, entry_type: EntryType,
#[serde(default)] #[serde(default)]
task_list: String, task_list: String,
#[serde(default = "default_true")]
multi_select: bool,
}
fn default_true() -> bool {
true
} }
#[derive(Deserialize)] #[derive(Deserialize)]
@ -189,11 +174,8 @@ fn create_directory(
node: &mut NodeMut<Rc<ListNode>>, node: &mut NodeMut<Rc<ListNode>>,
command_dir: &Path, command_dir: &Path,
validate: bool, validate: bool,
parent_multi_select: bool,
) { ) {
for entry in data { for entry in data {
let multi_select = parent_multi_select && entry.multi_select;
match entry.entry_type { match entry.entry_type {
EntryType::Entries(entries) => { EntryType::Entries(entries) => {
let mut node = node.append(Rc::new(ListNode { let mut node = node.append(Rc::new(ListNode {
@ -201,9 +183,8 @@ fn create_directory(
description: entry.description, description: entry.description,
command: Command::None, command: Command::None,
task_list: String::new(), task_list: String::new(),
multi_select,
})); }));
create_directory(entries, &mut node, command_dir, validate, multi_select); create_directory(entries, &mut node, command_dir, validate);
} }
EntryType::Command(command) => { EntryType::Command(command) => {
node.append(Rc::new(ListNode { node.append(Rc::new(ListNode {
@ -211,7 +192,6 @@ fn create_directory(
description: entry.description, description: entry.description,
command: Command::Raw(command), command: Command::Raw(command),
task_list: String::new(), task_list: String::new(),
multi_select,
})); }));
} }
EntryType::Script(script) => { EntryType::Script(script) => {
@ -230,7 +210,6 @@ fn create_directory(
file: script, file: script,
}, },
task_list: entry.task_list, task_list: entry.task_list,
multi_select,
})); }));
} }
} }
@ -273,9 +252,9 @@ fn is_executable(path: &Path) -> bool {
.unwrap_or(false) .unwrap_or(false)
} }
impl TabDirectories { impl TabList {
fn get_tabs() -> (TempDir, Vec<PathBuf>) { fn get_tabs() -> (TempDir, Vec<PathBuf>) {
let temp_dir = TempDir::with_prefix("linutil_scripts").unwrap(); let temp_dir = TempDir::new().unwrap();
TAB_DATA TAB_DATA
.extract(&temp_dir) .extract(&temp_dir)
.expect("Failed to extract the saved directory"); .expect("Failed to extract the saved directory");

View File

@ -1,14 +1,11 @@
mod config;
mod inner; mod inner;
use std::rc::Rc; use std::rc::Rc;
pub use ego_tree;
use ego_tree::Tree; use ego_tree::Tree;
use std::path::PathBuf; use std::path::PathBuf;
pub use config::Config; pub use inner::get_tabs;
pub use inner::{get_tabs, TabList};
#[derive(Clone, Hash, Eq, PartialEq)] #[derive(Clone, Hash, Eq, PartialEq)]
pub enum Command { pub enum Command {
@ -26,6 +23,7 @@ pub enum Command {
pub struct Tab { pub struct Tab {
pub name: String, pub name: String,
pub tree: Tree<Rc<ListNode>>, pub tree: Tree<Rc<ListNode>>,
pub multi_selectable: bool,
} }
#[derive(Clone, Hash, Eq, PartialEq)] #[derive(Clone, Hash, Eq, PartialEq)]
@ -34,18 +32,4 @@ pub struct ListNode {
pub description: String, pub description: String,
pub command: Command, pub command: Command,
pub task_list: String, pub task_list: String,
pub multi_select: bool,
}
impl Tab {
pub fn find_command(&self, name: &str) -> Option<Rc<ListNode>> {
self.tree.root().descendants().find_map(|node| {
let value = node.value();
if value.name == name && !node.has_children() {
Some(value.clone())
} else {
None
}
})
}
} }

View File

@ -12,9 +12,6 @@ installMeld() {
apt-get|nala) apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" -y install meld "$ESCALATION_TOOL" "$PACKAGER" -y install meld
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add meld
;;
*) *)
checkFlatpak checkFlatpak
flatpak install -y flathub org.gnome.meld flatpak install -y flathub org.gnome.meld

View File

@ -29,9 +29,6 @@ installNeovim() {
dnf|zypper) dnf|zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git "$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add neovim ripgrep fzf py3-virtualenv luarocks go shellcheck git
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installVsCode() { installVsCode() {
if ! command_exists com.visualstudio.code && ! command_exists code; then if ! command_exists code; then
printf "%b\n" "${YELLOW}Installing VS Code..${RC}." printf "%b\n" "${YELLOW}Installing VS Code..${RC}."
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
@ -28,10 +28,6 @@ installVsCode() {
printf "%b\n" '[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc' | "$ESCALATION_TOOL" tee /etc/yum.repos.d/vscode.repo > /dev/null printf "%b\n" '[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc' | "$ESCALATION_TOOL" tee /etc/yum.repos.d/vscode.repo > /dev/null
"$ESCALATION_TOOL" "$PACKAGER" install -y code "$ESCALATION_TOOL" "$PACKAGER" install -y code
;; ;;
apk)
checkFlatpak
flatpak install -y flathub com.visualstudio.code
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installVsCodium() { installVsCodium() {
if ! command_exists com.vscodium.codium && ! command_exists codium; then if ! command_exists codium; then
printf "%b\n" "${YELLOW}Installing VS Codium...${RC}" printf "%b\n" "${YELLOW}Installing VS Codium...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
@ -26,10 +26,6 @@ installVsCodium() {
printf "%b\n" "[gitlab.com_paulcarroty_vscodium_repo]\nname=download.vscodium.com\nbaseurl=https://download.vscodium.com/rpms/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg\nmetadata_expire=1h" | "$ESCALATION_TOOL" tee -a /etc/yum.repos.d/vscodium.repo printf "%b\n" "[gitlab.com_paulcarroty_vscodium_repo]\nname=download.vscodium.com\nbaseurl=https://download.vscodium.com/rpms/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg\nmetadata_expire=1h" | "$ESCALATION_TOOL" tee -a /etc/yum.repos.d/vscodium.repo
"$ESCALATION_TOOL" "$PACKAGER" install -y codium "$ESCALATION_TOOL" "$PACKAGER" install -y codium
;; ;;
apk)
checkFlatpak
flatpak install -y flathub com.vscodium.codium
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -9,9 +9,6 @@ installAlacritty() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add alacritty
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y alacritty "$ESCALATION_TOOL" "$PACKAGER" install -y alacritty
;; ;;

View File

@ -15,9 +15,6 @@ install_adb() {
dnf|zypper) dnf|zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -y android-tools "$ESCALATION_TOOL" "$PACKAGER" install -y android-tools
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add android-tools
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
exit 1 exit 1

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installBrave() { installBrave() {
if ! command_exists com.brave.Browser && ! command_exists brave; then if ! command_exists brave; then
printf "%b\n" "${YELLOW}Installing Brave...${RC}" printf "%b\n" "${YELLOW}Installing Brave...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
@ -29,10 +29,6 @@ installBrave() {
"$ESCALATION_TOOL" rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc "$ESCALATION_TOOL" rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
"$ESCALATION_TOOL" "$PACKAGER" install -y brave-browser "$ESCALATION_TOOL" "$PACKAGER" install -y brave-browser
;; ;;
apk)
checkFlatpak
flatpak install -y flathub com.brave.Browser
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -9,9 +9,6 @@ if ! command_exists chromium; then
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm chromium "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm chromium
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add chromium
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y chromium "$ESCALATION_TOOL" "$PACKAGER" install -y chromium
;; ;;

View File

@ -18,9 +18,6 @@ installFirefox() {
dnf) dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y firefox "$ESCALATION_TOOL" "$PACKAGER" install -y firefox
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add firefox
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installLibreWolf() { installLibreWolf() {
if ! command_exists io.gitlab.librewolf-community && ! command_exists librewolf; then if ! command_exists librewolf; then
printf "%b\n" "${YELLOW}Installing Librewolf...${RC}" printf "%b\n" "${YELLOW}Installing Librewolf...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
@ -32,10 +32,6 @@ Signed-By: /usr/share/keyrings/librewolf.gpg" | "$ESCALATION_TOOL" tee /etc/apt/
pacman) pacman)
"$AUR_HELPER" -S --needed --noconfirm librewolf-bin "$AUR_HELPER" -S --needed --noconfirm librewolf-bin
;; ;;
apk)
checkFlatpak
flatpak install flathub io.gitlab.librewolf-community
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -9,9 +9,6 @@ installLynx() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm lynx "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm lynx
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add lynx
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y lynx "$ESCALATION_TOOL" "$PACKAGER" install -y lynx
;; ;;

View File

@ -22,7 +22,6 @@ installThrorium() {
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1
;; ;;
esac esac
else else

View File

@ -1,34 +0,0 @@
#!/bin/sh -e
. ../../common-script.sh
installTorBrowser() {
if ! command_exists torbrowser-launcher; then
printf "%b\n" "${YELLOW}Installing Tor Browser...${RC}"
case "$PACKAGER" in
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y torbrowser-launcher
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install torbrowser-launcher
;;
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm torbrowser-launcher
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y torbrowser-launcher
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
exit 1
;;
esac
else
printf "%b\n" "${GREEN}Tor Browser is already installed.${RC}"
fi
}
checkEnv
checkEscalationTool
installTorBrowser

View File

@ -3,14 +3,14 @@
. ../../common-script.sh . ../../common-script.sh
installWaterfox() { installWaterfox() {
if ! command_exists net.waterfox.waterfox && ! command_exists waterfox; then if ! command_exists waterfox; then
printf "%b\n" "${YELLOW}Installing waterfox...${RC}" printf "%b\n" "${YELLOW}Installing waterfox...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$AUR_HELPER" -S --needed --noconfirm waterfox-bin "$AUR_HELPER" -S --needed --noconfirm waterfox-bin
;; ;;
*) *)
checkFlatpak . ../setup-flatpak.sh
flatpak install -y flathub net.waterfox.waterfox flatpak install -y flathub net.waterfox.waterfox
;; ;;
esac esac

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installDiscord() { installDiscord() {
if ! command_exists com.discordapp.Discord && ! command_exists discord; then if ! command_exists discord; then
printf "%b\n" "${YELLOW}Installing Discord...${RC}" printf "%b\n" "${YELLOW}Installing Discord...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
@ -20,10 +20,6 @@ installDiscord() {
"$ESCALATION_TOOL" "$PACKAGER" install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm "$ESCALATION_TOOL" "$PACKAGER" install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
"$ESCALATION_TOOL" "$PACKAGER" install -y discord "$ESCALATION_TOOL" "$PACKAGER" install -y discord
;; ;;
apk)
checkFlatpak
flatpak install -y flathub com.discordapp.Discord
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installJitsi() { installJitsi() {
if ! command_exists org.jitsi.jitsi-meet && ! command_exists jitsi-meet; then if ! command_exists jitsi-meet; then
printf "%b\n" "${YELLOW}Installing Jitsi meet...${RC}" printf "%b\n" "${YELLOW}Installing Jitsi meet...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
@ -21,10 +21,6 @@ installJitsi() {
dnf) dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y jitsi-meet "$ESCALATION_TOOL" "$PACKAGER" install -y jitsi-meet
;; ;;
apk)
checkFlatpak
flatpak install flathub org.jitsi.jitsi-meet
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -23,10 +23,6 @@ installSignal() {
checkFlatpak checkFlatpak
flatpak install -y flathub org.signal.Signal flatpak install -y flathub org.signal.Signal
;; ;;
apk)
checkFlatpak
flatpak install -y flathub org.signal.Signal
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -9,9 +9,6 @@ installTelegram() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm telegram-desktop "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm telegram-desktop
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add telegram-desktop
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y telegram-desktop "$ESCALATION_TOOL" "$PACKAGER" install -y telegram-desktop
;; ;;

View File

@ -9,9 +9,6 @@ installThunderBird() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm thunderbird "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm thunderbird
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add thunderbird
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y thunderbird "$ESCALATION_TOOL" "$PACKAGER" install -y thunderbird
;; ;;

View File

@ -1,23 +0,0 @@
#!/bin/sh -e
. ../../common-script.sh
installZapZap() {
if ! command_exists com.rtosta.zapzap && ! command_exists zapzap; then
printf "%b\n" "${YELLOW}Installing Zap-Zap...${RC}"
case "$PACKAGER" in
pacman)
"$AUR_HELPER" -S --needed --noconfirm zapzap
;;
*)
checkFlatpak
flatpak install flathub com.rtosta.zapzap
;;
esac
else
printf "%b\n" "${GREEN}Zap-Zap is already installed.${RC}"
fi
}
checkEnv
installZapZap

View File

@ -1,10 +1,10 @@
#!/bin/sh -e #!/bin/sh -e
. ../common-script.sh . ../common-script.sh
. ../common-service-script.sh
# Function to prompt the user for installation choice # Function to prompt the user for installation choice
choose_installation() { choose_installation() {
clear
printf "%b\n" "${YELLOW}Choose what to install:${RC}" printf "%b\n" "${YELLOW}Choose what to install:${RC}"
printf "%b\n" "1. ${YELLOW}Docker${RC}" printf "%b\n" "1. ${YELLOW}Docker${RC}"
printf "%b\n" "2. ${YELLOW}Docker Compose${RC}" printf "%b\n" "2. ${YELLOW}Docker Compose${RC}"
@ -34,20 +34,19 @@ install_docker() {
;; ;;
zypper) zypper)
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install docker "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install docker
"$ESCALATION_TOOL" systemctl enable docker
"$ESCALATION_TOOL" systemctl start docker
;; ;;
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm docker "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm docker
;; "$ESCALATION_TOOL" systemctl enable docker
apk) "$ESCALATION_TOOL" systemctl start docker
"$ESCALATION_TOOL" "$PACKAGER" add docker
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1
;; ;;
esac esac
startAndEnableService docker
} }
install_docker_compose() { install_docker_compose() {
@ -67,9 +66,6 @@ install_docker_compose() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm docker-compose "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm docker-compose
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add docker-cli-compose
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -6,7 +6,7 @@ setupDWM() {
printf "%b\n" "${YELLOW}Installing DWM-Titus...${RC}" printf "%b\n" "${YELLOW}Installing DWM-Titus...${RC}"
case "$PACKAGER" in # Install pre-Requisites case "$PACKAGER" in # Install pre-Requisites
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git unzip flameshot lxappearance feh mate-polkit meson libev uthash libconfig "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git unzip flameshot lxappearance feh mate-polkit
;; ;;
apt-get|nala) apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev libx11-xcb-dev libfontconfig1 libx11-6 libxft2 libxinerama1 libxcb-res0-dev git unzip flameshot lxappearance feh mate-polkit "$ESCALATION_TOOL" "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev libx11-xcb-dev libfontconfig1 libx11-6 libxft2 libxinerama1 libxcb-res0-dev git unzip flameshot lxappearance feh mate-polkit
@ -214,28 +214,10 @@ setupDisplayManager() {
printf "%b\n" "${YELLOW}3. GDM ${RC}" printf "%b\n" "${YELLOW}3. GDM ${RC}"
printf "%b\n" "${YELLOW} ${RC}" printf "%b\n" "${YELLOW} ${RC}"
printf "%b" "${YELLOW}Please select one: ${RC}" printf "%b" "${YELLOW}Please select one: ${RC}"
read -r choice read -r DM
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 case "$PACKAGER" in
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$DM" "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$DM"
if [ "$DM" = "lightdm" ]; then
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm lightdm-gtk-greeter
fi
;; ;;
apt-get|nala) apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DM" "$ESCALATION_TOOL" "$PACKAGER" install -y "$DM"

View File

@ -14,9 +14,6 @@ installFastfetch() {
"$ESCALATION_TOOL" "$PACKAGER" install -y /tmp/fastfetch.deb "$ESCALATION_TOOL" "$PACKAGER" install -y /tmp/fastfetch.deb
rm /tmp/fastfetch.deb rm /tmp/fastfetch.deb
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add fastfetch
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch "$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch
;; ;;

View File

@ -9,9 +9,6 @@ installKitty() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm kitty "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm kitty
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add kitty
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y kitty "$ESCALATION_TOOL" "$PACKAGER" install -y kitty
;; ;;

View File

@ -25,10 +25,6 @@ installLinutil() {
esac esac
printf "%b\n" "${GREEN}Installed successfully.${RC}" printf "%b\n" "${GREEN}Installed successfully.${RC}"
;; ;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" install linutil -y
printf "%b\n" "${GREEN}Installed successfully.${RC}"
;;
*) *)
printf "%b\n" "${RED}There are no official packages for your distro.${RC}" printf "%b\n" "${RED}There are no official packages for your distro.${RC}"
printf "%b" "${YELLOW}Do you want to install the crates.io package? (y/N): ${RC}" printf "%b" "${YELLOW}Do you want to install the crates.io package? (y/N): ${RC}"
@ -44,12 +40,10 @@ installLinutil() {
dnf) dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y curl rustup man-pages man-db man "$ESCALATION_TOOL" "$PACKAGER" install -y curl rustup man-pages man-db man
;; ;;
apk) zypper)
"$ESCALATION_TOOL" "$PACKAGER" add build-base "$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
"$ESCALATION_TOOL" "$PACKAGER" add rustup curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
rustup-init . $HOME/.cargo/env
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
;; ;;
*) *)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

View File

@ -19,13 +19,6 @@ updateLinutil() {
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
. $HOME/.cargo/env . $HOME/.cargo/env
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add build-base
"$ESCALATION_TOOL" "$PACKAGER" add rustup
rustup-init
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y rustup "$ESCALATION_TOOL" "$PACKAGER" install -y rustup
;; ;;

View File

@ -11,9 +11,6 @@ installDepend() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add bash bash-completion tar bat tree unzip fontconfig git
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git "$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
;; ;;
@ -57,7 +54,7 @@ installStarshipAndFzf() {
return return
fi fi
if ! curl -sSL https://starship.rs/install.sh | "$ESCALATION_TOOL" sh; then if ! curl -sSL https://starship.rs/install.sh | sh; then
printf "%b\n" "${RED}Something went wrong during starship install!${RC}" printf "%b\n" "${RED}Something went wrong during starship install!${RC}"
exit 1 exit 1
fi fi

View File

@ -16,9 +16,6 @@ installLibreOffice() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libreoffice-fresh "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libreoffice-fresh
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add libreoffice
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -9,9 +9,6 @@ installEvince() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm evince "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm evince
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add evince
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y evince "$ESCALATION_TOOL" "$PACKAGER" install -y evince
;; ;;

View File

@ -9,9 +9,6 @@ installOkular() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm okular "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm okular
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add okular
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y okular "$ESCALATION_TOOL" "$PACKAGER" install -y okular
;; ;;

View File

@ -1,33 +0,0 @@
#!/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

View File

@ -1,33 +0,0 @@
#!/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

View File

@ -9,9 +9,6 @@ installRofi() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rofi "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rofi
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add rofi
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y rofi "$ESCALATION_TOOL" "$PACKAGER" install -y rofi
;; ;;

View File

@ -84,17 +84,6 @@ description = "Sublime Text is a fast, lightweight, and customizable text editor
script = "Developer-tools/sublime-setup.sh" script = "Developer-tools/sublime-setup.sh"
task_list = "I" task_list = "I"
[[data.entries]]
name = "ZapZap"
description = "ZapZap is an open source whatsapp desktop client for Linux users developed by rafatosta."
script = "communication-apps/zapzap-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"
[[data.entries]] [[data.entries]]
name = "VS Code" 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." 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."
@ -203,12 +192,6 @@ description = "Vivaldi is a freeware, cross-platform web browser developed by Vi
script = "browsers/vivaldi.sh" script = "browsers/vivaldi.sh"
task_list = "I" task_list = "I"
[[data.entries]]
name = "Tor Browser"
description = "Tor Browser is a free and open-source firefox-based web browser designed for anonymity and censorship circumvention."
script = "browsers/tor-browser.sh"
task_list = "I"
[[data.entries]] [[data.entries]]
name = "waterfox" name = "waterfox"
description = "Waterfox is the privacy-focused web browser engineered to give you speed, control, and peace of mind on the internet." description = "Waterfox is the privacy-focused web browser engineered to give you speed, control, and peace of mind on the internet."
@ -217,7 +200,7 @@ task_list = "FI"
[[data]] [[data]]
name = "Alacritty" 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. This command installs and configures 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.\nThis command installs and condifures alacritty terminal emulator."
script = "alacritty-setup.sh" script = "alacritty-setup.sh"
task_list = "I FM" task_list = "I FM"
@ -229,13 +212,13 @@ task_list = "I"
[[data]] [[data]]
name = "Bash Prompt" name = "Bash Prompt"
description = "The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems. It is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful. This command configures the key sections and functionalities defined in the .bashrc file from CTT's mybash repository. https://github.com/ChrisTitusTech/mybash" description = "The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems.\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"
script = "mybash-setup.sh" script = "mybash-setup.sh"
task_list = "I FM" task_list = "I FM"
[[data]] [[data]]
name = "Bottles" name = "Bottles"
description = "Bottles allows Windows software, like applications and games, to run on Linux. Bottles also provides tools to categorize, organize and optimize your applications." description = "Bottles allows Windows software, like applications and games, to run on Linux.\nBottles also provides tools to categorize, organize and optimize your applications."
script = "bottles-setup.sh" script = "bottles-setup.sh"
task_list = "FI" task_list = "FI"
@ -245,18 +228,6 @@ description = "Docker is an open platform that uses OS-level virtualization to d
script = "docker-setup.sh" script = "docker-setup.sh"
task_list = "I SS" 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]] [[data]]
name = "DWM-Titus" 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" 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"
@ -265,13 +236,13 @@ task_list = "I PFM SS"
[[data]] [[data]]
name = "Fastfetch" name = "Fastfetch"
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" 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"
script = "fastfetch-setup.sh" script = "fastfetch-setup.sh"
task_list = "I FM" task_list = "I FM"
[[data]] [[data]]
name = "Flatpak / Flathub" 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. This 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.\nThis command installs Flatpak and adds the Flathub repository"
script = "setup-flatpak.sh" script = "setup-flatpak.sh"
task_list = "I" task_list = "I"
@ -283,7 +254,7 @@ task_list = "PFM"
[[data]] [[data]]
name = "Kitty" 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. kitty is written in a mix of C and Python programming languages. 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.\nkitty is written in a mix of C and Python programming languages.\n This command installs and configures kitty."
script = "kitty-setup.sh" script = "kitty-setup.sh"
task_list = "I FM" task_list = "I FM"
@ -296,7 +267,7 @@ task_list = "I"
[[data.preconditions]] [[data.preconditions]]
matches = false matches = false
data = "command_exists" data = "command_exists"
values = ["linutil"] values = [ "linutil" ]
[[data]] [[data]]
name = "Linutil Updater" name = "Linutil Updater"
@ -307,11 +278,11 @@ task_list = "I"
[[data.preconditions]] [[data.preconditions]]
matches = true matches = true
data = "command_exists" data = "command_exists"
values = ["linutil"] values = [ "linutil" ]
[[data]] [[data]]
name = "Rofi" name = "Rofi"
description = "Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport. This command installs and configures rofi with configuration from CTT's DWM repo. https://github.com/ChrisTitusTech/dwm-titus" description = "Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport.\nThis command installs and configures rofi with configuration from CTT's DWM repo.\nhttps://github.com/ChrisTitusTech/dwm-titus"
script = "rofi-setup.sh" script = "rofi-setup.sh"
task_list = "I FM" task_list = "I FM"
@ -323,10 +294,10 @@ task_list = "I SS"
[[data.preconditions]] [[data.preconditions]]
matches = true matches = true
data = { environment = "XDG_SESSION_TYPE" } data = { environment = "XDG_SESSION_TYPE" }
values = ["wayland", "Wayland"] values = [ "wayland", "Wayland" ]
[[data]] [[data]]
name = "ZSH Prompt" 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. This 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.\nThis command installs ZSH prompt and provides basic configuration."
script = "zsh-setup.sh" script = "zsh-setup.sh"
task_list = "I FM" task_list = "I FM"

View File

@ -10,9 +10,6 @@ installZsh() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm zsh "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm zsh
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add zsh
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y zsh "$ESCALATION_TOOL" "$PACKAGER" install -y zsh
;; ;;

View File

@ -10,7 +10,7 @@ GREEN='\033[32m'
command_exists() { command_exists() {
for cmd in "$@"; do for cmd in "$@"; do
export PATH="$HOME/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH" export PATH=/home/jeeva/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH
command -v "$cmd" >/dev/null 2>&1 || return 1 command -v "$cmd" >/dev/null 2>&1 || return 1
done done
return 0 return 0
@ -123,12 +123,6 @@ checkPackageManager() {
fi fi
done done
## Enable apk community packages
if [ "$PACKAGER" = "apk" ] && grep -qE '^#.*community' /etc/apk/repositories; then
"$ESCALATION_TOOL" sed -i '/community/s/^#//' /etc/apk/repositories
"$ESCALATION_TOOL" "$PACKAGER" update
fi
if [ -z "$PACKAGER" ]; then if [ -z "$PACKAGER" ]; then
printf "%b\n" "${RED}Can't find a supported package manager${RC}" printf "%b\n" "${RED}Can't find a supported package manager${RC}"
exit 1 exit 1
@ -175,7 +169,7 @@ checkEnv() {
checkArch checkArch
checkEscalationTool checkEscalationTool
checkCommandRequirements "curl groups $ESCALATION_TOOL" checkCommandRequirements "curl groups $ESCALATION_TOOL"
checkPackageManager 'nala apt-get dnf pacman zypper apk' checkPackageManager 'nala apt-get dnf pacman zypper'
checkCurrentDirectoryWritable checkCurrentDirectoryWritable
checkSuperUser checkSuperUser
checkDistro checkDistro

View File

@ -1,85 +0,0 @@
#!/bin/sh -e
checkInitManager() {
for manager in $1; do
if command_exists "$manager"; then
INIT_MANAGER="$manager"
printf "%b\n" "${CYAN}Using ${manager} to interact with init system${RC}"
break
fi
done
if [ -z "$INIT_MANAGER" ]; then
printf "%b\n" "${RED}Can't find a supported init system${RC}"
exit 1
fi
}
startService() {
case "$INIT_MANAGER" in
systemctl)
"$ESCALATION_TOOL" "$INIT_MANAGER" start "$1"
;;
rc-service)
"$ESCALATION_TOOL" "$INIT_MANAGER" "$1" start
;;
esac
}
stopService() {
case "$INIT_MANAGER" in
systemctl)
"$ESCALATION_TOOL" "$INIT_MANAGER" stop "$1"
;;
rc-service)
"$ESCALATION_TOOL" "$INIT_MANAGER" "$1" stop
;;
esac
}
enableService() {
case "$INIT_MANAGER" in
systemctl)
"$ESCALATION_TOOL" "$INIT_MANAGER" enable "$1"
;;
rc-service)
"$ESCALATION_TOOL" rc-update add "$1"
;;
esac
}
disableService() {
case "$INIT_MANAGER" in
systemctl)
"$ESCALATION_TOOL" "$INIT_MANAGER" disable "$1"
;;
rc-service)
"$ESCALATION_TOOL" rc-update del "$1"
;;
esac
}
startAndEnableService() {
case "$INIT_MANAGER" in
systemctl)
"$ESCALATION_TOOL" "$INIT_MANAGER" enable --now "$1"
;;
rc-service)
enableService "$1"
startService "$1"
;;
esac
}
isServiceActive() {
case "$INIT_MANAGER" in
systemctl)
"$ESCALATION_TOOL" "$INIT_MANAGER" is-active --quiet "$1"
;;
rc-service)
"$ESCALATION_TOOL" "$INIT_MANAGER" "$1" status --quiet
;;
esac
}
checkInitManager 'systemctl rc-service'

View File

@ -5,6 +5,6 @@ name = "Diablo II Resurrected"
[[data.entries]] [[data.entries]]
name = "Loot Filter" name = "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" 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"
script = "diablo-ii/d2r-loot-filters.sh" script = "diablo-ii/d2r-loot-filters.sh"
task_list = "FM" task_list = "FM"

View File

@ -9,9 +9,6 @@ installPkg() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm ufw "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm ufw
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add ufw
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y ufw "$ESCALATION_TOOL" "$PACKAGER" install -y ufw
;; ;;

View File

@ -2,11 +2,6 @@ name = "Security"
[[data]] [[data]]
name = "Firewall Baselines (CTT)" 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. This command installs UFW and configures UFW based on CTT's recommended rules. For 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.\nThis command installs UFW and configures UFW based on CTT's recommended rules.\nFor more information visit: https://christitus.com/linux-security-mistakes"
script = "firewall-baselines.sh" script = "firewall-baselines.sh"
task_list = "I SS" task_list = "I SS"
[[data.preconditions]]
matches = false
data = "command_exists"
values = [ "firewalld" ]

View File

@ -1,60 +0,0 @@
#!/bin/sh -e
. ../../common-script.sh
setUpRepos() {
if ! grep -q "^\s*\[jupiter-staging\]" /etc/pacman.conf; then
printf "%b\n" "${CYAN}Adding jupiter-staging to pacman repositories...${RC}"
echo "[jupiter-staging]" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf
echo "Server = https://steamdeck-packages.steamos.cloud/archlinux-mirror/\$repo/os/\$arch" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf
echo "SigLevel = Never" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf
fi
if ! grep -q "^\s*\[holo-staging\]" /etc/pacman.conf; then
printf "%b\n" "${CYAN}Adding holo-staging to pacman repositories...${RC}"
echo "[holo-staging]" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf
echo "Server = https://steamdeck-packages.steamos.cloud/archlinux-mirror/\$repo/os/\$arch" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf
echo "SigLevel = Never" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf
fi
}
installKernel() {
if ! "$PACKAGER" -Q | grep -q "\blinux-neptune"; then
printf "%b\n" "${CYAN}Installing linux-neptune..."
"$ESCALATION_TOOL" "$PACKAGER" -Syyu --noconfirm
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm linux-neptune linux-neptune-headers steamdeck-dsp jupiter-staging/alsa-ucm-conf
"$ESCALATION_TOOL" mkinitcpio -P
else
printf "%b\n" "${GREEN}linux-neptune detected. Skipping installation.${RC}"
fi
if [ -f /etc/default/grub ]; then
printf "%b\n" "${CYAN}Updating GRUB...${RC}"
if ! grep -q '^UPDATEDEFAULT=' /etc/default/grub; then
echo 'UPDATEDEFAULT=yes' | "$ESCALATION_TOOL" tee -a /etc/default/grub
else
"$ESCALATION_TOOL" sed -i 's/^UPDATEDEFAULT=.*/UPDATEDEFAULT=yes/' /etc/default/grub
fi
if [ -f /boot/grub/grub.cfg ]; then
"$ESCALATION_TOOL" grub-mkconfig -o /boot/grub/grub.cfg
else
printf "%b\n" "${RED}GRUB configuration file not found. Run grub-mkconfig manually.${RC}"
fi
else
printf "%b\n" "${RED}GRUB not detected. Manually set your bootloader to use linux-neptune.${RC}"
fi
}
copyFirmwareFiles() {
printf "%b\n" "${CYAN}Copying firmware files...${RC}"
"$ESCALATION_TOOL" mkdir -p /usr/lib/firmware/cirrus
"$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-cali.bin /usr/lib/firmware/cirrus/
"$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-cali.wmfw /usr/lib/firmware/cirrus/
"$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-prot.bin /usr/lib/firmware/cirrus/
"$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-prot.wmfw /usr/lib/firmware/cirrus/
}
checkEnv
checkEscalationTool
setUpRepos
installKernel
copyFirmwareFiles

View File

@ -1,120 +0,0 @@
#!/bin/sh -e
. ../../common-script.sh
LIBVA_DIR="$HOME/.local/share/linutil/libva"
MPV_CONF="$HOME/.config/mpv/mpv.conf"
installDeps() {
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel dkms ninja meson git
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
}
checkNvidiaHardware() {
# Refer https://nouveau.freedesktop.org/CodeNames.html for model code names
model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep NVIDIA | sed 's/.*Corporation //;s/ .*//' | cut -c 1-2)
case "$model" in
GM | GP | GV) return 1 ;;
TU | GA | AD) return 0 ;;
*) printf "%b\n" "${RED}Unsupported hardware." && exit 1 ;;
esac
}
checkIntelHardware() {
model=$(grep "model name" /proc/cpuinfo | head -n 1 | cut -d ':' -f 2 | cut -c 2-3)
[ "$model" -ge 11 ]
}
promptUser() {
printf "%b" "Do you want to $1 ? [y/N]:"
read -r confirm
[ "$confirm" = "y" ] || [ "$confirm" = "Y" ]
}
setKernelParam() {
PARAMETER="$1"
if grep -q "$PARAMETER" /etc/default/grub; then
printf "%b\n" "${YELLOW}NVIDIA modesetting is already enabled in GRUB.${RC}"
else
"$ESCALATION_TOOL" sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT=/ s/\"$/ $PARAMETER\"/" /etc/default/grub
printf "%b\n" "${CYAN}Added $PARAMETER to /etc/default/grub.${RC}"
"$ESCALATION_TOOL" grub-mkconfig -o /boot/grub/grub.cfg
fi
}
setupHardwareAcceleration() {
if ! command_exists grub-mkconfig; then
printf "%b\n" "${RED}Currently hardware acceleration is only available with GRUB.${RC}"
return
fi
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libva-nvidia-driver
mkdir -p "$HOME/.local/share/linutil"
if [ -d "$LIBVA_DIR" ]; then
rm -rf "$LIBVA_DIR"
fi
printf "%b\n" "${YELLOW}Cloning libva from https://github.com/intel/libva in ${LIBVA_DIR}${RC}"
git clone --branch=v2.22-branch --depth=1 https://github.com/intel/libva "$LIBVA_DIR"
mkdir -p "$LIBVA_DIR/build"
cd "$LIBVA_DIR/build" && arch-meson .. -Dwith_legacy=nvctrl && ninja
"$ESCALATION_TOOL" ninja install
"$ESCALATION_TOOL" sed -i '/^MOZ_DISABLE_RDD_SANDBOX/d' "/etc/environment"
"$ESCALATION_TOOL" sed -i '/^LIBVA_DRIVER_NAME/d' "/etc/environment"
printf "LIBVA_DRIVER_NAME=nvidia\nMOZ_DISABLE_RDD_SANDBOX=1" | "$ESCALATION_TOOL" tee -a /etc/environment >/dev/null
printf "%b\n" "${GREEN}Hardware Acceleration setup completed successfully.${RC}"
if promptUser "enable Hardware Acceleration in MPV player"; then
mkdir -p "$HOME/.config/mpv"
if [ -f "$MPV_CONF" ]; then
sed -i '/^hwdec/d' "$MPV_CONF"
fi
printf "hwdec=auto" | tee -a "$MPV_CONF" >/dev/null
printf "%b\n" "${GREEN}MPV Hardware Acceleration enabled successfully.${RC}"
fi
}
installDriver() {
# Refer https://wiki.archlinux.org/title/NVIDIA for open-dkms or dkms driver selection
if checkNvidiaHardware && promptUser "install nvidia's open source drivers"; then
printf "%b\n" "${YELLOW}Installing nvidia open source driver...${RC}"
installDeps
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-open-dkms nvidia-utils
else
printf "%b\n" "${YELLOW}Installing nvidia proprietary driver...${RC}"
installDeps
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms nvidia-utils
fi
if checkIntelHardware; then
setKernelParam "ibt=off"
fi
# Refer https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend
setKernelParam "nvidia.NVreg_PreserveVideoMemoryAllocations=1"
"$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service
printf "%b\n" "${GREEN}Driver installed successfully.${RC}"
if promptUser "setup Hardware Acceleration"; then
setupHardwareAcceleration
fi
printf "%b\n" "${GREEN}Please reboot your system for the changes to take effect.${RC}"
}
checkEnv
checkEscalationTool
installDriver

View File

@ -1,104 +0,0 @@
#!/bin/sh -e
. ../../common-script.sh
installQEMUDesktop() {
if ! command_exists qemu-img; then
printf "%b\n" "${YELLOW}Installing QEMU.${RC}"
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-desktop
else
printf "%b\n" "${GREEN}QEMU is already installed.${RC}"
fi
checkKVM
}
installQEMUEmulators() {
if ! "$PACKAGER" -Q | grep -q "qemu-emulators-full "; then
printf "%b\n" "${YELLOW}Installing QEMU-Emulators.${RC}"
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-emulators-full swtpm
else
printf "%b\n" "${GREEN}QEMU-Emulators already installed.${RC}"
fi
}
installVirtManager() {
if ! command_exists virt-manager; then
printf "%b\n" "${YELLOW}Installing Virt-Manager.${RC}"
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm virt-manager
else
printf "%b\n" "${GREEN}Virt-Manager already installed.${RC}"
fi
}
checkKVM() {
if [ ! -e "/dev/kvm" ]; then
printf "%b\n" "${RED}KVM is not available. Make sure you have CPU virtualization support enabled in your BIOS/UEFI settings. Please refer https://wiki.archlinux.org/title/KVM for more information.${RC}"
else
"$ESCALATION_TOOL" usermod "$USER" -aG kvm
fi
}
setupLibvirt() {
printf "%b\n" "${YELLOW}Configuring Libvirt.${RC}"
if "$PACKAGER" -Q | grep -q "iptables "; then
"$ESCALATION_TOOL" "$PACKAGER" -Rdd --noconfirm iptables
fi
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm dnsmasq iptables-nft
"$ESCALATION_TOOL" sed -i 's/^#\?firewall_backend\s*=\s*".*"/firewall_backend = "iptables"/' "/etc/libvirt/network.conf"
if systemctl is-active --quiet polkit; then
"$ESCALATION_TOOL" sed -i 's/^#\?auth_unix_ro\s*=\s*".*"/auth_unix_ro = "polkit"/' "/etc/libvirt/libvirtd.conf"
"$ESCALATION_TOOL" sed -i 's/^#\?auth_unix_rw\s*=\s*".*"/auth_unix_rw = "polkit"/' "/etc/libvirt/libvirtd.conf"
fi
"$ESCALATION_TOOL" usermod "$USER" -aG libvirt
for value in libvirt libvirt_guest; do
if ! grep -wq "$value" /etc/nsswitch.conf; then
"$ESCALATION_TOOL" sed -i "/^hosts:/ s/$/ ${value}/" /etc/nsswitch.conf
fi
done
"$ESCALATION_TOOL" systemctl enable --now libvirtd.service
"$ESCALATION_TOOL" virsh net-autostart default
checkKVM
}
installLibvirt() {
if ! command_exists libvirtd; then
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libvirt dmidecode
else
printf "%b\n" "${GREEN}Libvirt is already installed.${RC}"
fi
setupLibvirt
}
main() {
printf "%b\n" "${YELLOW}Choose what to install:${RC}"
printf "%b\n" "1. ${YELLOW}QEMU${RC}"
printf "%b\n" "2. ${YELLOW}QEMU-Emulators ( Extended architectures )${RC}"
printf "%b\n" "3. ${YELLOW}Libvirt${RC}"
printf "%b\n" "4. ${YELLOW}Virtual-Manager${RC}"
printf "%b\n" "5. ${YELLOW}All${RC}"
printf "%b" "Enter your choice [1-5]: "
read -r CHOICE
case "$CHOICE" in
1) installQEMUDesktop ;;
2) installQEMUEmulators ;;
3) installLibvirt ;;
4) installVirtManager ;;
5)
installQEMUDesktop
installQEMUEmulators
installLibvirt
installVirtManager
;;
*) printf "%b\n" "${RED}Invalid choice.${RC}" && exit 1 ;;
esac
}
checkEnv
checkEscalationTool
main

View File

@ -37,9 +37,6 @@ installDepend() {
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install $DEPENDENCIES $COMPILEDEPS "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install $DEPENDENCIES $COMPILEDEPS
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add build-base multitail tar tree trash-cli unzip cmake jq
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
;; ;;

View File

@ -1,168 +0,0 @@
#!/bin/sh -e
. ../../common-script.sh
# This script automates the installation and root and home snapshot configuration of Snapper and installs Grub-Btrfs on Fedora.
# Also installs python3-dnf-plugin-snapper package for automatic snapshots after dnf commands.
# Install Btrfs-Assistant/snapper and dependencies
installBtrfsStack() {
if ! command_exists btrfs-assistant; then
printf "%b\n" "${YELLOW}==========================================${RC}"
printf "%b\n" "${YELLOW}Installing Btrfs Assistant with snapper...${RC}"
printf "%b\n" "${YELLOW}==========================================${RC}"
case "$PACKAGER" in
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y btrfs-assistant python3-dnf-plugin-snapper
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1
;;
esac
else
printf "%b\n" "${GREEN}Btrfs Assistant is already installed.${RC}"
fi
}
# Create first snapper config for root and home and create new manual snapshots
configureSnapper() {
printf "%b\n" "${YELLOW}===========================================================================${RC}"
printf "%b\n" "${YELLOW}Creating snapper root(/) and /home config and taking the first snapshots...${RC}"
printf "%b\n" "${YELLOW}===========================================================================${RC}"
"$ESCALATION_TOOL" snapper -c home create-config /home && "$ESCALATION_TOOL" snapper -c home create --description "First home Snapshot"
"$ESCALATION_TOOL" snapper -c root create-config / && "$ESCALATION_TOOL" snapper -c root create --description "First root Snapshot"
printf "%b\n" "${YELLOW}Updating timeline settings...${RC}"
# Modifyling default timeline root config
"$ESCALATION_TOOL" sed -i'' '
s/^TIMELINE_LIMIT_HOURLY="[^"]*"/TIMELINE_LIMIT_HOURLY="1"/;
s/^TIMELINE_LIMIT_DAILY="[^"]*"/TIMELINE_LIMIT_DAILY="2"/;
s/^TIMELINE_LIMIT_WEEKLY="[^"]*"/TIMELINE_LIMIT_WEEKLY="1"/;
s/^TIMELINE_LIMIT_MONTHLY="[^"]*"/TIMELINE_LIMIT_MONTHLY="0"/;
s/^TIMELINE_LIMIT_YEARLY="[^"]*"/TIMELINE_LIMIT_YEARLY="0"/
' /etc/snapper/configs/root
# Modifyling default timeline for home config
"$ESCALATION_TOOL" sed -i'' '
s/^TIMELINE_LIMIT_HOURLY="[^"]*"/TIMELINE_LIMIT_HOURLY="2"/;
s/^TIMELINE_LIMIT_DAILY="[^"]*"/TIMELINE_LIMIT_DAILY="1"/;
s/^TIMELINE_LIMIT_WEEKLY="[^"]*"/TIMELINE_LIMIT_WEEKLY="0"/;
s/^TIMELINE_LIMIT_MONTHLY="[^"]*"/TIMELINE_LIMIT_MONTHLY="1"/;
s/^TIMELINE_LIMIT_YEARLY="[^"]*"/TIMELINE_LIMIT_YEARLY="0"/
' /etc/snapper/configs/home
printf "%b\n" "${GREEN}Snapper configs and first snapshots created.${RC}"
}
# Starting services
serviceStartEnable() {
printf "%b\n" "${YELLOW}==================================================================================${RC}"
printf "%b\n" "${YELLOW}Starting and enabling snapper-timeline.timer and snapper-cleanup.timer services...${RC}"
printf "%b\n" "${YELLOW}==================================================================================${RC}"
"$ESCALATION_TOOL" systemctl enable --now snapper-timeline.timer
"$ESCALATION_TOOL" systemctl enable --now snapper-cleanup.timer
printf "%b\n" "${GREEN}Snapper services started and enabled.${RC}"
}
# Ask user if they want to install grub-btrfs
askInstallGrubBtrfs() {
printf "%b\n" "${YELLOW}=====================================${RC}"
printf "%b\n" "${YELLOW}(optional) grub-btrfs installation...${RC}"
printf "%b\n" "${YELLOW}=====================================${RC}"
printf "%b\n" "${YELLOW}You can skip installing grub-btrfs and use only Btrfs Assistant GUI or snapper CLI.${RC}"
printf "%b\n" "${CYAN}Notice: grub-btrfs may cause problems with booting into snapshots and other OSes on systems with secure boot/tpm. You will be asked to apply mitigation for this issue in next step.${RC}"
while true; do
printf "%b" "${YELLOW}Do you want to install grub-btrfs? Press (y) for yes, (n) for no, (f) to apply tpm mitigation to already installed grub-btrfs: ${RC}"
read -r response
case "$response" in
[yY]*)
installGrubBtrfs
break
;;
[nN]*)
printf "%b\n" "${GREEN}Skipping grub-btrfs installation.${RC}"
break
;;
[fF]*)
mitigateTpmError
break
;;
*)
printf "%b\n" "${RED}Invalid input. Please enter 'y' for yes, 'n' for no, or (f) to apply tpm mitigation to already installed grub-btrfs.${RC}"
;;
esac
done
}
# Install grub-btrfs
installGrubBtrfs() {
# Check if the grub-btrfs dir exists before attempting to clone into it.
printf "%b\n" "${YELLOW}Downloading grub-btrfs and installing dependencies...${RC}"
if [ -d "$HOME/grub-btrfs" ]; then
rm -rf "$HOME/grub-btrfs"
fi
"$ESCALATION_TOOL" "$PACKAGER" install -y make git inotify-tools
cd "$HOME" && git clone https://github.com/Antynea/grub-btrfs
printf "%b\n" "${YELLOW}Installing grub-btrfs...${RC}"
cd "$HOME/grub-btrfs"
printf "%b\n" "${YELLOW}Modifying grub-btrfs configuration for Fedora...${RC}"
sed -i'' '/#GRUB_BTRFS_SNAPSHOT_KERNEL/a GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="systemd.volatile=state"' config
sed -i'' '/#GRUB_BTRFS_GRUB_DIRNAME/a GRUB_BTRFS_GRUB_DIRNAME="/boot/grub2"' config
sed -i'' '/#GRUB_BTRFS_MKCONFIG=/a GRUB_BTRFS_MKCONFIG=/sbin/grub2-mkconfig' config
sed -i'' '/#GRUB_BTRFS_SCRIPT_CHECK=/a GRUB_BTRFS_SCRIPT_CHECK=grub2-script-check' config
"$ESCALATION_TOOL" make install
printf "%b\n" "${YELLOW}Updating grub configuration and enabling grub-btrfsd service...${RC}"
"$ESCALATION_TOOL" grub2-mkconfig -o /boot/grub2/grub.cfg && "$ESCALATION_TOOL" systemctl enable --now grub-btrfsd.service
printf "%b\n" "${YELLOW}Cleaning up installation files...${RC}"
cd .. && rm -rf "$HOME/grub-btrfs"
printf "%b\n" "${GREEN}Grub-btrfs installed and service enabled.${RC}"
printf "%b\n" "${CYAN}Notice: To perform a system recovery via grub-btrfs, perform a restore operation with Btrfs Assistant GUI after booting into the snapshot.${RC}"
mitigateTpmError
}
mitigateTpmError() {
printf "%b\n" "${YELLOW}===============================================${RC}"
printf "%b\n" "${YELLOW}Mitigation for 'tpm.c:150:unknown TPM error'...${RC}"
printf "%b\n" "${YELLOW}===============================================${RC}"
printf "%b\n" "${YELLOW}Some systems with secure boot/tpm may encounter 'tpm.c:150:unknown TPM error' when booting into snapshots.${RC}"
printf "%b\n" "${YELLOW}If you encounter this issue, you can come back later and apply this mitigation or you can apply it now.${RC}"
while true; do
printf "%b\n" "${YELLOW}Do you want to apply the TPM error mitigation? (y/n): ${RC}"
read -r response
case "$response" in
[yY]*)
printf "%b\n" "${YELLOW}Creating /etc/grub.d/02_tpm file...${RC}"
echo '#!/bin/sh' | "$ESCALATION_TOOL" tee /etc/grub.d/02_tpm > /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

View File

@ -8,6 +8,8 @@ multimedia() {
if [ -e /etc/yum.repos.d/rpmfusion-free.repo ] && [ -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then if [ -e /etc/yum.repos.d/rpmfusion-free.repo ] && [ -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then
printf "%b\n" "${YELLOW}Installing Multimedia Codecs...${RC}" printf "%b\n" "${YELLOW}Installing Multimedia Codecs...${RC}"
"$ESCALATION_TOOL" "$PACKAGER" swap ffmpeg-free ffmpeg --allowerasing -y "$ESCALATION_TOOL" "$PACKAGER" swap ffmpeg-free ffmpeg --allowerasing -y
"$ESCALATION_TOOL" "$PACKAGER" update @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin -y
"$ESCALATION_TOOL" "$PACKAGER" update @sound-and-video -y
printf "%b\n" "${GREEN}Multimedia Codecs Installed...${RC}" printf "%b\n" "${GREEN}Multimedia Codecs Installed...${RC}"
else else
printf "%b\n" "${RED}RPM Fusion repositories not found. Please set up RPM Fusion first!${RC}" printf "%b\n" "${RED}RPM Fusion repositories not found. Please set up RPM Fusion first!${RC}"

View File

@ -1,11 +1,10 @@
#!/bin/sh -e #!/bin/sh -e
# shellcheck disable=SC2086
. ../common-script.sh . ../common-script.sh
installDepend() { installDepend() {
DEPENDENCIES='wine dbus git' # Check for dependencies
DEPENDENCIES='wine dbus'
printf "%b\n" "${YELLOW}Installing dependencies...${RC}" printf "%b\n" "${YELLOW}Installing dependencies...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
@ -22,20 +21,17 @@ installDepend() {
alsa-utils alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib giflib lib32-giflib libpng lib32-libpng \ 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 \ 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 \ 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 lib32-sdl2 v4l-utils lib32-v4l-utils sqlite lib32-sqlite" gst-plugins-base-libs lib32-gst-plugins-base-libs sdl2"
$AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS $AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS
;; ;;
apt-get | nala) apt-get|nala)
DISTRO_DEPS="libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386 wine64 wine32" DISTRO_DEPS="libasound2 libsdl2 wine64 wine32"
"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" dpkg --add-architecture i386 "$ESCALATION_TOOL" dpkg --add-architecture i386
if [ "$DTYPE" != "pop" ]; then
"$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common "$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common
"$ESCALATION_TOOL" apt-add-repository contrib -y "$ESCALATION_TOOL" apt-add-repository contrib -y
fi
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS
;; ;;
@ -54,8 +50,7 @@ installDepend() {
"$ESCALATION_TOOL" "$PACKAGER" -n install $DEPENDENCIES "$ESCALATION_TOOL" "$PACKAGER" -n install $DEPENDENCIES
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager ${PACKAGER}${RC}" "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
exit 1
;; ;;
esac esac
} }
@ -66,7 +61,7 @@ installAdditionalDepend() {
DISTRO_DEPS='steam lutris goverlay' DISTRO_DEPS='steam lutris goverlay'
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS
;; ;;
apt-get | nala) apt-get|nala)
version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris | version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris |
grep -v 'beta' | grep -v 'beta' |
tail -n1 | tail -n1 |
@ -76,7 +71,7 @@ installAdditionalDepend() {
curl -sSLo "lutris_${version_no_v}_all.deb" "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb" 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}" printf "%b\n" "${YELLOW}Installing Lutris...${RC}"
"$ESCALATION_TOOL" "$PACKAGER" install -y ./lutris_"${version_no_v}"_all.deb "$ESCALATION_TOOL" "$PACKAGER" install ./lutris_"${version_no_v}"_all.deb
rm lutris_"${version_no_v}"_all.deb rm lutris_"${version_no_v}"_all.deb
@ -95,12 +90,11 @@ installAdditionalDepend() {
"$ESCALATION_TOOL" "$PACKAGER" install -y $DISTRO_DEPS "$ESCALATION_TOOL" "$PACKAGER" install -y $DISTRO_DEPS
;; ;;
zypper) zypper)
# Flatpak
DISTRO_DEPS='lutris' DISTRO_DEPS='lutris'
"$ESCALATION_TOOL" "$PACKAGER" -n install $DISTRO_DEPS "$ESCALATION_TOOL" "$PACKAGER" -n install $DISTRO_DEPS
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager ${PACKAGER}${RC}"
exit 1
;; ;;
esac esac
} }

View File

@ -1,7 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ../common-script.sh . ../common-script.sh
. ../common-service-script.sh
cleanup_system() { cleanup_system() {
printf "%b\n" "${YELLOW}Performing system cleanup...${RC}" printf "%b\n" "${YELLOW}Performing system cleanup...${RC}"
@ -22,10 +21,7 @@ cleanup_system() {
;; ;;
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm "$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null || true "$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null 2>&1
;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" cache clean
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}. Skipping.${RC}" printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}. Skipping.${RC}"
@ -43,9 +39,7 @@ common_cleanup() {
if [ -d /var/log ]; then if [ -d /var/log ]; then
"$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \; "$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
fi fi
if [ "$INIT_MANAGER" = "systemctl" ]; then
"$ESCALATION_TOOL" journalctl --vacuum-time=3d "$ESCALATION_TOOL" journalctl --vacuum-time=3d
fi
} }
clean_data() { clean_data() {

View File

@ -5,85 +5,77 @@
fastUpdate() { fastUpdate() {
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$AUR_HELPER" -S --needed --noconfirm rate-mirrors-bin
$AUR_HELPER -S --needed --noconfirm rate-mirrors-bin
printf "%b\n" "${YELLOW}Generating a new list of mirrors using rate-mirrors. This process may take a few seconds...${RC}" printf "%b\n" "${YELLOW}Generating a new list of mirrors using rate-mirrors. This process may take a few seconds...${RC}"
if [ -s "/etc/pacman.d/mirrorlist" ]; then if [ -s /etc/pacman.d/mirrorlist ]; then
"$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak "$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
fi fi
# If for some reason DTYPE is still unknown use always arch so the rate-mirrors does not fail # If for some reason DTYPE is still unknown use always arch so the rate-mirrors does not fail
dtype_local="$DTYPE" dtype_local=${DTYPE}
if [ "$dtype_local" = "unknown" ]; then if [ "${DTYPE}" = "unknown" ]; then
dtype_local="arch" dtype_local="arch"
fi fi
if ! "$ESCALATION_TOOL" rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root "$dtype_local" > /dev/null || [ ! -s "/etc/pacman.d/mirrorlist" ]; then "$ESCALATION_TOOL" rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root ${dtype_local}
if [ $? -ne 0 ] || [ ! -s /etc/pacman.d/mirrorlist ]; then
printf "%b\n" "${RED}Rate-mirrors failed, restoring backup.${RC}" printf "%b\n" "${RED}Rate-mirrors failed, restoring backup.${RC}"
"$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist "$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist
fi fi
;; ;;
apt-get|nala) apt-get|nala)
if [ "$PACKAGER" = "apt-get" ]; then "$ESCALATION_TOOL" apt-get update
printf "%b\n" "${YELLOW}Installing nala for faster updates.${RC}" if ! command_exists nala; then
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; }
if "$ESCALATION_TOOL" "$PACKAGER" install -y nala; then
PACKAGER="nala";
printf "%b\n" "${CYAN}Using $PACKAGER as package manager${RC}"
else
printf "%b\n" "${RED}Nala installation failed.${RC}"
printf "%b\n" "${YELLOW}Falling back to apt-get.${RC}"
fi
fi fi
if [ "$PACKAGER" = "nala" ]; then if [ "$PACKAGER" = "nala" ]; then
if [ -f "/etc/apt/sources.list.d/nala-sources.list" ]; then "$ESCALATION_TOOL" cp /etc/apt/sources.list /etc/apt/sources.list.bak
"$ESCALATION_TOOL" cp /etc/apt/sources.list.d/nala-sources.list /etc/apt/sources.list.d/nala-sources.list.bak "$ESCALATION_TOOL" nala update
fi PACKAGER="nala"
if ! "$ESCALATION_TOOL" nala fetch --auto -y || [ ! -s "/etc/apt/sources.list.d/nala-sources.list" ]; then
printf "%b\n" "${RED}Nala fetch failed, restoring backup.${RC}"
"$ESCALATION_TOOL" cp /etc/apt/sources.list.d/nala-sources.list.bak /etc/apt/sources.list.d/nala-sources.list
fi
fi fi
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
;; ;;
dnf) dnf)
"$ESCALATION_TOOL" "$PACKAGER" update -y "$ESCALATION_TOOL" "$PACKAGER" update -y
;; ;;
zypper) zypper)
"$ESCALATION_TOOL" "$PACKAGER" ref "$ESCALATION_TOOL" "$PACKAGER" ref
;; "$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup
apk)
"$ESCALATION_TOOL" "$PACKAGER" update
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
exit 1 exit 1
;; ;;
esac esac
} }
updateSystem() { updateSystem() {
printf "%b\n" "${YELLOW}Updating system packages.${RC}" printf "%b\n" "${GREEN}Updating system${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y "$ESCALATION_TOOL" "$PACKAGER" upgrade -y
;; ;;
dnf) dnf)
"$ESCALATION_TOOL" "$PACKAGER" update -y
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y "$ESCALATION_TOOL" "$PACKAGER" upgrade -y
;; ;;
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -Sy --noconfirm --needed archlinux-keyring "$ESCALATION_TOOL" "$PACKAGER" -Sy --noconfirm --needed archlinux-keyring
"$AUR_HELPER" -Su --noconfirm "$ESCALATION_TOOL" "$PACKAGER" -Su --noconfirm
;; ;;
zypper) zypper)
"$ESCALATION_TOOL" "$PACKAGER" ref
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup "$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" upgrade
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
exit 1 exit 1
;; ;;
esac esac
@ -91,8 +83,18 @@ updateSystem() {
updateFlatpaks() { updateFlatpaks() {
if command_exists flatpak; then if command_exists flatpak; then
printf "%b\n" "${YELLOW}Updating flatpak packages.${RC}" printf "%b\n" "${YELLOW}Updating installed Flathub apps...${RC}"
flatpak update -y installed_apps=$(flatpak list --app --columns=application)
if [ -z "$installed_apps" ]; then
printf "%b\n" "${RED}No Flathub apps are installed.${RC}"
return
fi
for app in $installed_apps; do
printf "%b\n" "${YELLOW}Updating $app...${RC}"
flatpak update -y "$app"
done
fi fi
} }

View File

@ -1,4 +1,5 @@
name = "System Setup" name = "System Setup"
multi_selectable = false
[[data]] [[data]]
name = "Arch Linux" name = "Arch Linux"
@ -13,40 +14,16 @@ name = "Arch Server Setup"
description = "This command installs a minimal arch server setup under 5 minutes." description = "This command installs a minimal arch server setup under 5 minutes."
script = "arch/server-setup.sh" script = "arch/server-setup.sh"
task_list = "SI D" task_list = "SI D"
multi_select = false
[[data.entries]]
name ="Linux Neptune for SteamDeck"
description = "Valve's fork of Linux Kernel for the SteamDeck"
script = "arch/linux-neptune.sh"
task_list = "I PFM K"
[[data.entries.preconditions]]
matches = true
data = { file = "/sys/devices/virtual/dmi/id/board_vendor" }
values = [ "Valve" ]
[[data.entries]]
name = "Nvidia Drivers && Hardware Acceleration"
description = "This script installs and configures nvidia drivers with Hardware Acceleration."
script = "arch/nvidia-drivers.sh"
task_list = "I FM SS"
[[data.entries]] [[data.entries]]
name = "Paru AUR Helper" name = "Paru AUR Helper"
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" 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"
script = "arch/paru-setup.sh" script = "arch/paru-setup.sh"
task_list = "I" task_list = "I"
[[data.entries]]
name = "Virtualization"
description = "QEMU, Libvirt, Virt-Manager installation and configuration."
script = "arch/virtualization.sh"
task_list = "FM I SS RP"
[[data.entries]] [[data.entries]]
name = "Yay AUR Helper" name = "Yay AUR Helper"
description = "Yet Another Yogurt - An AUR Helper Written in Go. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers" description = "Yet Another Yogurt - An AUR Helper Written in Go.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
script = "arch/yay-setup.sh" script = "arch/yay-setup.sh"
task_list = "I" task_list = "I"
@ -78,7 +55,7 @@ task_list = "I"
[[data.entries]] [[data.entries]]
name = "RPM Fusion" name = "RPM Fusion"
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/" 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/"
script = "fedora/rpm-fusion-setup.sh" script = "fedora/rpm-fusion-setup.sh"
task_list = "MP" task_list = "MP"
@ -94,17 +71,6 @@ description = "Enables Virtualization through dnf"
script = "fedora/virtualization.sh" script = "fedora/virtualization.sh"
task_list = "I" 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]] [[data]]
name = "Build Prerequisites" name = "Build Prerequisites"
description = "This script is designed to handle the installation of various software dependencies across different Linux distributions" description = "This script is designed to handle the installation of various software dependencies across different Linux distributions"
@ -116,14 +82,12 @@ 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." description = "This script is designed to remove unnecessary packages, clean old cache files, remove temporary files, and to empty the trash."
script = "system-cleanup.sh" script = "system-cleanup.sh"
task_list = "RP PFM" task_list = "RP PFM"
multi_select = false
[[data]] [[data]]
name = "Full System Update" name = "Full System Update"
description = "This command updates your system to the latest packages available for your distro" description = "This command updates your system to the latest packages available for your distro"
script = "system-update.sh" script = "system-update.sh"
task_list = "PFM" task_list = "PFM"
multi_select = false
[[data]] [[data]]
name = "Gaming Dependencies" name = "Gaming Dependencies"

View File

@ -1,7 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ../common-script.sh . ../common-script.sh
. ../common-service-script.sh
# Function to check Bluez is installed # Function to check Bluez is installed
setupBluetooth() { setupBluetooth() {
@ -11,9 +10,6 @@ setupBluetooth() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm bluez-utils "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm bluez-utils
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add bluez
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y bluez "$ESCALATION_TOOL" "$PACKAGER" install -y bluez
;; ;;
@ -22,7 +18,15 @@ setupBluetooth() {
printf "%b\n" "${GREEN}Bluez is already installed.${RC}" printf "%b\n" "${GREEN}Bluez is already installed.${RC}"
fi fi
startService bluetooth # Check if bluetooth service is running
if ! systemctl is-active --quiet bluetooth; then
printf "%b\n" "${YELLOW}Bluetooth service is not running. Starting it now...${RC}"
"$ESCALATION_TOOL" systemctl start bluetooth
if systemctl is-active --quiet bluetooth; then
printf "%b\n" "${GREEN}Bluetooth service started successfully.${RC}"
fi
fi
} }
# Function to display the main menu # Function to display the main menu

View File

@ -12,7 +12,6 @@ list_devices() {
printf "\n" printf "\n"
} }
# shellcheck disable=SC2086
installDependencies() { installDependencies() {
DEPENDENCIES="xz gzip bzip2 jq" DEPENDENCIES="xz gzip bzip2 jq"
if ! command_exists ${DEPENDENCIES}; then if ! command_exists ${DEPENDENCIES}; then
@ -24,8 +23,6 @@ installDependencies() {
"${ESCALATION_TOOL}" "${PACKAGER}" install -y ${DEPENDENCIES};; "${ESCALATION_TOOL}" "${PACKAGER}" install -y ${DEPENDENCIES};;
pacman) pacman)
"${ESCALATION_TOOL}" "${PACKAGER}" -S --noconfirm --needed ${DEPENDENCIES};; "${ESCALATION_TOOL}" "${PACKAGER}" -S --noconfirm --needed ${DEPENDENCIES};;
apk)
"${ESCALATION_TOOL}" "${PACKAGER}" add ${DEPENDENCIES};;
*) *)
printf "%b\n" "${RED}Unsupported package manager.${RC}" printf "%b\n" "${RED}Unsupported package manager.${RC}"
exit 1 exit 1

View File

@ -19,9 +19,6 @@ if ! command_exists openssl; then
zypper) zypper)
"$ESCALATION_TOOL" "$PACKAGER" install openssl "$ESCALATION_TOOL" "$PACKAGER" install openssl
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add openssl
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1 exit 1

View File

@ -1,7 +1,11 @@
#!/bin/sh -e #!/bin/sh -e
. ../common-script.sh . ../common-script.sh
. ../common-service-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() { create_file() {
printf "%b\n" "Creating script..." printf "%b\n" "Creating script..."
@ -17,6 +21,7 @@ EOF
"$ESCALATION_TOOL" chmod +x /usr/local/bin/numlock "$ESCALATION_TOOL" chmod +x /usr/local/bin/numlock
} }
# Create a systemd service to run the script on boot
create_service() { create_service() {
printf "%b\n" "Creating service..." printf "%b\n" "Creating service..."
"$ESCALATION_TOOL" tee "/etc/systemd/system/numlock.service" >/dev/null <<'EOF' "$ESCALATION_TOOL" tee "/etc/systemd/system/numlock.service" >/dev/null <<'EOF'
@ -34,11 +39,7 @@ EOF
} }
numlockSetup() { numlockSetup() {
if [ "$INIT_MANAGER" = "rc-service" ]; then # Check if the script and service files exists
printf "%b\n" "${RED}Unsupported init system.${RC}"
exit 1
fi
if [ ! -f "/usr/local/bin/numlock" ]; then if [ ! -f "/usr/local/bin/numlock" ]; then
create_file create_file
fi fi
@ -50,10 +51,10 @@ numlockSetup() {
printf "%b" "Do you want to enable Numlock on boot? (y/N): " printf "%b" "Do you want to enable Numlock on boot? (y/N): "
read -r confirm read -r confirm
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
enableService numlock "$ESCALATION_TOOL" systemctl enable numlock.service --quiet
printf "%b\n" "Numlock will be enabled on boot" printf "%b\n" "Numlock will be enabled on boot"
else else
disableService numlock "$ESCALATION_TOOL" systemctl disable numlock.service --quiet
printf "%b\n" "Numlock will not be enabled on boot" printf "%b\n" "Numlock will not be enabled on boot"
fi fi
} }

View File

@ -10,8 +10,8 @@ installollama() {
printf "%b\n" "${GREEN}ollama is already installed.${RC}" printf "%b\n" "${GREEN}ollama is already installed.${RC}"
else else
printf "%b\n" "${YELLOW}Installing ollama...${RC}" printf "%b\n" "${YELLOW}Installing ollama...${RC}"
curl -fsSL https://ollama.com/install.sh | "$ESCALATION_TOOL" sh curl -fsSL https://ollama.com/install.sh | sh
"$ESCALATION_TOOL" startService ollama "$ESCALATION_TOOL" systemctl start ollama
fi fi
} }

View File

@ -19,9 +19,6 @@ installAutoCpufreq() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm git "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm git
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add git
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y git "$ESCALATION_TOOL" "$PACKAGER" install -y git
;; ;;
@ -48,7 +45,7 @@ configureAutoCpufreq() {
if command_exists auto-cpufreq; then if command_exists auto-cpufreq; then
# Check if the system has a battery to determine if it's a laptop # Check if the system has a battery to determine if it's a laptop
if ls /sys/class/power_supply/BAT* >/dev/null 2>&1; then if [ -d /sys/class/power_supply/BAT0 ]; then
printf "%b\n" "${GREEN}System detected as laptop. Updating auto-cpufreq for laptop...${RC}" printf "%b\n" "${GREEN}System detected as laptop. Updating auto-cpufreq for laptop...${RC}"
"$ESCALATION_TOOL" auto-cpufreq --force powersave "$ESCALATION_TOOL" auto-cpufreq --force powersave
else else

View File

@ -1,27 +0,0 @@
#!/bin/sh -e
. ../../common-script.sh
installCUPS() {
clear
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm cups
;;
apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y cups
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y cups
;;
*)
printf "%b\n" "${RED}Unsupported package manager ${PACKAGER}${RC}"
exit 1
;;
esac
}
checkEnv
checkEscalationTool
installCUPS

View File

@ -1,30 +0,0 @@
#!/bin/sh -e
. ../../common-script.sh
. ./install-cups.sh
installEpsonPrinterDriver() {
clear
case "$PACKAGER" in
pacman)
"$AUR_HELPER" -S --noconfirm epson-inkjet-printer-escpr
;;
apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y printer-driver-escpr
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y epson-inkjet-printer-escpr
;;
*)
printf "%b\n" "${RED}Unsupported package manager ${PACKAGER}${RC}"
exit 1
;;
esac
}
checkEnv
checkEscalationTool
checkAURHelper
installCUPS
installEpsonPrinterDriver

View File

@ -11,9 +11,6 @@ install_package() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$PACKAGE" "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$PACKAGE"
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add "$PACKAGE"
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y "$PACKAGE" "$ESCALATION_TOOL" "$PACKAGER" install -y "$PACKAGE"
;; ;;
@ -37,23 +34,23 @@ setup_ssh() {
install_package openssh install_package openssh
SSH_SERVICE="sshd" SSH_SERVICE="sshd"
;; ;;
apk)
install_package openssh
SSH_SERVICE="sshd"
;;
*) *)
install_package openssh-server install_package openssh-server
SSH_SERVICE="sshd" SSH_SERVICE="sshd"
;; ;;
esac esac
startAndEnableService "$SSH_SERVICE" # Enable and start the appropriate SSH service
"$ESCALATION_TOOL" systemctl enable "$SSH_SERVICE"
"$ESCALATION_TOOL" systemctl start "$SSH_SERVICE"
# Get the local IP address
LOCAL_IP=$(ip -4 addr show | awk '/inet / {print $2}' | tail -n 1) LOCAL_IP=$(ip -4 addr show | awk '/inet / {print $2}' | tail -n 1)
printf "%b\n" "${GREEN}Your local IP address is: $LOCAL_IP${RC}" printf "%b\n" "${GREEN}Your local IP address is: $LOCAL_IP${RC}"
if isServiceActive "$SSH_SERVICE"; then # Check if SSH is running
if systemctl is-active --quiet "$SSH_SERVICE"; then
printf "%b\n" "${GREEN}SSH is up and running.${RC}" printf "%b\n" "${GREEN}SSH is up and running.${RC}"
else else
printf "%b\n" "${RED}Failed to start SSH.${RC}" printf "%b\n" "${RED}Failed to start SSH.${RC}"
@ -133,11 +130,12 @@ setup_samba() {
EOL EOL
fi fi
for service in smb nmb; do # Enable and start Samba services
startAndEnableService "$service" "$ESCALATION_TOOL" systemctl enable smb nmb
done "$ESCALATION_TOOL" systemctl start smb nmb
if isServiceActive smb && isServiceActive nmb; then # Check if Samba is running
if systemctl is-active --quiet smb && systemctl is-active --quiet nmb; then
printf "%b\n" "${GREEN}Samba is up and running.${RC}" printf "%b\n" "${GREEN}Samba is up and running.${RC}"
printf "%b\n" "${YELLOW}Samba share available at: $SHARED_DIR${RC}" printf "%b\n" "${YELLOW}Samba share available at: $SHARED_DIR${RC}"
else else

View File

@ -1,8 +1,8 @@
name = "Utilities" name = "Utilities"
multi_selectable = false
[[data]] [[data]]
name = "Monitor Control" name = "Monitor Control"
multi_select = false
[[data.preconditions]] [[data.preconditions]]
matches = true matches = true
@ -76,24 +76,8 @@ name = "Set Resolution"
description = "This script is designed to change the resolution of monitors connected to your system" description = "This script is designed to change the resolution of monitors connected to your system"
script = "monitor-control/set_resolutions.sh" script = "monitor-control/set_resolutions.sh"
[[data]]
name = "Printers"
[[data.entries]]
name = "CUPS"
script = "printers/install-cups.sh"
description = "This script will install the CUPS system, required for most printer drivers on Linux."
task_list = "I"
[[data.entries]]
name = "Epson printer drivers"
script = "printers/install-epson-printer-drivers.sh"
description = "This script will install the Epson printer drivers."
task_list = "I"
[[data]] [[data]]
name = "User Account Manager" name = "User Account Manager"
multi_select = false
[[data.entries]] [[data.entries]]
name = "Add User" name = "Add User"
@ -120,7 +104,6 @@ name = "Auto Mount Drive"
description = "This utility is designed to help with automating the process of mounting a drive on to your system." description = "This utility is designed to help with automating the process of mounting a drive on to your system."
script = "auto-mount.sh" script = "auto-mount.sh"
task_list = "PFM" task_list = "PFM"
multi_select = false
[[data]] [[data]]
name = "Auto Login" name = "Auto Login"
@ -137,7 +120,6 @@ name = "Bluetooth Manager"
description = "This utility is designed to manage bluetooth in your system" description = "This utility is designed to manage bluetooth in your system"
script = "bluetooth-control.sh" script = "bluetooth-control.sh"
task_list = "I SS" task_list = "I SS"
multi_select = false
[[data]] [[data]]
name = "Bootable USB Creator" name = "Bootable USB Creator"
@ -151,7 +133,7 @@ task_list = "I FM"
[[data]] [[data]]
name = "Numlock on Startup" name = "Numlock on Startup"
description = "This utility is designed to enable Num Lock at boot, rather than within desktop environments like KDE or GNOME" description = "This utility is designed to configure auto enabling of numlock on boot"
script = "numlock.sh" script = "numlock.sh"
task_list = "PFM SS" task_list = "PFM SS"

View File

@ -12,11 +12,8 @@ install_timeshift() {
pacman) pacman)
"$ESCALATION_TOOL" "${PACKAGER}" -S --noconfirm timeshift "$ESCALATION_TOOL" "${PACKAGER}" -S --noconfirm timeshift
;; ;;
dnf|zypper|apt-get|nala)
"$ESCALATION_TOOL" "${PACKAGER}" install -y timeshift
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager.${RC}" "$ESCALATION_TOOL" "${PACKAGER}" install -y timeshift
;; ;;
esac esac
else else

View File

@ -13,9 +13,6 @@ setup_xrandr() {
apt-get|nala) apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y x11-xserver-utils "$ESCALATION_TOOL" "$PACKAGER" install -y x11-xserver-utils
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add xrandr
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-server-utils "$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-server-utils
;; ;;

View File

@ -1,7 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ../common-script.sh . ../common-script.sh
. ../common-service-script.sh
# Function to check if NetworkManager is installed # Function to check if NetworkManager is installed
setupNetworkManager() { setupNetworkManager() {
@ -14,9 +13,6 @@ setupNetworkManager() {
dnf) dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y NetworkManager-1 "$ESCALATION_TOOL" "$PACKAGER" install -y NetworkManager-1
;; ;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add networkmanager-wifi iwd
;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y network-manager "$ESCALATION_TOOL" "$PACKAGER" install -y network-manager
;; ;;
@ -26,12 +22,14 @@ setupNetworkManager() {
fi fi
# Check if NetworkManager service is running # Check if NetworkManager service is running
if ! isServiceActive NetworkManager; then if ! systemctl is-active --quiet NetworkManager; then
printf "%b\n" "${YELLOW}NetworkManager service is not running. Starting it now...${RC}" printf "%b\n" "${YELLOW}NetworkManager service is not running. Starting it now...${RC}"
startService NetworkManager "$ESCALATION_TOOL" systemctl start NetworkManager
else
if systemctl is-active --quiet NetworkManager; then
printf "%b\n" "${GREEN}NetworkManager service started successfully.${RC}" printf "%b\n" "${GREEN}NetworkManager service started successfully.${RC}"
fi fi
fi
} }
# Function to display the main menu # Function to display the main menu

4
docs/KnownIssues.md Normal file
View File

@ -0,0 +1,4 @@
# Known Issues
---
- [Known Issues](https://github.com/ChrisTitusTech/linutil/issues)

BIN
docs/assets/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

89
docs/assets/preview.tape Normal file
View File

@ -0,0 +1,89 @@
# VHS documentation
#
# Output:
# Output <path>.gif Create a GIF output at the given <path>
# Output <path>.mp4 Create an MP4 output at the given <path>
# Output <path>.webm Create a WebM output at the given <path>
#
# Require:
# Require <string> Ensure a program is on the $PATH to proceed
#
# Settings:
# Set FontSize <number> Set the font size of the terminal
# Set FontFamily <string> Set the font family of the terminal
# Set Height <number> Set the height of the terminal
# Set Width <number> Set the width of the terminal
# Set LetterSpacing <float> Set the font letter spacing (tracking)
# Set LineHeight <float> Set the font line height
# Set LoopOffset <float>% Set the starting frame offset for the GIF loop
# Set Theme <json|string> Set the theme of the terminal
# Set Padding <number> Set the padding of the terminal
# Set Framerate <number> Set the framerate of the recording
# Set PlaybackSpeed <float> Set the playback speed of the recording
# Set MarginFill <file|#000000> Set the file or color the margin will be filled with.
# Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set.
# Set BorderRadius <number> Set terminal border radius, in pixels.
# Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight)
# Set WindowBarSize <number> Set window bar size, in pixels. Default is 40.
# Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms.
#
# Sleep:
# Sleep <time> Sleep for a set amount of <time> in seconds
#
# Type:
# Type[@<time>] "<characters>" Type <characters> into the terminal with a
# <time> delay between each character
#
# Keys:
# Escape[@<time>] [number] Press the Escape key
# Backspace[@<time>] [number] Press the Backspace key
# Delete[@<time>] [number] Press the Delete key
# Insert[@<time>] [number] Press the Insert key
# Down[@<time>] [number] Press the Down key
# Enter[@<time>] [number] Press the Enter key
# Space[@<time>] [number] Press the Space key
# Tab[@<time>] [number] Press the Tab key
# Left[@<time>] [number] Press the Left Arrow key
# Right[@<time>] [number] Press the Right Arrow key
# Up[@<time>] [number] Press the Up Arrow key
# Down[@<time>] [number] Press the Down Arrow key
# PageUp[@<time>] [number] Press the Page Up key
# PageDown[@<time>] [number] Press the Page Down key
# Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C)
#
# Display:
# Hide Hide the subsequent commands from the output
# Show Show the subsequent commands in the output
Output preview.gif
Require linutil
Require sh
Set Shell "bash"
Set FontFamily "JetBrainsMono Nerd Font"
Set FontSize 24
Set Width 1920
Set Height 1080
Sleep 1s
Type "linutil" Sleep 1s Enter
Sleep 5s
Left Sleep 2s
Down Sleep 1s
Down Sleep 1s
Down Sleep 1s
Down Sleep 2s
Right Sleep 3s
Type "/" Sleep 1s
Type@200ms "System Cleanup" Sleep 1s Enter
Sleep 2s
Enter Sleep 3s
Type "y" Sleep 15s # CONFIRMATION PROMPT
Escape

72
docs/contributing.md Normal file
View File

@ -0,0 +1,72 @@
<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->
# Contributing Guidelines for Linutil
Thank you for considering contributing to Linutil! We appreciate your effort in helping improve this project. To ensure that your contributions align with the goals and quality standards of Linutil, please follow these guidelines:
## 1. **Install Rust**:
Make sure you have Rust installed on your machine. You can install it by following the instructions at [rust-lang.org](https://www.rust-lang.org/tools/install).
## 2. **Fork and Clone the repo**
1. Make a fork of the repo in GitHub
2. Clone the fork
```bash
git clone https://github.com/YOUR_USERNAME_HERE/linutil.git
cd linutil
```
## 3. Make your changes
- **Edit the files you want to change**: Make your changes to the relevant files.
- **Test your changes**: Run `cargo run` to test your modifications in a local environment and ensure everything works as expected.
## 4. Understand the existing code
- **Have a clear reason**: Dont change the way things are done without a valid reason. If you propose an alteration, be prepared to explain why its necessary and how it improves the project.
- **Respect existing conventions**: Changes should align with the existing code style, design patterns, and overall project philosophy. If you want to introduce a new way of doing things, justify it clearly.
## 5. Learn from Past Pull Requests (PRs)
- **Check merged PRs**: Reviewing merged pull requests can give you an idea of what kind of contributions are accepted and how they are implemented.
- **Study rejected PRs**: This is especially important as it helps you avoid making similar mistakes or proposing changes that have already been considered and declined.
## 6. Write Clean, Descriptive Commit Messages
- **Be descriptive**: Your commit messages should clearly describe what the change does and why it was made.
- **Use the imperative mood**: For example, "Add feature X" or "Fix bug in Y", rather than "Added feature X" or "Fixed bug in Y".
- **Keep commits clean**: Avoid committing a change and then immediately following it with a fix for that change. Instead, amend your commit or squash it if needed.
## 7. Keep Your Pull Requests (PRs) Small and Focused
- **Make small, targeted PRs**: Focus on one feature or fix per pull request. This makes it easier to review and increases the likelihood of acceptance.
- **Avoid combining unrelated changes**: PRs that tackle multiple unrelated issues are harder to review and might be rejected because of a single problem.
## 8. Understand and Test the Code You Write
- **Review your code**: Before submitting your changes, take the time to review your code for readability, efficiency and performance. Consider how your changes affect the project.
- **Avoid using LLMs**: Don't submit AI-generated code without reviewing and testing it first. Ensure that any code you submit is thoroughly understood and meets the project's standards.
- **Testing Requirements**: Failure to conduct testing after multiple requests may result in the closure of your Pull Request.
## 9. Code Review and Feedback
- **Expect feedback**: PRs will undergo code review. Be open to feedback and willing to make adjustments as needed.
- **Participate in reviews**: If you feel comfortable, review other contributors' PRs as well. Peer review is a great way to learn and ensure high-quality contributions.
## 10. Contributing Is More Than Just Code
- **Test the tool**: Running tests and providing feedback on how the tool works in different environments is a valuable contribution.
- **Write well-formed issues**: Clearly describe bugs or problems you encounter, providing as much detail as possible, including steps to reproduce the issue.
- **Propose reasonable feature requests**: When suggesting new features, ensure they fit within the scope, style, and design of the project. Provide clear reasoning and use cases.
## 11. Documentation
- **Update the documentation**: If your change affects the functionality, please update the relevant documentation files to reflect this.
- **Automatic generation**: If you decide to add functionality through a new shell script, make sure to fill out all fields in `tab_data.toml` and run `cargo xtask docgen`.
## 12. License
- **Agree to the license**: By contributing to Linutil, you agree that your contributions will be licensed under the project's MIT license.
We appreciate your contributions and look forward to collaborating with you to make Linutil better!

4
docs/faq.md Normal file
View File

@ -0,0 +1,4 @@
# FAQ's
## How do I uninstall LinUtil?
* You do not have to uninstall LinUtil. As it is a script you run from your terminal it only loads into your RAM. This means as soon as you close LinUtil it will be deleted off your system.

76
docs/index.md Normal file
View File

@ -0,0 +1,76 @@
# Welcome to the LinUtil Documentation!
[![Version](https://img.shields.io/github/v/release/ChrisTitusTech/linutil?color=%230567ff&label=Latest%20Release&style=for-the-badge)](https://github.com/ChrisTitusTech/linutil/releases/latest)
![GitHub Downloads (specific asset, all releases)](https://img.shields.io/github/downloads/ChrisTitusTech/linutil/linutil?label=Total%20Downloads&style=for-the-badge)
[![](https://dcbadge.limes.pink/api/server/https://discord.gg/bujFYKAHSp)](https://discord.gg/bujFYKAHSp)
[![Crates.io Version](https://img.shields.io/crates/v/linutil_tui?style=for-the-badge&color=%23af3a03)](https://crates.io/crates/linutil_tui) [![linutil AUR Version](https://img.shields.io/aur/version/linutil?style=for-the-badge&label=%5BAUR%5D%20linutil&color=%23230567ff)](https://aur.archlinux.org/packages/linutil) [![linutil-bin AUR Version](https://img.shields.io/aur/version/linutil-bin?style=for-the-badge&label=%5BAUR%5D%20linutil-bin&color=%23230567ff)](https://aur.archlinux.org/packages/linutil-bin)
## Running the latest release of LinUtil
To get started, run the following command in your terminal:
### Stable branch
```
curl -fsSL https://christitus.com/linux | sh
```
---
### Installation
LinUtil is also available as a package in various repositories:
[![Packaging status](https://repology.org/badge/vertical-allrepos/linutil.svg)](https://repology.org/project/linutil/versions)
<details>
<summary>Arch Linux</summary>
LinUtil can be installed on [Arch Linux](https://archlinux.org) with three different [AUR](https://aur.archlinux.org) packages:
- `linutil` - Stable release compiled from source
- `linutil-bin` - Stable release pre-compiled
- `linutil-git` - Compiled from the last commit (not recommended)
by running:
```bash
git clone https://aur.archlinux.org/<package>.git
cd linutil
makepkg -si
```
Replace `<package>` with your preferred package.
If you use [yay](https://github.com/Jguer/yay), [paru](https://github.com/Morganamilo/paru) or any other [AUR Helper](https://wiki.archlinux.org/title/AUR_helpers), it's even simpler:
```bash
paru -S linutil
```
Replace `paru` with your preferred helper and `linutil` with your preferred package.
</details>
<details>
<summary>Cargo</summary>
LinUtil can be installed via [Cargo](https://doc.rust-lang.org/cargo) with:
```bash
cargo install linutil
```
Note that crates installed using `cargo install` require manual updating with `cargo install --force` (update functionality is [included in LinUtil](https://christitustech.github.io/linutil/userguide/#applications-setup))
</details>
---
After you've ran the command, you should see a GUI on your screen; It will look something like this:
![preview](assets/preview.gif)
!!! info
LinUtil is updated weekly as of the time of writing. Consequently, features and functionalities may evolve, and the documentation may not always reflect the most current images or information.

View File

@ -13,8 +13,8 @@
## Milestones ## Milestones
### Q4 2024 ### Q4 2024
- [x] Finish the foundation of the project's CLI - [x] Finish the foundation of the project's CLI
- [x] Implement CLI arguments and configuration support - [ ] Implement CLI arguments and configuration support
- [x] Add an option for logging script executions - [ ] Add an option for logging script executions
### Q1 2025 ### Q1 2025
- [ ] GUI Brainstorming and Planning - [ ] GUI Brainstorming and Planning
@ -25,4 +25,3 @@
## Community Feedback ## Community Feedback
- Encourage community input and suggestions for future development. - Encourage community input and suggestions for future development.

View File

@ -44,41 +44,58 @@ https://github.com/ChrisTitusTech/neovim
- **Mozilla Firefox**: Mozilla Firefox is a free and open-source web browser developed by the Mozilla Foundation. - **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. - **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. - **Vivaldi**: Vivaldi is a freeware, cross-platform web browser developed by Vivaldi Technologies.
- **Tor Browser**: Tor Browser is a free and open-source firefox-based web browser designed for anonymity and censorship circumvention.
- **waterfox**: Waterfox is the privacy-focused web browser engineered to give you speed, control, and peace of mind on the internet. - **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. - **Alacritty**: Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows.
This command installs and condifures alacritty terminal emulator.
- **Android Debloater**: Universal Android Debloater (UAD) is a tool designed to help users remove bloatware and unnecessary pre-installed applications from Android devices, enhancing performance and user experience. - **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 - **Bash Prompt**: The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems.
- **Bottles**: Bottles allows Windows software, like applications and games, to run on Linux. Bottles also provides tools to categorize, organize and optimize your applications. 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. - **Docker**: Docker is an open platform that uses OS-level virtualization to deliver software in packages called containers.
- **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.
- **DWM-Titus**: DWM is a dynamic window manager for X. - **DWM-Titus**: DWM is a dynamic window manager for X.
It manages windows in tiled, monocle and floating layouts. 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. All of the layouts can be applied dynamically, optimising the environment for the application in use and the task performed.
This command installs and configures DWM and a desktop manager. This command installs and configures DWM and a desktop manager.
The list of patches applied can be found in CTT's DWM repository The list of patches applied can be found in CTT's DWM repository
https://github.com/ChrisTitusTech/dwm-titus https://github.com/ChrisTitusTech/dwm-titus
- **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 - **Fastfetch**: Fastfetch is a neofetch-like tool for fetching system information and displaying it prettily.
- **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 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. - **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 Installer**: Installs a distro-specific Linutil package locally.
- **Linutil Updater**: Updates your local Linutil crate installation. - **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. - **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 ## Gaming
### Diablo II Resurrected ### 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 ## 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 ## System Setup
@ -86,21 +103,21 @@ https://github.com/ChrisTitusTech/dwm-titus
### Arch Linux ### Arch Linux
- **Arch Server Setup**: This command installs a minimal arch server setup under 5 minutes. - **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.
- **Nvidia Drivers && Hardware Acceleration**: This script installs and configures nvidia drivers with Hardware Acceleration. 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.
- **Virtualization**: QEMU, Libvirt, Virt-Manager installation and configuration. 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 ### Fedora
- **Configure DNF**: Optimizes DNF for parallel downloads - **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. - **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. - **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 - **Upgrade to a New Fedora Release**: Upgrades system to the next Fedora release
- **Virtualization**: Enables Virtualization through dnf - **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 - **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 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 - **Full System Update**: This command updates your system to the latest packages available for your distro
@ -127,17 +144,11 @@ https://github.com/ChrisTitusTech/dwm-titus
- **Set Primary Monitor**: This script is designed to set a Primary monitor in your system - **Set Primary Monitor**: This script is designed to set a Primary monitor in your system
- **Set Resolution**: This script is designed to change the resolution of monitors connected to your system - **Set Resolution**: This script is designed to change the resolution of monitors connected to your system
### Printers
- **CUPS**: This script will install the CUPS system, required for most printer drivers on Linux.
- **Epson printer drivers**: This script will install the Epson printer drivers.
### User Account Manager ### User Account Manager
- **Auto Mount Drive**: This utility is designed to help with automating the process of mounting a drive on to your system. - **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 - **Bluetooth Manager**: This utility is designed to manage bluetooth in your system
- **Numlock on Startup**: This utility is designed to enable Num Lock at boot, rather than within desktop environments like KDE or GNOME - **Numlock on Startup**: This utility is designed to configure auto enabling of numlock on boot
- **Ollama**: This utility is designed to manage ollama in your system - **Ollama**: This utility is designed to manage ollama in your system
- **Service Manager**: This utility is designed to manage services in your system - **Service Manager**: This utility is designed to manage services in your system
- **WiFi Manager**: This utility is designed to manage wifi in your system - **WiFi Manager**: This utility is designed to manage wifi in your system

View File

@ -22,10 +22,6 @@ curl -fsSL https://christitus.com/linux | sh
curl -fsSL https://christitus.com/linuxdev | sh curl -fsSL https://christitus.com/linuxdev | sh
.SH OPTIONS .SH OPTIONS
.TP
\fB\-c\fR, \fB\-\-config\fR \fI<path>\fR
Path to the configuration file.
.TP .TP
\fB\-t\fR, \fB\-\-theme\fR \fI<theme>\fR \fB\-t\fR, \fB\-\-theme\fR \fI<theme>\fR
Set the theme to use in the TUI. Set the theme to use in the TUI.
@ -36,18 +32,10 @@ Possible values:
.br .br
Defaults to \fIdefault\fR. Defaults to \fIdefault\fR.
.TP
\fB\-y\fR, \fB\-\-skip\-confirmation\fR
Skip confirmation prompt before executing commands.
.TP .TP
\fB\-\-override\-validation\fR \fB\-\-override\-validation\fR
Show all available entries, disregarding compatibility checks. (\fBUNSAFE\fR) Show all available entries, disregarding compatibility checks. (\fBUNSAFE\fR)
.TP
\fB\-\-size\-bypass\fR
Bypass the terminal size limit
.TP .TP
\fB\-h\fR, \fB\-\-help\fR \fB\-h\fR, \fB\-\-help\fR
Print help. Print help.

12
overrides/main.html Normal file
View File

@ -0,0 +1,12 @@
{% extends "base.html" %}
{% block header %}
{{ super() }}
<div style="color: red; text-align: center; padding: 10px; font-size: 20px;">
<strong>Announcement:</strong> This documentation is still in progress.
</div>
{% endblock %}
{% block footer %}
{# Empty block to override the footer #}
{% endblock %}

View File

@ -43,7 +43,7 @@ check $? "Downloading linutil"
chmod +x "$temp_file" chmod +x "$temp_file"
check $? "Making linutil executable" check $? "Making linutil executable"
"$temp_file" "$@" "$temp_file"
check $? "Executing linutil" check $? "Executing linutil"
rm -f "$temp_file" rm -f "$temp_file"

View File

@ -69,7 +69,7 @@ check $? "Downloading linutil"
chmod +x "$TMPFILE" chmod +x "$TMPFILE"
check $? "Making linutil executable" check $? "Making linutil executable"
"$TMPFILE" "$@" "$TMPFILE"
check $? "Executing linutil" check $? "Executing linutil"
rm -f "$TMPFILE" rm -f "$TMPFILE"

View File

@ -15,18 +15,18 @@ tips = ["rand"]
[dependencies] [dependencies]
clap = { version = "4.5.20", features = ["derive"] } clap = { version = "4.5.20", features = ["derive"] }
crossterm = "0.28.1"
ego-tree = { workspace = true }
oneshot = "0.1.8" oneshot = "0.1.8"
portable-pty = "0.8.1" portable-pty = "0.8.1"
ratatui = "0.29.0" ratatui = "0.29.0"
tui-term = "0.2.0" tui-term = "0.2.0"
temp-dir = "0.1.14" temp-dir = "0.1.14"
time = { version = "0.3.36", features = ["local-offset", "macros", "formatting"] }
unicode-width = "0.2.0" unicode-width = "0.2.0"
rand = { version = "0.8.5", optional = true } rand = { version = "0.8.5", optional = true }
linutil_core = { path = "../core", version = "24.9.28" } linutil_core = { path = "../core", version = "24.9.28" }
tree-sitter-highlight = "0.24.3" tree-sitter-highlight = "0.24.3"
tree-sitter-bash = "0.23.1" tree-sitter-bash = "0.23.1"
textwrap = "0.16.1"
anstyle = "1.0.8" anstyle = "1.0.8"
ansi-to-tui = "7.0.0" ansi-to-tui = "7.0.0"
zips = "0.1.7" zips = "0.1.7"

View File

@ -2,8 +2,8 @@ use std::borrow::Cow;
use crate::{float::FloatContent, hint::Shortcut}; use crate::{float::FloatContent, hint::Shortcut};
use crossterm::event::{KeyCode, KeyEvent};
use ratatui::{ use ratatui::{
crossterm::event::{KeyCode, KeyEvent},
layout::Alignment, layout::Alignment,
prelude::*, prelude::*,
widgets::{Block, Borders, Clear, List}, widgets::{Block, Borders, Clear, List},
@ -60,7 +60,6 @@ impl FloatContent for ConfirmPrompt {
fn draw(&mut self, frame: &mut Frame, area: Rect) { fn draw(&mut self, frame: &mut Frame, area: Rect) {
let block = Block::default() let block = Block::default()
.borders(Borders::ALL) .borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED)
.title(" Confirm selections ") .title(" Confirm selections ")
.title_bottom(" [y] to continue, [n] to abort ") .title_bottom(" [y] to continue, [n] to abort ")
.title_alignment(Alignment::Center) .title_alignment(Alignment::Center)

View File

@ -1,7 +1,8 @@
use crate::{state::ListEntry, theme::Theme}; use crate::{state::ListEntry, theme::Theme};
use linutil_core::{ego_tree::NodeId, Tab}; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use ego_tree::NodeId;
use linutil_core::Tab;
use ratatui::{ use ratatui::{
crossterm::event::{KeyCode, KeyEvent, KeyModifiers},
layout::{Position, Rect}, layout::{Position, Rect},
style::{Color, Style}, style::{Color, Style},
text::Span, text::Span,
@ -122,12 +123,7 @@ impl Filter {
//Create the search bar widget //Create the search bar widget
let search_bar = Paragraph::new(display_text) let search_bar = Paragraph::new(display_text)
.block( .block(Block::default().borders(Borders::ALL).title(" Search "))
Block::default()
.borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED)
.title(" Search "),
)
.style(Style::default().fg(search_color)); .style(Style::default().fg(search_color));
//Render the search bar (First chunk of the screen) //Render the search bar (First chunk of the screen)

View File

@ -1,5 +1,5 @@
use crossterm::event::{KeyCode, KeyEvent};
use ratatui::{ use ratatui::{
crossterm::event::{KeyCode, KeyEvent},
layout::{Constraint, Direction, Layout, Rect}, layout::{Constraint, Direction, Layout, Rect},
Frame, Frame,
}; };

View File

@ -8,8 +8,9 @@ use crate::{float::FloatContent, hint::Shortcut};
use linutil_core::Command; use linutil_core::Command;
use crossterm::event::{KeyCode, KeyEvent};
use ratatui::{ use ratatui::{
crossterm::event::{KeyCode, KeyEvent},
layout::Rect, layout::Rect,
style::{Style, Stylize}, style::{Style, Stylize},
text::Line, text::Line,
@ -19,19 +20,16 @@ use ratatui::{
use ansi_to_tui::IntoText; use ansi_to_tui::IntoText;
use textwrap::wrap;
use tree_sitter_bash as hl_bash; use tree_sitter_bash as hl_bash;
use tree_sitter_highlight::{self as hl, HighlightEvent}; use tree_sitter_highlight::{self as hl, HighlightEvent};
use zips::zip_result; use zips::zip_result;
pub struct FloatingText { pub struct FloatingText {
pub src: String, pub src: Vec<String>,
wrapped_lines: Vec<String>,
max_line_width: usize, max_line_width: usize,
v_scroll: usize, v_scroll: usize,
h_scroll: usize, h_scroll: usize,
mode_title: String, mode_title: String,
wrap_words: bool,
frame_height: usize, frame_height: usize,
} }
@ -110,6 +108,12 @@ fn get_highlighted_string(s: &str) -> Option<String> {
Some(output) Some(output)
} }
macro_rules! max_width {
($($lines:tt)+) => {{
$($lines)+.iter().fold(0, |accum, val| accum.max(val.len()))
}}
}
#[inline] #[inline]
fn get_lines(s: &str) -> Vec<&str> { fn get_lines(s: &str) -> Vec<&str> {
s.lines().collect::<Vec<_>>() s.lines().collect::<Vec<_>>()
@ -121,56 +125,57 @@ fn get_lines_owned(s: &str) -> Vec<String> {
} }
impl FloatingText { impl FloatingText {
pub fn new(text: String, title: &str, wrap_words: bool) -> Self { pub fn new(text: String, title: &str) -> Self {
let max_line_width = 80; let src = get_lines(&text)
let wrapped_lines = if wrap_words {
wrap(&text, max_line_width)
.into_iter() .into_iter()
.map(|cow| cow.into_owned()) .map(|s| s.to_string())
.collect() .collect::<Vec<_>>();
} else {
get_lines_owned(&text)
};
let max_line_width = max_width!(src);
Self { Self {
src: text, src,
wrapped_lines,
mode_title: title.to_string(), mode_title: title.to_string(),
max_line_width, max_line_width,
v_scroll: 0, v_scroll: 0,
h_scroll: 0, h_scroll: 0,
wrap_words,
frame_height: 0, frame_height: 0,
} }
} }
pub fn from_command(command: &Command, title: String) -> Option<Self> { pub fn from_command(command: &Command, title: String) -> Option<Self> {
let src = match command { let (max_line_width, src) = match command {
Command::Raw(cmd) => Some(cmd.clone()), Command::Raw(cmd) => {
Command::LocalFile { file, .. } => std::fs::read_to_string(file) // 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)) .map_err(|_| format!("File not found: {:?}", file))
.ok(), .unwrap();
Command::None => None,
}?;
let max_line_width = 80; (max_width!(get_lines(&raw)), Some(raw))
let wrapped_lines = get_lines_owned(&get_highlighted_string(&src)?); }
// If command is a folder, we don't display a preview
Command::None => (0usize, None),
};
let src = get_lines_owned(&get_highlighted_string(&src?)?);
Some(Self { Some(Self {
src, src,
wrapped_lines,
mode_title: title, mode_title: title,
max_line_width, max_line_width,
h_scroll: 0, h_scroll: 0,
v_scroll: 0, v_scroll: 0,
wrap_words: false,
frame_height: 0, frame_height: 0,
}) })
} }
fn scroll_down(&mut self) { fn scroll_down(&mut self) {
let visible_lines = self.frame_height.saturating_sub(2); let visible_lines = self.frame_height.saturating_sub(2);
if self.v_scroll + visible_lines < self.wrapped_lines.len() { if self.v_scroll + visible_lines < self.src.len() {
self.v_scroll += 1; self.v_scroll += 1;
} }
} }
@ -192,20 +197,6 @@ impl FloatingText {
self.h_scroll += 1; 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 { impl FloatContent for FloatingText {
@ -215,7 +206,6 @@ impl FloatContent for FloatingText {
// Define the Block with a border and background color // Define the Block with a border and background color
let block = Block::default() let block = Block::default()
.borders(Borders::ALL) .borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED)
.title(self.mode_title.clone()) .title(self.mode_title.clone())
.title_alignment(ratatui::layout::Alignment::Center) .title_alignment(ratatui::layout::Alignment::Center)
.title_style(Style::default().reversed()) .title_style(Style::default().reversed())
@ -227,22 +217,13 @@ impl FloatContent for FloatingText {
// Calculate the inner area to ensure text is not drawn over the border // Calculate the inner area to ensure text is not drawn over the border
let inner_area = block.inner(area); let inner_area = block.inner(area);
let Rect { width, height, .. } = inner_area; let Rect { height, .. } = inner_area;
self.update_wrapping(width as usize);
let lines = self let lines = self
.wrapped_lines .src
.iter() .iter()
.skip(self.v_scroll) .skip(self.v_scroll)
.take(height as usize) .take(height as usize)
.flat_map(|l| { .flat_map(|l| l.into_text().unwrap())
if self.wrap_words {
vec![Line::raw(l.clone())]
} else {
l.into_text().unwrap().lines
}
})
.map(|line| { .map(|line| {
let mut skipped = 0; let mut skipped = 0;
let mut spans = line let mut spans = line

View File

@ -71,8 +71,8 @@ impl Shortcut {
} }
fn to_spans(&self) -> Vec<Span<'static>> { fn to_spans(&self) -> Vec<Span<'static>> {
let description = Span::styled(self.desc, Style::default().italic()); let mut ret: Vec<_> = self
self.key_sequences .key_sequences
.iter() .iter()
.flat_map(|seq| { .flat_map(|seq| {
[ [
@ -81,7 +81,8 @@ impl Shortcut {
Span::default().content("] "), Span::default().content("] "),
] ]
}) })
.chain(std::iter::once(description)) .collect();
.collect() ret.push(Span::styled(self.desc, Style::default().italic()));
ret
} }
} }

View File

@ -9,58 +9,36 @@ mod theme;
use std::{ use std::{
io::{self, stdout}, io::{self, stdout},
path::PathBuf,
time::Duration, time::Duration,
}; };
use crate::theme::Theme; use crate::theme::Theme;
use clap::Parser; use clap::Parser;
use crossterm::{
use ratatui::{
backend::CrosstermBackend,
crossterm::{
event::{self, DisableMouseCapture, Event, KeyEventKind}, event::{self, DisableMouseCapture, Event, KeyEventKind},
style::ResetColor, style::ResetColor,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
ExecutableCommand, ExecutableCommand,
},
Terminal,
}; };
use ratatui::{backend::CrosstermBackend, Terminal};
use state::AppState; use state::AppState;
// Linux utility toolbox // Linux utility toolbox
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
struct Args { struct Args {
#[arg(short, long, help = "Path to the configuration file")]
config: Option<PathBuf>,
#[arg(short, long, value_enum)] #[arg(short, long, value_enum)]
#[arg(default_value_t = Theme::Default)] #[arg(default_value_t = Theme::Default)]
#[arg(help = "Set the theme to use in the application")] #[arg(help = "Set the theme to use in the application")]
theme: Theme, theme: Theme,
#[arg(
short = 'y',
long,
help = "Skip confirmation prompt before executing commands"
)]
skip_confirmation: bool,
#[arg(long, default_value_t = false)] #[arg(long, default_value_t = false)]
#[clap(help = "Show all available options, disregarding compatibility checks (UNSAFE)")] #[clap(help = "Show all available options, disregarding compatibility checks (UNSAFE)")]
override_validation: bool, override_validation: bool,
#[arg(long, default_value_t = false)]
#[clap(help = "Bypass the terminal size limit")]
size_bypass: bool,
} }
fn main() -> io::Result<()> { fn main() -> io::Result<()> {
let args = Args::parse(); let args = Args::parse();
let mut state = AppState::new( let mut state = AppState::new(args.theme, args.override_validation);
args.config,
args.theme,
args.override_validation,
args.size_bypass,
args.skip_confirmation,
);
stdout().execute(EnterAlternateScreen)?; stdout().execute(EnterAlternateScreen)?;
enable_raw_mode()?; enable_raw_mode()?;

View File

@ -1,11 +1,11 @@
use crate::{float::FloatContent, hint::Shortcut}; use crate::{float::FloatContent, hint::Shortcut};
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use linutil_core::Command; use linutil_core::Command;
use oneshot::{channel, Receiver}; use oneshot::{channel, Receiver};
use portable_pty::{ use portable_pty::{
ChildKiller, CommandBuilder, ExitStatus, MasterPty, NativePtySystem, PtySize, PtySystem, ChildKiller, CommandBuilder, ExitStatus, MasterPty, NativePtySystem, PtySize, PtySystem,
}; };
use ratatui::{ use ratatui::{
crossterm::event::{KeyCode, KeyEvent, KeyModifiers},
layout::{Rect, Size}, layout::{Rect, Size},
style::{Color, Style, Stylize}, style::{Color, Style, Stylize},
text::{Line, Span}, text::{Line, Span},
@ -17,11 +17,11 @@ use std::{
sync::{Arc, Mutex}, sync::{Arc, Mutex},
thread::JoinHandle, thread::JoinHandle,
}; };
use time::{macros::format_description, OffsetDateTime};
use tui_term::{ use tui_term::{
vt100::{self, Screen}, vt100::{self, Screen},
widget::PseudoTerminal, widget::PseudoTerminal,
}; };
pub struct RunningCommand { pub struct RunningCommand {
/// A buffer to save all the command output (accumulates, until the command exits) /// A buffer to save all the command output (accumulates, until the command exits)
buffer: Arc<Mutex<Vec<u8>>>, buffer: Arc<Mutex<Vec<u8>>>,
@ -37,7 +37,6 @@ pub struct RunningCommand {
writer: Box<dyn Write + Send>, writer: Box<dyn Write + Send>,
/// Only set after the process has ended /// Only set after the process has ended
status: Option<ExitStatus>, status: Option<ExitStatus>,
log_path: Option<String>,
scroll_offset: usize, scroll_offset: usize,
} }
@ -54,7 +53,6 @@ impl FloatContent for RunningCommand {
// Display a block indicating the command is running // Display a block indicating the command is running
Block::default() Block::default()
.borders(Borders::ALL) .borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED)
.title_top(Line::from("Running the command....").centered()) .title_top(Line::from("Running the command....").centered())
.title_style(Style::default().reversed()) .title_style(Style::default().reversed())
.title_bottom(Line::from("Press Ctrl-C to KILL the command")) .title_bottom(Line::from("Press Ctrl-C to KILL the command"))
@ -80,20 +78,9 @@ impl FloatContent for RunningCommand {
.style(Style::default()), .style(Style::default()),
); );
let mut block = Block::default() Block::default()
.borders(Borders::ALL) .borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED) .title_top(title_line.centered())
.title_top(title_line.centered());
if let Some(log_path) = &self.log_path {
block =
block.title_bottom(Line::from(format!(" Log saved: {} ", log_path)).centered());
} else {
block =
block.title_bottom(Line::from(" Press 'l' to save command log ").centered());
}
block
}; };
// Process the buffer and create the pseudo-terminal widget // Process the buffer and create the pseudo-terminal widget
@ -122,11 +109,6 @@ impl FloatContent for RunningCommand {
KeyCode::PageDown => { KeyCode::PageDown => {
self.scroll_offset = self.scroll_offset.saturating_sub(10); self.scroll_offset = self.scroll_offset.saturating_sub(10);
} }
KeyCode::Char('l') if self.is_finished() => {
if let Ok(log_path) = self.save_log() {
self.log_path = Some(log_path);
}
}
// Pass other key events to the terminal // Pass other key events to the terminal
_ => self.handle_passthrough_key_event(key), _ => self.handle_passthrough_key_event(key),
} }
@ -150,7 +132,6 @@ impl FloatContent for RunningCommand {
Shortcut::new("Close window", ["Enter", "q"]), Shortcut::new("Close window", ["Enter", "q"]),
Shortcut::new("Scroll up", ["Page up"]), Shortcut::new("Scroll up", ["Page up"]),
Shortcut::new("Scroll down", ["Page down"]), Shortcut::new("Scroll down", ["Page down"]),
Shortcut::new("Save log", ["l"]),
]), ]),
) )
} else { } else {
@ -254,7 +235,6 @@ impl RunningCommand {
pty_master: pair.master, pty_master: pair.master,
writer, writer,
status: None, status: None,
log_path: None,
scroll_offset: 0, scroll_offset: 0,
} }
} }
@ -273,7 +253,7 @@ impl RunningCommand {
// Process the buffer with a parser with the current screen size // Process the buffer with a parser with the current screen size
// We don't actually need to create a new parser every time, but it is so much easier this // We don't actually need to create a new parser every time, but it is so much easier this
// way, and doesn't cost that much // way, and doesn't cost that much
let mut parser = vt100::Parser::new(size.height, size.width, 1000); let mut parser = vt100::Parser::new(size.height, size.width, 200);
let mutex = self.buffer.lock(); let mutex = self.buffer.lock();
let buffer = mutex.as_ref().unwrap(); let buffer = mutex.as_ref().unwrap();
parser.process(buffer); parser.process(buffer);
@ -302,24 +282,6 @@ impl RunningCommand {
} }
} }
fn save_log(&self) -> std::io::Result<String> {
let mut log_path = std::env::temp_dir();
let date_format = format_description!("[year]-[month]-[day]-[hour]-[minute]-[second]");
log_path.push(format!(
"linutil_log_{}.log",
OffsetDateTime::now_local()
.unwrap_or(OffsetDateTime::now_utc())
.format(&date_format)
.unwrap()
));
let mut file = std::fs::File::create(&log_path)?;
let buffer = self.buffer.lock().unwrap();
file.write_all(&buffer)?;
Ok(log_path.to_string_lossy().into_owned())
}
/// Convert the KeyEvent to pty key codes, and send them to the virtual terminal /// Convert the KeyEvent to pty key codes, and send them to the virtual terminal
fn handle_passthrough_key_event(&mut self, key: &KeyEvent) { fn handle_passthrough_key_event(&mut self, key: &KeyEvent) {
let input_bytes = match key.code { let input_bytes = match key.code {

View File

@ -7,20 +7,20 @@ use crate::{
running_command::RunningCommand, running_command::RunningCommand,
theme::Theme, theme::Theme,
}; };
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
use linutil_core::{ego_tree::NodeId, Config, ListNode, TabList}; use ego_tree::NodeId;
use linutil_core::{ListNode, Tab};
#[cfg(feature = "tips")] #[cfg(feature = "tips")]
use rand::Rng; use rand::Rng;
use ratatui::{ use ratatui::{
crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers},
layout::{Alignment, Constraint, Direction, Flex, Layout}, layout::{Alignment, Constraint, Direction, Flex, Layout},
style::{Style, Stylize}, style::{Style, Stylize},
text::{Line, Span, Text}, text::{Line, Span, Text},
widgets::{Block, Borders, List, ListState, Paragraph}, widgets::{Block, Borders, List, ListState, Paragraph},
Frame, Frame,
}; };
use std::path::PathBuf;
use std::rc::Rc; use std::rc::Rc;
use temp_dir::TempDir;
const MIN_WIDTH: u16 = 100; const MIN_WIDTH: u16 = 100;
const MIN_HEIGHT: u16 = 25; const MIN_HEIGHT: u16 = 25;
@ -31,7 +31,6 @@ D - disk modifications (ex. partitioning) (privileged)
FI - flatpak installation FI - flatpak installation
FM - file modification FM - file modification
I - installation (privileged) I - installation (privileged)
K - kernel modifications (privileged)
MP - package manager actions MP - package manager actions
SI - full system installation SI - full system installation
SS - systemd actions (privileged) SS - systemd actions (privileged)
@ -41,12 +40,14 @@ P* - privileged *
"; ";
pub struct AppState { pub struct AppState {
/// This must be passed to retain the temp dir until the end of the program
_temp_dir: TempDir,
/// Selected theme /// Selected theme
theme: Theme, theme: Theme,
/// Currently focused area /// Currently focused area
pub focus: Focus, pub focus: Focus,
/// List of tabs /// List of tabs
tabs: TabList, tabs: Vec<Tab>,
/// Current tab /// Current tab
current_tab: ListState, current_tab: ListState,
/// This stack keeps track of our "current directory". You can think of it as `pwd`. but not /// This stack keeps track of our "current directory". You can think of it as `pwd`. but not
@ -61,8 +62,6 @@ pub struct AppState {
drawable: bool, drawable: bool,
#[cfg(feature = "tips")] #[cfg(feature = "tips")]
tip: String, tip: String,
size_bypass: bool,
skip_confirmation: bool,
} }
pub enum Focus { pub enum Focus {
@ -87,19 +86,12 @@ enum SelectedItem {
} }
impl AppState { impl AppState {
pub fn new( pub fn new(theme: Theme, override_validation: bool) -> Self {
config_path: Option<PathBuf>, let (temp_dir, tabs) = linutil_core::get_tabs(!override_validation);
theme: Theme,
override_validation: bool,
size_bypass: bool,
skip_confirmation: bool,
) -> Self {
let tabs = linutil_core::get_tabs(!override_validation);
let root_id = tabs[0].tree.root().id(); let root_id = tabs[0].tree.root().id();
let auto_execute_commands = config_path.map(|path| Config::from_file(&path).auto_execute);
let mut state = Self { let mut state = Self {
_temp_dir: temp_dir,
theme, theme,
focus: Focus::List, focus: Focus::List,
tabs, tabs,
@ -112,36 +104,12 @@ impl AppState {
drawable: false, drawable: false,
#[cfg(feature = "tips")] #[cfg(feature = "tips")]
tip: get_random_tip(), tip: get_random_tip(),
size_bypass,
skip_confirmation,
}; };
state.update_items(); state.update_items();
if let Some(auto_execute_commands) = auto_execute_commands {
state.handle_initial_auto_execute(&auto_execute_commands);
}
state state
} }
fn handle_initial_auto_execute(&mut self, auto_execute_commands: &[String]) {
self.selected_commands = auto_execute_commands
.iter()
.filter_map(|name| self.tabs.iter().find_map(|tab| tab.find_command(name)))
.collect();
if !self.selected_commands.is_empty() {
let cmd_names: Vec<_> = 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));
}
}
fn get_list_item_shortcut(&self) -> Box<[Shortcut]> { fn get_list_item_shortcut(&self) -> Box<[Shortcut]> {
if self.selected_item_is_dir() { if self.selected_item_is_dir() {
Box::new([Shortcut::new("Go to selected dir", ["l", "Right", "Enter"])]) Box::new([Shortcut::new("Go to selected dir", ["l", "Right", "Enter"])])
@ -185,10 +153,12 @@ impl AppState {
hints.push(Shortcut::new("Select item below", ["j", "Down"])); hints.push(Shortcut::new("Select item below", ["j", "Down"]));
hints.push(Shortcut::new("Next theme", ["t"])); hints.push(Shortcut::new("Next theme", ["t"]));
hints.push(Shortcut::new("Previous theme", ["T"])); hints.push(Shortcut::new("Previous theme", ["T"]));
hints.push(Shortcut::new("Multi-selection mode", ["v"]));
if self.multi_select { if self.is_current_tab_multi_selectable() {
hints.push(Shortcut::new("Toggle multi-selection mode", ["v"]));
hints.push(Shortcut::new("Select multiple commands", ["Space"])); hints.push(Shortcut::new("Select multiple commands", ["Space"]));
} }
hints.push(Shortcut::new("Next tab", ["Tab"])); hints.push(Shortcut::new("Next tab", ["Tab"]));
hints.push(Shortcut::new("Previous tab", ["Shift-Tab"])); hints.push(Shortcut::new("Previous tab", ["Shift-Tab"]));
hints.push(Shortcut::new("Important actions guide", ["g"])); hints.push(Shortcut::new("Important actions guide", ["g"]));
@ -218,9 +188,7 @@ impl AppState {
pub fn draw(&mut self, frame: &mut Frame) { pub fn draw(&mut self, frame: &mut Frame) {
let terminal_size = frame.area(); let terminal_size = frame.area();
if !self.size_bypass if terminal_size.width < MIN_WIDTH || terminal_size.height < MIN_HEIGHT {
&& (terminal_size.height < MIN_HEIGHT || terminal_size.width < MIN_WIDTH)
{
let warning = Paragraph::new(format!( let warning = Paragraph::new(format!(
"Terminal size too small:\nWidth = {} Height = {}\n\nMinimum size:\nWidth = {} Height = {}", "Terminal size too small:\nWidth = {} Height = {}\n\nMinimum size:\nWidth = {} Height = {}",
terminal_size.width, terminal_size.width,
@ -247,9 +215,9 @@ impl AppState {
self.drawable = true; self.drawable = true;
} }
let label_block = Block::default() let label_block =
.borders(Borders::ALL) Block::default()
.border_set(ratatui::symbols::border::ROUNDED) .borders(Borders::all())
.border_set(ratatui::symbols::border::Set { .border_set(ratatui::symbols::border::Set {
top_left: " ", top_left: " ",
top_right: " ", top_right: " ",
@ -283,8 +251,7 @@ impl AppState {
let keybinds_block = Block::default() let keybinds_block = Block::default()
.title(format!(" {} ", keybind_scope)) .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 keybinds = create_shortcut_list(shortcuts, keybind_render_width);
let n_lines = keybinds.len() as u16; let n_lines = keybinds.len() as u16;
@ -328,11 +295,7 @@ impl AppState {
}; };
let list = List::new(tabs) let list = List::new(tabs)
.block( .block(Block::default().borders(Borders::ALL))
Block::default()
.borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED),
)
.highlight_style(tab_hl_style) .highlight_style(tab_hl_style)
.highlight_symbol(self.theme.tab_icon()); .highlight_symbol(self.theme.tab_icon());
frame.render_stateful_widget(list, left_chunks[1], &mut self.current_tab); frame.render_stateful_widget(list, left_chunks[1], &mut self.current_tab);
@ -367,12 +330,7 @@ impl AppState {
let (indicator, style) = if is_selected { let (indicator, style) = if is_selected {
(self.theme.multi_select_icon(), Style::default().bold()) (self.theme.multi_select_icon(), Style::default().bold())
} else { } else {
let ms_style = if self.multi_select && !node.multi_select { ("", Style::new())
Style::default().fg(self.theme.multi_select_disabled_color())
} else {
Style::new()
};
("", ms_style)
}; };
if *has_children { if *has_children {
Line::from(format!( Line::from(format!(
@ -382,7 +340,6 @@ impl AppState {
indicator indicator
)) ))
.style(self.theme.dir_color()) .style(self.theme.dir_color())
.patch_style(style)
} else { } else {
Line::from(format!( Line::from(format!(
"{} {} {}", "{} {} {}",
@ -400,21 +357,13 @@ impl AppState {
|ListEntry { |ListEntry {
node, has_children, .. 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 { if *has_children {
Line::from(" ") Line::from(" ").style(self.theme.dir_color())
.style(self.theme.dir_color())
.patch_style(ms_style)
} else { } else {
Line::from(format!("{} ", node.task_list)) Line::from(format!("{} ", node.task_list))
.alignment(Alignment::Right) .alignment(Alignment::Right)
.style(self.theme.cmd_color()) .style(self.theme.cmd_color())
.bold() .bold()
.patch_style(ms_style)
} }
}, },
)); ));
@ -444,7 +393,6 @@ impl AppState {
.block( .block(
Block::default() Block::default()
.borders(Borders::ALL & !Borders::RIGHT) .borders(Borders::ALL & !Borders::RIGHT)
.border_set(ratatui::symbols::border::ROUNDED)
.title(title) .title(title)
.title_bottom(bottom_title), .title_bottom(bottom_title),
) )
@ -454,7 +402,6 @@ impl AppState {
let disclaimer_list = List::new(task_items).highlight_style(style).block( let disclaimer_list = List::new(task_items).highlight_style(style).block(
Block::default() Block::default()
.borders(Borders::ALL & !Borders::LEFT) .borders(Borders::ALL & !Borders::LEFT)
.border_set(ratatui::symbols::border::ROUNDED)
.title(task_list_title), .title(task_list_title),
); );
@ -532,13 +479,6 @@ impl AppState {
// enabled, need to clear it to prevent state corruption // enabled, need to clear it to prevent state corruption
if !self.multi_select { if !self.multi_select {
self.selected_commands.clear() 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(), ConfirmStatus::Confirm => self.handle_confirm_command(),
@ -616,22 +556,29 @@ impl AppState {
} }
fn toggle_multi_select(&mut self) { fn toggle_multi_select(&mut self) {
if self.is_current_tab_multi_selectable() {
self.multi_select = !self.multi_select; self.multi_select = !self.multi_select;
if !self.multi_select { if !self.multi_select {
self.selected_commands.clear(); self.selected_commands.clear();
} }
} }
}
fn toggle_selection(&mut self) { fn toggle_selection(&mut self) {
if let Some(node) = self.get_selected_node() { if let Some(command) = self.get_selected_node() {
if node.multi_select { if self.selected_commands.contains(&command) {
if self.selected_commands.contains(&node) { self.selected_commands.retain(|c| c != &command);
self.selected_commands.retain(|c| c != &node);
} else { } else {
self.selected_commands.push(node); self.selected_commands.push(command);
} }
} }
} }
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) { fn update_items(&mut self) {
@ -640,7 +587,10 @@ impl AppState {
self.current_tab.selected().unwrap(), self.current_tab.selected().unwrap(),
self.visit_stack.last().unwrap().0, 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(); let len = self.filter.item_list().len();
if len > 0 { if len > 0 {
let current = self.selection.selected().unwrap_or(0); let current = self.selection.selected().unwrap_or(0);
@ -759,8 +709,7 @@ impl AppState {
fn enable_description(&mut self) { fn enable_description(&mut self) {
if let Some(command_description) = self.get_selected_description() { if let Some(command_description) = self.get_selected_description() {
if !command_description.is_empty() { if !command_description.is_empty() {
let description = let description = FloatingText::new(command_description, "Command Description");
FloatingText::new(command_description, "Command Description", true);
self.spawn_float(description, 80, 80); self.spawn_float(description, 80, 80);
} }
} }
@ -789,9 +738,6 @@ impl AppState {
} }
} }
if self.skip_confirmation {
self.handle_confirm_command();
} else {
let cmd_names = self let cmd_names = self
.selected_commands .selected_commands
.iter() .iter()
@ -801,7 +747,6 @@ impl AppState {
let prompt = ConfirmPrompt::new(&cmd_names[..]); let prompt = ConfirmPrompt::new(&cmd_names[..]);
self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40)); self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40));
} }
}
SelectedItem::None => {} SelectedItem::None => {}
} }
} }
@ -850,7 +795,7 @@ impl AppState {
fn toggle_task_list_guide(&mut self) { fn toggle_task_list_guide(&mut self) {
self.spawn_float( self.spawn_float(
FloatingText::new(ACTIONS_GUIDE.to_string(), "Important Actions Guide", true), FloatingText::new(ACTIONS_GUIDE.to_string(), "Important Actions Guide"),
80, 80,
80, 80,
); );

View File

@ -28,13 +28,6 @@ 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 { pub fn tab_color(&self) -> Color {
match self { match self {
Theme::Default => Color::Rgb(255, 255, 85), Theme::Default => Color::Rgb(255, 255, 85),

View File

@ -11,7 +11,7 @@ pub fn userguide() -> Result<String, DynError> {
let mut md = String::new(); let mut md = String::new();
md.push_str("<!-- THIS FILE IS GENERATED BY cargo xtask docgen -->\n# Walkthrough\n"); md.push_str("<!-- THIS FILE IS GENERATED BY cargo xtask docgen -->\n# Walkthrough\n");
let tabs = linutil_core::get_tabs(false); let tabs = linutil_core::get_tabs(false).1;
for tab in tabs { for tab in tabs {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
@ -24,7 +24,7 @@ pub fn userguide() -> Result<String, DynError> {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
println!(" Directory: {}", entry.name); println!(" Directory: {}", entry.name);
if entry.name != "root" { if entry.name != "root".to_string() {
md.push_str(&format!("\n### {}\n\n", entry.name)); md.push_str(&format!("\n### {}\n\n", entry.name));
} }
@ -36,7 +36,8 @@ pub fn userguide() -> Result<String, DynError> {
current_dir current_dir
)); ));
} */ // Commenting this for now, might be a good idea later } */ // Commenting this for now, might be a good idea later
} else if !entry.description.is_empty() { } else {
if !entry.description.is_empty() {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
println!(" Entry: {}", entry.name); println!(" Entry: {}", entry.name);
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
@ -48,6 +49,7 @@ pub fn userguide() -> Result<String, DynError> {
} */ // https://github.com/ChrisTitusTech/linutil/pull/753 } */ // https://github.com/ChrisTitusTech/linutil/pull/753
} }
} }
}
Ok(md) Ok(md)
} }