diff options
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/app.c | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cd1a3733..46d418e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -198,10 +198,11 @@ elseif (UNIX AND NOT APPLE) | |||
198 | Name=Lagrange | 198 | Name=Lagrange |
199 | Comment=${PROJECT_DESCRIPTION} | 199 | Comment=${PROJECT_DESCRIPTION} |
200 | Categories=Network | 200 | Categories=Network |
201 | Exec=${CMAKE_INSTALL_PREFIX}/bin/lagrange | 201 | Exec=${CMAKE_INSTALL_PREFIX}/bin/lagrange %U |
202 | Terminal=false | 202 | Terminal=false |
203 | Type=Application | 203 | Type=Application |
204 | Icon=fi.skyjake.lagrange | 204 | Icon=fi.skyjake.lagrange |
205 | MimeType=x-scheme-handler/gemini; | ||
205 | ") | 206 | ") |
206 | install (TARGETS app DESTINATION bin) | 207 | install (TARGETS app DESTINATION bin) |
207 | install (FILES ${desktop} DESTINATION share/applications) | 208 | install (FILES ${desktop} DESTINATION share/applications) |
@@ -339,6 +339,22 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
339 | postCommandString_App(i.value); | 339 | postCommandString_App(i.value); |
340 | } | 340 | } |
341 | } | 341 | } |
342 | /* URLs from the command line. */ { | ||
343 | iBool newTab = iFalse; | ||
344 | for (size_t i = 1; i < size_StringList(args_CommandLine(&d->args)); i++) { | ||
345 | const iString *arg = constAt_StringList(args_CommandLine(&d->args), i); | ||
346 | const iBool isKnownScheme = | ||
347 | startsWithCase_String(arg, "gemini:") || startsWithCase_String(arg, "file:") || | ||
348 | startsWithCase_String(arg, "data:") || startsWithCase_String(arg, "about:"); | ||
349 | if (isKnownScheme || fileExists_FileInfo(arg)) { | ||
350 | postCommandf_App("open newtab:%d url:%s%s", | ||
351 | newTab, | ||
352 | isKnownScheme ? "" : "file://", | ||
353 | cstr_String(arg)); | ||
354 | newTab = iTrue; | ||
355 | } | ||
356 | } | ||
357 | } | ||
342 | } | 358 | } |
343 | 359 | ||
344 | static void deinit_App(iApp *d) { | 360 | static void deinit_App(iApp *d) { |