Created
June 2, 2024 23:07
-
-
Save josephbolus/bd865dfd4c7c492c8ea6c939551e1438 to your computer and use it in GitHub Desktop.
Installs Zellij and btop with custom MacOS keybindings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Exit immediately if a command exits with a non-zero status | |
set -e | |
# Variables | |
zellij_version="0.40.1" | |
btop_version="1.3.2" | |
zellij_file="zellij-${zellij_version}.tar.gz" | |
zellij_url="https://github.com/zellij-org/zellij/releases/download/v${zellij_version}/zellij-x86_64-unknown-linux-musl.tar.gz" | |
btop_file="btop-${btop_version}.tbz" | |
btop_url="https://github.com/aristocratos/btop/releases/download/v${btop_version}/btop-x86_64-linux-musl.tbz" | |
# Pre-requisites | |
sudo dnf install -y wget make bzip2 > /dev/null | |
echo "-> Installing Zellij..." | |
wget -q -O ${zellij_file} ${zellij_url} | |
tar -xvzf ${zellij_file} > /dev/null | |
sudo mv zellij /usr/local/bin/ > /dev/null | |
sudo ln -sf /usr/local/bin/zellij /usr/sbin/zellij > /dev/null | |
rm -rf ${zellij_file} > /dev/null | |
mkdir -p ~/.config/zellij > /dev/null | |
# Configure Zellij with Tokyo Night theme and custom keybindings | |
cat << EOF >> ~/.config/zellij/config.kdl | |
// pane_frames false | |
themes { | |
tokyo-night { | |
fg 169 177 214 | |
bg 26 27 38 | |
black 56 62 90 | |
red 249 51 87 | |
green 158 206 106 | |
yellow 224 175 104 | |
blue 122 162 247 | |
magenta 187 154 247 | |
cyan 42 195 222 | |
white 192 202 245 | |
orange 255 158 100 | |
} | |
} | |
theme "tokyo-night" | |
default_layout "compact" | |
keybinds { | |
normal {} | |
locked { | |
bind "Alt g" { SwitchToMode "Normal"; } | |
} | |
move { | |
bind "Alt v" { SwitchToMode "Normal"; } | |
} | |
pane { | |
bind "Alt a" { SwitchToMode "Normal"; } | |
} | |
resize { | |
bind "Alt z" { SwitchToMode "Normal"; } | |
} | |
scroll { | |
bind "Alt s" { SwitchToMode "Normal"; } | |
} | |
session { | |
bind "Alt w" { SwitchToMode "Normal"; } | |
bind "Alt s" { SwitchToMode "scroll"; } | |
} | |
tab { | |
bind "Alt b" { SwitchToMode "Normal"; } | |
} | |
shared_except "locked" { | |
unbind "Ctrl h" // was Move, now Alt-v | |
unbind "Ctrl o" // was Session, now Alt-w | |
unbind "Ctrl s" // was Scroll, now Alt-s | |
unbind "Ctrl n" // was Resize, now Alt-z | |
unbind "Ctrl p" // was Pane, now Alt-a | |
unbind "Ctrl t" // was Tab, now Alt-b | |
unbind "Ctrl g" // was Locked, now Alt-g | |
unbind "Ctrl q" // was Quit, now Alt-q | |
bind "Alt g" { SwitchToMode "locked"; } | |
bind "Alt q" { Quit; } | |
bind "Alt t" { NewTab; } | |
bind "Alt d" { NewPane "down";} | |
bind "Alt r" { NewPane "right"; } | |
bind "Alt f" { ToggleFloatingPanes; } | |
bind "Alt 1" { GoToTab 1; } | |
bind "Alt 2" { GoToTab 2; } | |
bind "Alt 3" { GoToTab 3; } | |
bind "Alt 4" { GoToTab 4; } | |
bind "Alt 5" { GoToTab 5; } | |
bind "Alt 6" { GoToTab 6; } | |
bind "Alt 7" { GoToTab 7; } | |
bind "Alt 8" { GoToTab 8; } | |
bind "Alt 9" { GoToTab 9; } | |
bind "Alt 0" { GoToTab 10; } | |
} | |
shared_except "move" "locked" { | |
bind "Alt v" { SwitchToMode "move"; } | |
} | |
shared_except "pane" "locked" { | |
bind "Alt a" { SwitchToMode "pane"; } | |
} | |
shared_except "resize" "locked" { | |
bind "Alt z" { SwitchToMode "resize"; } | |
} | |
shared_except "scroll" "locked" { | |
bind "Alt s" { SwitchToMode "scroll"; } | |
} | |
shared_except "session" "locked" { | |
bind "Alt w" { SwitchToMode "session"; } | |
} | |
shared_except "tab" "locked" { | |
bind "Alt b" { SwitchToMode "tab"; } | |
} | |
} | |
EOF | |
echo "-> Zellij $(zellij --version) installed!" | |
sleep 2 | |
echo "-> Installing btop..." | |
wget -q -O ${btop_file} ${btop_url} | |
tar -xvjf ${btop_file} > /dev/null | |
pushd btop > /dev/null | |
sudo ./install.sh > /dev/null | |
popd > /dev/null | |
rm -rf ./btop | |
sudo ln -sf /usr/local/bin/btop /usr/sbin/btop > /dev/null | |
echo "-> btop $(btop --version) installed!" | |
echo "-> All Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment