Search code examples
rustgtkgtk3

setup rust + gtk::Application to ignore --config argument


I am displaying a UI in a rust based application using gtk3. I am parsing the arguments in the main method for a --config argument in order to find a custom configuration file. The gtk::Application object also does some command line processing and is complaining of

Unknown option --config

How do I prevent gtk from processing the command line or exclude config from gtk command line processing?


Solution

  • gtk::Application has both a run and run_with_args command (src). If you pass an empty array into run_with_args then gtk won't have any arguments to complain about and you can parse them yourself however you like.