Skip to content

Commit

Permalink
more friendly notification
Browse files Browse the repository at this point in the history
  • Loading branch information
frostwong committed Dec 5, 2024
1 parent 2d2c3b0 commit 44f84f4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This keyboard remap is based on the [Xremap](https://github.com/k0kubun/xremap)
![Gnome macOS Remap Icon](./resources/gnome-macos-remap-wayland-dark.png#gh-dark-mode-only)

## How does it work?
Script doenloads the latest version of the `xremap` remapper for your architecture. Configuration file `config.yml` contains majority of the remapping instructions. On top of that the default GNOME shell and Mutter keybindings are modified. A systemd service is created and enabled for a particular user. Therefore after the install other users on the system will not be affected by the remap.
Script downloads the latest version of the `xremap` remapper for your architecture. Configuration file `config.yml` contains majority of the remapping instructions. On top of that the default GNOME shell and Mutter keybindings are modified. A systemd service is created and enabled for a particular user. Therefore after the install other users on the system will not be affected by the remap.

## Prerequisities
* Install Git and GNOME extensions `sudo <your-package-manager> install git gnome-shell-extensions`.
Expand Down
58 changes: 34 additions & 24 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,31 @@ else
exit 1
fi

# Download latest release from GitHub
wget https://github.com/xremap/xremap/releases/latest/download/$ARCHIVE_NAME

# Extract the archive
echo "INFO: Extracting the archive..."
if ! command -v unzip &> /dev/null; then
echo "ERROR: Command \"unzip\" not found."
exit 0
fi
unzip -o ./xremap-linux-${ARCH}-*.zip

# Remove old binary (if any)
if command -v gnome-terminal &> /dev/null ; then
echo "INFO: Removing old binary..."
sudo rm -rf /usr/local/bin/xremap
if which xremap > /dev/null 2>&1; then
echo "INFO: xremap is already installed. Skipping...
else
# Download latest release from GitHub
wget https://github.com/xremap/xremap/releases/latest/download/$ARCHIVE_NAME
# Extract the archive
echo "INFO: Extracting the archive..."
if ! command -v unzip &> /dev/null; then
echo "ERROR: Command \"unzip\" not found."
exit 0
fi
unzip -o ./xremap-linux-${ARCH}-*.zip
# Remove old binary (if any)
if command -v gnome-terminal &> /dev/null ; then
echo "INFO: Removing old binary..."
sudo rm -rf /usr/local/bin/xremap
fi
# Install new binary (if any)
echo "INFO: Installing the binary..."
sudo cp ./xremap /usr/local/bin
fi
# Install new binary (if any)
echo "INFO: Installing the binary..."
sudo cp ./xremap /usr/local/bin

# Tweaking server access control for X11
# https://github.com/k0kubun/xremap#x11
if [ "${XDG_SESSION_TYPE}" == "x11" ]; then
Expand Down Expand Up @@ -156,12 +160,18 @@ gsettings set org.gnome.settings-daemon.plugins.media-keys screensaver "[]"
# Download and enable Xremap GNOME extension (for Wayland only)
systemctl --user status gnome-macos-remap
if [ "${XDG_SESSION_TYPE}" == "wayland" ]; then
RED=`tput setaf 1`
RESET=`tput sgr0`
echo "INFO: ${RED}Action Required${RESET}. Install the xremap extension and restart your PC."
echo " https://extensions.gnome.org/extension/5060/xremap/"
# Check if xremap extension is enabled
if gnome-extensions list | grep -q "[email protected]"; then
echo "INFO: The xremap extension is already enabled."
else
RED=`tput setaf 1`
RESET=`tput sgr0`
echo "INFO: ${RED}Action Required${RESET}. Install the xremap extension and restart your PC."
echo " https://extensions.gnome.org/extension/5060/xremap/"
fi
else
gnome-extensions disable [email protected]
echo "INFO: Please restart your computer."
fi
fi

0 comments on commit 44f84f4

Please sign in to comment.