Tuesday 17 November 2015

Notification mirroring with Tasker, Autoremote and Autonotification

I am one of those people who like keeping a separate work and personal phone. Pushbullet used to be that great software which mirrored my notifications on both phones, until one day they didn't. This became a real irritant once I got a Pebble Time (See my review) and really wanted all my notifications on it. So bit the bullet and bought Tasker and set about trying to replicate this functionality.

My Setup

Business phone -> Personal phone -> Pebble Time

Basic requirements

  1. Notifications of select apps (mainly work email, SMS, WhatsApp) on the Business phone should be mirrored on my Personal phone - This would automatically make them show up on the Pebble Time
  2. Notifications dismissed on either phone or the Pebble should lead to the notification being dismissed everywhere else

Apps needed

I have paid versions of all the following apps and have bought all the in-app purchases. I'm not sure if the free versions will work as well.
  1. Tasker (link) Can't give a  Play store link because it's disappeared from the Play store (See here)
  2. Autoremote (link)
  3. Autonotification (link)

Procedure

The basic idea is from this video by João Dias. I just changed the settings to mirror to the 2nd phone instead of to Chrome. What is added is a way to dismiss the autoremote notification if the original notification is dismissed.
I have not set up 2-way mirroring because my primary motive was to get all notifications on the Pebble.
I'm going to assume that you have Tasker set up for External access, Auto remote set up on both phones and both phones set up as Auto remote registered devices.

We need to set up the following actions (Screenshots coming soon)
  1. If any notification (from select apps) is received on the Business phone, trigger a notification on the Personal phone
  2. If the triggered notification is dismissed on the Personal phone, dismiss the notification on the Business phone
  3. If the triggered notification is touched on the Personal phone, trigger the default notification touch action on the Business phone
  4. If the triggered notification is dismissed on the Business phone, dismiss the notification on the Personal phone
  5. If there is an incoming call on the Business phone, trigger a notification on the personal phone
This should take care of mirroring all notifications from the Business phone to the Personal phone.

Wednesday 2 September 2015

My time with Pebble Time

Quick Review

I've had the new Pebble Time for a couple of weeks now and thought I'd pen down a quick overview of what I think.

Pebble Time reminds me of the Nokia S40/60 phones from ten years ago. It's a great 1st smartwatch if you can get used to a few irritants.

The good

  1. Notifications on the wrist are great. It's usually the small ones like messages on Whatsapp or personal emails that really don't need more than a quick glance that this works best with
  2. Google authenticator/ Bank OTP's are fantastic on the watch. No more reaching for the phone for that number
  3. The timeline interface works really well and is a great construct for a smartwatch. There's unfortunately just not enough apps yet to fill it up, and those that are there aren't always reliable
  4. Pebble Time has the fastest charging possible. It goes from 0 - 100% in about an hour which is a real boon

The bad

  1. The battery life is nowhere near the much touted 7 days. I have only moderate usage and I've just about managed 3 days + another day with just the watch functionality. If I turn off activity tracking (either with Misfit or Plex), it goes up to 4 + 1 days
  2. The apps for the Pebble are slow to load. To get over the 8 app limit of the old Pebble, I feel the Pebble Time actively swaps apps in and out of the connected phone. It's a nifty trick but makes for really long loading times if the app isn't in the Pebble Time memory already
  3. It's just not as useful on the iPhone, though that's not really Pebble's fault

The ugly

  1. You really don't need a smartwatch (yet). There just isn't a killer use case
  2. They should have really made the bezzle smaller

Should you buy it?

The answer isn't straightforward.

All said and done, I'm pretty happy with the Pebble Time. It's a great gadget, though smartwatches as a whole need another iteration to become really useful, IMO.I would recommend the Pebble only if you are an early adopter who doesn't have an iPhone and doesn't think Android wear watches are worth the time. But if you're anyone else, then the Pebble Time may not be as useful for you. If you're only looking for Fitness tracking features, get a Fitbit instead. It does one thing and does it better than any tracking app for the Pebble.

If you do decide to get one after reading this, keep reading on.

Must have watchfaces

Most websites recommend way too many watchfaces. I enjoyed changing them when I had just got my Pebble watch, but I've realised that it's finally boiled down to these 4 for me:
  1. Digital watchface: 91 Dub v3.0 (link) that I use with F91-W by NIVZ as my preferred theme
    91 Dub v3.0
  2. Analog watchface: Timeface One (Analog) (link) that I use with a black background, white numbers and red watch hands

    Timeface One (Analog)
  3. Minimal watchface: Macro clock (link) that I use with a black background, white numbers and red watch hand
    Macro clock
  4. Fun watchface: Mario Time (link) which is only used to show friends what a fun watch the Pebble Time is, but is never used otherwise
    Mario Time


