feat: adds keyboard shortcut support
feat: adds wezterm feat: adds cargo, flatpak and apt
This commit is contained in:
parent
f87e08ec49
commit
819fb027bf
@ -1,8 +1,9 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source ~/dotfiles/bin/helpers/packages.sh
|
||||
source ~/dotfiles/bin/helpers/apt_packages.sh
|
||||
source ~/dotfiles/bin/helpers/vscode-extensions.sh
|
||||
source ~/dotfiles/bin/helpers/cargo_packages.sh
|
||||
|
||||
# Check if parameter --verbose was passed
|
||||
if [ "$2" = "--verbose" ]; then
|
||||
@ -11,51 +12,6 @@ else
|
||||
verbose=false
|
||||
fi
|
||||
|
||||
# count entries in packages
|
||||
count=$(echo $packages | wc -w)
|
||||
installed=0
|
||||
|
||||
for package in $packages; do
|
||||
pkg_status=$(dpkg -s $package 2> /dev/null | grep "Status" | cut -d " " -f 4)
|
||||
|
||||
if [ "$pkg_status" = "installed" ]; then
|
||||
installed=$((installed + 1))
|
||||
else
|
||||
if [ "$verbose" = true ]; then
|
||||
printfe "%s\n" "red" "$package is not installed"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
printfe "%s\n" "cyan" "APT $installed/$count packages installed"
|
||||
|
||||
|
||||
load_vscode_extensions
|
||||
count_installed_extensions=0
|
||||
|
||||
# Loop through each extension and check if it's installed
|
||||
for extension in "${extensionList[@]}"; do
|
||||
result=$(code --list-extensions | grep -E "^${extension}$")
|
||||
if [ -z "$result" ]; then
|
||||
if [ "$verbose" = true ]; then
|
||||
printfe "%s" "yellow" "Extension $extension is not installed\n"
|
||||
fi
|
||||
else
|
||||
count_installed_extensions=$((count_installed_extensions + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$verbose" = true ]; then
|
||||
printfe "%s\n" "yellow" "Expected extensions:"
|
||||
for ext in "${extensionList[@]}"; do
|
||||
printfe "%s\n" "blue" "$ext"
|
||||
done
|
||||
|
||||
printfe "%s\n" "yellow" "Installed extensions:"
|
||||
while IFS= read -r installed_ext; do
|
||||
printfe "%s\n" "blue" "$installed_ext"
|
||||
done < <(code --list-extensions)
|
||||
fi
|
||||
|
||||
total_extensions=${#extensionList[@]}
|
||||
printfe "%s\n" "cyan" "VSCode $count_installed_extensions/$total_extensions extensions installed"
|
||||
print_apt_status
|
||||
print_cargo_status
|
||||
print_vsc_status
|
||||
|
@ -10,6 +10,10 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
####################################################################################################
|
||||
# Update symlinks
|
||||
####################################################################################################
|
||||
|
||||
printfe "%s\n" "cyan" "Updating symlinks..."
|
||||
check_or_make_symlink ~/.zshrc ~/dotfiles/zshrc
|
||||
check_or_make_symlink ~/.config/Code/User/settings.json ~/dotfiles/vscode/settings.json
|
||||
@ -21,15 +25,58 @@ else
|
||||
check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.linux
|
||||
fi
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring packages are installed..."
|
||||
source ~/dotfiles/bin/helpers/packages.sh
|
||||
ensure_packages_installed
|
||||
check_or_make_symlink ~/.ssh/config ~/dotfiles/ssh/config
|
||||
check_or_make_symlink ~/.wezterm.lua ~/dotfiles/config/wezterm.lua
|
||||
|
||||
|
||||
####################################################################################################
|
||||
# Update packages
|
||||
####################################################################################################
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring APT repositories are added..."
|
||||
source ~/dotfiles/bin/helpers/apt_packages.sh
|
||||
ensure_repositories
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring APT packages are installed..."
|
||||
ensure_apt_packages_installed
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring Cargo packages are installed..."
|
||||
source ~/dotfiles/bin/helpers/cargo_packages.sh
|
||||
ensure_cargo_packages_installed
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring Flatpak remotes are added..."
|
||||
source ~/dotfiles/bin/helpers/flatpak_packages.sh
|
||||
ensure_remotes_added
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring Flatpak packages are installed..."
|
||||
ensure_flatpak_packages_installed
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring VSCode extensions are installed..."
|
||||
source ~/dotfiles/bin/helpers/vscode-extensions.sh
|
||||
ensure_vscode_extensions_installed
|
||||
|
||||
printfe "%s\n" "cyan" "Importing Gnome Terminal preferences..."
|
||||
cat ~/dotfiles/config/gterminal.preferences | dconf load /org/gnome/terminal/legacy/profiles:/
|
||||
####################################################################################################
|
||||
# Update system settings
|
||||
####################################################################################################
|
||||
|
||||
printfe "%s\n" "green" "Finished, don't forget restart your terminal"
|
||||
printfe "%s\n" "cyan" "Setting up keyboard shortcuts..."
|
||||
source ~/dotfiles/bin/helpers/keyboard_shortcuts.sh
|
||||
ensure_keyboard_shortcuts
|
||||
|
||||
# printfe "%s\n" "cyan" "Importing Gnome Terminal preferences..."
|
||||
# cat ~/dotfiles/config/gterminal.preferences | dconf load /org/gnome/terminal/legacy/profiles:/
|
||||
|
||||
printfe "%s\n" "cyan" "Setting wezterm as default terminal..."
|
||||
if [ ! -f /usr/bin/wezterm ]; then
|
||||
printfe "%s\n" "red" "Wezterm is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
current_terminal=$(sudo update-alternatives --query x-terminal-emulator | grep '^Value:' | awk '{print $2}')
|
||||
|
||||
if [ "$current_terminal" != "/usr/bin/wezterm" ]; then
|
||||
printfe "%s\n" "yellow" " - Setting wezterm as default terminal"
|
||||
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/wezterm 60
|
||||
else
|
||||
printfe "%s\n" "green" " - wezterm is already the default terminal"
|
||||
fi
|
||||
|
227
bin/helpers/apt_packages.sh
Normal file
227
bin/helpers/apt_packages.sh
Normal file
@ -0,0 +1,227 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
apt_packages=(
|
||||
"zsh"
|
||||
"git"
|
||||
"curl"
|
||||
"wget"
|
||||
"vim"
|
||||
"sl"
|
||||
"just"
|
||||
"libglvnd-dev"
|
||||
"libwayland-dev"
|
||||
"libseat-dev"
|
||||
"libxkbcommon-dev"
|
||||
"libinput-dev"
|
||||
"udev"
|
||||
"dbus"
|
||||
"libdbus-1-dev"
|
||||
"libsystemd-dev"
|
||||
"libpixman-1-dev"
|
||||
"libssl-dev"
|
||||
"libflatpak-dev"
|
||||
"libpulse-dev"
|
||||
"libexpat1-dev"
|
||||
"libfontconfig-dev"
|
||||
"libfreetype-dev"
|
||||
"mold"
|
||||
"cargo"
|
||||
"libgbm-dev"
|
||||
"libclang-dev"
|
||||
"libpipewire-0.3-dev"
|
||||
"libpam0g-dev"
|
||||
"openssh-server"
|
||||
"build-essential"
|
||||
"flatpak"
|
||||
"meson"
|
||||
"pipx"
|
||||
"python3-nautilus"
|
||||
"gettext"
|
||||
"fzf"
|
||||
"neofetch"
|
||||
"screenfetch"
|
||||
"wezterm"
|
||||
"brave-browser"
|
||||
"code"
|
||||
"1password"
|
||||
"1password-cli"
|
||||
"spotify-client"
|
||||
"yq"
|
||||
)
|
||||
|
||||
add_wezterm_repo() {
|
||||
# Check if we have a wezterm.list file already, if not then create one
|
||||
if [ ! -f /etc/apt/sources.list.d/wezterm.list ]; then
|
||||
curl -fsSL https://apt.fury.io/wez/gpg.key | sudo gpg --yes --dearmor -o /usr/share/keyrings/wezterm-fury.gpg
|
||||
echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list
|
||||
result=$(sudo apt update 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to add Wezterm repository"
|
||||
printfe "%s\n" "yellow" "$result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printfe "%s\n" "yellow" " - Added Wezterm repository"
|
||||
else
|
||||
printfe "%s\n" "green" " - Wezterm repository already added"
|
||||
fi
|
||||
}
|
||||
|
||||
add_brave_repo() {
|
||||
# Check if we have a brave-browser-release.list file already, if not then create one
|
||||
if [ ! -f /etc/apt/sources.list.d/brave-browser-release.list ]; then
|
||||
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
|
||||
result=$(sudo apt update 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to add Brave repository"
|
||||
printfe "%s\n" "yellow" "$result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printfe "%s\n" "yellow" " - Added Brave repository"
|
||||
else
|
||||
printfe "%s\n" "green" " - Brave repository already added"
|
||||
fi
|
||||
}
|
||||
|
||||
add_1password_repo() {
|
||||
# Check if we have a 1password.list file already, if not then create one
|
||||
if [ ! -f /etc/apt/sources.list.d/1password.list ]; then
|
||||
curl -sS https://downloads.1password.com/linux/keys/1password.asc | sudo gpg --dearmor --output /usr/share/keyrings/1password-archive-keyring.gpg
|
||||
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/1password-archive-keyring.gpg] https://downloads.1password.com/linux/debian/amd64 stable main' | sudo tee /etc/apt/sources.list.d/1password.list
|
||||
sudo mkdir -p /etc/debsig/policies/AC2D62742012EA22/
|
||||
curl -sS https://downloads.1password.com/linux/debian/debsig/1password.pol | sudo tee /etc/debsig/policies/AC2D62742012EA22/1password.pol
|
||||
sudo mkdir -p /usr/share/debsig/keyrings/AC2D62742012EA22
|
||||
curl -sS https://downloads.1password.com/linux/keys/1password.asc | sudo gpg --dearmor --output /usr/share/debsig/keyrings/AC2D62742012EA22/debsig.gpg
|
||||
result=$(sudo apt update 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to add 1Password repository"
|
||||
printfe "%s\n" "yellow" "$result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printfe "%s\n" "yellow" " - Added 1Password repository"
|
||||
else
|
||||
printfe "%s\n" "green" " - 1Password repository already added"
|
||||
fi
|
||||
}
|
||||
|
||||
add_spotify_repo() {
|
||||
# Check if we have a spotify.list file already, if not then create one
|
||||
if [ ! -f /etc/apt/sources.list.d/spotify.list ]; then
|
||||
curl -sS https://download.spotify.com/debian/pubkey_6224F9941A8AA6D1.gpg | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify.gpg
|
||||
echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list
|
||||
result=$(sudo apt update 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to add Spotify repository"
|
||||
printfe "%s\n" "yellow" "$result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printfe "%s\n" "yellow" " - Added Spotify repository"
|
||||
else
|
||||
printfe "%s\n" "green" " - Spotify repository already added"
|
||||
fi
|
||||
}
|
||||
|
||||
add_vscode_repo() {
|
||||
# Check if we have a vscode.list file already, if not then create one
|
||||
if [ ! -f /etc/apt/sources.list.d/vscode.list ]; then
|
||||
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
|
||||
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
|
||||
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" |sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null
|
||||
rm -f packages.microsoft.gpg
|
||||
result=$(sudo apt update 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to add VSCode repository"
|
||||
printfe "%s\n" "yellow" "$result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printfe "%s\n" "yellow" " - Added VSCode repository"
|
||||
else
|
||||
printfe "%s\n" "green" " - VSCode repository already added"
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_repositories() {
|
||||
if [ "$verbose" = true ]; then
|
||||
printfe "%s\n" "cyan" "Installing common dependencies..."
|
||||
fi
|
||||
result=$(sudo apt install wget gpg ca-certificates curl software-properties-common apt-transport-https 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to install common dependencies"
|
||||
printfe "%s\n" "yellow" "$result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
add_wezterm_repo
|
||||
add_brave_repo
|
||||
add_1password_repo
|
||||
add_spotify_repo
|
||||
add_vscode_repo
|
||||
}
|
||||
|
||||
ensure_apt_packages_installed() {
|
||||
# Check if apt_packages array contains duplicates
|
||||
if [ $(echo $apt_packages | tr ' ' '\n' | sort | uniq -d | wc -l) -ne 0 ]; then
|
||||
printfe "%s\n" "red" "The apt_packages array contains duplicates"
|
||||
printfe "%s\n" "yellow" "Duplicates:"
|
||||
printfe "%s\n" "blue" $(echo $apt_packages | tr ' ' '\n' | sort | uniq -d)
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for package in $apt_packages; do
|
||||
pkg_status=$(dpkg -s $package 2> /dev/null | grep "Status" | cut -d " " -f 4)
|
||||
|
||||
# If pkg_status is `installed` then we don't need to install the package, otherwise if it's empty then the package is not installed
|
||||
if [ -z $pkg_status ]; then
|
||||
ensure_sudo_privileges "In order to install $package, please provide your password:"
|
||||
|
||||
printfe "%s" "yellow" " - Installing $package..."
|
||||
echo -en "\r"
|
||||
|
||||
result=$(sudo apt install -y $package 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to install $package"
|
||||
printfe "%s\n" "yellow" "$result"
|
||||
exit 1
|
||||
else
|
||||
printfe "%s\n" "green" " - $package installed successfully"
|
||||
fi
|
||||
else
|
||||
printfe "%s\n" "green" " - $package is already installed"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
print_apt_status() {
|
||||
printfe "%s" "cyan" "Checking APT packages..."
|
||||
echo -en "\r"
|
||||
|
||||
# count entries in packages
|
||||
count=$(echo $apt_packages | wc -w)
|
||||
installed=0
|
||||
|
||||
for package in $apt_packages; do
|
||||
pkg_status=$(dpkg -s $package 2> /dev/null | grep "Status" | cut -d " " -f 4)
|
||||
|
||||
if [ "$pkg_status" = "installed" ]; then
|
||||
installed=$((installed + 1))
|
||||
else
|
||||
if [ "$verbose" = true ]; then
|
||||
printfe "%s\n" "red" "$package is not installed"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
printfe "%s\n" "cyan" "APT $installed/$count packages installed"
|
||||
}
|
66
bin/helpers/cargo_packages.sh
Normal file
66
bin/helpers/cargo_packages.sh
Normal file
@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
cargo_packages=(
|
||||
"exa"
|
||||
"lsd"
|
||||
"bat"
|
||||
"starship"
|
||||
"ripgrep"
|
||||
"fd-find"
|
||||
"procs"
|
||||
"bottom"
|
||||
)
|
||||
|
||||
ensure_cargo_packages_installed() {
|
||||
# Check if cargo_packages array contains duplicates
|
||||
if [ $(echo $cargo_packages | tr ' ' '\n' | sort | uniq -d | wc -l) -ne 0 ]; then
|
||||
printfe "%s\n" "red" "The cargo_packages array contains duplicates"
|
||||
printfe "%s\n" "yellow" "Duplicates:"
|
||||
printfe "%s\n" "blue" $(echo $cargo_packages | tr ' ' '\n' | sort | uniq -d)
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for package in $cargo_packages; do
|
||||
pkg_status=$(cargo install --list | grep -E "^${package}\sv[0-9.]+:$")
|
||||
|
||||
# If pkg_status is `installed` then we don't need to install the package, otherwise if it's empty then the package is not installed
|
||||
if [ -z $pkg_status ]; then
|
||||
ensure_sudo_privileges "In order to install cargo_packages, please provide your password:"
|
||||
printfe "%s" "yellow" " - Installing $package..."
|
||||
echo -en "\r"
|
||||
result=$(cargo install $package 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to install $package"
|
||||
exit 1
|
||||
fi
|
||||
printfe "%s\n" "green" " - Installed $package"
|
||||
else
|
||||
printfe "%s\n" "green" " - $package is already installed"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
print_cargo_status() {
|
||||
printfe "%s" "cyan" "Checking Cargo packages..."
|
||||
echo -en "\r"
|
||||
|
||||
count=$(echo $cargo_packages | wc -w)
|
||||
installed=0
|
||||
|
||||
for package in $cargo_packages; do
|
||||
pkg_status=$(cargo install --list | grep -E "^${package}\sv[0-9.]+:$")
|
||||
|
||||
if [ -z $pkg_status ]; then
|
||||
if [ "$verbose" = true ]; then
|
||||
printfe "%s\n" "red" "$package is not installed"
|
||||
fi
|
||||
else
|
||||
installed=$((installed + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
printfe "%s\n" "cyan" "Cargo $installed/$count packages installed"
|
||||
}
|
75
bin/helpers/flatpak_packages.sh
Normal file
75
bin/helpers/flatpak_packages.sh
Normal file
@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
flatpak_packages=(
|
||||
"app.drey.Doggo"
|
||||
"org.gnome.Boxes"
|
||||
"org.gnome.baobab"
|
||||
"re.sonny.Junction"
|
||||
"com.yubico.yubioath"
|
||||
"net.nokyan.Resources"
|
||||
"com.system76.Popsicle"
|
||||
"com.github.marhkb.Pods"
|
||||
"org.wezfurlong.wezterm"
|
||||
"io.github.dimtpap.coppwr"
|
||||
"com.github.tchx84.Flatseal"
|
||||
"dev.bragefuglseth.Keypunch"
|
||||
"io.github.flattool.Warehouse"
|
||||
"io.github.jonmagon.kdiskmark"
|
||||
"org.onlyoffice.desktopeditors"
|
||||
"io.missioncenter.MissionCenter"
|
||||
"io.podman_desktop.PodmanDesktop"
|
||||
"io.github.giantpinkrobots.flatsweep"
|
||||
"io.github.realmazharhussain.GdmSettings"
|
||||
"io.github.thetumultuousunicornofdarkness.cpu-x"
|
||||
)
|
||||
|
||||
flatpak_remotes=(
|
||||
"https://flathub.org/repo/flathub.flatpakrepo"
|
||||
)
|
||||
|
||||
ensure_remotes_added() {
|
||||
for remote in $flatpak_remotes; do
|
||||
printfe "%s\n" "green" " - Ensuring remote $remote"
|
||||
flatpak remote-add --if-not-exists flathub $remote
|
||||
done
|
||||
}
|
||||
|
||||
ensure_flatpak_packages_installed() {
|
||||
for package in $flatpak_packages; do
|
||||
if ! flatpak list | grep -q $package; then
|
||||
printfe "%s" "yellow" " - Installing $package"
|
||||
result=$(flatpak install --user -y flathub $package 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" "Failed to install $package: $result"
|
||||
fi
|
||||
|
||||
echo -en "\r"
|
||||
printfe "%s\n" "green" " - $package installed"
|
||||
else
|
||||
printfe "%s\n" "green" " - $package is already installed"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
print_flatpak_status() {
|
||||
printfe "%s" "cyan" "Checking Flatpak packages..."
|
||||
echo -en "\r"
|
||||
|
||||
count=$(echo $flatpak_packages | wc -w)
|
||||
installed=0
|
||||
|
||||
for package in $flatpak_packages; do
|
||||
if flatpak list | grep -q $package; then
|
||||
installed=$((installed + 1))
|
||||
else
|
||||
if [ "$verbose" = true ]; then
|
||||
printfe "%s\n" "red" "$package is not installed"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
printfe "%s\n" "cyan" "Flatpak $installed/$count packages installed"
|
||||
}
|
@ -160,22 +160,24 @@ check_or_make_symlink() {
|
||||
if [ ! -L $1 ]; then
|
||||
if [ -f $1 ]; then
|
||||
mv $1 $1.bak
|
||||
printfe "%s\n" "yellow" "Backed up $1 to $1.bak"
|
||||
printfe "%s\n" "yellow" " - Backed up $1 to $1.bak"
|
||||
fi
|
||||
mkdir -p $(dirname $1)
|
||||
ln -s $2 $1
|
||||
printfe "%s\n" "green" "Created symlink $1 -> $2"
|
||||
printfe "%s\n" "green" " - Created symlink $1 -> $2"
|
||||
fi
|
||||
|
||||
# Confirm the symlink that already exists point to the correct location
|
||||
if [ -L $1 ]; then
|
||||
if [ "$(readlink $1)" != $2 ]; then
|
||||
printfe "%s\n" "yellow" "Symlink $1 exists but points to the wrong location"
|
||||
printfe "%s\n" "yellow" "Expected: $2"
|
||||
printfe "%s\n" "yellow" "Actual: $(readlink $1)"
|
||||
printfe "%s\n" "yellow" "Fixing symlink"
|
||||
printfe "%s\n" "yellow" " - Symlink $1 exists but points to the wrong location"
|
||||
printfe "%s\n" "yellow" " Expected: $2"
|
||||
printfe "%s\n" "yellow" " Actual: $(readlink $1)"
|
||||
printfe "%s\n" "yellow" " Fixing symlink"
|
||||
rm $1
|
||||
mkdir -p $(dirname $1)
|
||||
ln -s $2 $1
|
||||
printfe "%s\n" "green" "Created symlink $1 -> $2"
|
||||
printfe "%s\n" "green" " Created symlink $1 -> $2"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
47
bin/helpers/keyboard_shortcuts.sh
Normal file
47
bin/helpers/keyboard_shortcuts.sh
Normal file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
# Ensure jq is installed
|
||||
if ! command -v jq &> /dev/null; then
|
||||
echo "jq could not be found, please install it."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Parse JSON file
|
||||
shortcuts_file=~/dotfiles/config/keyboard-shortcuts.json
|
||||
if [ ! -f "${shortcuts_file}" ]; then
|
||||
echo "Shortcuts file not found: ${shortcuts_file}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shortcuts=$(jq -r '.shortcuts' "${shortcuts_file}")
|
||||
|
||||
ensure_keyboard_shortcuts() {
|
||||
# Retrieve current custom keybindings
|
||||
existing_bindings=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings | tr -d "[]'")
|
||||
new_bindings=()
|
||||
index=0
|
||||
|
||||
# Iterate over parsed JSON shortcuts
|
||||
for key_combination in $(echo "$shortcuts" | jq -r 'keys[]'); do
|
||||
command=$(echo "$shortcuts" | jq -r ".[\"$key_combination\"]")
|
||||
|
||||
printfe '%s\n' "green" " - Ensuring custom shortcut ${key_combination} command ${command}"
|
||||
|
||||
custom_binding="/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${index}/"
|
||||
new_bindings+=("$custom_binding")
|
||||
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:"${custom_binding}" name "${key_combination} to run ${command}"
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:"${custom_binding}" command "${command}"
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:"${custom_binding}" binding "${key_combination}"
|
||||
dconf write "${custom_binding}enabled" true
|
||||
|
||||
((index++))
|
||||
done
|
||||
|
||||
new_bindings_string=$(printf "'%s', " "${new_bindings[@]}")
|
||||
new_bindings_string="[${new_bindings_string%, }]"
|
||||
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "${new_bindings_string}"
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
packages=(
|
||||
"zsh"
|
||||
"git"
|
||||
"curl"
|
||||
"wget"
|
||||
"vim"
|
||||
"tmux"
|
||||
"sl"
|
||||
"just"
|
||||
"libglvnd-dev"
|
||||
"libwayland-dev"
|
||||
"libseat-dev"
|
||||
"libxkbcommon-dev"
|
||||
"libinput-dev"
|
||||
"udev"
|
||||
"dbus"
|
||||
"libdbus-1-dev"
|
||||
"libsystemd-dev"
|
||||
"libpixman-1-dev"
|
||||
"libssl-dev"
|
||||
"libflatpak-dev"
|
||||
"libpulse-dev"
|
||||
"libexpat1-dev"
|
||||
"libfontconfig-dev"
|
||||
"libfreetype-dev"
|
||||
"mold"
|
||||
"cargo"
|
||||
"libgbm-dev"
|
||||
"libclang-dev"
|
||||
"libpipewire-0.3-dev"
|
||||
"libpam0g-dev"
|
||||
"openssh-server"
|
||||
"build-essential"
|
||||
"flatpak"
|
||||
"meson"
|
||||
"pipx"
|
||||
"python3-nautilus"
|
||||
"gettext"
|
||||
"fzf"
|
||||
"neofetch"
|
||||
"screenfetch"
|
||||
)
|
||||
|
||||
ensure_packages_installed() {
|
||||
# Check if packages array contains duplicates
|
||||
if [ $(echo $packages | tr ' ' '\n' | sort | uniq -d | wc -l) -ne 0 ]; then
|
||||
printfe "%s\n" "red" "The packages array contains duplicates"
|
||||
printfe "%s\n" "yellow" "Duplicates:"
|
||||
printfe "%s\n" "blue" $(echo $packages | tr ' ' '\n' | sort | uniq -d)
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for package in $packages; do
|
||||
pkg_status=$(dpkg -s $package 2> /dev/null | grep "Status" | cut -d " " -f 4)
|
||||
|
||||
# If pkg_status is `installed` then we don't need to install the package, otherwise if it's empty then the package is not installed
|
||||
if [ -z $pkg_status ]; then
|
||||
ensure_sudo_privileges "In order to install packages, please provide your password:"
|
||||
|
||||
printfe "%s" "yellow" "Installing $package..."
|
||||
echo -en "\r"
|
||||
|
||||
sudo apt install -y $package &> /dev/null
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" "Failed to install $package"
|
||||
exit 1
|
||||
else
|
||||
printfe "%s\n" "green" "$package installed successfully"
|
||||
fi
|
||||
else
|
||||
printfe "%s\n" "green" "$package is already installed"
|
||||
fi
|
||||
done
|
||||
}
|
@ -19,16 +19,51 @@ ensure_vscode_extensions_installed() {
|
||||
for extension in "${extensionList[@]}"; do
|
||||
result=$(code --list-extensions | grep -E "^${extension}$")
|
||||
if [ -z "$result" ]; then
|
||||
printfe "%s" "yellow" "Installing $extension..."
|
||||
printfe "%s" "yellow" " - Installing $extension..."
|
||||
code --install-extension $extension
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" "Failed to install $extension"
|
||||
printfe "%s\n" "red" " - Failed to install $extension"
|
||||
exit 1
|
||||
fi
|
||||
printfe "%s\n" "green" "Installed $extension"
|
||||
printfe "%s\n" "green" " - Installed $extension"
|
||||
else
|
||||
printfe "%s\n" "green" "$extension is already installed"
|
||||
printfe "%s\n" "green" " - $extension is already installed"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
print_vsc_status() {
|
||||
printfe "%s" "cyan" "Checking VSCode extensions..."
|
||||
echo -en "\r"
|
||||
|
||||
load_vscode_extensions
|
||||
count_installed_extensions=0
|
||||
|
||||
# Loop through each extension and check if it's installed
|
||||
for extension in "${extensionList[@]}"; do
|
||||
result=$(code --list-extensions | grep -E "^${extension}$")
|
||||
if [ -z "$result" ]; then
|
||||
if [ "$verbose" = true ]; then
|
||||
printfe "%s" "yellow" "Extension $extension is not installed\n"
|
||||
fi
|
||||
else
|
||||
count_installed_extensions=$((count_installed_extensions + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$verbose" = true ]; then
|
||||
printfe "%s\n" "yellow" "Expected extensions:"
|
||||
for ext in "${extensionList[@]}"; do
|
||||
printfe "%s\n" "blue" "$ext"
|
||||
done
|
||||
|
||||
printfe "%s\n" "yellow" "Installed extensions:"
|
||||
while IFS= read -r installed_ext; do
|
||||
printfe "%s\n" "blue" "$installed_ext"
|
||||
done < <(code --list-extensions)
|
||||
fi
|
||||
|
||||
total_extensions=${#extensionList[@]}
|
||||
printfe "%s\n" "cyan" "VSCode $count_installed_extensions/$total_extensions extensions installed"
|
||||
}
|
||||
|
@ -3,14 +3,13 @@ reset-and-clear='<Primary><Shift>k'
|
||||
|
||||
[legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9]
|
||||
background-color='rgb(23,20,33)'
|
||||
cursor-blink-mode='on'
|
||||
cursor-shape='underline'
|
||||
default-size-columns=120
|
||||
default-size-rows=30
|
||||
font='MesloLGS Nerd Font 14'
|
||||
font='MesloLGS NF 12'
|
||||
foreground-color='rgb(208,207,204)'
|
||||
use-system-font=false
|
||||
use-theme-colors=false
|
||||
visible-name='Ubuntu'
|
||||
|
||||
[legacy/profiles:/legacy/keybindings]
|
||||
reset-and-clear='<Primary><Shift>k'
|
||||
@ -21,10 +20,11 @@ cursor-blink-mode='on'
|
||||
cursor-shape='underline'
|
||||
default-size-columns=120
|
||||
default-size-rows=30
|
||||
font='MesloLGS Nerd Font 14'
|
||||
font='MesloLGS NF 12'
|
||||
foreground-color='rgb(208,207,204)'
|
||||
use-system-font=false
|
||||
use-theme-colors=false
|
||||
visible-name='Ubuntu'
|
||||
|
||||
[legacy/profiles:/legacy/profiles:/legacy/keybindings]
|
||||
reset-and-clear='<Primary><Shift>k'
|
||||
@ -53,3 +53,17 @@ font='MesloLGS Nerd Font 14'
|
||||
foreground-color='rgb(208,207,204)'
|
||||
use-system-font=false
|
||||
use-theme-colors=false
|
||||
|
||||
[legacy/profiles:/legacy/profiles:/legacy/profiles:/legacy/profiles:/legacy/keybindings]
|
||||
reset-and-clear='<Primary><Shift>k'
|
||||
|
||||
[legacy/profiles:/legacy/profiles:/legacy/profiles:/legacy/profiles:/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9]
|
||||
background-color='rgb(23,20,33)'
|
||||
cursor-blink-mode='on'
|
||||
cursor-shape='underline'
|
||||
default-size-columns=120
|
||||
default-size-rows=30
|
||||
font='MesloLGS Nerd Font 14'
|
||||
foreground-color='rgb(208,207,204)'
|
||||
use-system-font=false
|
||||
use-theme-colors=false
|
||||
|
7
config/keyboard-shortcuts.json
Normal file
7
config/keyboard-shortcuts.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"shortcuts": {
|
||||
"<Primary><Alt>e": "nautilus",
|
||||
"<Primary><Alt>t": "wezterm",
|
||||
"<Shift><Alt>space": "1password --quick-access"
|
||||
}
|
||||
}
|
2
config/ssh/config
Normal file
2
config/ssh/config
Normal file
@ -0,0 +1,2 @@
|
||||
Host *
|
||||
IdentityAgent ~/.1password/agent.sock
|
65
config/wezterm.lua
Normal file
65
config/wezterm.lua
Normal file
@ -0,0 +1,65 @@
|
||||
-- Pull in the wezterm API
|
||||
local wezterm = require 'wezterm'
|
||||
|
||||
-- This will hold the configuration.
|
||||
local config = wezterm.config_builder()
|
||||
|
||||
config.font = wezterm.font("MesloLGS NF")
|
||||
|
||||
config.keys = {
|
||||
-- Ctrl+K for to clear the terminal
|
||||
{
|
||||
key = 'k',
|
||||
mods = 'CTRL',
|
||||
action = wezterm.action{ClearScrollback = "ScrollbackAndViewport"}
|
||||
},
|
||||
-- Ctrl+T for new tab
|
||||
{
|
||||
key = 't',
|
||||
mods = 'CTRL',
|
||||
action = wezterm.action{SpawnTab="CurrentPaneDomain"}
|
||||
},
|
||||
-- Ctrl+W for close tab
|
||||
{
|
||||
key = 'w',
|
||||
mods = 'CTRL',
|
||||
action = wezterm.action{CloseCurrentTab={confirm=true}}
|
||||
},
|
||||
-- Ctrl+s for split horizontal
|
||||
{
|
||||
key = 's',
|
||||
mods = 'CTRL',
|
||||
action = wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}
|
||||
},
|
||||
-- Ctrl+d for split vertical
|
||||
{
|
||||
key = 'd',
|
||||
mods = 'CTRL',
|
||||
action = wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}
|
||||
},
|
||||
}
|
||||
|
||||
-- Use default titlebar instead of the one provided by wezterm
|
||||
config.window_frame = {
|
||||
inactive_titlebar_bg = '#353535',
|
||||
active_titlebar_bg = '#2b2042',
|
||||
inactive_titlebar_fg = '#cccccc',
|
||||
active_titlebar_fg = '#ffffff',
|
||||
inactive_titlebar_border_bottom = '#2b2042',
|
||||
active_titlebar_border_bottom = '#2b2042',
|
||||
button_fg = '#cccccc',
|
||||
button_bg = '#2b2042',
|
||||
button_hover_fg = '#ffffff',
|
||||
button_hover_bg = '#3b3052',
|
||||
|
||||
font = require('wezterm').font 'Roboto',
|
||||
font_size = 12,
|
||||
}
|
||||
|
||||
-- Set the default cursor style to a blinking underscore
|
||||
config.default_cursor_style = "BlinkingUnderline"
|
||||
config.initial_rows = 30
|
||||
config.initial_cols = 120
|
||||
|
||||
-- and finally, return the configuration to wezterm
|
||||
return config
|
@ -1 +1 @@
|
||||
["davidanson.vscode-markdownlint","esbenp.prettier-vscode","github.copilot","github.copilot-chat","ms-azuretools.vscode-docker","ms-vscode-remote.remote-containers","vscode-icons-team.vscode-icons"]
|
||||
["aaron-bond.better-comments","bmewburn.vscode-intelephense-client","christian-kohler.path-intellisense","davidanson.vscode-markdownlint","esbenp.prettier-vscode","foxundermoon.shell-format","github.copilot","github.copilot-chat","github.vscode-pull-request-github","mguellsegarra.highlight-on-copy","ms-azuretools.vscode-docker","ms-vscode-remote.remote-containers","ms-vscode-remote.remote-ssh","ms-vscode-remote.remote-ssh-edit","ms-vscode.makefile-tools","ms-vscode.remote-explorer","ms-vsliveshare.vsliveshare","nicolasvuillamy.vscode-groovy-lint","usernamehw.errorlens","vincaslt.highlight-matching-tag","vscode-icons-team.vscode-icons","warpnet.salt-lint","xdebug.php-debug","xdebug.php-pack","zobo.php-intellisense"]
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"security.workspace.trust.untrustedFiles": "open",
|
||||
|
||||
"editor.fontFamily": "MesloLGS Nerd Font",
|
||||
"terminal.integrated.fontFamily": "MesloLGS Nerd Font",
|
||||
"editor.fontFamily": "MesloLGS NF",
|
||||
"terminal.integrated.fontFamily": "MesloLGS NF",
|
||||
"github.copilot.enable": {
|
||||
"*": true,
|
||||
"plaintext": true,
|
||||
|
2
zshrc
2
zshrc
@ -19,7 +19,6 @@ plugins=(
|
||||
docker
|
||||
1password
|
||||
ubuntu
|
||||
tmux
|
||||
sudo
|
||||
screen
|
||||
brew
|
||||
@ -47,6 +46,7 @@ alias l='lsd -Sl --reverse --human-readable --group-directories-first'
|
||||
alias mv='/usr/local/bin/advmv -g'
|
||||
alias cp='/usr/local/bin/advcp -g'
|
||||
alias ddpul='docker compose down && docker compose pull && docker compose up -d && docker compose logs -f'
|
||||
alias cat='bat'
|
||||
|
||||
# Tradaware / DiscountOffice
|
||||
if [ -d "/home/menno/Projects/Work" ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user