Skip to content

Commit

Permalink
Merge branch 'release/4.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-ueding committed Oct 16, 2015
2 parents f455757 + fff6fd8 commit c1d9aac
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
Changelog
#########

v4.7.0
Released: 2015-10-16 10:10:16 +0200

- Add configuration option to disable the rotate and dock hook
individually.
- In cases where ``/dev/log`` does not exist, it will use standard UDP to
connect to the log.

v4.6.0
Released: 2015-10-15 20:30:31 +0200

Expand Down
10 changes: 7 additions & 3 deletions doc/man/thinkpad-dock.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ hierarchical, I will denote the options with a dot. The first one would be

Those are the possible options:

``gui.kdialog``
Please see the appropriate section in thinkpad-rotate(1), it has the same
option. *Default:*.

``hooks.postdock``
Full path to postdock hook. *Default: ~/.config/thinkpad-scripts/hooks/postdock*

Expand Down Expand Up @@ -160,9 +164,9 @@ Those are the possible options:
``sound.undock_loudness``
Volume to set to when undocking. *Default: 50%*.

``gui.kdialog``
Please see the appropriate section in thinkpad-rotate(1), it has the same
option. *Default:*.
``trigger.enable_dock``
Sets whether the docking should be executed by the hardware trigger.
*Default: true*.

Hooks
-----
Expand Down
4 changes: 4 additions & 0 deletions doc/man/thinkpad-rotate.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ You can set the following option:
``screen.internal``
The ``xrandr`` name for the internal monitor. *Default: LVDS1*

``trigger.enable_rotate``
Sets whether the rotation should be executed by the hardware trigger.
*Default: true*.

``touch.regex``
Regular expression to match Wacom devices against. If your devices do not
start with ``Wacom ISD``, change this appropriately.
Expand Down
6 changes: 5 additions & 1 deletion tps/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ def set_up_logging(verbosity):
logging.basicConfig(level=console_log_level, format=console_format)

if config['logging'].getboolean('syslog'):
syslog = logging.handlers.SysLogHandler(address='/dev/log')
kwargs = {}
dev_log = '/dev/log'
if os.path.exists(dev_log):
kwargs['address'] = dev_log
syslog = logging.handlers.SysLogHandler(**kwargs)
syslog.setLevel(logging.DEBUG)
formatter = logging.Formatter(syslog_format)
syslog.setFormatter(formatter)
Expand Down
4 changes: 4 additions & 0 deletions tps/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ dock_loudness = 100%
undock_loudness = 50%
unmute = true

[trigger]
enable_dock = true
enable_rotate = true

[touch]
regex = Wacom ISD.*id=(\d+)

Expand Down
6 changes: 6 additions & 0 deletions tps/dock.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ def main():
'''
options = _parse_args()
config = tps.config.get_config()

# Quickly abort if the call is by the hook and the user disabled the trigger.
if options.via_hook and not config['trigger'].getboolean('enable_dock'):
sys.exit(0)

if options.state == 'on':
desired = True
elif options.state == 'off':
Expand Down Expand Up @@ -242,6 +247,7 @@ def _parse_args():
parser.add_argument("-v", dest='verbose', action="count",
help='Enable verbose output. Can be supplied multiple '
'times for even more verbosity.')
parser.add_argument('--via-hook', action='store_true', help='Let the program know that it was called using the hook. This will then enable some workarounds. You do not need to care about this.')

options = parser.parse_args()

Expand Down
2 changes: 1 addition & 1 deletion tps/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,5 @@ def main_dock_hook():
tps.check_call([
'sudo', '-u', get_graphicsl_user(), '-i',
'env', 'DISPLAY=:0.0',
'/usr/bin/thinkpad-dock', options.action
'/usr/bin/thinkpad-dock', options.action, '--via-hook'
], logger)
5 changes: 4 additions & 1 deletion tps/rotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ def main():
'''
options = _parse_args()


config = tps.config.get_config()

# Quickly abort if the call is by the hook and the user disabled the trigger.
if options.via_hook and not config['trigger'].getboolean('enable_rotate'):
sys.exit(0)

if options.via_hook:
xrandr_bug_fail_early(config)

Expand Down

0 comments on commit c1d9aac

Please sign in to comment.