Browse Source

Add --session and --pick-session

-s,--session replaces --browser.session
--pick-session shows the SessionDialog instead of creating a session on
startup
Aqua-sama 2 weeks ago
parent
commit
e4402ac5ca
Signed by: Aqua-sama <aqua@iserlohn-fortress.net> GPG Key ID: 5378B8349C1D5ADA

+ 8
- 2
doc/Usage/CommandLine.asciidoc View File

@@ -1,8 +1,14 @@
1 1
 == Command-line Options
2 2
 
3 3
 === General
4
-* `-h`, `--help`: Display this help.
4
+* `-h`, `--help`: Display command-line options list..
5 5
 * `-v`, `--version`: Display version information.
6
-* `--build`: Display build branch and commit.
6
+* `--build`: Display build commit.
7
+
8
+=== Configuration
7 9
 * `-c`, `--config`: Set configuration file.
8 10
 * `--no-remote`: Don't check for other instances when starting.
11
+
12
+=== Sessions
13
+* `-s, --session`: Open the selected session.
14
+* `--pick-session`: Open all available sessions and select which one to open.

+ 12
- 54
doc/Usage/Configuration.asciidoc View File

@@ -1,56 +1,14 @@
1 1
 == Configuration
2 2
 
3
-The Configuration is loaded from .config/smolbote/smolbote.cfg. Most
4
-settings are only loaded on launch.
5
-
6
-For a full list of settings, check '--help'.
7
-
8
-You can overwrite options at runtime using the option path as a command line
9
-parameter.
10
-
11
-- Browser (group: browser)
12
-
13
-- Main Window (group: mainwindow)
14
-A main window contains one or more subwindows.
15
-
16
-- Subwindow (group: window)
17
-A subwindow contains multiple tabs and functions similarly to a tab group.
18
-
19
-- Navigation bar (group: navigation)
20
-The navigation bar is the toolbar that holds the history, reload and home 
21
-buttons, as well as the address bar. It can be made movable through the
22
-navigation.movable option.
23
-
24
-- Address bar (group: addressbar)
25
-
26
-- Filter (group: filter)
27
-
28
-- Plugins (group: plugins)
29
-Plugins a way of extending smolbote's functionality using the Qt plugin system.
30
-They are not to be confused with NPAPI/PPAPI or WebExtension plugins.
31
-
32
-To enable a plugin either copy it or symlink it in the plugins.path location,
33
-or set its absolute path as the plugins.path.
34
-
35
-- Profiles (group: profile)
36
-A Profile is a collection of settings, policies, scripts, cookies, cache and
37
-history. Profiles can be used to isolate pages from each other.
38
-
39
-Each window has a default profile it uses when opening new tabs. This can be
40
-set by the profile.default option, and can be changed from the window's menu.
41
-Additionally, tabs can have their profiles individually changed from their page
42
-menu.
43
-
44
-Because profiles store all their data separately, you can log in into the same
45
-site with a different account from each profile. However, links opened into new
46
-tabs will still use the subwindow's default profile. For example, you can set a
47
-profile to hold login information for a site, but all new tabs opened from that
48
-site would still be using the default off-the-record profile.
49
-
50
-Profile definitions are stored in the profiles.path location. To create a new
51
-profile, create a profile-id.profile file in that location.
52
-
53
-- Bookmarks (group: bookmarks)
54
-
55
-- Downloads (group: downloads)
56
-
3
+The Configuration is loaded from the path specified by `--config`, by default
4
+_~/.config/smolbote/smolbote.cfg_.
5
+
6
+You can set the value of configuration options using its name in a key=value
7
+pair, for example:
8
+[source, ini]
9
+----
10
+mainwindow.height=600
11
+----
12
+For a full list of options, check `--help`.
13
+
14
+You can overwrite options at runtime using the option name as a parameter.

+ 7
- 0
doc/Usage/Plugins.asciidoc View File

@@ -0,0 +1,7 @@
1
+== Plugins
2
+Plugins a way of extending smolbote's functionality using the Qt plugin system.
3
+They are not to be confused with NPAPI/PPAPI or WebExtension plugins.
4
+
5
+To enable a plugin either copy it or symlink it in the plugins.path location,
6
+or set its absolute path as the plugins.path.
7
+

+ 2
- 0
doc/meson.build View File

@@ -2,6 +2,8 @@ if get_option('manpage').enabled()
2 2
     asciidoctor = find_program('asciidoctor', required: true)
3 3
 
