aboutsummaryrefslogtreecommitdiffstats
path: root/.i3/py3status/30-touchpad.py
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@gmail.com>2016-01-06 15:11:44 +0800
committerAaron LI <aaronly.me@gmail.com>2016-01-06 15:11:44 +0800
commitdba767e8ff1599a0b4cf8fb3dc06ac0cce727748 (patch)
tree1c85bbf6409e1cb398da0dcb4cd5ad8a78644354 /.i3/py3status/30-touchpad.py
parentc07a9bd96fde28c0f672af8d1b4d345c2e34f1b3 (diff)
downloaddotfiles-dba767e8ff1599a0b4cf8fb3dc06ac0cce727748.tar.bz2
i3: update configuration for i3wm
* Update i3 wm config * Add i3blocks.conf * Remove py3status
Diffstat (limited to '.i3/py3status/30-touchpad.py')
-rw-r--r--.i3/py3status/30-touchpad.py86
1 files changed, 0 insertions, 86 deletions
diff --git a/.i3/py3status/30-touchpad.py b/.i3/py3status/30-touchpad.py
deleted file mode 100644
index 195d6b1..0000000
--- a/.i3/py3status/30-touchpad.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# Weitian LI <liweitianux@gmail.com>
-# 2014/05/15
-
-"""
-touchpad module for py3status
-"""
-
-## Get output of shell command:
-## python 3.x:
-## >>> subprocess.getoutput(cmd)
-## >>> subprocess.getstatusoutput(cmd)
-## python 2.7.x:
-## >>> subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE)
-
-import os
-import re
-import subprocess
-
-
-POSITION = 0
-
-
-class Py3status:
- """
- Touchpad module to show the status of touchpad.
-
- Click events:
- left button: enable touchpad
- middle button: toggle touchpad
- """
-
- def __init__(self):
- """
- get touchpad status
- """
- cmd = 'synclient -l | grep -c "TouchpadOff.*=.*0"'
- touchpad_status = subprocess.getoutput(cmd)
- if int(touchpad_status) == 1:
- self.status = 'on'
- else:
- self.status = 'off'
-
- def touchpad(self, i3status_output_json, i3status_config):
- """
- Display touchpad status.
- """
- #prompt = '' # Icons: uF10A (ipad)
- prompt = '' # Icons: uF3E3 (palm)
- response = {
- 'full_text': '',
- 'name': 'touchpad',
- 'instance': 'first',
- }
- if self.status == 'on':
- response['color'] = i3status_config['color_good']
- status_text = '' # Icons: uF00C (check)
- else:
- response['color'] = i3status_config['color_bad']
- status_text = '' # Icons: uF00D (cross)
- response['full_text'] = '{0} {1}'.format(prompt, status_text)
- return (POSITION, response)
-
- def on_click(self, i3status_output_json, i3status_config, event):
- """
- Handle click events.
- """
- if event['button'] == 1:
- # left button click
- cmd = 'synclient TouchpadOff=0'
- cmd_output = subprocess.getoutput(cmd)
- self.status = 'on'
- elif event['button'] == 2:
- # middle button click
- if self.status == 'on':
- cmd = 'synclient TouchpadOff=1'
- self.status = 'off'
- else:
- cmd = 'synclient TouchpadOff=0'
- self.status = 'on'
- cmd_output = subprocess.getoutput(cmd)
- #
- os.system('killall -USR1 py3status')
-