[formatting] reformat using "black -t py34"
getting rid of thinking about consistent formatting...
This commit is contained in:
parent
fa98bcbdd1
commit
30c1f712a6
119 changed files with 3961 additions and 3495 deletions
|
@ -7,34 +7,48 @@ import glob
|
|||
import socket
|
||||
|
||||
button = {
|
||||
'left-mouse': 1,
|
||||
'middle-mouse': 2,
|
||||
'right-mouse': 3,
|
||||
'wheel-up': 4,
|
||||
'wheel-down': 5,
|
||||
"left-mouse": 1,
|
||||
"middle-mouse": 2,
|
||||
"right-mouse": 3,
|
||||
"wheel-up": 4,
|
||||
"wheel-down": 5,
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='send commands to bumblebee-status')
|
||||
parser.add_argument('-b', '--button', choices=['left-mouse', 'right-mouse', 'middle-mouse', 'wheel-up', 'wheel-down'], help='button to emulate', default='left-mouse')
|
||||
parser.add_argument('-i', '--id', help='ID of widget to trigger')
|
||||
parser.add_argument('-m', '--module', help='name of the module to trigger', required=True)
|
||||
parser = argparse.ArgumentParser(description="send commands to bumblebee-status")
|
||||
parser.add_argument(
|
||||
"-b",
|
||||
"--button",
|
||||
choices=["left-mouse", "right-mouse", "middle-mouse", "wheel-up", "wheel-down"],
|
||||
help="button to emulate",
|
||||
default="left-mouse",
|
||||
)
|
||||
parser.add_argument("-i", "--id", help="ID of widget to trigger")
|
||||
parser.add_argument(
|
||||
"-m", "--module", help="name of the module to trigger", required=True
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
for f in glob.glob('/tmp/.bumblebee-status.*'):
|
||||
for f in glob.glob("/tmp/.bumblebee-status.*"):
|
||||
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
try:
|
||||
s.connect(f)
|
||||
s.sendall(json.dumps({
|
||||
'name': args.module,
|
||||
'instance': args.id,
|
||||
'button': button[args.button],
|
||||
}).encode('ascii'))
|
||||
s.sendall(
|
||||
json.dumps(
|
||||
{
|
||||
"name": args.module,
|
||||
"instance": args.id,
|
||||
"button": button[args.button],
|
||||
}
|
||||
).encode("ascii")
|
||||
)
|
||||
except Exception as e:
|
||||
os.remove(f)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue