From 5385467911840211f16e8b038649d40ed1382313 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 4 Jan 2022 21:32:15 +0100 Subject: [PATCH] [AUTOCONFIG] Add window manager i3 and awesome with basics configs --- .env | 8 ++++--- configs/link_conf.sh | 7 ------ install.sh | 4 +++- scripts/tools/neovim/install.sh | 8 +++---- scripts/window_manager/awesome/install.sh | 27 +++++++++++++++++++++++ scripts/window_manager/i3/install.sh | 27 +++++++++++++++++++++++ 6 files changed, 66 insertions(+), 15 deletions(-) delete mode 100755 configs/link_conf.sh create mode 100755 scripts/window_manager/awesome/install.sh create mode 100755 scripts/window_manager/i3/install.sh diff --git a/.env b/.env index ca74f26..feb4da4 100644 --- a/.env +++ b/.env @@ -5,11 +5,13 @@ # SHELL=zsh # Available configuration (awesome, i3) -WM=awesome +WINDOW_MANAGER=awesome +WITH_WINDOW_MANAGER_DEPENDENCIES=yes +WITH_WINDOW_MANAGER_CONFIG=yes # Install neovim with custom configuration WITH_NEOVIM=yes WITH_NEOVIM_DEPENDENCIES=yes # Possible value = yes | no | force -WITH_CUSTOM_NEOVIM_CONFIG=yes -WITH_CUSTOM_LAZYGIT_CONFIG=yes +WITH_NEOVIM_CONFIG=yes +WITH_LAZYGIT_CONFIG=yes diff --git a/configs/link_conf.sh b/configs/link_conf.sh deleted file mode 100755 index 6cb4271..0000000 --- a/configs/link_conf.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -CWD=$(pwd) -[ ! -f "$HOME/.config/nvim" ] && ln -s "$CWD/nvim" "$HOME/.config/nvim" -[ ! -f "$HOME/.config/i3" ] && ln -s "$CWD/i3" "$HOME/.config/i3" -[ ! -f "$HOME/.config/lazygit" ] && ln -s "$CWD/lazygit" "$HOME/.config/lazygit" -[ ! -f "$HOME/.config/awesome" ] && ln -s "$CWD/awesome" "$HOME/.config/awesome" diff --git a/install.sh b/install.sh index 5c2a52a..df84b74 100755 --- a/install.sh +++ b/install.sh @@ -25,4 +25,6 @@ fi find ./scripts -type f -iname "*.sh" -exec chmod +x {} \; # Install and configure functionality -./scripts/tools/neovim/install.sh \ No newline at end of file +./scripts/tools/neovim/install.sh +./scripts/window_manager/awesome/install.sh +./scripts/window_manager/i3/install.sh \ No newline at end of file diff --git a/scripts/tools/neovim/install.sh b/scripts/tools/neovim/install.sh index 2d3def9..cbd671b 100755 --- a/scripts/tools/neovim/install.sh +++ b/scripts/tools/neovim/install.sh @@ -12,8 +12,8 @@ if [[ "$WITH_NEOVIM" == 'yes' ]]; then echo '[INFO] Neovim already installed' fi - if [[ "$WITH_CUSTOM_LAZYGIT_CONFIG" == 'yes' || "$WITH_CUSTOM_LAZYGIT_CONFIG" == 'force' ]]; then - if [[ -d "$HOME/.config/lazygit" && "$WITH_CUSTOM_LAZYGIT_CONFIG" == 'force' ]]; then + if [[ "$WITH_LAZYGIT_CONFIG" == 'yes' || "$WITH_LAZYGIT_CONFIG" == 'force' ]]; then + if [[ -d "$HOME/.config/lazygit" && "$WITH_LAZYGIT_CONFIG" == 'force' ]]; then rm -rf "$HOME/.config/lazygit" echo '[INFO] Lazygit config removed | Forced by environment variable' fi @@ -25,8 +25,8 @@ if [[ "$WITH_NEOVIM" == 'yes' ]]; then fi fi - if [[ "$WITH_CUSTOM_NEOVIM_CONFIG" == 'yes' || "$WITH_CUSTOM_NEOVIM_CONFIG" == 'force' ]]; then - if [[ -d "$HOME/.config/nvim" && "$WITH_CUSTOM_NEOVIM_CONFIG" == 'force' ]]; then + if [[ "$WITH_NEOVIM_CONFIG" == 'yes' || "$WITH_NEOVIM_CONFIG" == 'force' ]]; then + if [[ -d "$HOME/.config/nvim" && "$WITH_NEOVIM_CONFIG" == 'force' ]]; then rm -rf "$HOME/.config/nvim" echo '[INFO] Neovim config removed | Forced by environment variable' fi diff --git a/scripts/window_manager/awesome/install.sh b/scripts/window_manager/awesome/install.sh new file mode 100755 index 0000000..a60feae --- /dev/null +++ b/scripts/window_manager/awesome/install.sh @@ -0,0 +1,27 @@ +source ./scripts/common.sh + +if [[ "$WINDOW_MANAGER" == 'awesome' ]]; then + if ! command_exists awesome; then + install_package awesome + echo '[INFO] Awesome installed' + + if [[ "$WITH_WINDOW_MANAGER_DEPENDENCIES" == 'yes' ]]; then + #install_package ripgrep fd dart lazygit rust-analyzer lldb + fi + else + echo '[INFO] Awesome already installed' + fi + + if [[ "$WITH_WINDOW_MANAGER_CONFIG" == 'yes' || "$WITH_WINDOW_MANAGER_CONFIG" == 'force' ]]; then + if [[ -d "$HOME/.config/awesome" && "$WITH_WINDOW_MANAGER_CONFIG" == 'force' ]]; then + rm -rf "$HOME/.config/awesome" + echo '[INFO] Awesome config removed | Forced by environment variable' + fi + if [[ ! -d "$HOME/.config/awesome" ]]; then + ln -s "$CWD/configs/awesome" "$HOME/.config/awesome" + echo "[INFO] Awesome config linked with symbolic link : $CWD/configs/awesome -> $HOME/.config/awesome" + else + echo '[INFO] Awesome config already linked' + fi + fi +fi \ No newline at end of file diff --git a/scripts/window_manager/i3/install.sh b/scripts/window_manager/i3/install.sh new file mode 100755 index 0000000..ff497d8 --- /dev/null +++ b/scripts/window_manager/i3/install.sh @@ -0,0 +1,27 @@ +source ./scripts/common.sh + +if [[ "$WINDOW_MANAGER" == 'i3' ]]; then + if ! command_exists i3; then + install_package i3-wm + echo '[INFO] I3 installed' + + if [[ "$WITH_WINDOW_MANAGER_DEPENDENCIES" == 'yes' ]]; then + #install_package ripgrep fd dart lazygit rust-analyzer lldb + fi + else + echo '[INFO] I3 already installed' + fi + + if [[ "$WITH_WINDOW_MANAGER_CONFIG" == 'yes' || "$WITH_WINDOW_MANAGER_CONFIG" == 'force' ]]; then + if [[ -d "$HOME/.config/i3" && "$WITH_WINDOW_MANAGER_CONFIG" == 'force' ]]; then + rm -rf "$HOME/.config/i3" + echo '[INFO] I3 config removed | Forced by environment variable' + fi + if [[ ! -d "$HOME/.config/i3" ]]; then + ln -s "$CWD/configs/i3" "$HOME/.config/i3" + echo "[INFO] I3 config linked with symbolic link : $CWD/configs/i3 -> $HOME/.config/i3" + else + echo '[INFO] I3 config already linked' + fi + fi +fi \ No newline at end of file