Skip to content

Commit 96d4e0f

Browse files
Merge branch 'main' into replaceechowithprintf3
2 parents 3c409be + a151a15 commit 96d4e0f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+582
-428
lines changed

.github/workflows/bashisms.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ jobs:
1919
- uses: actions/checkout@v2
2020

2121
- name: Install devscripts
22-
run: sudo apt install devscripts
22+
run: sudo apt-get update && sudo apt-get install devscripts
2323

24-
- name: Concatenate all .sh files and check for bashisms
24+
- name: Check for bashisms
2525
working-directory: tabs
26-
run: |
27-
find . -name '*.sh' -exec checkbashisms {} + > all_scripts.sh
26+
run: find . -name '*.sh' | xargs -P 4 -n 1 checkbashisms

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
![GitHub Downloads (specific asset, all releases)](https://img.shields.io/github/downloads/ChrisTitusTech/linutil/linutil?label=Total%20Downloads&style=for-the-badge)
55
[![](https://dcbadge.limes.pink/api/server/https://discord.gg/bujFYKAHSp)](https://discord.gg/bujFYKAHSp)
66

7+
<!-- TODO: crates.io package here + <br> -->
8+
[![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)
9+
710
![Preview](docs/assets/preview.png)
811

912
**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.

core/src/inner.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub fn get_tabs(validate: bool) -> Vec<Tab> {
2424
.map(|(TabEntry { name, data }, directory)| {
2525
let mut tree = Tree::new(ListNode {
2626
name: "root".to_string(),
27+
description: "".to_string(),
2728
command: Command::None,
2829
});
2930
let mut root = tree.root_mut();
@@ -146,12 +147,14 @@ fn create_directory(data: Vec<Entry>, node: &mut NodeMut<ListNode>, command_dir:
146147
if let Some(entries) = entry.entries {
147148
let mut node = node.append(ListNode {
148149
name: entry.name,
150+
description: entry.description,
149151
command: Command::None,
150152
});
151153
create_directory(entries, &mut node, command_dir);
152154
} else if let Some(command) = entry.command {
153155
node.append(ListNode {
154156
name: entry.name,
157+
description: entry.description,
155158
command: Command::Raw(command),
156159
});
157160
} else if let Some(script) = entry.script {
@@ -161,6 +164,7 @@ fn create_directory(data: Vec<Entry>, node: &mut NodeMut<ListNode>, command_dir:
161164
}
162165
node.append(ListNode {
163166
name: entry.name,
167+
description: entry.description,
164168
command: Command::LocalFile(dir),
165169
});
166170
} else {

core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ pub struct Tab {
2121
#[derive(Clone, Hash, Eq, PartialEq)]
2222
pub struct ListNode {
2323
pub name: String,
24+
pub description: String,
2425
pub command: Command,
2526
}

tabs/applications-setup/alacritty-setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ installAlacritty() {
77
if ! command_exists alacritty; then
88
case "$PACKAGER" in
99
pacman)
10-
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm alacritty
10+
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty
1111
;;
1212
*)
13-
$ESCALATION_TOOL "$PACKAGER" install -y alacritty
13+
"$ESCALATION_TOOL" "$PACKAGER" install -y alacritty
1414
;;
1515
esac
1616
else

tabs/applications-setup/dwmtitus-setup.sh

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ setupDWM() {
66
printf "%b\n" "${YELLOW}Installing DWM-Titus if not already installed${RC}"
77
case "$PACKAGER" in # Install pre-Requisites
88
pacman)
9-
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git
9+
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git
1010
;;
1111
apt-get|nala)
12-
$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
12+
"$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
1313
;;
1414
dnf)
15-
$ESCALATION_TOOL "$PACKAGER" groupinstall -y "Development Tools"
16-
$ESCALATION_TOOL "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel
15+
"$ESCALATION_TOOL" "$PACKAGER" groupinstall -y "Development Tools"
16+
"$ESCALATION_TOOL" "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel
1717
;;
1818
*)
1919
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
@@ -26,7 +26,7 @@ makeDWM() {
2626
cd "$HOME" && git clone https://github.com/ChrisTitusTech/dwm-titus.git # CD to Home directory to install dwm-titus
2727
# This path can be changed (e.g. to linux-toolbox directory)
2828
cd dwm-titus/ # Hardcoded path, maybe not the best.
29-
$ESCALATION_TOOL make clean install # Run make clean install
29+
"$ESCALATION_TOOL" make clean install # Run make clean install
3030
}
3131

3232
install_nerd_font() {
@@ -115,7 +115,7 @@ picom_animations() {
115115
fi
116116

117117
# Install the built binary
118-
if ! $ESCALATION_TOOL ninja -C build install; then
118+
if ! "$ESCALATION_TOOL" ninja -C build install; then
119119
printf "%b\n" "${RED}Failed to install the built binary${RC}"
120120
return 1
121121
fi
@@ -179,13 +179,13 @@ setupDisplayManager() {
179179
printf "%b\n" "${YELLOW}Setting up Xorg${RC}"
180180
case "$PACKAGER" in
181181
pacman)
182-
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm xorg-xinit xorg-server
182+
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm xorg-xinit xorg-server
183183
;;
184184
apt-get|nala)
185-
$ESCALATION_TOOL "$PACKAGER" install -y xorg xinit
185+
"$ESCALATION_TOOL" "$PACKAGER" install -y xorg xinit
186186
;;
187187
dnf)
188-
$ESCALATION_TOOL "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg
188+
"$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg
189189
;;
190190
*)
191191
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
@@ -207,13 +207,13 @@ setupDisplayManager() {
207207
printf "%b\n" "${YELLOW}No display manager found, installing $DM${RC}"
208208
case "$PACKAGER" in
209209
pacman)
210-
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm "$DM"
210+
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$DM"
211211
;;
212212
apt-get|nala)
213-
$ESCALATION_TOOL "$PACKAGER" install -y "$DM"
213+
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DM"
214214
;;
215215
dnf)
216-
$ESCALATION_TOOL "$PACKAGER" install -y "$DM"
216+
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DM"
217217
;;
218218
*)
219219
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
@@ -232,28 +232,28 @@ setupDisplayManager() {
232232
printf "%b\n" "${YELLOW}Configuring SDDM for autologin${RC}"
233233
SDDM_CONF="/etc/sddm.conf"
234234
if [ ! -f "$SDDM_CONF" ]; then
235-
echo "[Autologin]" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
236-
echo "User=$USER" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
237-
echo "Session=dwm" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
235+
echo "[Autologin]" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
236+
echo "User=$USER" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
237+
echo "Session=dwm" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
238238
else
239-
$ESCALATION_TOOL sed -i '/^\[Autologin\]/d' "$SDDM_CONF"
240-
$ESCALATION_TOOL sed -i '/^User=/d' "$SDDM_CONF"
241-
$ESCALATION_TOOL sed -i '/^Session=/d' "$SDDM_CONF"
242-
echo "[Autologin]" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
243-
echo "User=$USER" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
244-
echo "Session=dwm" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
239+
"$ESCALATION_TOOL" sed -i '/^\[Autologin\]/d' "$SDDM_CONF"
240+
"$ESCALATION_TOOL" sed -i '/^User=/d' "$SDDM_CONF"
241+
"$ESCALATION_TOOL" sed -i '/^Session=/d' "$SDDM_CONF"
242+
echo "[Autologin]" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
243+
echo "User=$USER" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
244+
echo "Session=dwm" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
245245
fi
246246
printf "%b\n" "{YELLOW}Checking if autologin group exists${RC}"
247247
if ! getent group autologin > /dev/null; then
248248
printf "%b\n" "${YELLOW}Creating autologin group${RC}"
249-
$ESCALATION_TOOL groupadd autologin
249+
"$ESCALATION_TOOL" groupadd autologin
250250
else
251251
printf "%b\n" "${GREEN}Autologin group already exists${RC}"
252252
fi
253253
printf "%b\n" "${YELLOW}Adding user with UID 1000 to autologin group${RC}"
254254
USER_UID_1000=$(getent passwd 1000 | cut -d: -f1)
255255
if [ -n "$USER_UID_1000" ]; then
256-
$ESCALATION_TOOL usermod -aG autologin "$USER_UID_1000"
256+
"$ESCALATION_TOOL" usermod -aG autologin "$USER_UID_1000"
257257
printf "%b\n" "${GREEN}User $USER_UID_1000 added to autologin group${RC}"
258258
else
259259
printf "%b\n" "${RED}No user with UID 1000 found - Auto login not possible${RC}"
@@ -271,8 +271,8 @@ install_slstatus() {
271271
read -r response # -r flag to prevent backslashes from being interpreted
272272
if [ "$response" = "y" ] || [ "$response" = "Y" ]; then
273273
printf "%b\n" "${YELLOW}Installing slstatus${RC}"
274-
cd "$HOME/dwm-titus/slstatus" || { echo "Failed to change directory to slstatus"; return 1; }
275-
if $ESCALATION_TOOL make clean install; then
274+
cd "$HOME/dwm-titus/slstatus" || { printf "%b\n" "${RED}Failed to change directory to slstatus${RC}"; return 1; }
275+
if "$ESCALATION_TOOL" make clean install; then
276276
printf "%b\n" "${GREEN}slstatus installed successfully${RC}"
277277
else
278278
printf "%b\n" "${RED}Failed to install slstatus${RC}"

tabs/applications-setup/fastfetch-setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ installFastfetch() {
77
if ! command_exists fastfetch; then
88
case "$PACKAGER" in
99
pacman)
10-
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm fastfetch
10+
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch
1111
;;
1212
*)
13-
$ESCALATION_TOOL "$PACKAGER" install -y fastfetch
13+
"$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch
1414
;;
1515
esac
1616
else

tabs/applications-setup/kitty-setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ installKitty() {
77
if ! command_exists kitty; then
88
case "$PACKAGER" in
99
pacman)
10-
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm kitty
10+
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm kitty
1111
;;
1212
*)
13-
$ESCALATION_TOOL "$PACKAGER" install -y kitty
13+
"$ESCALATION_TOOL" "$PACKAGER" install -y kitty
1414
;;
1515
esac
1616
else

tabs/applications-setup/mybash-setup.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ installDepend() {
88
printf "%b\n" "${YELLOW}Installing Bash...${RC}"
99
case "$PACKAGER" in
1010
pacman)
11-
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git
11+
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git
1212
;;
1313
apt)
14-
$ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
14+
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
1515
;;
1616
dnf)
17-
$ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
17+
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
1818
;;
1919
zypper)
20-
$ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
20+
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
2121
;;
2222
*)
2323
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" # The packages above were grabbed out of the original mybash-setup-script.
@@ -70,7 +70,7 @@ installStarshipAndFzf() {
7070
printf "%b\n" "${GREEN}Fzf already installed${RC}"
7171
else
7272
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
73-
$ESCALATION_TOOL ~/.fzf/install
73+
"$ESCALATION_TOOL" ~/.fzf/install
7474
fi
7575
}
7676

tabs/applications-setup/neovim-setup.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ installNeovim() {
1717
printf "%b\n" "${YELLOW}Installing Neovim...${RC}"
1818
case "$PACKAGER" in
1919
pacman)
20-
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git
20+
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git
2121
;;
2222
apt)
23-
$ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fd-find python3-venv luarocks golang-go shellcheck git
23+
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fd-find python3-venv luarocks golang-go shellcheck git
2424
;;
2525
dnf)
26-
$ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
26+
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
2727
;;
2828
zypper)
29-
$ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
29+
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
3030
;;
3131
*)
3232
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" # The packages above were grabbed out of the original nvim-setup-script.

0 commit comments

Comments
 (0)