aboutsummaryrefslogtreecommitdiffstats
path: root/adjbacklight.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-10-12 23:58:08 +0200
committerMattias Andrée <maandree@operamail.com>2012-10-12 23:58:08 +0200
commitf1c303b27f92aa2f99751df3879125d96b94cdb1 (patch)
treef148f06ecc0f29299bd5aa1924479956f5f5e1cb /adjbacklight.py
parenttime for java (diff)
downloadadjbacklight-f1c303b27f92aa2f99751df3879125d96b94cdb1.tar.gz
adjbacklight-f1c303b27f92aa2f99751df3879125d96b94cdb1.tar.bz2
adjbacklight-f1c303b27f92aa2f99751df3879125d96b94cdb1.tar.xz
java implementation + completed
Diffstat (limited to '')
-rwxr-xr-xadjbacklight.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/adjbacklight.py b/adjbacklight.py
deleted file mode 100755
index b915114..0000000
--- a/adjbacklight.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-
-import os
-import sys
-from subprocess import Popen, PIPE
-
-
-
-'''
-Hack to enforce UTF-8 in output (in the future, if you see anypony not using utf-8 in programs by default, report them to Princess Celestia so she can banish them to the moon)
-'''
-def print(text = '', end = '\n'):
- sys.stdout.buffer.write((str(text) + end).encode('utf-8'))
-
-
-
-'''
-This is the mane class of the program
-'''
-class Adjbacklight():
- def __init__(self):
- #Popen('stty -icanon'.split(' '), stderr=os.fdopen(2, 'w')).wait()
- try:
- dir = '/sys/class/backlight/intel_backlight/'
- (size, dummy) = Popen('stty size'.split(' '), stdout=PIPE, stderr=PIPE).communicate()
- width = int(size.decode('UTF-8').replace('\n', '').split(' ')[1])
- with open(dir + 'brightness', 'r') as file:
- current = int(file.readline().replace('\n', ''))
- with open(dir + 'max_brightness', 'r') as file:
- max = int(file.readline().replace('\n', ''))
- self.__interface(0, current, max, width, dir + 'brightness')
- finally:
- pass#Popen('stty icanon'.split(' '), stderr=os.fdopen(2, 'w')).wait()
-
- def __interface(self, min, cur, max, width, file):
- step = (max - min) // 100
- while (True):
- print(sys.stdin.buffer.read1())
-
-
-
-'''
-Start the program from Adjbacklight.__init__ if this is the executed file
-'''
-if __name__ == '__main__':
- Adjbacklight()