瀏覽代碼

Works nicely on OS X now

master
mort 9 年之前
父節點
當前提交
866b2709dd
共有 11 個檔案被更改,包括 64 行新增17 行删除
  1. 11
    0
      bin/mclip
  2. 1
    1
      bin/merror
  3. 9
    0
      bin/mnotificationwrapper
  4. 1
    1
      bin/mnotify
  5. 3
    1
      bin/mrec
  6. 9
    2
      bin/mshot
  7. 2
    0
      bin/msound
  8. 6
    2
      bin/mupload
  9. 2
    2
      bin/pbin
  10. 5
    1
      dotfiles/zshrc
  11. 15
    7
      setup.sh

+ 11
- 0
bin/mclip 查看文件

@@ -0,0 +1,11 @@
#/bin/bash

OS=$(uname)

content=$(cat -)

if [ "$OS" -eq "Darwin" ]; then
echo -n "$content" | pbcopy
else
echo -n "$content" | xsel -ib
fi

+ 1
- 1
bin/merror 查看文件

@@ -1,4 +1,4 @@
#!/bin/bash

msound error
notify-send -u critical -i ~/assets/img/error.png "$1" "$2"
mnotificationwrapper "critical" "$HOME/assets/img/error.png" "$1" "$2"

+ 9
- 0
bin/mnotificationwrapper 查看文件

@@ -0,0 +1,9 @@
#!/bin/bash

OS=$(uname)

if [ "$OS" = "Darwin" ]; then
terminal-notifier -contentImage "$2" -title "$3" -message "$4"
else
notify-send -u "$1" -i "$2" "$3" "$4"
fi

+ 1
- 1
bin/mnotify 查看文件

@@ -1,4 +1,4 @@
#!/bin/bash

msound ding
notify-send -u low -i ~/assets/img/info.png "$1" "$2"
mnotificationwrapper "low" "$HOME/assets/img/info.png" "$1" "$2"

+ 3
- 1
bin/mrec 查看文件

@@ -1,5 +1,7 @@
#!/bin/bash

OS=$(uname)

source ~/.mrecrc

if [ "$1" = "" ] && [ ! -f ~/.mrec/name ]; then
@@ -10,7 +12,7 @@ elif [ "$1" = "" ]; then #stop recording
pid=$(cat ~/.mrec/pid)

URL="d.mort.coffee/vid/${name}.ogv"
echo $URL | xsel -bi
echo $URL | mclip

kill $pid


+ 9
- 2
bin/mshot 查看文件

@@ -1,12 +1,19 @@
#!/bin/bash

OS=$(uname)

if [ "$1" = "" ]; then
echo "mshot <name>"
fi

sleep 0.1
DIR=`mktemp -d`
scrot "$DIR/pic.png"
DIR=$(mktemp -d /tmp/mupload.XXXXXXXXXX)

if [ "$OS" = "Darwin" ]; then
screencapture "$DIR/pic.png"
else
scrot "$DIR/pic.png"
fi

mupload "$DIR/pic.png" "img/${1}.png"
if [ $? -eq 0 ]; then

+ 2
- 0
bin/msound 查看文件

@@ -1,3 +1,5 @@
#!/bin/bash

OS=$(uname)

mplayer -nogui "$HOME/assets/sounds/${1}.mp3" </dev/null >/dev/null 2>&1 &

+ 6
- 2
bin/mupload 查看文件

@@ -1,5 +1,7 @@
#!/bin/bash

OS=$(uname)

if [ "$1" == "" ] || [ "$2" == "" ]; then
echo "mupload <file> <name>"
exit 1
@@ -9,10 +11,12 @@ elif [ ! -f "$1" ]; then
fi

URL="http://d.mort.coffee/$2"
echo $URL | xsel -ib

echo "$URL" | mclip

scp "$1" "martin@serve.mort.coffee:/var/www/mort.coffee/d/public/content/$2"
if [ $? -eq 0 ]; then
echo $URL
echo "$URL"
else
exit 1
fi

+ 2
- 2
bin/pbin 查看文件

@@ -20,10 +20,10 @@ else
name="$2"
fi

pasteId=$(curl "$url" -s -F "name=$name" -F "content=$content")
pasteId=$(curl "$url" -s --data-urlencode "name=$name" --data-urlencode "content=$content")

if [ $? -eq 0 ]; then
echo "Your paste should now be at http://pbin.in/$pasteId"
echo "http://pbin.in/$pasteId"
else
echo "An error occurred." 1>&2
exit 1

+ 5
- 1
dotfiles/zshrc 查看文件

@@ -2,7 +2,11 @@
export LC_ALL="en_US.UTF-8"

# neat aliases
alias ls="ls --color=always"
if [ $(uname) = "Linux" ]; then
alias ls="ls --color=always"
else
alias ls="ls -G"
fi
alias ll="ls -l"
alias la="ls -a"
source ~/.zshalias

+ 15
- 7
setup.sh 查看文件

@@ -4,10 +4,18 @@ issues=0

check_command()
{
which "$1" &> /dev/null
if [ "$?" -ne 0 ]; then
exists=0

for arg in "$@"; do
which "$arg" &> /dev/null
if [ "$?" -eq 0 ]; then
exists=1
fi
done

if [ "$exists" -eq 0 ]; then
issues=1
echo "Missing command: $1"
echo "Missing command: $@"
fi
}

@@ -28,12 +36,12 @@ check_command "compton"
check_command "amixer"
check_command "xbacklight"
check_command "feh"
check_command "xsel"
check_command "xsel" "pbcopy"
check_command "recordmydesktop"
check_command "mplayer"
check_command "scrot"
check_command "notify-send"
check_command "dunst"
check_command "scrot" "screencapture"
check_command "notify-send" "terminal-notifier"
check_command "dunst" "terminal-notifier"
check_command "curl"
check_command "sudo"


Loading…
取消
儲存