citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

phone-clipboard (404B)


      1 #!/usr/bin/env bash
      2 
      3 set -e
      4 
      5 send_to_phone() {
      6     phonectl copy:"$@"
      7     notify-send "copied '$@' to phone"
      8     exit 0
      9 }
     10 
     11 if [ ! -z "$@" ]
     12 then
     13     send_to_phone "$@"
     14 fi
     15 
     16 clipboard=$(phonectl clipboard)
     17 
     18 if [[ "$clipboard" = "GPhone clipboard: "* ]]; then
     19   <<<"$clipboard" sed "s/^GPhone clipboard: //g"
     20   exit 0
     21 fi
     22 
     23 printf "%s\n" "$clipboard" >&2
     24 notify-send "could not access phone clipboard"
     25 exit 1