4 4
     custom_target('manpage',
5
+        # list depend_files so the output can be updated if any of them are changed
6
+        depend_files: ['smolbote.7.asciidoc', 'Usage/CommandLine.asciidoc', 'Usage/Configuration.asciidoc', 'Usage/Profile.asciidoc', 'Usage/Plugins.asciidoc', 'Usage/Filter.asciidoc'],
5 7
         input: 'smolbote.7.asciidoc',
6 8
         output: 'smolbote.7',
7 9
         command: [asciidoctor, '--backend=manpage', '--out-file=@OUTPUT@', '@INPUT@'],

+ 4
- 0
doc/smolbote.7.asciidoc View File

@@ -21,6 +21,10 @@ include::Usage/Configuration.asciidoc[]
21 21
 
22 22
 include::Usage/Profile.asciidoc[]
23 23
 
24
+include::Usage/Plugins.asciidoc[]
25
+
26
+include::Usage/Filter.asciidoc[]
27
+
24 28
 == Copyright
25 29
 This program is free software: you can redistribute it and/or modify
26 30
 it under the terms of the GNU General Public License version 3 as

+ 3
- 1
lib/configuration/Kconfig View File

@@ -1,4 +1,3 @@
1
-
2 1
 menu "Configuration defaults"
3 2
     config PATH_CONFIG
4 3
         string "Configuration location"
@@ -18,6 +17,9 @@ menu "Configuration defaults"
18 17
     config PATH_DOWNLOADS
19 18
         string "Downloads location"
20 19
         default "~/Downloads"
20
+    config PATH_SESSION
21
+        string "Session location"
22
+        default "~/.config/smolbote/session.d"
21 23
 endmenu
22 24
 
23 25
 menu "Keyboard shortcuts"

+ 7
- 4
lib/configuration/configuration.cpp View File

@@ -37,13 +37,16 @@ Configuration::Configuration(QObject *parent)
37 37
     , m_homePath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation).toStdString())
38 38
 {
39 39
     commandLine_desc.add_options()
40
-        ("help,h", "Display this help.")
40
+        ("help,h", "Display command-line options list.")
41 41
         ("version,v", "Display version information.")
42
-        ("build", "Display build branch and commit.")
42
+        ("build", "Display build commit.")
43 43
 
44 44
         ("config,c", po::value<std::string>()->default_value(defaultUserConfigLocation()), "Set the configuration file.")
45 45
         ("no-remote", "Do not accept or send remote commands.")
46 46
 
47
+        ("session,s", po::value<std::string>(), "Open the selected session.")
48
+        ("pick-session", "Show all available sessions and select which one to open.")
49
+
47 50
         ("args", po::value<std::vector<std::string>>(), "Command(s) and/or URL(s).")
48 51
         ;
49 52
 
@@ -51,11 +54,11 @@ Configuration::Configuration(QObject *parent)
51 54
 
52 55
     configuration_desc.add_options()
53 56
         ("browser.stylesheet", po::value<std::string>())
54
-        ("browser.session", po::value<std::string>(), "Load session data from specified arg.")
55 57
         ("browser.locale", po::value<std::string>(), "Set Qt localization.")
56 58
         ("browser.translation", po::value<std::string>(), "Set application localization.")
57 59
 
58
-        ("browser.session.path", po::value<std::string>()->default_value("~/.config/smolbote/session.d"))
60
+        // sessions
61
+        ("browser.session.path", po::value<std::string>()->default_value(CONFIG_PATH_SESSION))
59 62
 
60 63
 #ifdef CONFIG_USEBREAKPAD
61 64
         ("browser.crash.path", po::value<std::string>()->default_value(CONFIG_PATH_CRASHDUMP))

+ 1
- 0
linux/.config View File

@@ -15,6 +15,7 @@ CONFIG_PATH_PLUGINS="~/.config/smolbote/plugins.d"
15 15
 CONFIG_PATH_PROFILES="~/.config/smolbote/profiles.d"
16 16
 CONFIG_PATH_BOOKMARKS="~/.config/smolbote/bookmarks.xbel"
17 17
 CONFIG_PATH_DOWNLOADS="~/Downloads"
18
+CONFIG_PATH_SESSION="~/.config/smolbote/session.d"
18 19
 
19 20
 #
20 21
 # Keyboard shortcuts

+ 10
- 5
src/main.cpp View File

@@ -9,6 +9,7 @@
9 9
 #include "browser.h"
10 10
 #include "configuration.h"
11 11
 #include "session/session.h"
12
+#include "session/sessiondialog.h"
12 13
 #include "util.h"
13 14
 #include <QFile>
14 15
 #include <QLibraryInfo>
@@ -205,10 +206,11 @@ int main(int argc, char **argv)
205 206
     }
206 207
 
207 208
     // command line arguments
208
-    bool isStandalone = config->exists("no-remote");
209
-    auto arguments = config->value<std::vector<std::string>>("args");
210
-    auto session = config->value<QString>("browser.session");
211
-    auto profile = config->value<QString>("profile.default");
209
+    const bool isStandalone = config->exists("no-remote");
210
+    const auto arguments = config->value<std::vector<std::string>>("args");
211
+    const bool pickSession = config->exists("pick-session");
212
+    const auto session = config->value<QString>("session");
213
+    const auto profile = config->value<QString>("profile.default");
212 214
 
213 215
     app.setConfiguration(config);
214 216
     app.setup(plugins);
@@ -235,7 +237,10 @@ int main(int argc, char **argv)
235 237
         });
236 238
     }
237 239
 
238
-    {
240
+    if(pickSession) {
241
+        auto *dlg = new SessionDialog();
242
+        dlg->exec();
243
+    } else {
239 244
         QJsonObject sessionData;
240 245
         if(session) {
241 246
             QFile sessionJson(session.value());

Loading…
Cancel
Save