summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/app.c16
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)
198Name=Lagrange 198Name=Lagrange
199Comment=${PROJECT_DESCRIPTION} 199Comment=${PROJECT_DESCRIPTION}
200Categories=Network 200Categories=Network
201Exec=${CMAKE_INSTALL_PREFIX}/bin/lagrange 201Exec=${CMAKE_INSTALL_PREFIX}/bin/lagrange %U
202Terminal=false 202Terminal=false
203Type=Application 203Type=Application
204Icon=fi.skyjake.lagrange 204Icon=fi.skyjake.lagrange
205MimeType=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)
diff --git a/src/app.c b/src/app.c
index 03e9b036..f5294cb0 100644
--- a/src/app.c
+++ b/src/app.c
@@ -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
344static void deinit_App(iApp *d) { 360static void deinit_App(iApp *d) {