X-Git-Url: https://git.ralfj.de/lilass.git/blobdiff_plain/381dd16b7011170fac8413d93f0d175ef2f22c7a..06344a9d0c2cbd40023d1db4ab966c0577234049:/lilass?ds=sidebyside diff --git a/lilass b/lilass index 42c15c6..5dfd19a 100755 --- a/lilass +++ b/lilass @@ -112,7 +112,7 @@ if __name__ == "__main__": dest="internal_only", action='store_true', help="Enable internal screen, disable all the others.") parser.add_argument("-s", "--show", - dest="show", choices=ShowLevels.getNames(), + dest="show", choices=ShowLevels.getNames(), default=ShowLevels.ONEXTERNAL.text, help="In which situations should the UI be displayed?") cmdArgs = parser.parse_args() @@ -163,11 +163,21 @@ if __name__ == "__main__": else: setup = screen.ScreenSetup(intResolution = situation.internalResolutions()[0], extResolution = situation.externalResolutions()[0], relPosition = relPos) else: - # ask the user - setup = frontend.setup(situation) - if setup is None: sys.exit(1) # the user canceled - with database.Database(databaseFilePath) as db: - situation.putDBInfo(db, setup) + showlvl = ShowLevels(cmdArgs.show) + if showlvl != ShowLevels.ONEXTERNAL and situation.lastSetup: + # use last config + setup = situation.lastSetup + elif showlvl == ShowLevels.ONERROR: + # guess config + setup = screen.ScreenSetup(situation.internalResolutions()[0], situation.externalResolutions()[0], screen.RelativeScreenPosition.RIGHT) + # TODO make default relative position configurable in the config file + # TODO this has a bit of code duplication with the cmdArgs method above + else: + # ask the user + setup = frontend.setup(situation) + if setup is None: sys.exit(1) # the user canceled + with database.Database(databaseFilePath) as db: + situation.putDBInfo(db, setup) else: # use first resolution of internal connector setup = screen.ScreenSetup(intResolution = situation.internalConnector.getResolutionList()[0], extResolution = None)