add backup shortcut to open in a different browser

This commit is contained in:
NunoSempere 2024-07-28 19:14:05 -04:00
parent c3d627f922
commit 459784029b
2 changed files with 11 additions and 1 deletions

View File

@ -98,6 +98,7 @@ typedef enum {
prettify,
save_uri_to_txt,
open_uri_in_brave,
} func;
static struct {
@ -136,5 +137,6 @@ static struct {
{ CTRL, KEY(Up), halve_window },
{ CTRL, KEY(Down), rebig_window },
{ CTRL, KEY(p), prettify },
{ CTRL, KEY(s), save_uri_to_txt }
{ CTRL, KEY(s), save_uri_to_txt },
{ CTRL, KEY(b), open_uri_in_brave }
};

View File

@ -378,6 +378,14 @@ int handle_shortcut(func id)
fclose(f);
webkit_web_view_evaluate_javascript(view, "alert('Saved current uri to /opt/rosenrot/uris.txt')", -1, NULL, "rosenrot-alert-numtabs", NULL, NULL, NULL);
}
break;
}
case open_uri_in_brave: {
const char* uri = webkit_web_view_get_uri(view);
char cmd[strlen("brave-browser --new-window ") + strlen(uri) + 1];
snprintf(cmd, sizeof(cmd) + 1, "brave-browser --new-window %s", uri);
system(cmd);
break;
}
}