Explorar el Código

Strip regexp match

Andrew Swistak hace 11 años
padre
commit
8ef717a34b
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      bin/toggle_external_display.rb

+ 2 - 2
bin/toggle_external_display.rb

@@ -33,9 +33,9 @@ def enable_multihead(external_monitor, resolution, side)
 end
 
 if xrandr =~ /((HDMI|[^e]DP)(\d*)) (dis)?connected \d+x\d+/
-  disable_monitor($1)
+  disable_monitor($1.strip)
 elsif xrandr =~ /((HDMI|[^e]DP)(\d*)) connected/
-  ext_mon = $1
+  ext_mon = $1.strip
   resolutions = xrandr.sub(/.*#{ext_mon}.*?\n/m, '').scan(/\d{1,4}x\d{1,4}.*?(?=\s)/)
   resolutions = resolutions.sort_by { |res| x, y = res.split(/[^\d]/).map(&:to_f); -x*y }