-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
773 additions
and
733 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
VERSION = 0.1.0 | ||
NAME = yoga-spin | ||
|
||
BASE_DIR = build | ||
INSTALL_PATH=$(BASE_DIR)/$(NAME)_$(VERSION)_all | ||
|
||
DEBIAN_DIR = $(INSTALL_PATH)/DEBIAN | ||
DEBIAN_CONTROL = control | ||
DEBIAN_SCRIPTS = \ | ||
postinst \ | ||
postrm | ||
|
||
BIN_DIR = $(INSTALL_PATH)/usr/bin | ||
BIN = spin.py | ||
|
||
ICONS_DIR = $(INSTALL_PATH)/usr/share/icons/hicolor/scalable/apps | ||
ICONS = \ | ||
yoga-spin-lock.svg \ | ||
yoga-spin-mode.svg | ||
|
||
APPS_DIR = $(INSTALL_PATH)/usr/share/applications | ||
APPS = \ | ||
yoga-spin-lock.desktop \ | ||
yoga-spin-mode.desktop | ||
|
||
all: | ||
|
||
install: | ||
install -d $(INSTALL_PATH) | ||
install -d $(DEBIAN_DIR) | ||
install -m 644 $(addprefix package/DEBIAN/,$(DEBIAN_CONTROL)) $(DEBIAN_DIR) | ||
install -m 755 $(addprefix package/DEBIAN/,$(DEBIAN_SCRIPTS)) $(DEBIAN_DIR) | ||
install -d $(ICONS_DIR) | ||
install -m 644 $(addprefix package/icons/,$(ICONS)) $(ICONS_DIR) | ||
install -d $(APPS_DIR) | ||
install -m 644 $(addprefix package/applications/,$(APPS)) $(APPS_DIR) | ||
install -d $(BIN_DIR) | ||
install -m 755 $(BIN) $(BIN_DIR) | ||
dpkg-deb -b $(INSTALL_PATH) | ||
|
||
clean: | ||
rm -rf $(INSTALL_PATH) | ||
rm $(INSTALL_PATH).deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,103 @@ | ||
# spin | ||
|
||
a small utility to assist in setting usage modes of laptop-tablet devices | ||
a small utily for toggling between laptop and tablet mode. | ||
|
||
It includes the following features | ||
- Palm rejection when using the Wacom stylus | ||
- Disabling of the trackpad and nipple, when set to tablet mode | ||
- Automatically orient the display, wacom sensor and touch screen sensor when in tablet mode | ||
- Rotation locking, either using the rotate lock key, command line or on screen icon | ||
- Currently swtiching between tablet and laptop mode needs to be done manually, as I'm not able to get the information I need for the display position sensor | ||
|
||
This is a fork of wdbm/spin | ||
|
||
|
||
## prerequisites | ||
|
||
```Bash | ||
sudo apt-get -y install python-docopt | ||
sudo apt-get -y install python-qt4 | ||
``` | ||
|
||
## Building and installation | ||
|
||
This tool is set up to build a Debian package for easy installation. Simply run. | ||
|
||
```Bash | ||
make install | ||
``` | ||
|
||
You'll find the .deb file in the build folder, and can install it like you would any .deb package. | ||
|
||
```Bash | ||
sudo dpkg -i build/yoga-spin_0.1.0_all.deb | ||
``` | ||
|
||
I'll be making a prebuild .deb package available shortly. | ||
|
||
## quick start | ||
|
||
This utility can be run in its default graphical mode or in a non-graphical mode. The graphical mode is engaged by running | ||
If run without any parameters, this tool does nothing. To start it run: | ||
|
||
```Bash | ||
spin.py | ||
spin.py --daemon | ||
``` | ||
|
||
while the non-graphical mode is engaged by using the option ```--nogui```: | ||
This will run a process that listens for sensors and commands, and adjusts the display appropriately. It will activate palm rejection when the pen is in use, auto rotate the screen when in tablet mode and more. | ||
|
||
You can add this command to your startup applications, if you want it to run every time you log in. | ||
|
||
Once you have the daemon running, you can send it two commands: | ||
|
||
```Bash | ||
spin.py --nogui | ||
spin.py --mode | ||
``` | ||
|
||
This tells it to toggle between Tablet and Laptop mode. The tool always starts in laptop mode. | ||
|
||
When in Tablet mode, it will use the accelorometer to adjust the screens orientation. You can lock this, using the rotation lock key on the side of the laptop, or using: | ||
|
||
```Bash | ||
spin.py --lock | ||
``` | ||
|
||
This toggles the display rotation lock when in Tablet mode. You can also use the rotate lock key on the side of the computer. Note that this key also transmits the Super-o keys, which in turn opens up the Unity launcher. A workaround for this, is to assign Super-o to an empty keyboard shortcut in the System Preferences. | ||
|
||
In addition there are two applications launchers, which can be found in /usr/share/applications/Yoga Spin - *, that can run these commands. You can drag these to the Unity launcher, to quickly toggle between modes. | ||
|
||
For debugging, you can run spin.py with different log levels, for more info, see: | ||
|
||
```Bash | ||
spin.py --help | ||
``` | ||
|
||
By default, this utility disables the touchscreen on detecting the stylus in proximity and it changes between the laptop and tablet modes on detecting toggling between the laptop and tablet usage configurations. These default behaviours are provided by both the graphical and non-graphical modes of this utility. This utility should be initiated in the laptop usage configuration. | ||
|
||
## compatibility | ||
|
||
This utility has been tested on the following operating systems: | ||
|
||
- Ubuntu 14.10 | ||
- Ubuntu 15.04 | ||
- Ubuntu 15.10 | ||
|
||
This utility has been tested on the following computer models: | ||
|
||
- ThinkPad S1 Yoga | ||
- ThinkPad S120 Yoga | ||
|
||
It should work on the ThinkPad S1 Yoga, but I've not tested this fork with it. | ||
|
||
There is evidence that it does not run with full functionality on the ThinkPad Yoga 14. | ||
|
||
## acceleration control | ||
|
||
There is an experimental acceleration control included which is deactivated by default. It can be activated by selecting the appropriate button in the graphical mode. Use it with caution because it can result in distortion of the display, including display blackout. | ||
## about this fork | ||
|
||
This is a fork of wdbm/spin. Everything should be working properly with my Thinkpad Yoga 12 2nd Gen machine under Ubuntu 15.10. There are some major changes from the wdbm/spin version, including: | ||
|
||
- Removed the GUI. | ||
- Improved the handling of the accelerometer using vector math, so it detects the correct orientation. | ||
- Moved all changes to the screen rotation to the main process, and use messaging from the subprocesses to tell the main process what to do. | ||
- Added support for the rotation lock key on the side of the ThinkPad Yoga 12. | ||
- It now waits for the touchscreen to be ready, before attempting to rotate it. | ||
- Added packaging of the tool into Debian package (.deb) file. | ||
|
||
## future | ||
Known issues: | ||
|
||
Under consideration is state recording in order to avoid execution of unnecessary commands, better handling of subprocesses, clearer logging and a more ergonomic graphical mode. | ||
- I've yet to get the display position detector to differentiate when going from tent mode, to tablet or laptop mode, so am currently unable to use it to automatically switch between tablet and laptop modes. It's not ideal, and I've posted about this upstream to the systemd folks, so hopefully we'll have this fully automated some day. If anyone has a solution to this, I would love to hear from you. | ||
- There is some issue with Wacom calibration getting worse each time you calibrate. I've included some code in spin.py that resets the calibration each time the screen is rotated, but this is not ideal. I need to figure out exactly what is going on here. It may be related to the screen reporting the wrong PPI in Gimp (96x96 on Linux and 144x144 on Windows, correct I believe is 177x177), so if the calibration tool may be getting the incorrect screen size or ppi. This is not really related to this tool, but needs to be fixed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Package: yoga-spin | ||
Version: 0.1.0 | ||
Architecture: all | ||
Maintainer: Ragnar Brynjulfsson <[email protected]> | ||
Installed-Size: 128 | ||
Section: misc | ||
Depends: python-qt4, python-numpy, xinput, x11-xserver-utils, xserver-xorg-input-wacom | ||
Priority: extra | ||
Description: Tool for swapping between Tablet and Laptop modes on ThinkPad Yoga 12 | ||
This tool runs in the background, and can be sent commands to flip between Laptop | ||
and Tablet mode. In Tablet mode it uses the motion sensor in the machine to orient | ||
the display. | ||
. | ||
In addition it includes support for palm rejection when using the Wacom pen. | ||
. | ||
Forked from spin.py from https://github.com/wdbm/spin | ||
Homepage: http://ragnarb.com/thinkpad-yoga-12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
gtk-update-icon-cache /usr/share/icons/hicolor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
gtk-update-icon-cache /usr/share/icons/hicolor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Desktop Entry] | ||
Name=Yoga Spin - Toggle Rotation Lock | ||
Exec=spin.py --rotatelock | ||
Terminal=false | ||
Type=Application | ||
Icon=yoga-spin-lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Desktop Entry] | ||
Name=Yoga Spin - Toggle Mode | ||
Exec=spin.py --mode | ||
Terminal=false | ||
Type=Application | ||
Icon=yoga-spin-mode |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.