Merge pull request #31 from NunoSempere/upstream

Some quality of life tweaks.
This commit is contained in:
fenze 2022-12-13 18:15:35 +00:00 committed by GitHub
commit 055e50c9ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 6 deletions

View File

@ -1,4 +1,4 @@
<h3 align=center> Rose Browser</h1> <h3 align=center> Rose Browser</h3>
<h4 align=center>Minimal browser based on webkit2gtk</h4> <h4 align=center>Minimal browser based on webkit2gtk</h4>
#### Features #### Features

View File

@ -20,14 +20,16 @@
#define GTK "gtk-application-prefer-dark-theme", true, "gtk-enable-animations", false #define GTK "gtk-application-prefer-dark-theme", true, "gtk-enable-animations", false
#define HOME "https://duckduckgo.com" #define HOME "https://lite.duckduckgo.com/html/"
#define SEARCH "https://duckduckgo.com/?q=%s" #define SEARCH "https://lite.duckduckgo.com/html/?q=%s"
#define CACHE_DIR "/home/fenze/.cache/rose" #define CACHE_DIR "/home/fenze/.cache/rose"
#define KEY(x) GDK_KEY_##x #define KEY(x) GDK_KEY_##x
#define ZOOM 1 /* Starting zoom level */ #define ZOOM 1 /* Starting zoom level */
#define ZOOM_VAL .1 /* Zooming value in zoomin/zoomout functions */ #define ZOOM_VAL .1 /* Zooming value in zoomin/zoomout functions */
#define BG_COLOR "#1E1E2E" #define BG_COLOR "#1E1E2E" /* or e.g., "#FEFEFE" if not using dark theme */
#define WIDTH 500
#define HEIGHT 400
typedef enum { typedef enum {
goback, goback,
@ -74,3 +76,25 @@ static struct {
{ CTRL, KEY(n), finder_next }, { CTRL, KEY(n), finder_next },
{ CTRL | SFT, KEY(N), finder_prev } { CTRL | SFT, KEY(N), finder_prev }
}; };
/* For controls more akin to normal browsers, use:
{
{ CTRL, KEY(h), goback },
{ CTRL, KEY(j), goforward },
{ CTRL, KEY(r), refresh },
{ CTRL | SFT, KEY(R), refresh_force },
{ CTRL | SFT, KEY(H), back_to_home },
{ CTRL, KEY(equal), zoomin },
{ CTRL, KEY(minus), zoomout },
{ CTRL, KEY(0), zoom_reset },
{ CTRL, KEY(Page_Down), prev_tab },
{ CTRL, KEY(Page_Up), next_tab },
{ CTRL, KEY(w), close_tab },
{ 0x0, KEY(F11), toggle_fullscreen },
{ CTRL, KEY(l), show_searchbar },
{ CTRL, KEY(f), show_finder },
{ CTRL, KEY(n), finder_next },
{ CTRL | SFT, KEY(N), finder_prev }
};
*/
/* Reference for the key shorthand:
* <https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkkeysyms.h> */

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
test "$1" = "--help" || test -z "$1" && { test "$1" = "--help" || test -z "$1" && {
echo -e "usage: rose-mklink <alias> <url>\n" echo -e "usage: rose-mklink <alias> <url>\n"

4
rose.c
View File

@ -296,7 +296,7 @@ void setup(GtkNotebook *notebook, const char *uri)
bar = GTK_HEADER_BAR(gtk_header_bar_new()); bar = GTK_HEADER_BAR(gtk_header_bar_new());
search_buf = GTK_ENTRY_BUFFER(gtk_entry_buffer_new("", 0)); search_buf = GTK_ENTRY_BUFFER(gtk_entry_buffer_new("", 0));
search = GTK_ENTRY(gtk_entry_new_with_buffer(search_buf)); search = GTK_ENTRY(gtk_entry_new_with_buffer(search_buf));
gtk_window_set_default_size(window, WIDTH, HEIGHT);
window_init(notebook); window_init(notebook);
notebook_init(notebook, uri); notebook_init(notebook, uri);
@ -305,6 +305,8 @@ void setup(GtkNotebook *notebook, const char *uri)
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(notebook)); gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(notebook));
gtk_widget_show_all(GTK_WIDGET(window)); gtk_widget_show_all(GTK_WIDGET(window));
gtk_widget_hide(GTK_WIDGET(bar)); gtk_widget_hide(GTK_WIDGET(bar));
webkit_web_view_set_zoom_level(notebook_get_webview(notebook), ZOOM);
} }
int main(int argc, char **argv) int main(int argc, char **argv)