mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-22 05:12:27 +00:00
Merge remote-tracking branch 'upstream/main' into auto-cpufreq
This commit is contained in:
commit
c62e53ff08
24
Cargo.lock
generated
24
Cargo.lock
generated
|
@ -443,6 +443,7 @@ dependencies = [
|
||||||
"rand",
|
"rand",
|
||||||
"ratatui",
|
"ratatui",
|
||||||
"temp-dir",
|
"temp-dir",
|
||||||
|
"textwrap",
|
||||||
"tree-sitter-bash",
|
"tree-sitter-bash",
|
||||||
"tree-sitter-highlight",
|
"tree-sitter-highlight",
|
||||||
"tui-term",
|
"tui-term",
|
||||||
|
@ -889,6 +890,12 @@ 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"
|
||||||
|
@ -955,6 +962,17 @@ 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"
|
||||||
|
@ -1067,6 +1085,12 @@ 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"
|
||||||
|
|
|
@ -33,30 +33,18 @@ pub fn get_tabs(validate: bool) -> (TempDir, Vec<Tab>) {
|
||||||
|
|
||||||
let tabs: Vec<Tab> = tabs
|
let tabs: Vec<Tab> = tabs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(
|
.map(|(TabEntry { name, data }, directory)| {
|
||||||
|(
|
let mut tree = Tree::new(Rc::new(ListNode {
|
||||||
TabEntry {
|
name: "root".to_string(),
|
||||||
name,
|
description: String::new(),
|
||||||
data,
|
command: Command::None,
|
||||||
multi_selectable,
|
task_list: String::new(),
|
||||||
},
|
multi_select: false,
|
||||||
directory,
|
}));
|
||||||
)| {
|
let mut root = tree.root_mut();
|
||||||
let mut tree = Tree::new(Rc::new(ListNode {
|
create_directory(data, &mut root, &directory, validate, true);
|
||||||
name: "root".to_string(),
|
Tab { name, tree }
|
||||||
description: String::new(),
|
})
|
||||||
command: Command::None,
|
|
||||||
task_list: String::new(),
|
|
||||||
}));
|
|
||||||
let mut root = tree.root_mut();
|
|
||||||
create_directory(data, &mut root, &directory, validate);
|
|
||||||
Tab {
|
|
||||||
name,
|
|
||||||
tree,
|
|
||||||
multi_selectable,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
if tabs.is_empty() {
|
if tabs.is_empty() {
|
||||||
|
@ -74,12 +62,6 @@ struct TabList {
|
||||||
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)]
|
||||||
|
@ -94,6 +76,12 @@ 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)]
|
||||||
|
@ -174,8 +162,11 @@ 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 {
|
||||||
|
@ -183,8 +174,9 @@ 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);
|
create_directory(entries, &mut node, command_dir, validate, multi_select);
|
||||||
}
|
}
|
||||||
EntryType::Command(command) => {
|
EntryType::Command(command) => {
|
||||||
node.append(Rc::new(ListNode {
|
node.append(Rc::new(ListNode {
|
||||||
|
@ -192,6 +184,7 @@ 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) => {
|
||||||
|
@ -210,6 +203,7 @@ fn create_directory(
|
||||||
file: script,
|
file: script,
|
||||||
},
|
},
|
||||||
task_list: entry.task_list,
|
task_list: entry.task_list,
|
||||||
|
multi_select,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ 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)]
|
||||||
|
@ -32,4 +31,5 @@ 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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,6 +218,9 @@ setupDisplayManager() {
|
||||||
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"
|
||||||
|
|
|
@ -200,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.\nThis command installs and condifures alacritty terminal emulator."
|
description = "Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows. This command installs and configures alacritty terminal emulator."
|
||||||
script = "alacritty-setup.sh"
|
script = "alacritty-setup.sh"
|
||||||
task_list = "I FM"
|
task_list = "I FM"
|
||||||
|
|
||||||
|
@ -218,13 +218,13 @@ task_list = "I SS"
|
||||||
|
|
||||||
[[data]]
|
[[data]]
|
||||||
name = "Bash Prompt"
|
name = "Bash Prompt"
|
||||||
description = "The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems.\nIt is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful.\nThis command configures the key sections and functionalities defined in the .bashrc file from CTT's mybash repository.\nhttps://github.com/ChrisTitusTech/mybash"
|
description = "The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems. It is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful. This command configures the key sections and functionalities defined in the .bashrc file from CTT's mybash repository. https://github.com/ChrisTitusTech/mybash"
|
||||||
script = "mybash-setup.sh"
|
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.\nBottles also provides tools to categorize, organize and optimize your applications."
|
description = "Bottles allows Windows software, like applications and games, to run on Linux. Bottles also provides tools to categorize, organize and optimize your applications."
|
||||||
script = "bottles-setup.sh"
|
script = "bottles-setup.sh"
|
||||||
task_list = "FI"
|
task_list = "FI"
|
||||||
|
|
||||||
|
@ -242,13 +242,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.\nIt is written mainly in C, with performance and customizability in mind.\nThis command installs fastfetch and configures from CTT's mybash repository.\nhttps://github.com/ChrisTitusTech/mybash"
|
description = "Fastfetch is a neofetch-like tool for fetching system information and displaying it prettily. It is written mainly in C, with performance and customizability in mind. This command installs fastfetch and configures from CTT's mybash repository. https://github.com/ChrisTitusTech/mybash"
|
||||||
script = "fastfetch-setup.sh"
|
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.\nThis command installs Flatpak and adds the Flathub repository"
|
description = "Flatpak is a universal application sandbox for Linux that uses isolated packages from Flathub to prevent conflicts and system alterations, while alleviating dependency concerns. This command installs Flatpak and adds the Flathub repository"
|
||||||
script = "setup-flatpak.sh"
|
script = "setup-flatpak.sh"
|
||||||
task_list = "I"
|
task_list = "I"
|
||||||
|
|
||||||
|
@ -260,7 +260,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.\nkitty is written in a mix of C and Python programming languages.\n This command installs and configures kitty."
|
description = "kitty is a free and open-source GPU-accelerated terminal emulator for Linux, macOS, and some BSD distributions, focused on performance and features. kitty is written in a mix of C and Python programming languages. This command installs and configures kitty."
|
||||||
script = "kitty-setup.sh"
|
script = "kitty-setup.sh"
|
||||||
task_list = "I FM"
|
task_list = "I FM"
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ 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.\nThis command installs and configures rofi with configuration from CTT's DWM repo.\nhttps://github.com/ChrisTitusTech/dwm-titus"
|
description = "Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport. This command installs and configures rofi with configuration from CTT's DWM repo. https://github.com/ChrisTitusTech/dwm-titus"
|
||||||
script = "rofi-setup.sh"
|
script = "rofi-setup.sh"
|
||||||
task_list = "I FM"
|
task_list = "I FM"
|
||||||
|
|
||||||
|
@ -304,6 +304,6 @@ 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.\nThis command installs ZSH prompt and provides basic configuration."
|
description = "The Z shell is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh. This command installs ZSH prompt and provides basic configuration."
|
||||||
script = "zsh-setup.sh"
|
script = "zsh-setup.sh"
|
||||||
task_list = "I FM"
|
task_list = "I FM"
|
|
@ -10,7 +10,7 @@ GREEN='\033[32m'
|
||||||
|
|
||||||
command_exists() {
|
command_exists() {
|
||||||
for cmd in "$@"; do
|
for cmd in "$@"; do
|
||||||
export PATH=/home/jeeva/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH
|
export PATH="$HOME/.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
|
||||||
|
|
|
@ -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.\nIt's designed to be a simple, clean, and easy to read loot filter that highlights the most important items.\nWorks on battle.net and single player.\nNo frills, no config, just highlights high runes and other valuable items.\nFor more information visit: https://github.com/ChrisTitusTech/d2r-loot-filter"
|
description = "This is a loot filter for Diablo II Resurrected. It's designed to be a simple, clean, and easy to read loot filter that highlights the most important items. Works on battle.net and single player. No frills, no config, just highlights high runes and other valuable items. For more information visit: https://github.com/ChrisTitusTech/d2r-loot-filter"
|
||||||
script = "diablo-ii/d2r-loot-filters.sh"
|
script = "diablo-ii/d2r-loot-filters.sh"
|
||||||
task_list = "FM"
|
task_list = "FM"
|
||||||
|
|
|
@ -2,6 +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.\nThis command installs UFW and configures UFW based on CTT's recommended rules.\nFor more information visit: https://christitus.com/linux-security-mistakes"
|
description = "Developed to ease iptables firewall configuration, UFW provides a user friendly way to create an IPv4 or IPv6 host-based firewall. This command installs UFW and configures UFW based on CTT's recommended rules. For more information visit: https://christitus.com/linux-security-mistakes"
|
||||||
script = "firewall-baselines.sh"
|
script = "firewall-baselines.sh"
|
||||||
task_list = "I SS"
|
task_list = "I SS"
|
||||||
|
|
|
@ -21,12 +21,12 @@ 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"
|
gst-plugins-base-libs lib32-gst-plugins-base-libs sdl2 lib32-sdl2 v4l-utils lib32-v4l-utils sqlite lib32-sqlite"
|
||||||
|
|
||||||
$AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS
|
$AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS
|
||||||
;;
|
;;
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
DISTRO_DEPS="libasound2 libsdl2 wine64 wine32"
|
DISTRO_DEPS="libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386 wine64 wine32"
|
||||||
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
"$ESCALATION_TOOL" dpkg --add-architecture i386
|
"$ESCALATION_TOOL" dpkg --add-architecture i386
|
||||||
|
@ -36,7 +36,7 @@ installDepend() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
if [ "$(rpm -E %fedora)" -le 41 ]; then
|
if [ "$(rpm -E %fedora)" -le 41 ]; then
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install ffmpeg ffmpeg-libs -y
|
"$ESCALATION_TOOL" "$PACKAGER" install ffmpeg ffmpeg-libs -y
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
||||||
else
|
else
|
||||||
|
@ -69,7 +69,7 @@ installAdditionalDepend() {
|
||||||
|
|
||||||
version_no_v=$(echo "$version" | tr -d v)
|
version_no_v=$(echo "$version" | tr -d v)
|
||||||
curl -sSLo "lutris_${version_no_v}_all.deb" "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb"
|
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 ./lutris_"${version_no_v}"_all.deb
|
"$ESCALATION_TOOL" "$PACKAGER" install ./lutris_"${version_no_v}"_all.deb
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
name = "System Setup"
|
name = "System Setup"
|
||||||
multi_selectable = false
|
|
||||||
|
|
||||||
[[data]]
|
[[data]]
|
||||||
name = "Arch Linux"
|
name = "Arch Linux"
|
||||||
|
@ -14,16 +13,17 @@ 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]]
|
[[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.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
|
description = "Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
|
||||||
script = "arch/paru-setup.sh"
|
script = "arch/paru-setup.sh"
|
||||||
task_list = "I"
|
task_list = "I"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Yay AUR Helper"
|
name = "Yay AUR Helper"
|
||||||
description = "Yet Another Yogurt - An AUR Helper Written in Go.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
|
description = "Yet Another Yogurt - An AUR Helper Written in Go. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
|
||||||
script = "arch/yay-setup.sh"
|
script = "arch/yay-setup.sh"
|
||||||
task_list = "I"
|
task_list = "I"
|
||||||
|
|
||||||
|
@ -55,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.\nThat software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions; you can use the RPM Fusion repositories with tools like yum and PackageKit.\nFor more information visit: https://rpmfusion.org/"
|
description = "RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship. That software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions; you can use the RPM Fusion repositories with tools like yum and PackageKit. For more information visit: https://rpmfusion.org/"
|
||||||
script = "fedora/rpm-fusion-setup.sh"
|
script = "fedora/rpm-fusion-setup.sh"
|
||||||
task_list = "MP"
|
task_list = "MP"
|
||||||
|
|
||||||
|
@ -82,12 +82,14 @@ name = "Full System Cleanup"
|
||||||
description = "This script is designed to remove unnecessary packages, clean old cache files, remove temporary files, and to empty the trash."
|
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"
|
||||||
|
|
|
@ -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
|
||||||
|
@ -78,6 +78,7 @@ script = "monitor-control/set_resolutions.sh"
|
||||||
|
|
||||||
[[data]]
|
[[data]]
|
||||||
name = "User Account Manager"
|
name = "User Account Manager"
|
||||||
|
multi_select = false
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Add User"
|
name = "Add User"
|
||||||
|
@ -104,6 +105,7 @@ name = "Auto Mount Drive"
|
||||||
description = "This utility is designed to help with automating the process of mounting a drive on to your system."
|
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"
|
||||||
|
@ -115,6 +117,7 @@ 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"
|
||||||
|
|
|
@ -45,17 +45,12 @@ https://github.com/ChrisTitusTech/neovim
|
||||||
- **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.
|
||||||
- **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.
|
- **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.
|
||||||
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.
|
||||||
- **Auto CPU Frequency**: Automatic CPU speed & power optimizer.
|
- **Auto CPU Frequency**: Automatic CPU speed & power optimizer.
|
||||||
https://github.com/AdnanHodzic/auto-cpufreq
|
https://github.com/AdnanHodzic/auto-cpufreq
|
||||||
- **Bash Prompt**: The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems.
|
- **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
|
||||||
It is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful.
|
- **Bottles**: Bottles allows Windows software, like applications and games, to run on Linux. Bottles also provides tools to categorize, organize and optimize your applications.
|
||||||
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.
|
||||||
- **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.
|
||||||
|
@ -63,41 +58,26 @@ All of the layouts can be applied dynamically, optimising the environment for th
|
||||||
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.
|
- **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
|
||||||
It is written mainly in C, with performance and customizability in mind.
|
- **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
|
||||||
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**: 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 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.
|
- **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
|
||||||
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.
|
- **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.
|
||||||
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.
|
- **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
|
||||||
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.
|
- **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
|
||||||
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
|
||||||
|
|
||||||
|
@ -105,19 +85,15 @@ For more information visit: https://christitus.com/linux-security-mistakes
|
||||||
### 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.
|
||||||
- **Paru AUR Helper**: Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction.
|
- **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
|
||||||
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
|
||||||
- **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.
|
- **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/
|
||||||
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
|
||||||
- **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
|
||||||
|
|
|
@ -36,6 +36,10 @@ Defaults to \fIdefault\fR.
|
||||||
\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.
|
||||||
|
|
|
@ -27,6 +27,7 @@ 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"
|
||||||
|
|
|
@ -20,16 +20,19 @@ 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: Vec<String>,
|
pub src: 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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,12 +111,6 @@ 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<_>>()
|
||||||
|
@ -125,50 +122,49 @@ fn get_lines_owned(s: &str) -> Vec<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FloatingText {
|
impl FloatingText {
|
||||||
pub fn new(text: String, title: &str) -> Self {
|
pub fn new(text: String, title: &str, wrap_words: bool) -> Self {
|
||||||
let src = get_lines(&text)
|
let max_line_width = 80;
|
||||||
.into_iter()
|
let wrapped_lines = if wrap_words {
|
||||||
.map(|s| s.to_string())
|
wrap(&text, max_line_width)
|
||||||
.collect::<Vec<_>>();
|
.into_iter()
|
||||||
|
.map(|cow| cow.into_owned())
|
||||||
|
.collect()
|
||||||
|
} else {
|
||||||
|
get_lines_owned(&text)
|
||||||
|
};
|
||||||
|
|
||||||
let max_line_width = max_width!(src);
|
|
||||||
Self {
|
Self {
|
||||||
src,
|
src: text,
|
||||||
|
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 (max_line_width, src) = match command {
|
let src = match command {
|
||||||
Command::Raw(cmd) => {
|
Command::Raw(cmd) => Some(cmd.clone()),
|
||||||
// just apply highlights directly
|
Command::LocalFile { file, .. } => std::fs::read_to_string(file)
|
||||||
(max_width!(get_lines(cmd)), Some(cmd.clone()))
|
.map_err(|_| format!("File not found: {:?}", file))
|
||||||
}
|
.ok(),
|
||||||
Command::LocalFile { file, .. } => {
|
Command::None => None,
|
||||||
// have to read from tmp dir to get cmd src
|
}?;
|
||||||
let raw = std::fs::read_to_string(file)
|
|
||||||
.map_err(|_| format!("File not found: {:?}", file))
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
(max_width!(get_lines(&raw)), Some(raw))
|
let max_line_width = 80;
|
||||||
}
|
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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -197,6 +193,20 @@ 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 {
|
||||||
|
@ -217,13 +227,22 @@ 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 { height, .. } = inner_area;
|
let Rect { width, height, .. } = inner_area;
|
||||||
|
|
||||||
|
self.update_wrapping(width as usize);
|
||||||
|
|
||||||
let lines = self
|
let lines = self
|
||||||
.src
|
.wrapped_lines
|
||||||
.iter()
|
.iter()
|
||||||
.skip(self.v_scroll)
|
.skip(self.v_scroll)
|
||||||
.take(height as usize)
|
.take(height as usize)
|
||||||
.flat_map(|l| l.into_text().unwrap())
|
.flat_map(|l| {
|
||||||
|
if self.wrap_words {
|
||||||
|
vec![Line::raw(l.clone())]
|
||||||
|
} else {
|
||||||
|
l.into_text().unwrap().lines
|
||||||
|
}
|
||||||
|
})
|
||||||
.map(|line| {
|
.map(|line| {
|
||||||
let mut skipped = 0;
|
let mut skipped = 0;
|
||||||
let mut spans = line
|
let mut spans = line
|
||||||
|
|
|
@ -33,12 +33,15 @@ struct Args {
|
||||||
#[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(args.theme, args.override_validation);
|
let mut state = AppState::new(args.theme, args.override_validation, args.size_bypass);
|
||||||
|
|
||||||
stdout().execute(EnterAlternateScreen)?;
|
stdout().execute(EnterAlternateScreen)?;
|
||||||
enable_raw_mode()?;
|
enable_raw_mode()?;
|
||||||
|
|
|
@ -62,6 +62,7 @@ pub struct AppState {
|
||||||
drawable: bool,
|
drawable: bool,
|
||||||
#[cfg(feature = "tips")]
|
#[cfg(feature = "tips")]
|
||||||
tip: String,
|
tip: String,
|
||||||
|
size_bypass: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Focus {
|
pub enum Focus {
|
||||||
|
@ -86,7 +87,7 @@ enum SelectedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppState {
|
impl AppState {
|
||||||
pub fn new(theme: Theme, override_validation: bool) -> Self {
|
pub fn new(theme: Theme, override_validation: bool, size_bypass: bool) -> Self {
|
||||||
let (temp_dir, tabs) = linutil_core::get_tabs(!override_validation);
|
let (temp_dir, tabs) = linutil_core::get_tabs(!override_validation);
|
||||||
let root_id = tabs[0].tree.root().id();
|
let root_id = tabs[0].tree.root().id();
|
||||||
|
|
||||||
|
@ -104,6 +105,7 @@ impl AppState {
|
||||||
drawable: false,
|
drawable: false,
|
||||||
#[cfg(feature = "tips")]
|
#[cfg(feature = "tips")]
|
||||||
tip: get_random_tip(),
|
tip: get_random_tip(),
|
||||||
|
size_bypass,
|
||||||
};
|
};
|
||||||
|
|
||||||
state.update_items();
|
state.update_items();
|
||||||
|
@ -153,12 +155,10 @@ 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.is_current_tab_multi_selectable() {
|
if self.multi_select {
|
||||||
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"]));
|
||||||
|
@ -188,7 +188,9 @@ 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 terminal_size.width < MIN_WIDTH || terminal_size.height < MIN_HEIGHT {
|
if !self.size_bypass
|
||||||
|
&& (terminal_size.height < MIN_HEIGHT || terminal_size.width < MIN_WIDTH)
|
||||||
|
{
|
||||||
let warning = Paragraph::new(format!(
|
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,
|
||||||
|
@ -330,7 +332,12 @@ 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 {
|
||||||
("", Style::new())
|
let ms_style = if self.multi_select && !node.multi_select {
|
||||||
|
Style::default().fg(self.theme.multi_select_disabled_color())
|
||||||
|
} else {
|
||||||
|
Style::new()
|
||||||
|
};
|
||||||
|
("", ms_style)
|
||||||
};
|
};
|
||||||
if *has_children {
|
if *has_children {
|
||||||
Line::from(format!(
|
Line::from(format!(
|
||||||
|
@ -340,6 +347,7 @@ 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!(
|
||||||
"{} {} {}",
|
"{} {} {}",
|
||||||
|
@ -357,13 +365,21 @@ 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(" ").style(self.theme.dir_color())
|
Line::from(" ")
|
||||||
|
.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)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
@ -479,6 +495,13 @@ 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(),
|
||||||
|
@ -556,41 +579,31 @@ 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(command) = self.get_selected_node() {
|
if let Some(node) = self.get_selected_node() {
|
||||||
if self.selected_commands.contains(&command) {
|
if node.multi_select {
|
||||||
self.selected_commands.retain(|c| c != &command);
|
if self.selected_commands.contains(&node) {
|
||||||
} else {
|
self.selected_commands.retain(|c| c != &node);
|
||||||
self.selected_commands.push(command);
|
} else {
|
||||||
|
self.selected_commands.push(node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_current_tab_multi_selectable(&self) -> bool {
|
|
||||||
let index = self.current_tab.selected().unwrap_or(0);
|
|
||||||
self.tabs
|
|
||||||
.get(index)
|
|
||||||
.map_or(false, |tab| tab.multi_selectable)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_items(&mut self) {
|
fn update_items(&mut self) {
|
||||||
self.filter.update_items(
|
self.filter.update_items(
|
||||||
&self.tabs,
|
&self.tabs,
|
||||||
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);
|
||||||
|
@ -709,7 +722,8 @@ 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 = FloatingText::new(command_description, "Command Description");
|
let description =
|
||||||
|
FloatingText::new(command_description, "Command Description", true);
|
||||||
self.spawn_float(description, 80, 80);
|
self.spawn_float(description, 80, 80);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -795,7 +809,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"),
|
FloatingText::new(ACTIONS_GUIDE.to_string(), "Important Actions Guide", true),
|
||||||
80,
|
80,
|
||||||
80,
|
80,
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,6 +28,13 @@ impl Theme {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn multi_select_disabled_color(&self) -> Color {
|
||||||
|
match self {
|
||||||
|
Theme::Default => Color::DarkGray,
|
||||||
|
Theme::Compatible => Color::DarkGray,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn tab_color(&self) -> Color {
|
pub fn tab_color(&self) -> Color {
|
||||||
match self {
|
match self {
|
||||||
Theme::Default => Color::Rgb(255, 255, 85),
|
Theme::Default => Color::Rgb(255, 255, 85),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user