Must have apps

There are a ton of apps for the Pebble, but after a lot of installs and uninstalls, I realised that the only ones used are the ones that do not need much input. Games are completely out. The list below is in the order I have them on my Pebble
  1. Dialer for Pebble (link) - More feature rich than the default Pebble dialler app. Let's you remotely put the phone on speaker which is a great feature
    Dialer for Pebble
  2. Music Boss (link) - Far better than the default Music app. Music Boss lets you control your music and switch between different music apps on the phone
    Music Boss
  3. Nav Me (link) - Google maps navigation on the wrist. Excellent use for the Pebble
    Nav Me
  4. Runkeeper (link) - This isn't a Pebble app, but works with the Runkeeper app on the phone. Other running apps include Strava, Runtastic and Endomondo, but this is the one I use
    Runkeeper
  5. Gallon Challenge (link) - The best app for reminders to drink water
    Gallon Challenge
  6. Uber (link) - a.k.a. Transport, a big help if you use use the service often
    Uber
  7. Watch Trigger (link) - To be able to click a selfie from afar. Would have liked it better if it used the default camera app on the phone
    Watch Trigger
  8. Travel (link) - Should sync with Tripit, but I'm having some issues. Ronny who develops it is quick to respond though, so I'm hoping the bugs get worked out. Try Pebble Trips (link) for a more static experience and no timeline integration.
    TravelPebble Trips
  9. Misfit (link)/ Plexfit (link) - Both decent apps for fitness tracking, though I found Plex to be slightly more accurate because you can manually adjust sensitivity. Neither of them are as good as a Fitbit though, and the lack of a social angle is pretty bad (NOTE: Misfit does have a social aspect, but I don't know anyone else using one)
    MisfitPlexfit
  10. Battery+ (link) - This is never going to be a mainstay once I figure out how much battery life I get, but it's a great app for a few weeks
    Battery+


Special mention

The special mention goes out to an android app called Tablet Notifier (link) which is great for me because I have 2 phones, one for business and one personal. It mirrors notifications from my work phone to my personal phone which is connected to the Pebble Time, so that I can get notifications (or rather notification alerts) from both devices. Pushbullet used to do this far better, but notification mirroring across Android devices has been discontinued.

Thursday 26 March 2015

iPad as a 2nd monitor - now on Linux

So after I figured out how to use my iPad as a 2nd monitor on the Mac and Windows, I thought I'd write another post on how to achieve this on Linux. I used Ubuntu Linux as my Linux of choice (until of course, the new Mac) and the post details how I got it to work on Ubuntu.

This is quite a bit more complicated than the extremely easy method that works on the Mac and on Windows.

What works

Screen sharing on the iPad
Mouse, keyboard and clipboard sharing across the laptop and the iPad

What doesn’t

Drag and drop windows from one screen to the other - This does not seem possible to do between X displays

Setup

Step 1: Install the following on Ubuntu

tightvnc - Runs a VNC server on a new X display
x2x - Lets you share the mouse and keyboard across X displays
ipad_charge - Enables charging the iPad in Ubuntu
gnome-session-fallback - Enables a Gnome session in VNC as Unity doesn’t play nicely
xsel - Enables sharing of the clipboard (Credit: nerdopolis @ http://ubuntuforums.org/showthread.php?t=1431913)


Run the following commands to complete the installation.
sudo apt-get install -y tightvncserver x2x gnome-session-fallback xsel
sudo apt-get install -y build-essential libusb-1.0-0 libusb-1.0-0-dev git
git clone https://github.com/mkorenkov/ipad_charge.git
cd ./ipad_charge
make
sudo make install

Step 2: Setup a VNC Password

This provides at least basic security to your main machine, but you should be ok on a home network. You could set up an ssh connection for more security, but this make the rendering of the screen very slow
vncpasswd


Enter a password for the VNC server twice and “no” for a read only password

Step 3: Create the xstartup file

Create a file called xstartup in the $HOME/.vnc folder with the following contents
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
#Open a terminal window in the new X display. Comment the following line if unnecessary
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession

Step 4: Create a .xsession file

Create a file called .xsession in the $HOME directory with the following contents. This will enable a gnome desktop as Unity does not work over VNC
gnome-session --session=gnome-fallback

Step 5: Install and configure a VNC client on the iPad

Any VNC client will do, but I like this one. It’s free for the basic features which are enough for what we need.
Mocha VNC Lite
Use the following details in the Mocha VNC Lite configuration. The settings may be named different depending on the client you choose. The settings will also be saved, hence from the
VNC server address: As shown when you run the ipad_monitor.sh script
VNC server port: 5901
VNC password: The one you set using the vncpasswd command
Local mouse: Off

Step 6: Additional tips to be more productive

  1. Evince: Default PDF reader that works better than Acrobat reader
  2. Browsers seem to like opening on only one of the displays at a time. I ended up using Chrome on my laptop and Firefox on the VNC display
  3. Synapse: A keystroke search tool to replace Unity Dash
  4. Autohide the top panel to increase available screen real estate
  5. Add an Window Selector to the bottom panel to easily switch windows and increase the bottom size panel to 48 to make touch selection easier
  6. Add a new Gnome panel to the left with Synapse and any other frequently used applications to replace Unity Dash

Usage

Step 1: Create the 2nd screen with keyboard and mouse sharing

Download the ipad_monitor.sh file. Change it to include your network card device (Mine is wlan0 but yours may look like eth0 or eth1) and run it. Enter L (Left) or R (Right) in the command options depending on the side you have placed the iPad. The script needs to be running to enable the monitor.
./ipad_monitor.sh R

Step 2: Share the clipboard

Download the share_clip.sh file. Start a new terminal window & run it with the following command. The script needs to be running to enable clipboard sharing.
./share_clip.sh
Note: autocutsel can also achieve clipboard sharing, but it only worked from server to client for me, and not both ways. The script enables bidirectional clipboard sharing which is a lot more useful. To use autocutsel, add the command autocutsel -s PRIMARY -fork to the ~/.vnc/xstartup file

Step 3: Connect to the laptop using the VNC client

Connect to the server you saved in step 5 above. Click the “Lock” icon in the status bar a the bottom of the screen and then the upside down triangle at the bottom right of the screen to hide the status bar.

Step 4: Enjoy your ultra portable 2nd screen

That’s all. You can now interact on the iPad screen using the keyboard and mouse.


Steps summary

The below steps are for the iPad placed to the right of the laptop.
Ctrl + Alt + T
<path>/ipad_monitor.sh R
Ctrl + Shift + T
<path>/share_clip.sh
Connect from iPad using Mocha VNC. Lock the screen and minimise the status bar.

Scripts

ipad_monitor.sh

#!/bin/bash


if [ "$1" == "L" ]; then
dir="west"
pos="left"
elif [ "$1" == "R" ]; then
dir="east"
pos="right"
else
echo "Incorrect position selected. Defaulting to \"Right\""
dir="east"
pos="right"
fi
chmod +x ~/.vnc/xstartup #Just in case
vncserver -alwaysshared :1 #Start the VNC server
ipad_charge #Allow iPad charging on Linux


#Friendly print of the ip address for the iPad to connect to
INPUT=`ifconfig wlan0 | grep "inet addr"`
SUBSTRING=`echo $INPUT| cut -d' ' -f 2`
echo ""
echo "Ipad Monitor enabled to the $pos of the primary screen. Start VNC client on the iPad and connect to IP $SUBSTRING, port 5901"
echo "Press CTRL+C to disable the iPad monitor"
echo "Run the share_clip.sh script in a new terminal window to enable clipboard sharing"
####
x2x -$dir -to :1 #Share the mouse and keyboard


#Cleanup before exit
function finish {
vncserver -kill :1 #Disable the VNC server
ipad_charge --off #Disable USB charging
echo "Ipad Monitor disabled." #Display the status
}


trap finish EXIT


share_clip.sh (Credit: nerdopolis @ http://ubuntuforums.org/showthread.php?t=1431913)

#! /bin/bash
firstxserver=":0" #1st display is default X display 0
secondxserver=":1" #2nd display has been configured to be at X display 1 while starting the VNC server


#set the variables to the default
echo . | xsel --display $firstxserver -b -i
echo . | xsel --display $secondxserver -b -i
clipboard=.


while [ 1 ]
do
#get the values of the clipboard
firstdislpayclipboard=$(xsel --display $firstxserver -b -o)
seconddislpayclipboard=$(xsel --display $secondxserver -b -o)


#if the first x servers clipboad chages
if [ "$firstdislpayclipboard" != "$clipboard" ]
then


#if it doesnt change to be blank
if [ $(echo $firstdislpayclipboard | grep ^$ -c) -ne 1 ]
then
#set the appropriate variables to be the contents of the first comand
seconddislpayclipboard=$firstdislpayclipboard
clipboard=$firstdislpayclipboard
xsel --display $firstxserver -b -o | xsel --display $secondxserver -b -i
else
#if it is blank set it to be .in case if its because the x server went  down
echo . | xsel --display $firstxserver -b -i
fi


fi


#if the second x servers clipboad chages
if [ "$seconddislpayclipboard" != "$clipboard" ]
then


#if it doesnt change to be blank
if [ $(echo $seconddislpayclipboard | grep ^$ -c) -ne 1 ]
then
#set the appropriate variables to be the contents of the first comand
firstdislpayclipboard=$seconddislpayclipboard
clipboard=$seconddislpayclipboard
xsel --display $secondxserver -b -o | xsel --display $firstxserver -b -i
else
#if it is blank set it to be .in case if its because the x server went  down
echo . | xsel --display $secondxserver -b -i
fi


fi


sleep 1

done

Todo

Enable dragging of windows from the laptop to the iPad screen. This does not seem to do between X displays. It's highly unlikely that I bother figuring this out because the Mac has become my daily usage computer, but you can try out the solutions below.

Workarounds

xpra comes close to achieving sharing of windows. The only challenge is that each program that you want to run needs to be run using the commands. Also, it seems only one client can connect at a time, so it doesn’t seem possible to run multiple programs on 1 X display (100 in the example below) and keep a few windows on the laptop screen and a few on the iPad screen

To share firefox, run on the laptop
xpra start :100 --start-child=firefox

To view the firefox window, run on the laptop or the iPad
xpra attach :100

xdmx is also another program that could help

teleport is yet another program that seems to do this but I can’t understand how to use it

Wednesday 11 March 2015

iPad as a 2nd monitor

I recently got myself a Macbook Air and was blown away by it. This is my first Mac bought to replace my 7 year old workhorse laptop which has now been converted into my home media streaming server (courtesy Serviio).

In just a few days, I noticed how I've moved to using the Mac Air instead of my iPad as my goto computing device. That's when I realised that the killer feature of the Mac Air is its zero startup time - it was like having the convenience of the iPad and the functionality of a full fledged laptop.

That got me thinking that I need to repurpose the iPad and put it to some use, so I thought of making it a 2nd screen for the Mac Air. A little bit of searching the web led me to a number of solutions, some working over Wifi, some using the USB cable. However, all of them were paid solutions, and I wasn't in the mood for spending money on them, just after cleaning out my wallet on the Mac Air.

So a little more effort, and I got a perfectly workable solution, all for free.

Installation

  1. Download and install the following software on the Mac Air
    1. Syphon Virtual Screen - Creates a virtual display. Get it here.
    2. RealVNC Server - Creates a VNC server that allows remote viewing and control of the virtual display. Get it here.
  2. Install the following software on the iPad
    1. RealVNC Viewer - Allows viewing and control of the virtual display from the iPad. Get it here.

Using the virtual screen

  1. Start Syphon Virtual Screen from your applications. Enable it from the menu and set a screen resolution. Since I have an iPad 2, I've set mine to 1024x768
  2. Start VNC Server and select Options->Expert. Change the "Monitor" parameter to "1". This selects the virtual display instead of the default display

  3. Start VNC Viewer on the iPad and connect to the VNC server you just set up. You must be on the same network for this to work.
Voila! Your iPad is now a 2nd monitor for your Mac. The default configuration for this virtual monitor is to the right of the Mac screen and you can drag and drop your windows to it.

The same trick can work for any tablet or even an old laptop. All you need is a VNC client on the tablet or old laptop.

Pro tip: Download and install Spectacle on your Mac for easy keyboard shortcuts to move Windows between the monitors. Get it here.

Notes

  1. In the Syphon Virtual Screen preferences, all you need enabled is "Enable virtual device at startup"
  2. If you would like to change the location of the virtual monitor, you can do that from "System Preferences->Displays->Arrangement". Just drag and drop it wherever it's more convenient
  3. Syphon Virtual Screen does seem to make the Mac laggy, so I only recommend turning it on when you actually are using the virtual monitor
  4. If you want to have a similar setup for Windows, use Zonescreen to create a virtual monitor instead of Syphon Virtual Screen. Get it here