Last active
December 2, 2019 15:22
-
-
Save flipflopsandrice/07d84567f4197ef253055066669078b3 to your computer and use it in GitHub Desktop.
Set up devdocs as key-binding reference tool
This file contains hidden or 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 | |
###### | |
# 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