Set up devdocs as key-binding reference tool
#!/bin/bash | |
###### | |
# Install wmctrl, nativefier and devdocs so we can map | |
# a key-binding to quick-access reference tool | |
# | |
# See: https://dev.to/flipflopsandrice/quick-access-to-reference-docs-ubuntu-34lm | |
# Installs wmctrl | |
sudo apt install wmctrl | |
# Install nativefier globally | |
npm install nativefier -g | |
# Create software folder | |
mkdir ~/Software && cd ~/Software | |
# Generate local electron version of devdocs | |
nativefier --name "DevDocs" "https://devdocs.io/" | |
echo "[Desktop Entry]" \ | |
"Type=Application" \ | |
"Terminal=false" \ | |
"Exec=/home/$(whoami)/Software/dev-docs-linux-x64/dev-docs" \ | |
"Name=DevDocs" > \ | |
"# Icon=/path-to-optional-icon.png" \ | |
> ~/.local/share/applications/devdocs.desktop | |
# Create folder to store our script | |
mkdir ~/bin | |
# Create launch/focus script | |
echo "#!/bin/bash" \ | |
(wmctrl -l | grep -q DevDocs) && wmctrl -a DevDocs || gtk-launch devdocs" \ | |
> `~/bin/devdocs.sh` | |
# Make the script executable for the user | |
chmod u+x ~/bin/devdocs.sh | |
######### | |
## DONE! Make sure you now add a key-binding to fire this command: | |
## ~/bin/devdocs.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment