#!/usr/bin/env bash
setopt interactivecomments
set -eo pipefail
# Update system and install base packages
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y make build-essential git htop tmux jq ncdu pigz pv zip unzip curl wget gpg llvm
sudo apt-get install -y vim tree gufw shellcheck copyq bleachbit aptitude synaptic fastfetch gnome-tweaks gnome-shell-extensions dconf-editor dconf-cli gir1.2-gnomedesktop-3.0
# Install GNOME extensions
SHELL_VERSION="$(gnome-shell --version | awk '{print $3}')"
declare -A GNOME_EXTENSIONS=(
[dash-to-dock@micxgx.gmail.com]=307
[appindicatorsupport@rgcjonas.gmail.com]=615
[ding@rastersoft.com]=2087
)
install_gnome_extension() {
local extension_id="$1"
local download_url
local extension_zip
download_url="$(curl -fsSL "https://extensions.gnome.org/extension-info/?pk=${extension_id}&shell_version=${SHELL_VERSION}" | jq -er '.download_url')"
extension_zip="$(mktemp)"
curl -fsSL "https://extensions.gnome.org${download_url}" -o "$extension_zip"
gnome-extensions install --force "$extension_zip"
rm -f "$extension_zip"
}
for extension_id in "${GNOME_EXTENSIONS[@]}"; do
install_gnome_extension "$extension_id"
done
# Enable these extensions on the next GNOME Shell login
printf -v ENABLED_EXTENSIONS "'%s', " "${!GNOME_EXTENSIONS[@]}"
gsettings set org.gnome.shell enabled-extensions "[${ENABLED_EXTENSIONS%, }]"
# Dock and windows
gsettings set org.gnome.shell favorite-apps "['firefox-esr.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.Settings.desktop', 'org.gnome.Extensions.desktop']"
dconf write /org/gnome/shell/extensions/dash-to-dock/click-action "'focus-minimize-or-previews'"
gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'
# Power and appearance
powerprofilesctl set performance
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'nothing'
gsettings set org.gnome.desktop.screensaver lock-enabled false
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-automatic true
gsettings set org.gnome.settings-daemon.plugins.color night-light-temperature 4000
# Nautilus
mkdir -p "$HOME/.config/gtk-3.0"
cat > "$HOME/.config/gtk-3.0/bookmarks" <<EOF
file://${HOME}/Downloads
file://${HOME}
file:///
EOF
# Add user to sudoers with NOPASSWD
echo "$USER ALL=(ALL:ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/$USER
sudo chmod 0440 /etc/sudoers.d/$USER
sudo visudo -c
# Update default editor to Vim
sudo update-alternatives --set editor /usr/bin/vim.basic
# Grub timeout duration
sudo sed -i "s/GRUB_TIMEOUT=[0-9]*/GRUB_TIMEOUT=2/" "/etc/default/grub" && sudo update-grub
# Zsh & Fonts
sudo apt-get install -y zsh fonts-powerline
sudo chsh -s "$(which zsh)" "$USER"
# Ohmyzsh https://ohmyz.sh/
RUNZSH=no sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Ohmyzsh Plugins
git clone --depth=1 https://github.com/marlonrichert/zsh-autocomplete.git "${HOME}/.oh-my-zsh/custom/plugins/zsh-autocomplete"
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git "${HOME}/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git "${HOME}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
# Configure .zshrc
ZSHRC_FILE="$HOME/.zshrc"
OLD_PLUGINS="plugins=(git)"
NEW_PLUGINS="plugins=(git sudo copyfile command-not-found docker python zsh-autocomplete zsh-autosuggestions zsh-syntax-highlighting)"
sed -i "s/${OLD_PLUGINS}/${NEW_PLUGINS}/" "$ZSHRC_FILE"
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/' "$ZSHRC_FILE"
sed -i "s/^# zstyle ':omz:update' mode auto/zstyle ':omz:update' mode auto/" "$ZSHRC_FILE"
echo 'setopt interactivecomments' >> "$ZSHRC_FILE"
# Flatpak
sudo apt-get install -y flatpak gnome-software-plugin-flatpak
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Discord https://flathub.org/apps/com.discordapp.Discord
flatpak install -y flathub com.discordapp.Discord
# Spotify https://flathub.org/en/apps/com.spotify.Client
flatpak install -y flathub com.spotify.Client
# Librewolf https://librewolf.net/installation/debian/
sudo apt-get update && sudo apt-get install -y extrepo
sudo extrepo enable librewolf
sudo apt-get update && sudo apt-get install -y librewolf
#!/usr/bin/env zsh
cd "$HOME"
setopt interactivecomments
set -eo pipefail
# Sudo without password
echo "$USER ALL=(ALL:ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/$USER
sudo chmod 0440 /etc/sudoers.d/$USER
sudo visudo -c
# Disable Gatekeeper
sudo spctl --master-disable
# Set hostnames
sudo scutil --set HostName "macbook"
sudo scutil --set LocalHostName "macbook"
sudo scutil --set ComputerName "macbook"
dscacheutil -flushcache
# Mute startup sound
sudo nvram StartupMute=%01
# Require password immediately after sleep/wake
sudo sysadminctl -screenLock immediate -password -
# Display sleep timers on battery and wall power (in minutes)
sudo pmset -b displaysleep 5
sudo pmset -c displaysleep 5
# Battery percentage in the menu bar
defaults -currentHost write com.apple.controlcenter.plist BatteryShowPercentage -bool true
# Don't write .DS_Store on USB or network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Continuous key repeat
defaults write -g ApplePressAndHoldEnabled -bool false
# Key repeat rate (fastest) and delay until repeat (shortest)
defaults write -g KeyRepeat -int 2
defaults write -g InitialKeyRepeat -int 15
# Spelling and auto-correction
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
defaults write -g NSAutomaticCapitalizationEnabled -bool false
defaults write -g NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write -g NSAutomaticDashSubstitutionEnabled -bool false
defaults write -g NSAutomaticPeriodSubstitutionEnabled -bool false
defaults write -g NSAutomaticTextCompletionEnabled -bool false
# Tap to Click
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write -g com.apple.mouse.tapBehavior -int 1
# Disable trackpad force click and haptic feedback
defaults write com.apple.AppleMultitouchTrackpad ActuateDetents -int 0
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad ActuateDetents -int 0
defaults -currentHost write -g com.apple.trackpad.forceClick -int 0
# Three-Finger Drag (text selection)
defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool true
defaults -currentHost write -g com.apple.trackpad.threeFingerDragGesture -bool true
# Three-Finger Tap for Look Up
defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerTapGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerTapGesture -int 2
defaults -currentHost write -g com.apple.trackpad.threeFingerTapGesture -int 2
# Natural scrolling, trackpad zooming, and rotations
defaults write -g com.apple.swipescrolldirection -bool true
defaults write com.apple.AppleMultitouchTrackpad TrackpadPinch -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadPinch -bool true
defaults write com.apple.AppleMultitouchTrackpad TrackpadRotate -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRotate -bool true
defaults write com.apple.AppleMultitouchTrackpad TrackpadTwoFingerDoubleTapGesture -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadTwoFingerDoubleTapGesture -bool true
# Swipe between pages with two fingers
defaults write -g AppleEnableSwipeNavigateWithScrolls -bool true
defaults write -g AppleEnableMouseSwipeNavigateWithScrolls -bool true
# Swipe between desktops with four fingers
defaults write com.apple.AppleMultitouchTrackpad TrackpadFourFingerHorizSwipeGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFourFingerHorizSwipeGesture -int 2
defaults -currentHost write -g com.apple.trackpad.fourFingerHorizSwipeGesture -int 2
# Mission Control & App Expose with four-finger vertical swipes
defaults write com.apple.dock showAppExposeGestureEnabled -bool true
defaults write com.apple.AppleMultitouchTrackpad TrackpadFourFingerVertSwipeGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFourFingerVertSwipeGesture -int 2
defaults -currentHost write -g com.apple.trackpad.fourFingerVertSwipeGesture -int 2
# System Behaviour
defaults write -g AppleInterfaceStyle -string "Dark"
defaults write -g AppleLanguages -array "en-CY" "el-CY"
defaults write -g AppleLocale -string "en_CY"
defaults write -g AppleMeasurementUnits -string "Centimeters"
defaults write -g AppleMetricUnits -bool true
defaults write -g AppleICUForce24HourTime -bool true
defaults write -g AppleScrollerPagingBehavior -bool true
# Keyboard sources
defaults write com.apple.HIToolbox AppleEnabledInputSources -array \
'{ InputSourceKind = "Keyboard Layout"; "KeyboardLayout ID" = "-18944"; "KeyboardLayout Name" = Greek; }' \
'{ Bundle ID = "com.apple.CharacterPaletteIM"; InputSourceKind = "Non Keyboard Input Method"; }' \
'{ Bundle ID = "com.apple.PressAndHold"; InputSourceKind = "Non Keyboard Input Method"; }' \
'{ InputSourceKind = "Keyboard Layout"; "KeyboardLayout ID" = 250; "KeyboardLayout Name" = "British-PC"; }'
defaults write com.apple.HIToolbox AppleSelectedInputSources -array \
'{ Bundle ID = "com.apple.PressAndHold"; InputSourceKind = "Non Keyboard Input Method"; }' \
'{ InputSourceKind = "Keyboard Layout"; "KeyboardLayout ID" = 250; "KeyboardLayout Name" = "British-PC"; }'
defaults write com.apple.HIToolbox AppleCurrentKeyboardLayoutInputSourceID -string "com.apple.keylayout.British-PC"
# Dock
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock tilesize -int 60
defaults write com.apple.dock wvous-bl-corner -int 4
defaults write com.apple.dock wvous-bl-modifier -int 0
defaults write com.apple.dock wvous-br-corner -int 10
defaults write com.apple.dock wvous-br-modifier -int 0
defaults write com.apple.dock show-recents -bool false
defaults write com.apple.dock persistent-apps -array
# Desktop and Window Manager
defaults write com.apple.WindowManager EnableStandardClickToShowDesktop -int 0
defaults write com.apple.WindowManager StandardHideWidgets -int 1
defaults write com.apple.WindowManager StageManagerHideWidgets -int 1
# Finder layout and display
defaults write com.apple.finder AppleShowAllFiles -bool true
defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder ShowStatusBar -bool true
defaults write com.apple.finder _FXSortFoldersFirst -bool true
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
defaults write -g AppleShowAllExtensions -bool true
# Relaunch services so most preferences take effect immediately
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u || true
killall cfprefsd || true
killall SystemUIServer || true
killall ControlCenter || true
killall NotificationCenter || true
killall Finder || true
killall Dock || true
# Install Homebrew without confirmation prompts
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Configure Homebrew
touch "$HOME/.zprofile"
echo 'eval "$(/opt/homebrew/bin/brew shellenv zsh)"' >> "$HOME/.zprofile"
eval "$(/opt/homebrew/bin/brew shellenv zsh)"
# Install brew formulas and casks
brew install -y fastfetch
brew install -y ncdu
brew install -y --cask iterm2
brew install -y --cask docker
brew install -y --cask zed
brew install -y --cask discord
brew install -y --cask spotify
# Install Ohmyzsh https://ohmyz.sh/
RUNZSH=no /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Install Powerline Fonts
git clone --depth=1 https://github.com/powerline/fonts.git
cd fonts
./install.sh
cd ..
rm -rf fonts
# Configure iTerm2 defaults
defaults write com.googlecode.iterm2 PromptOnQuit -bool false
defaults write com.googlecode.iterm2 OnlyWhenMoreTabs -bool false
defaults write com.googlecode.iterm2 "Prompt Before Closing 2" -bool false
defaults write com.googlecode.iterm2 "Unlimited Scrollback" -bool true
defaults write com.googlecode.iterm2 "Normal Font" -string "MesloLGMDZForPowerline-Regular 12"
# Install Zsh Plugins
git clone --depth=1 https://github.com/marlonrichert/zsh-autocomplete.git "${HOME}/.oh-my-zsh/custom/plugins/zsh-autocomplete"
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git "${HOME}/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git "${HOME}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
# Update .zshrc configuration
ZSHRC_FILE="$HOME/.zshrc"
OLD_PLUGINS="plugins=(git)"
NEW_PLUGINS="plugins=(git sudo copyfile command-not-found docker python zsh-autocomplete zsh-autosuggestions zsh-syntax-highlighting)"
sed -i '' "s/${OLD_PLUGINS}/${NEW_PLUGINS}/" "$ZSHRC_FILE"
sed -i '' 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/' "$ZSHRC_FILE"
sed -i '' "s/^# zstyle ':omz:update' mode auto/zstyle ':omz:update' mode auto/" "$ZSHRC_FILE"
echo 'setopt interactivecomments' >> "$ZSHRC_FILE"