Skip to content

Commit

Permalink
experimenting command line feature
Browse files Browse the repository at this point in the history
  • Loading branch information
RajSolai committed Jun 22, 2023
1 parent 658a1c2 commit 526e0ab
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,25 @@ public class Application : Gtk.Application {
}

public static int main (string[] args) {
var tesseract_trigger = new TesseractTrigger ();
bool takeScreenshot = processArguments (args);
var app = new Application ();
return app.run (args);
if (!takeScreenshot) {
// Run the UI
return app.run ();
}
// Run the screenshot
tesseract_trigger.perform_operation (null,'screenshot');
return 0;
}

private static bool processArguments (string[] args) {
bool takeScreenshot = false;
foreach (string arg in args) {
if (arg == "--screenshot") {
takeScreenshot = true;
}
}
return takeScreenshot;
}
}

0 comments on commit 526e0ab

Please sign in to comment.