5656-s, --save <profile> save your current setup to profile <profile>
5757-l, --load <profile> load profile <profile>
5858-d, --default <profile> make profile <profile> the default profile
59+ --skip-options <option> comma separated list of xrandr arguments (e.g. "gamma")
60+ to skip both in detecting changes and applying a profile
5961--force force (re)loading of a profile
6062--fingerprint fingerprint your current hardware setup
6163--config dump your current xrandr setup
@@ -182,7 +184,12 @@ def options_with_defaults(self):
182184 if xrandr_version () >= Version ("1.2" ):
183185 options .update (self .XRANDR_12_DEFAULTS )
184186 options .update (self .options )
185- return options
187+ return { a : b for a , b in options .items () if a not in self .ignored_options }
188+
189+ @property
190+ def filtered_options (self ):
191+ "Return a dictionary of options without ignored options"
192+ return { a : b for a , b in self .options .items () if a not in self .ignored_options }
186193
187194 @property
188195 def option_vector (self ):
@@ -192,7 +199,7 @@ def option_vector(self):
192199 @property
193200 def option_string (self ):
194201 "Return the command line parameters in the configuration file format"
195- return "\n " .join ([ " " .join (option ) if option [1 ] else option [0 ] for option in chain ((("output" , self .output ),), sorted (self .options .items ()))])
202+ return "\n " .join ([ " " .join (option ) if option [1 ] else option [0 ] for option in chain ((("output" , self .output ),), sorted (self .filtered_options .items ()))])
196203
197204 @property
198205 def sort_key (self ):
@@ -212,8 +219,13 @@ def __init__(self, output, edid, options):
212219 self .output = output
213220 self .edid = edid
214221 self .options = options
222+ self .ignored_options = []
215223 self .remove_default_option_values ()
216224
225+ def set_ignored_options (self , options ):
226+ "Set a list of xrandr options that are never used (neither when comparing configurations nor when applying them)"
227+ self .ignored_options = list (options )
228+
217229 def remove_default_option_values (self ):
218230 "Remove values from the options dictionary that are superflous"
219231 if "off" in self .options and len (self .options .keys ()) > 1 :
@@ -341,7 +353,7 @@ def edid_equals(self, other):
341353 return self .edid == other .edid
342354
343355 def __eq__ (self , other ):
344- return self .edid_equals (other ) and self .output == other .output and self .options == other .options
356+ return self .edid_equals (other ) and self .output == other .output and self .filtered_options == other .filtered_options
345357
346358def xrandr_version ():
347359 "Return the version of XRandR that this system uses"
@@ -612,7 +624,7 @@ def exec_scripts(profile_path, script_name):
612624
613625def main (argv ):
614626 try :
615- options = dict (getopt .getopt (argv [1 :], "s:l:d:cfh" , [ "dry-run" , "change" , "default=" , "save=" , "load=" , "force" , "fingerprint" , "config" , "help" ])[0 ])
627+ options = dict (getopt .getopt (argv [1 :], "s:l:d:cfh" , [ "dry-run" , "change" , "default=" , "save=" , "load=" , "force" , "fingerprint" , "config" , "skip-options=" , " help" ])[0 ])
616628 except getopt .GetoptError as e :
617629 print ("Failed to parse options: {0}.\n "
618630 "Use --help to get usage information." .format (str (e )),
@@ -649,6 +661,14 @@ def main(argv):
649661 output_configuration (config , sys .stdout )
650662 sys .exit (0 )
651663
664+ if "--skip-options" in options :
665+ skip_options = [ y [2 :] if y [:2 ] == "--" else y for y in ( x .strip () for x in options ["--skip-options" ].split ("," ) ) ]
666+ for profile in profiles .values ():
667+ for output in profile ["config" ].values ():
668+ output .set_ignored_options (skip_options )
669+ for output in config .values ():
670+ output .set_ignored_options (skip_options )
671+
652672 if "-s" in options :
653673 options ["--save" ] = options ["-s" ]
654674 if "--save" in options :
0 commit comments