Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@ Takes screenshots and uploads them to puush using the puush API and copies the l

## Instructions
- Clone or download the repo
- In file "puush" add your puush API key to PUUSH_API_KEY
- Run "install.sh" to install to /usr/local/bin
- Alternatively you can install wherever you want
- On first run of 'puush' a default config file will be generated into
$HOME/.puush
- In this config file add your puush API key to PUUSH_API_KEY
- (You can find your API key at http://puush.me/account/settings)
- Make it executable using __chmod +x puush__
- Place this file wherever you want (recommended: /usr/local/bin)
- Set up keyboard shortcuts within linux
- (in Ubuntu it's system settings > keyboard > keyboard shortcuts > custom shortcuts)
- Log out for the changes to take place
- Here's what it looks like for mine: ![Puush keyboard setup](http://puu.sh/cOyVz/8dcb1cd498.png)

### Commands
``` bash
puush -a # puush desktop
puush -b # area puush
puush -c # puush window
puush -d # file upload
puush.sh -a # puush desktop
puush.sh -b # area puush
puush.sh -c # puush window
puush.sh -d # file upload

puush -h # help
puush.sh -h # help
```

## Dependencies
Expand Down
6 changes: 6 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

mkdir -p /usr/local/bin
cp ./puush.sh ./puush.png /usr/local/bin
chmod 755 /usr/local/bin/puush.sh
chmod 644 /usr/local/bin/puush.png
File renamed without changes
28 changes: 22 additions & 6 deletions puush → puush.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
# Set API Key here

PUUSH_CONFIG_FILE="$HOME/.puush"
PUUSH_API_KEY=""

# Puush for Ubuntu/linux
Expand All @@ -17,7 +18,8 @@ PUUSH_API_KEY=""
# Licence : Beerware
#
# Instructions:
# - Add your puush API key to PUUSH_API_KEY (You can find your API key at http://puush.me/account/settings)
# - Configure your puush API key by adding PUUSH_API_KEY to the $HOME/.puush file
# - You can find your API key at http://puush.me/account/settings
# - Place this file wherever you want (/usr/local/bin)
# - Set up keyboard shortcuts within linux (in Ubuntu it's system settings > keyboard > keyboard shortcuts > custom shortcuts)
#
Expand All @@ -33,6 +35,14 @@ PUUSH_API_KEY=""
# - Link(s) will be copied into clipboard and appear in notifications
# - puush curl upload code borrowed from online sources

function createDefaultConfigFile()
{
echo "# Configure your puush API key here" >> $PUUSH_CONFIG_FILE
echo "# - You can find your API key at http://puush.me/account/settings" >> $PUUSH_CONFIG_FILE
echo "PUUSH_API_KEY=\"\"" >> $PUUSH_CONFIG_FILE
echo >> $PUUSH_CONFIG_FILE
}

# Usage: puushFile [fileName]
function puushFile ()
{
Expand All @@ -49,7 +59,7 @@ function puushFile ()
if [ ! -z "$fileURL" ]; then
#Copy link to clipboard, show notification
printf $fileURL | xclip -selection "clipboard"
notify-send -i "$( cd "$( dirname "$0" )" && pwd )/icon.png" -t 2000 "puush complete!" "$fileURL"
notify-send -i "$( cd "$( dirname "$0" )" && pwd )/puush.png" -t 2000 "puush complete!" "$fileURL"
fi
}

Expand All @@ -75,12 +85,18 @@ function helpText ()

function generateFileName () { echo "/tmp/puush-linux ($(date +"%Y-%m-%d at %I.%M.%S")).png"; }

if [ -f $PUUSH_CONFIG_FILE ]; then
source $PUUSH_CONFIG_FILE
else
echo "Creating default config file in $PUUSH_CONFIG_FILE"
createDefaultConfigFile
fi

if [ -z "$PUUSH_API_KEY" ]; then
echo "Set the variable PUUSH_API_KEY in $0"
echo "You can find your API key at http://puush.me/account/settings"
echo "Set the variable PUUSH_API_KEY in $PUUSH_CONFIG_FILE" >/dev/stderr
echo "You can find your API key at http://puush.me/account/settings" >/dev/stderr

notify-send -i "$( cd "$( dirname "$0" )" && pwd )/icon.png" "Set the variable PUUSH_API_KEY in $0" "You can find your API key at http://puush.me/account/settings"
notify-send -i "$( cd "$( dirname "$0" )" && pwd )/puush.png" "Set the variable PUUSH_API_KEY in $PUUSH_CONFIG_FILE" "You can find your API key at http://puush.me/account/settings"

exit 1

Expand Down