add shortcut to save current uri to a file
This commit is contained in:
parent
c3ac0c0333
commit
20a0c15caa
4
config.h
4
config.h
|
@ -97,6 +97,7 @@ typedef enum {
|
|||
rebig_window,
|
||||
|
||||
prettify,
|
||||
save_uri_to_txt,
|
||||
} func;
|
||||
|
||||
static struct {
|
||||
|
@ -134,5 +135,6 @@ static struct {
|
|||
{ CTRL, KEY(N), finder_prev },
|
||||
{ CTRL, KEY(Left), halve_window },
|
||||
{ CTRL, KEY(Right), rebig_window },
|
||||
{ CTRL, KEY(p), prettify }
|
||||
{ CTRL, KEY(p), prettify },
|
||||
{ CTRL, KEY(s), save_uri_to_txt }
|
||||
};
|
||||
|
|
2
makefile
2
makefile
|
@ -88,6 +88,8 @@ runtime_files:
|
|||
sudo mkdir -p /opt/rosenrot/
|
||||
sudo cp styles-gtk/style-gtk3.css /opt/rosenrot/
|
||||
sudo cp styles-gtk/style-gtk4.css /opt/rosenrot/
|
||||
sudo touch /opt/rosenrot/uris.txt
|
||||
sudo chmod a+rw /opt/rosenrot/uris.txt
|
||||
sudo cp -r images/flower-imgs /opt/rosenrot/
|
||||
sudo cp plugins/style/style.js /opt/rosenrot/
|
||||
sudo cp plugins/readability/readability.js /opt/rosenrot/
|
||||
|
|
12
rosenrot4.c
12
rosenrot4.c
|
@ -367,6 +367,18 @@ int handle_shortcut(func id)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case save_uri_to_txt: {
|
||||
const char* uri = webkit_web_view_get_uri(view);
|
||||
FILE *f = fopen("/opt/rosenrot/uris.txt", "a");
|
||||
if (f == NULL) {
|
||||
printf("Error opening /opt/rosenrot/uris.txt");
|
||||
} else {
|
||||
fprintf(f, "%s", uri);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user