]> git.mar77i.info Git - zenbook_conf/commitdiff
xinput: specify imports from subrocess master
authormar77i <mar77i@protonmail.ch>
Fri, 27 Dec 2024 11:20:49 +0000 (12:20 +0100)
committermar77i <mar77i@protonmail.ch>
Fri, 27 Dec 2024 11:20:49 +0000 (12:20 +0100)
xinput.py

index 5c6f4ef4e4bd9b516f67db31ccdf7b168a4abaad..0dc586a0b279b662ebd8d3f24c364ac770627d93 100644 (file)
--- a/xinput.py
+++ b/xinput.py
@@ -1,6 +1,6 @@
 import os
 import re
 import os
 import re
-import subprocess
+from subprocess import DEVNULL, check_output, run
 
 
 class XinputConf:
 
 
 class XinputConf:
@@ -49,7 +49,7 @@ class XinputConf:
         self.conf = self.get_conf()
 
     def get_conf(self):
         self.conf = self.get_conf()
 
     def get_conf(self):
-        output = subprocess.check_output(["xinput", "list"], text=True)
+        output = check_output(["xinput", "list"], text=True)
         devices = []
         for line in output.split(os.linesep):
             match = self.DEVICE_PATTERN.match(line)
         devices = []
         for line in output.split(os.linesep):
             match = self.DEVICE_PATTERN.match(line)
@@ -72,13 +72,13 @@ class XinputConf:
         if enable is None:
             enable = device["enabled"]
         if enable:
         if enable is None:
             enable = device["enabled"]
         if enable:
-            subprocess.run(["xinput", "enable", device["id"]])
-            subprocess.run(
+            run(["xinput", "enable", device["id"]])
+            run(
                 ["xinput", "map-to-output", device["id"], device["output"]],
                 ["xinput", "map-to-output", device["id"], device["output"]],
-                stderr=subprocess.DEVNULL if device.get("ignore_result") else None,
+                stderr=DEVNULL if device.get("ignore_result") else None,
             )
         else:
             )
         else:
-            subprocess.run(["xinput", "disable", device["id"]])
+            run(["xinput", "disable", device["id"]])
         self.conf = self.get_conf()
 
     def update(self, mode):
         self.conf = self.get_conf()
 
     def update(self, mode):