mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-23 13:45:19 +00:00
Compare commits
9 Commits
e8eb2cf8a4
...
83f231e414
Author | SHA1 | Date | |
---|---|---|---|
|
83f231e414 | ||
|
d39ffad527 | ||
|
c0982a787f | ||
|
4f7de594a6 | ||
|
fa2f838b63 | ||
|
1d9471a3ce | ||
|
4d478a1047 | ||
|
1dea0c2391 | ||
|
c9e1cc6b99 |
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
@ -16,6 +16,7 @@ cd linutil
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3. Make your changes
|
## 3. Make your changes
|
||||||
|
|
||||||
- **Edit the files you want to change**: Make your changes to the relevant files.
|
- **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.
|
- **Test your changes**: Run `cargo run` to test your modifications in a local environment and ensure everything works as expected.
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ cd linutil
|
||||||
## 11. Documentation
|
## 11. Documentation
|
||||||
|
|
||||||
- **Update the documentation**: If your change affects the functionality, please update the relevant documentation files to reflect this.
|
- **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
|
## 12. License
|
||||||
|
|
||||||
|
|
2
.github/workflows/github-pages.yml
vendored
2
.github/workflows/github-pages.yml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
||||||
|
|
||||||
- name: Copy Contributing Guidelines
|
- name: Copy Contributing Guidelines
|
||||||
run: |
|
run: |
|
||||||
echo "<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md'
|
echo -e "<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md'
|
||||||
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -9,6 +9,9 @@ installAlacritty() {
|
||||||
pacman)
|
pacman)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty
|
||||||
;;
|
;;
|
||||||
|
nix-env)
|
||||||
|
"$PACKAGER" -iA nixpkgs.alacritty
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y alacritty
|
"$ESCALATION_TOOL" "$PACKAGER" install -y alacritty
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -15,6 +15,9 @@ install_adb() {
|
||||||
dnf|zypper)
|
dnf|zypper)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y android-tools
|
"$ESCALATION_TOOL" "$PACKAGER" install -y android-tools
|
||||||
;;
|
;;
|
||||||
|
nix-env)
|
||||||
|
"$PACKAGER" -iA nixpkgs.android-tools
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
# Function to prompt the user for installation choice
|
# Function to prompt the user for installation choice
|
||||||
choose_installation() {
|
choose_installation() {
|
||||||
clear
|
|
||||||
printf "%b\n" "${YELLOW}Choose what to install:${RC}"
|
printf "%b\n" "${YELLOW}Choose what to install:${RC}"
|
||||||
printf "%b\n" "1. ${YELLOW}Docker${RC}"
|
printf "%b\n" "1. ${YELLOW}Docker${RC}"
|
||||||
printf "%b\n" "2. ${YELLOW}Docker Compose${RC}"
|
printf "%b\n" "2. ${YELLOW}Docker Compose${RC}"
|
||||||
|
@ -36,6 +35,11 @@ install_docker() {
|
||||||
"$ESCALATION_TOOL" systemctl enable docker
|
"$ESCALATION_TOOL" systemctl enable docker
|
||||||
"$ESCALATION_TOOL" systemctl start docker
|
"$ESCALATION_TOOL" systemctl start docker
|
||||||
;;
|
;;
|
||||||
|
nix-env)
|
||||||
|
"$PACKAGER" -iA nixpkgs.docker
|
||||||
|
"$ESCALATION_TOOL" sed -i'' -E '/^[[:space:]]*virtualisation\.docker\.enable/!b; s/^([[:space:]]*)virtualisation\.docker\.enable.*/\1virtualisation.docker.enable = true;/' "$NIXOS_CONFIG" || echo 'virtualisation.docker.enable = true;' | "$ESCALATION_TOOL" tee -a "$NIXOS_CONFIG"
|
||||||
|
"$ESCALATION_TOOL" nixos-rebuild switch
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -55,6 +59,9 @@ install_docker_compose() {
|
||||||
pacman)
|
pacman)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm docker-compose
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm docker-compose
|
||||||
;;
|
;;
|
||||||
|
nix-env)
|
||||||
|
"$PACKAGER" -iA nixpkgs.docker-compose
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -84,4 +91,4 @@ install_components() {
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
install_components
|
install_components
|
||||||
|
|
|
@ -15,6 +15,8 @@ setupDWM() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" groupinstall -y "Development Tools"
|
"$ESCALATION_TOOL" "$PACKAGER" groupinstall -y "Development Tools"
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel unzip flameshot lxappearance feh mate-polkit # no need to include git here as it should be already installed via "Development Tools"
|
"$ESCALATION_TOOL" "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel unzip flameshot lxappearance feh mate-polkit # no need to include git here as it should be already installed via "Development Tools"
|
||||||
;;
|
;;
|
||||||
|
nix-env)
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -25,6 +25,11 @@ setup_flatpak() {
|
||||||
pacman)
|
pacman)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak
|
||||||
;;
|
;;
|
||||||
|
nix-env)
|
||||||
|
"$PACKAGER" -iA nixpkgs.flatpak
|
||||||
|
"$ESCALATION_TOOL" sed -i'' -E '/^[[:space:]]*services\.flatpak\.enable/!b; s/^([[:space:]]*)services\.flatpak\.enable.*/\1services.flatpak.enable = true;/' "$NIXOS_CONFIG" || echo 'services.flatpak.enable = true;' | "$ESCALATION_TOOL" tee -a "$NIXOS_CONFIG"
|
||||||
|
"$ESCALATION_TOOL" nixos-rebuild switch
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
|
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -78,6 +78,16 @@ checkPackageManager() {
|
||||||
if command_exists "${pgm}"; then
|
if command_exists "${pgm}"; then
|
||||||
PACKAGER=${pgm}
|
PACKAGER=${pgm}
|
||||||
printf "%b\n" "${CYAN}Using ${pgm} as package manager${RC}"
|
printf "%b\n" "${CYAN}Using ${pgm} as package manager${RC}"
|
||||||
|
|
||||||
|
if [ $PACKAGER = 'nix-env' ] && [ -z "$NIXOS_CONFIG" ]; then
|
||||||
|
NIXOS_CONFIG="/etc/nixos/configuration.nix"
|
||||||
|
while [ ! -f "$NIXOS_CONFIG" ]; do
|
||||||
|
printf "%b\n" "${RED}configuration.nix not found.${RC}"
|
||||||
|
printf "%b" "${YELLOW}Enter the path manually: ${RC}"
|
||||||
|
read -r NIXOS_CONFIG
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -127,7 +137,7 @@ checkDistro() {
|
||||||
checkEnv() {
|
checkEnv() {
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
checkCommandRequirements "curl groups $ESCALATION_TOOL"
|
checkCommandRequirements "curl groups $ESCALATION_TOOL"
|
||||||
checkPackageManager 'nala apt-get dnf pacman zypper'
|
checkPackageManager 'nala apt-get dnf pacman zypper nix-env'
|
||||||
checkCurrentDirectoryWritable
|
checkCurrentDirectoryWritable
|
||||||
checkSuperUser
|
checkSuperUser
|
||||||
checkDistro
|
checkDistro
|
||||||
|
|
|
@ -13,7 +13,7 @@ change_orientation() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Change Monitor Orientation${RC}"
|
printf "%b\n" "${YELLOW} Change Monitor Orientation${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b" "${YELLOW}Choose a monitor to configure: ${RC}"
|
printf "%b\n" "${YELLOW}Choose a monitor to configure: ${RC}"
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||||
|
|
|
@ -13,7 +13,7 @@ disable_monitor() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Disable Monitor${RC}"
|
printf "%b\n" "${YELLOW} Disable Monitor${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b" "Choose a monitor to disable: "
|
printf "%b\n" "Choose a monitor to disable: "
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||||
|
|
|
@ -13,7 +13,7 @@ enable_monitor() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Enable Monitor${RC}"
|
printf "%b\n" "${YELLOW} Enable Monitor${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b" "${YELLOW}Choose a monitor to enable: ${RC}"
|
printf "%b\n" "${YELLOW}Choose a monitor to enable: ${RC}"
|
||||||
|
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
. ./utility_functions.sh
|
. ../utility_functions.sh
|
||||||
|
|
||||||
. ../../common-script.sh
|
. ../../common-script.sh
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ manage_arrangement() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Manage Monitor Arrangement${RC}"
|
printf "%b\n" "${YELLOW} Manage Monitor Arrangement${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b" "${YELLOW}Choose the monitor to arrange: ${RC}"
|
printf "%b\n" "${YELLOW}Choose the monitor to arrange: ${RC}"
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${YELLOW}$monitor${RC}"
|
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ set_primary_monitor() {
|
||||||
printf "%b\n" "${YELLOW}Choose a monitor to set as primary:${RC}"
|
printf "%b\n" "${YELLOW}Choose a monitor to set as primary:${RC}"
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${YELLOW}$monitor${RC}"
|
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->\n\n# Contributing Guidelines for Linutil
|
<!-- 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:
|
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:
|
||||||
|
|
||||||
|
@ -16,6 +18,7 @@ cd linutil
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3. Make your changes
|
## 3. Make your changes
|
||||||
|
|
||||||
- **Edit the files you want to change**: Make your changes to the relevant files.
|
- **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.
|
- **Test your changes**: Run `cargo run` to test your modifications in a local environment and ensure everything works as expected.
|
||||||
|
|
||||||
|
@ -60,6 +63,7 @@ cd linutil
|
||||||
## 11. Documentation
|
## 11. Documentation
|
||||||
|
|
||||||
- **Update the documentation**: If your change affects the functionality, please update the relevant documentation files to reflect this.
|
- **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
|
## 12. License
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{state::ListEntry, theme::Theme};
|
use crate::{state::ListEntry, theme::Theme};
|
||||||
use crossterm::event::{KeyCode, KeyEvent};
|
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||||
use ego_tree::NodeId;
|
use ego_tree::NodeId;
|
||||||
use linutil_core::Tab;
|
use linutil_core::Tab;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
@ -116,21 +116,27 @@ impl Filter {
|
||||||
pub fn handle_key(&mut self, event: &KeyEvent) -> SearchAction {
|
pub fn handle_key(&mut self, event: &KeyEvent) -> SearchAction {
|
||||||
//Insert user input into the search bar
|
//Insert user input into the search bar
|
||||||
match event.code {
|
match event.code {
|
||||||
|
KeyCode::Char('c') if event.modifiers.contains(KeyModifiers::CONTROL) => {
|
||||||
|
return self.exit_search()
|
||||||
|
}
|
||||||
KeyCode::Char(c) => self.insert_char(c),
|
KeyCode::Char(c) => self.insert_char(c),
|
||||||
KeyCode::Backspace => self.remove_previous(),
|
KeyCode::Backspace => self.remove_previous(),
|
||||||
KeyCode::Delete => self.remove_next(),
|
KeyCode::Delete => self.remove_next(),
|
||||||
KeyCode::Left => return self.cursor_left(),
|
KeyCode::Left => return self.cursor_left(),
|
||||||
KeyCode::Right => return self.cursor_right(),
|
KeyCode::Right => return self.cursor_right(),
|
||||||
KeyCode::Esc => {
|
|
||||||
self.input_position = 0;
|
|
||||||
self.search_input.clear();
|
|
||||||
return SearchAction::Exit;
|
|
||||||
}
|
|
||||||
KeyCode::Enter => return SearchAction::Exit,
|
KeyCode::Enter => return SearchAction::Exit,
|
||||||
|
KeyCode::Esc => return self.exit_search(),
|
||||||
_ => return SearchAction::None,
|
_ => return SearchAction::None,
|
||||||
};
|
};
|
||||||
SearchAction::Update
|
SearchAction::Update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn exit_search(&mut self) -> SearchAction {
|
||||||
|
self.input_position = 0;
|
||||||
|
self.search_input.clear();
|
||||||
|
SearchAction::Exit
|
||||||
|
}
|
||||||
|
|
||||||
fn cursor_left(&mut self) -> SearchAction {
|
fn cursor_left(&mut self) -> SearchAction {
|
||||||
self.input_position = self.input_position.saturating_sub(1);
|
self.input_position = self.input_position.saturating_sub(1);
|
||||||
SearchAction::None
|
SearchAction::None
|
||||||
|
|
|
@ -119,7 +119,10 @@ impl AppState {
|
||||||
match self.focus {
|
match self.focus {
|
||||||
Focus::Search => (
|
Focus::Search => (
|
||||||
"Search bar",
|
"Search bar",
|
||||||
Box::new([Shortcut::new("Finish search", ["Enter"])]),
|
Box::new([
|
||||||
|
Shortcut::new("Abort search", ["Esc", "CTRL-c"]),
|
||||||
|
Shortcut::new("Search", ["Enter"]),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
|
|
||||||
Focus::List => {
|
Focus::List => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user