[Asus Padfone X and S] ngoonee:
I've had my Padfone S for a few months now but never really found the time to figure this out till I woke up early this morning.

Background, the Padfone series of phones have a tablet 'dock' which acts as an external larger screen when its plugged in. Does not appear as a dock in the android sense of the word, so the dock state for Tasker isn't useful. The HDMI state activates for a short while when plugged into the tablet but deactivates a short while later, so no use as well.

Earlier posts in Tasker's google group suggested using `dumpsys display` with grep, but that's quite ROM-specific, and besides its hard to debug without a terminal due to the sheer volume of output.

**Check Tablet mode part**

I used to just grep wm size or wm density for Override, but that had a bug.

So it turns out 'Override' simply means 'not the same as the mode I booted in'. My task failed when I rebooted as a tablet, it would give the opposite answer. The solution, after I've played around a bit, is two calls to wm size/density.

The first call is `wm size | grep "Physical size: 1920x1200" | wc -l` - I save this in %tabletboot, it has the value of 1 when booted as tablet, 0 if booted as phone.

The second call is `wm size | wc -l` - I save this as %samemode, it has the value of 1 if we're in the mode we booted in (tablet/phone) and of 2 if we're not (because there's an additional Override line).

The test is simply "If %tabletboot + %samemode is even" or is equal to 2, if you prefer. This would be true if we booted as tablet AND we're still in that mode or if we booted as phone AND we're in the opposite mode.

**GMD Gesture Control part**

The reason I wanted to do this was mainly because GMD Gesture Control could only work either in phone or tablet mode for me. Auto-detection of the touchscreen input didn't work because of course there are 2 touch screens, so for tablet mode I needed to select 'asus_dds_sis_touch' and 'HC_DEFAULT' in GMD's advanced settings while for phone mode I needed to select 'Himax-touchscreen' and 'HC_FT5X'. Of course, you may also want to have different gestures for the different screens.

First, from a Padfone perspective, you need to go to ASUS Customized Settings -> Padfone Settings -> Dynamic Display List and add GMD Gesture Control to the list not to be killed when switching modes. Tasker and any Tasker plugins which need to constantly run (such as Whatstasker) should also be here.

GMD Gesture Control puts its settings in two files (both in /data/data/com.goodmooddroid.gesturecontrol/shared_prefs) named 'GestureControl.xml' and 'gestures.xml'. You'll need to create two additional copies of these files and delete the originals. So I ended up with 'tabGestureControl.xml', 'phoneGestureControl.xml', 'tabgestures.xml', and 'phonegestures.xml'.

Now, back to Tasker. Set up a state profile based on the value of the %TABLET variable. You'll need an entry task and exit task, which are almost identical. Basically, both tasks need to do these steps in order:-

1. Delete both GestureControl.xml and gestures.xml (use Root, continue after error)

2. Symbolically link the right copy of GestureControl.xml/gestures.xml

3. Kill GMD Gesture Control using root to restart it.

4. Pause GMD Gestures (use AutoShortcut), wait 1 second, and then unpause GMD Gestures

Of course, step 2 differs in the entry/exit task, one is for tablet configuration, one is for phone. The rest are identical.

Step 1 can be done using Run Shell and calling `rm /data/data/com.goodmooddroid.gesturecontrol/shared_prefs/GestureControl.xml` or using Tasker's Delete File. Remember to delete both files.

Step 2 needs Run Shell to call `ln -s /data/data/com.goodmooddroid.gesturecontrol/shared_prefs/tabGestureControl.xml /data/data/com.goodmooddroid.gesturecontrol/shared_prefs/GestureControl.xml`. Again, remember to do this for both files.

Step 4 needs autoshortcut, so download that and use it, under Plugins.

That's about it. The same technique can be used for anything you want to change in this awesome Padfone device. Perhaps you'd want to activate an overlay or change an app's font settings. With Tasker, no limits =).