give ubuntu mac keystrokes
Add this to your .bashrc at least for one login, especially as root so it installs the packages
# install dependencies
sudo apt-get install -y dbus-x11 // required for below
sudo apt install gnome-sushi // file preview with spacebar
# disable capslock and insert
setxkbmap -option caps:none // I hate capslock
xmodmap -e "keycode 118 = NoSymbol" # Insert key (usually keycode 118) disabled
# enable command q, command h, command m and command-tab
gsettings set org.gnome.desktop.wm.keybindings close "['<Control>q', '<Super>q']"
gsettings set org.gnome.desktop.wm.keybindings minimize "['<Control>h', '<Super>h']"
gsettings set org.gnome.desktop.wm.keybindings minimize "['<Control>h', '<Super>h', '<Control>m', '<Super>m']"
gsettings set org.gnome.desktop.wm.keybindings switch-applications "['<Super>Tab', '<Control>Tab']"
gsettings set org.gnome.desktop.wm.keybindings close "['<Control>q', '<Super>q']"
gsettings set org.gnome.desktop.wm.keybindings minimize "['<Control>h', '<Super>h']"
gsettings set org.gnome.desktop.wm.keybindings minimize "['<Control>h', '<Super>h', '<Control>m', '<Super>m']"
gsettings set org.gnome.desktop.wm.keybindings switch-applications "['<Super>Tab', '<Control>Tab']"
# turn the windows key into a control key so that windows c, v, x, z behaves like mac command cxvz
cat > ~/.Xmodmap <<'EOF'
keycode 133 = Control_L
keycode 134 = Control_R
EOF
echo "xmodmap ~/.Xmodmap" >> ~/.xprofile
chmod +x ~/.xprofile
xmodmap ~/.Xmodmap
cat > ~/.Xmodmap <<'EOF'
keycode 133 = Control_L
keycode 134 = Control_R
EOF
echo "xmodmap ~/.Xmodmap" >> ~/.xprofile
chmod +x ~/.xprofile
xmodmap ~/.Xmodmap
# screenshots on control/win shift 3 and 4
sudo apt install xbindkeys xdotool gnome-screenshot
sudo apt install xbindkeys xdotool gnome-screenshot
# Create ~/.xbindkeysrc with correct mapping
cat > ~/.xbindkeysrc <<EOF
"gnome-screenshot -a -c"
control+shift + mod2 + Release + Mod2 + c:12
"gnome-screenshot -c"
control+shift + mod2 + Release + Mod2 + c:13
EOF
cat > ~/.xbindkeysrc <<EOF
"gnome-screenshot -a -c"
control+shift + mod2 + Release + Mod2 + c:12
"gnome-screenshot -c"
control+shift + mod2 + Release + Mod2 + c:13
EOF
# Make autostart folder if needed
mkdir -p ~/.config/autostart
mkdir -p ~/.config/autostart
# Create xbindkeys autostart .desktop file
cat > ~/.config/autostart/xbindkeys.desktop <<EOF
[Desktop Entry]
Type=Application
Exec=xbindkeys
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=XBindKeys
EOF
cat > ~/.config/autostart/xbindkeys.desktop <<EOF
[Desktop Entry]
Type=Application
Exec=xbindkeys
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=XBindKeys
EOF
# Start xbindkeys now
killall xbindkeys 2>/dev/null
xbindkeys
# set control period to be cancel instead of control C
killall xbindkeys 2>/dev/null
xbindkeys
# set control period to be cancel instead of control C
#!/bin/bash# Ensure dependencies are presentsudo apt install -y xbindkeys xdotool gnome-screenshot# Make script folder if it doesn't existmkdir -p ~/scripts# Create the SIGINT scriptcat > ~/scripts/send-sigint.sh <<'EOF'#!/bin/bash# Send SIGINT to foreground process of focused terminal windowwinpid=$(xdotool getwindowpid "$(xdotool getactivewindow)")target_pid=$(pgrep -P "$winpid" | head -n1)if [[ -z "$target_pid" ]]; thentarget_pid="$winpid"fikill -INT "$target_pid"EOFchmod +x ~/scripts/send-sigint.sh# Write .xbindkeysrc with snipping and interrupt keyscat > ~/.xbindkeysrc <<EOF"gnome-screenshot -a -c"control+shift + mod2 + Release + Mod2 + c:12"gnome-screenshot -c"control+shift + mod2 + Release + Mod2 + c:13"~/scripts/send-sigint.sh"control + c:60EOF# Add autostart entrymkdir -p ~/.config/autostartcat > ~/.config/autostart/xbindkeys.desktop <<EOF[Desktop Entry]Type=ApplicationName=XBindKeysExec=xbindkeysHidden=falseX-GNOME-Autostart-enabled=trueNoDisplay=falseEOF# Restart xbindkeyskillall xbindkeys 2>/dev/nullxbindkeysecho "✅ Setup complete. Win+Period now sends SIGINT to foreground process."