summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-09-07 22:08:22 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-09-07 22:08:22 +0300
commitc10fc7a058c05edcedeb23bdcc9faae635f1780d (patch)
tree1bf4177116c12ebfa1275cf2406305c08b8f868b
parentdf8e4076903831fee5275ee803f874d21db7c703 (diff)
App: Added options -w, -h for window sizing
-rw-r--r--res/arg-help.txt2
-rw-r--r--src/app.c12
-rw-r--r--src/app.h2
3 files changed, 16 insertions, 0 deletions
diff --git a/res/arg-help.txt b/res/arg-help.txt
index 9f6548f2..bf6e7e97 100644
--- a/res/arg-help.txt
+++ b/res/arg-help.txt
@@ -6,6 +6,7 @@ separate tabs.
6General options: 6General options:
7 7
8 -E, --echo Print all internal app events to stdout. 8 -E, --echo Print all internal app events to stdout.
9 -h, --height N Set initial window height to N pixels.
9 --help Print these instructions. 10 --help Print these instructions.
10 --sw Disable hardware accelerated rendering. 11 --sw Disable hardware accelerated rendering.
11 -u, --url-or-search URL | text 12 -u, --url-or-search URL | text
@@ -13,6 +14,7 @@ General options:
13 This only works if the search query URL has been 14 This only works if the search query URL has been
14 configured. 15 configured.
15 -V, --version Print the application version. 16 -V, --version Print the application version.
17 -w, --width N Set initial window width to N pixels.
16 18
17Options that control a running instance of Lagrange: 19Options that control a running instance of Lagrange:
18 20
diff --git a/src/app.c b/src/app.c
index 9ff8ebc8..fa8cc105 100644
--- a/src/app.c
+++ b/src/app.c
@@ -668,6 +668,8 @@ static void init_App_(iApp *d, int argc, char **argv) {
668 defineValues_CommandLine(&d->args, "help", 0); 668 defineValues_CommandLine(&d->args, "help", 0);
669 defineValues_CommandLine(&d->args, listTabUrls_CommandLineOption, 0); 669 defineValues_CommandLine(&d->args, listTabUrls_CommandLineOption, 0);
670 defineValues_CommandLine(&d->args, openUrlOrSearch_CommandLineOption, 1); 670 defineValues_CommandLine(&d->args, openUrlOrSearch_CommandLineOption, 1);
671 defineValues_CommandLine(&d->args, windowWidth_CommandLineOption, 1);
672 defineValues_CommandLine(&d->args, windowHeight_CommandLineOption, 1);
671 defineValuesN_CommandLine(&d->args, "new-tab", 0, 1); 673 defineValuesN_CommandLine(&d->args, "new-tab", 0, 1);
672 defineValues_CommandLine(&d->args, "tab-url", 0); 674 defineValues_CommandLine(&d->args, "tab-url", 0);
673 defineValues_CommandLine(&d->args, "sw", 0); 675 defineValues_CommandLine(&d->args, "sw", 0);
@@ -787,6 +789,16 @@ static void init_App_(iApp *d, int argc, char **argv) {
787 setThemePalette_Color(d->prefs.theme); /* default UI colors */ 789 setThemePalette_Color(d->prefs.theme); /* default UI colors */
788 loadPrefs_App_(d); 790 loadPrefs_App_(d);
789 load_Keys(dataDir_App_()); 791 load_Keys(dataDir_App_());
792 /* See if the user wants to override the window size. */ {
793 iCommandLineArg *arg = iClob(checkArgument_CommandLine(&d->args, windowWidth_CommandLineOption));
794 if (arg) {
795 d->initialWindowRect.size.x = toInt_String(value_CommandLineArg(arg, 0));
796 }
797 arg = iClob(checkArgument_CommandLine(&d->args, windowHeight_CommandLineOption));
798 if (arg) {
799 d->initialWindowRect.size.y = toInt_String(value_CommandLineArg(arg, 0));
800 }
801 }
790 d->window = new_Window(d->initialWindowRect); 802 d->window = new_Window(d->initialWindowRect);
791 load_Visited(d->visited, dataDir_App_()); 803 load_Visited(d->visited, dataDir_App_());
792 load_Bookmarks(d->bookmarks, dataDir_App_()); 804 load_Bookmarks(d->bookmarks, dataDir_App_());
diff --git a/src/app.h b/src/app.h
index 55bec5a6..08589000 100644
--- a/src/app.h
+++ b/src/app.h
@@ -44,6 +44,8 @@ iDeclareType(Window)
44/* Command line options strings. */ 44/* Command line options strings. */
45#define listTabUrls_CommandLineOption "list-tab-urls;L" 45#define listTabUrls_CommandLineOption "list-tab-urls;L"
46#define openUrlOrSearch_CommandLineOption "url-or-search;u" 46#define openUrlOrSearch_CommandLineOption "url-or-search;u"
47#define windowWidth_CommandLineOption "width;w"
48#define windowHeight_CommandLineOption "height;h"
47 49
48enum iAppDeviceType { 50enum iAppDeviceType {
49 desktop_AppDeviceType, 51 desktop_AppDeviceType,