Skip to content

Instantly share code, notes, and snippets.

@rodrigo-x
Created October 31, 2023 05:08
Show Gist options
  • Save rodrigo-x/25bba15cf8dd5c7d30e50895b8ce8362 to your computer and use it in GitHub Desktop.
Save rodrigo-x/25bba15cf8dd5c7d30e50895b8ce8362 to your computer and use it in GitHub Desktop.
coverflow
#!/usr/bin/env bash
REPO_URL="https://github.com/dmo60/CoverflowAltTab.git"
EXTENSION_DIR="$HOME/CoverflowAltTab"
execute_command() {
local command="$1"
local message="$2"
echo "$message"
if ! $command; then
echo "Erro ao executar o comando: $command"
exit 1
fi
}
check_git_connectivity() {
execute_command "git ls-remote \"$REPO_URL\" &>/dev/null" "Verificando a conectividade com o servidor Git..."
}
install_git_if_needed() {
if ! command -v git &>/dev/null; then
execute_command "sudo apt-get update && sudo apt-get install git -y" "Git não encontrado. Instalando..."
fi
}
clone_extension() {
execute_command "git clone \"$REPO_URL\" \"$EXTENSION_DIR\"" "Clonando repositório..."
}
update_extension() {
execute_command "git -C \"$EXTENSION_DIR\" pull origin master" "Atualizando repositório..."
}
install_extension() {
execute_command "make -C \"$EXTENSION_DIR\" && make -C \"$EXTENSION_DIR\" install && make -C \"$EXTENSION_DIR\" enable" "Instalando extensão..."
}
restart_muffin_window_manager() {
execute_command "muffin --replace &" "Reiniciando o gerenciador de janelas Muffin..."
}
main() {
echo "Iniciando a instalação da extensão Coverflow Alt-Tab..."
install_git_if_needed
check_git_connectivity
if [ -d "$EXTENSION_DIR" ]; then
update_extension
else
clone_extension
fi
install_extension
restart_muffin_window_manager
echo "A extensão Coverflow Alt-Tab foi instalada e ativada. Reinicie a sessão ou faça logoff e login para aplicar as alterações."
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment