Passing multiple ApplicationFlags to Adw.Application with PyGObject

Hello!

I am using Adw.Application with PyGOject and I want to pass multiple ApplicationFlags to my application. But whatever I try, this does not seem to be supported. Mainly I want to pass “Gio.ApplicationFlags.HANDLES_OPEN” to let my app open files and “Gio.ApplicationFlags.HANDLES_COMMAND_LINE” so I can enable the “–file” argument for passing the files on the command line or possibly even something else in the future. So how can I initialize and application instance and pass multiple ApplicationFlags?

Thanks in advance!

You’ll need to bitwise OR them, which in Python syntax is:

Gio.ApplicationFlags.HANDLES_OPEN | Gio.ApplicationFlags.HANDLES_COMMAND_LINE

Note that file opening from the CLI should already work with a positional argument when you only have Gio.ApplicationFlags.HANDLES_OPEN.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.