소스 검색

added flag --disabled to show disabled only

Fabian Peter Hammerle 7 년 전
부모
커밋
7885a55af0
2개의 변경된 파일16개의 추가작업 그리고 7개의 파일을 삭제
  1. 8 4
      README.md
  2. 8 3
      scripts/xrandrl

+ 8 - 4
README.md

@@ -9,6 +9,14 @@ sudo apt-get install python3 libx11-dev libxrandr-dev
 ## Examples
 
 ```{sh}
+$ xrandrl --connected
+eDP2
+DP2-1
+DP2-2
+
+$ xrandrl --connected --disabled
+DP2-1
+
 $ xrandrl
 eDP2
 DP1
@@ -22,8 +30,4 @@ VGA1
 VIRTUAL1
 eDP-1-1
 DVI-D-1-1
-$ xrandrl --connected
-eDP2
-DP2-1
-DP2-2
 ```

+ 8 - 3
scripts/xrandrl

@@ -2,7 +2,6 @@
 # PYTHON_ARGCOMPLETE_OK
 
 """
-sudo apt-get install libx11-dev libxrandr-dev
 https://cgit.freedesktop.org/xorg/app/xrandr/tree/xrandr.c
 """
 
@@ -133,10 +132,11 @@ def get_xrandr_output_infos(xdisplay):
             for o in range(screen_resrcs.contents.noutput)]
 
 
-def process(connected):
+def process(connected, disabled):
     xdisplay = X11.XOpenDisplay(None)
     for output_info in get_xrandr_output_infos(xdisplay):
-        if not connected or output_info.contents.connection == RR_Connected:
+        if ((not connected or output_info.contents.connection == RR_Connected)
+                and (not disabled or output_info.contents.crtc == 0)):
             output_name = output_info.contents.name \
                 .decode(sys.getfilesystemencoding())
             print(output_name)
@@ -151,6 +151,11 @@ def _init_argparser():
         action='store_true',
         help='connected only',
     )
+    argparser.add_argument(
+        '--disabled',
+        action='store_true',
+        help='disabled only (does not imply --connected)',
+    )
     return argparser