Compare commits

...

9 Commits

Author SHA1 Message Date
nyx
a86c4399d9
Merge 96f7fa6528 into 76f8e6438b 2024-11-08 18:18:59 -05:00
Real-MullaC
76f8e6438b
docs: new repo (#888)
* Removes docs and mentions on readme

* Update README.md

* Update README.md

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* Update linutil.yml

* Delete xtask.yml

* Update preview.yml

* Update README.md

---------

Co-authored-by: Chris Titus <contact@christitus.com>
Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
2024-11-08 17:09:25 -06:00
Jeevitha Kannan K S
8639da3855
feat: Command execution log (#898)
* feat: option to save logs

* refact: use time crate

* fix: panics

* hints

* update roadmap
2024-11-08 09:10:31 -06:00
Infinite State
17ff412595
fix(system-cleanup): failing with no orphan packages on arch (#882)
* Add extra check

* Update core/tabs/system-setup/system-cleanup.sh

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

---------

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
2024-11-08 09:07:35 -06:00
Infinite State
95cfbe8920
fix: Autocpu-freq script not detecting battery on laptops (#877)
* Add refined check

* remove an unneccessary comment

Co-authored-by: nyx <nnyyxxxx@protonmail.com>

---------

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
Co-authored-by: nyx <nnyyxxxx@protonmail.com>
2024-11-08 09:06:47 -06:00
Angaddeep Singh
0d4688d53e
Update multimedia-codecs.sh (#863) 2024-11-08 09:05:45 -06:00
Angaddeep Singh
2badbe9ead
Delist Firewall setup on systems with Firewalld installed, such as fedora (#862)
* fedora commit

* Update core/tabs/security/tab_data.toml

Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com>

---------

Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com>
2024-11-08 09:05:16 -06:00
Jeevitha Kannan K S
a0630e0a68
fix: Debian && popos gaming deps (#859)
* fix: debian gaming deps

* fix: pop-os gaming dependency issue

* Update gaming-setup.sh

* fix: shellcheck warning , formatting
2024-11-08 09:04:42 -06:00
Jeevitha Kannan K S
da534df296
refactor: system-update.sh (#843) 2024-11-08 09:03:41 -06:00
24 changed files with 166 additions and 523 deletions

89
.github/mkdocs.yml vendored
View File

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

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

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

View File

@ -59,16 +59,16 @@ jobs:
- name: Generate preview
uses: charmbracelet/vhs-action@v2.1.0
with:
path: "docs/assets/preview.tape"
path: ".github/preview.tape"
- name: Move preview
run: mv preview.gif docs/assets/preview.gif
run: mv preview.gif .github/preview.gif
- name: Create PR
uses: peter-evans/create-pull-request@v7.0.5
with:
commit-message: Preview for ${{ env.tag_name }}
file-pattern: "docs/assets/preview.gif"
file-pattern: ".github/preview.gif"
add-options: "--force"
token: ${{ secrets.PAT_TOKEN }}
branch: feature/preview-${{ env.tag_name }}

View File

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

72
Cargo.lock generated
View File

@ -248,6 +248,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "deranged"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
"powerfmt",
]
[[package]]
name = "downcast-rs"
version = "1.2.1"
@ -418,9 +427,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.158"
version = "0.2.161"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
[[package]]
name = "linutil_core"
@ -449,6 +458,7 @@ dependencies = [
"ratatui",
"temp-dir",
"textwrap",
"time",
"tree-sitter-bash",
"tree-sitter-highlight",
"tui-term",
@ -557,6 +567,21 @@ dependencies = [
"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]]
name = "once_cell"
version = "1.19.0"
@ -625,6 +650,12 @@ dependencies = [
"winreg",
]
[[package]]
name = "powerfmt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "ppv-lite86"
version = "0.2.20"
@ -743,9 +774,9 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
name = "rustix"
version = "0.38.37"
version = "0.38.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811"
checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a"
dependencies = [
"bitflags 2.6.0",
"errno",
@ -1010,6 +1041,39 @@ dependencies = [
"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]]
name = "toml"
version = "0.8.19"

View File

@ -7,7 +7,7 @@
<!-- TODO: crates.io package here + <br> -->
[![Crates.io Version](https://img.shields.io/crates/v/linutil_tui?style=for-the-badge&color=%23af3a03)](https://crates.io/crates/linutil_tui) [![linutil AUR Version](https://img.shields.io/aur/version/linutil?style=for-the-badge&label=%5BAUR%5D%20linutil&color=%23230567ff)](https://aur.archlinux.org/packages/linutil) [![linutil-bin AUR Version](https://img.shields.io/aur/version/linutil-bin?style=for-the-badge&label=%5BAUR%5D%20linutil-bin&color=%23230567ff)](https://aur.archlinux.org/packages/linutil-bin)
![Preview](docs/assets/preview.gif)
![Preview](/.github/preview.gif)
**Linutil** is a distro-agnostic toolbox designed to simplify everyday Linux tasks. It helps you set up applications and optimize your system for specific use cases. The utility is actively developed in Rust 🦀, providing performance and reliability.
@ -128,13 +128,15 @@ If you find Linutil helpful, please consider giving it a ⭐️ to show your sup
## 🎓 Documentation
For comprehensive information on how to use Linutil, visit the [Linutil Official Documentation](https://christitustech.github.io/linutil/).
For comprehensive information on how to use Linutil, visit the [Linutil Official Documentation](https://chris-titus-docs.github.io/linutil-docs/).
## 🛠 Contributing
We welcome contributions from the community! Before you start, please review our [Contributing Guidelines](.github/CONTRIBUTING.md) to understand how to make the most effective and efficient contributions.
[Official LinUtil Roadmap](https://christitustech.github.io/linutil/roadmap)
[Official LinUtil Roadmap](https://chris-titus-docs.github.io/linutil-docs/roadmap/)
Docs are now [here](https://github.com/Chris-Titus-Docs/linutil-docs)
## 🏅 Thanks to All Contributors

View File

@ -5,3 +5,8 @@ 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"
script = "firewall-baselines.sh"
task_list = "I SS"
[[data.preconditions]]
matches = false
data = "command_exists"
values = [ "firewalld" ]

View File

@ -8,8 +8,6 @@ multimedia() {
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}"
"$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}"
else
printf "%b\n" "${RED}RPM Fusion repositories not found. Please set up RPM Fusion first!${RC}"

View File

@ -1,10 +1,11 @@
#!/bin/sh -e
# shellcheck disable=SC2086
. ../common-script.sh
installDepend() {
# Check for dependencies
DEPENDENCIES='wine dbus'
DEPENDENCIES='wine dbus git'
printf "%b\n" "${YELLOW}Installing dependencies...${RC}"
case "$PACKAGER" in
pacman)
@ -28,10 +29,13 @@ installDepend() {
apt-get | nala)
DISTRO_DEPS="libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386 wine64 wine32"
"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" dpkg --add-architecture i386
if [ "$DTYPE" != "pop" ]; then
"$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common
"$ESCALATION_TOOL" apt-add-repository contrib -y
fi
"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS
;;
@ -72,7 +76,7 @@ installAdditionalDepend() {
curl -sSLo "lutris_${version_no_v}_all.deb" "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb"
printf "%b\n" "${YELLOW}Installing Lutris...${RC}"
"$ESCALATION_TOOL" "$PACKAGER" install ./lutris_"${version_no_v}"_all.deb
"$ESCALATION_TOOL" "$PACKAGER" install -y ./lutris_"${version_no_v}"_all.deb
rm lutris_"${version_no_v}"_all.deb
@ -91,7 +95,6 @@ installAdditionalDepend() {
"$ESCALATION_TOOL" "$PACKAGER" install -y $DISTRO_DEPS
;;
zypper)
# Flatpak
DISTRO_DEPS='lutris'
"$ESCALATION_TOOL" "$PACKAGER" -n install $DISTRO_DEPS
;;

View File

@ -22,7 +22,7 @@ cleanup_system() {
;;
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null 2>&1
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null || true
;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" cache clean

View File

@ -5,83 +5,85 @@
fastUpdate() {
case "$PACKAGER" in
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}"
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
fi
# If for some reason DTYPE is still unknown use always arch so the rate-mirrors does not fail
dtype_local=${DTYPE}
if [ "${DTYPE}" = "unknown" ]; then
dtype_local="$DTYPE"
if [ "$dtype_local" = "unknown" ]; then
dtype_local="arch"
fi
"$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
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
printf "%b\n" "${RED}Rate-mirrors failed, restoring backup.${RC}"
"$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist
fi
;;
apt-get|nala)
"$ESCALATION_TOOL" apt-get update
if ! command_exists nala; then
"$ESCALATION_TOOL" apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; }
if [ "$PACKAGER" = "apt-get" ]; then
printf "%b\n" "${YELLOW}Installing nala for faster updates.${RC}"
"$ESCALATION_TOOL" "$PACKAGER" update
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
if [ "$PACKAGER" = "nala" ]; then
"$ESCALATION_TOOL" cp /etc/apt/sources.list /etc/apt/sources.list.bak
"$ESCALATION_TOOL" nala update
PACKAGER="nala"
if [ -f "/etc/apt/sources.list.d/nala-sources.list" ]; then
"$ESCALATION_TOOL" cp /etc/apt/sources.list.d/nala-sources.list /etc/apt/sources.list.d/nala-sources.list.bak
fi
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
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" update -y
;;
zypper)
"$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
;;
esac
}
updateSystem() {
printf "%b\n" "${GREEN}Updating system${RC}"
printf "%b\n" "${YELLOW}Updating system packages.${RC}"
case "$PACKAGER" in
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" update -y
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
;;
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -Sy --noconfirm --needed archlinux-keyring
"$ESCALATION_TOOL" "$PACKAGER" -Su --noconfirm
"$AUR_HELPER" -Su --noconfirm
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" ref
"$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
;;
esac
@ -89,18 +91,8 @@ updateSystem() {
updateFlatpaks() {
if command_exists flatpak; then
printf "%b\n" "${YELLOW}Updating installed Flathub apps...${RC}"
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
printf "%b\n" "${YELLOW}Updating flatpak packages.${RC}"
flatpak update -y
fi
}

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

View File

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

View File

@ -1,72 +0,0 @@
<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->
# Contributing Guidelines for Linutil
Thank you for considering contributing to Linutil! We appreciate your effort in helping improve this project. To ensure that your contributions align with the goals and quality standards of Linutil, please follow these guidelines:
## 1. **Install Rust**:
Make sure you have Rust installed on your machine. You can install it by following the instructions at [rust-lang.org](https://www.rust-lang.org/tools/install).
## 2. **Fork and Clone the repo**
1. Make a fork of the repo in GitHub
2. Clone the fork
```bash
git clone https://github.com/YOUR_USERNAME_HERE/linutil.git
cd linutil
```
## 3. Make your changes
- **Edit the files you want to change**: Make your changes to the relevant files.
- **Test your changes**: Run `cargo run` to test your modifications in a local environment and ensure everything works as expected.
## 4. Understand the existing code
- **Have a clear reason**: 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!

View File

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

View File

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

View File

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

View File

@ -140,3 +140,4 @@ https://github.com/ChrisTitusTech/dwm-titus
- **Ollama**: This utility is designed to manage ollama in your system
- **Service Manager**: This utility is designed to manage services in your system
- **WiFi Manager**: This utility is designed to manage wifi in your system

View File

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

View File

@ -20,6 +20,7 @@ portable-pty = "0.8.1"
ratatui = "0.29.0"
tui-term = "0.2.0"
temp-dir = "0.1.14"
time = { version = "0.3.36", features = ["local-offset", "macros", "formatting"] }
unicode-width = "0.2.0"
rand = { version = "0.8.5", optional = true }
linutil_core = { path = "../core", version = "24.9.28" }

View File

@ -17,11 +17,11 @@ use std::{
sync::{Arc, Mutex},
thread::JoinHandle,
};
use time::{macros::format_description, OffsetDateTime};
use tui_term::{
vt100::{self, Screen},
widget::PseudoTerminal,
};
pub struct RunningCommand {
/// A buffer to save all the command output (accumulates, until the command exits)
buffer: Arc<Mutex<Vec<u8>>>,
@ -37,6 +37,7 @@ pub struct RunningCommand {
writer: Box<dyn Write + Send>,
/// Only set after the process has ended
status: Option<ExitStatus>,
log_path: Option<String>,
scroll_offset: usize,
}
@ -79,10 +80,20 @@ impl FloatContent for RunningCommand {
.style(Style::default()),
);
Block::default()
let mut block = Block::default()
.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
@ -111,6 +122,11 @@ impl FloatContent for RunningCommand {
KeyCode::PageDown => {
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
_ => self.handle_passthrough_key_event(key),
}
@ -134,6 +150,7 @@ impl FloatContent for RunningCommand {
Shortcut::new("Close window", ["Enter", "q"]),
Shortcut::new("Scroll up", ["Page up"]),
Shortcut::new("Scroll down", ["Page down"]),
Shortcut::new("Save log", ["l"]),
]),
)
} else {
@ -237,6 +254,7 @@ impl RunningCommand {
pty_master: pair.master,
writer,
status: None,
log_path: None,
scroll_offset: 0,
}
}
@ -284,6 +302,24 @@ 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
fn handle_passthrough_key_event(&mut self, key: &KeyEvent) {
let input_bytes = match key.code {