Merge branch 'main' into refactor_float

This commit is contained in:
Chris Titus 2024-08-08 17:58:08 -05:00 committed by GitHub
commit a7c70cd653
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 90 additions and 46 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,28 @@
#!/bin/sh -e
. ./common-script.sh
removeSnaps() {
case $PACKAGER in
pacman)
sudo ${PACKAGER} -Rns snapd
;;
apt-get|nala)
sudo ${PACKAGER} autoremove --purge snapd
if [ "$ID" = ubuntu ]; then
sudo apt-mark hold snapd
fi
;;
dnf)
sudo ${PACKAGER} remove snapd
;;
zypper)
sudo ${PACKAGER} remove snapd
;;
*)
echo "removing snapd not implemented for this package manager"
esac
}
checkEnv
removeSnaps

View File

@ -42,6 +42,49 @@ impl CustomList {
name: "root",
command: Command::None,
} => {
ListNode {
name: "Applications Setup",
command: Command::None
} => {
ListNode {
name: "Alacritty",
command: Command::LocalFile("applications-setup/alacritty-setup.sh"),
},
ListNode {
name: "Bash Prompt",
command: Command::Raw("bash -c \"$(curl -s https://raw.githubusercontent.com/ChrisTitusTech/mybash/main/setup.sh)\""),
},
ListNode {
name: "DWM-Titus",
command: Command::LocalFile("applications-setup/dwmtitus-setup.sh")
},
ListNode {
name: "Kitty",
command: Command::LocalFile("applications-setup/kitty-setup.sh")
},
ListNode {
name: "Neovim",
command: Command::Raw("bash -c \"$(curl -s https://raw.githubusercontent.com/ChrisTitusTech/neovim/main/setup.sh)\""),
},
ListNode {
name: "Rofi",
command: Command::LocalFile("applications-setup/rofi-setup.sh"),
},
ListNode {
name: "ZSH Prompt",
command: Command::LocalFile("applications-setup/zsh-setup.sh"),
}
},
ListNode {
name: "Security",
command: Command::None
} => {
ListNode {
name: "Firewall Baselines (CTT)",
command: Command::LocalFile("security/firewall-baselines.sh"),
}
},
ListNode {
name: "System Setup",
command: Command::None,
@ -58,15 +101,10 @@ impl CustomList {
name: "Global Theme",
command: Command::LocalFile("system-setup/3-global-theme.sh"),
},
},
ListNode {
name: "Security",
command: Command::None
} => {
ListNode {
name: "Firewall Baselines (CTT)",
command: Command::LocalFile("security/firewall-baselines.sh"),
}
name: "Remove Snaps",
command: Command::LocalFile("system-setup/4-remove-snaps.sh"),
},
},
ListNode {
name: "Utilities",
@ -130,40 +168,6 @@ impl CustomList {
},
},
},
ListNode {
name: "Applications Setup",
command: Command::None
} => {
ListNode {
name: "Alacritty",
command: Command::LocalFile("applications-setup/alacritty-setup.sh"),
},
ListNode {
name: "Bash Prompt",
command: Command::Raw("bash -c \"$(curl -s https://raw.githubusercontent.com/ChrisTitusTech/mybash/main/setup.sh)\""),
},
ListNode {
name: "DWM-Titus",
command: Command::LocalFile("applications-setup/dwmtitus-setup.sh")
},
ListNode {
name: "Kitty",
command: Command::LocalFile("applications-setup/kitty-setup.sh")
},
ListNode {
name: "Neovim",
command: Command::Raw("bash -c \"$(curl -s https://raw.githubusercontent.com/ChrisTitusTech/neovim/main/setup.sh)\""),
},
ListNode {
name: "Rofi",
command: Command::LocalFile("applications-setup/rofi-setup.sh"),
},
ListNode {
name: "ZSH Prompt",
command: Command::LocalFile("applications-setup/zsh-setup.sh"),
}
},
ListNode {
name: "Full System Update",
command: Command::LocalFile("system-update.sh"),
@ -301,7 +305,15 @@ impl CustomList {
self.toggle_preview_window(state);
None
}
KeyCode::Enter => self.handle_enter(),
KeyCode::Enter | KeyCode::Right | KeyCode::Char('l') => {
if self.preview_window_state.is_none() {
self.handle_enter()
} else {
None
}
}
KeyCode::Left | KeyCode::Char('h') if !self.at_root() => self.enter_parent_directory(),
_ => None,
}
}
@ -340,6 +352,12 @@ impl CustomList {
None
}
fn enter_parent_directory(&mut self) -> Option<Command> {
self.visit_stack.pop();
self.list_state.select(Some(0));
None
}
/// Handles the <Enter> key. This key can do 3 things:
/// - Run a command, if it is the currently selected item,
/// - Go up a directory
@ -357,9 +375,7 @@ impl CustomList {
.unwrap();
if !self.at_root() && selected_index == 0 {
self.visit_stack.pop();
self.list_state.select(Some(0));
return None;
return self.enter_parent_directory();
}
let mut actual_index = selected_index;