Compare commits
2 Commits
38eee1eb44
...
e98f5e9b29
Author | SHA1 | Date | |
---|---|---|---|
e98f5e9b29 | |||
5c56652e87 |
6
TODO.md
6
TODO.md
|
@ -1,12 +1,9 @@
|
||||||
# To do
|
# To do
|
||||||
|
|
||||||
## Quality of life:
|
|
||||||
|
|
||||||
- [ ] Document creating new applications, e.g., as in [Asana for Linux](https://git.nunosempere.com/NunoSempere/asana-for-linux)
|
- [ ] Document creating new applications, e.g., as in [Asana for Linux](https://git.nunosempere.com/NunoSempere/asana-for-linux)
|
||||||
- [ ] Use something other than Whatsapp as an example syslink.
|
- [ ] This time, use something other than Whatsapp as an example syslink.
|
||||||
- [ ] Fix bug about distorted audio. Maybe related to [this pipewire issue](<https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1547>)?
|
- [ ] Fix bug about distorted audio. Maybe related to [this pipewire issue](<https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1547>)?
|
||||||
- See whether it even exists at all
|
- See whether it even exists at all
|
||||||
- [ ] Fix PageUp/PageDown shortcuts.
|
|
||||||
- [ ] Upgrade to GTK-4 / Webkitgtk 6.0? Will take a fair amount of time, since GTK4 redesigns the application model somewhat.
|
- [ ] Upgrade to GTK-4 / Webkitgtk 6.0? Will take a fair amount of time, since GTK4 redesigns the application model somewhat.
|
||||||
- Instructions for webkit-6.0 [here](https://github.com/WebKit/WebKit/blob/ed1422596dce5ff012e64a38faf402ac1674fc7e/Source/WebKit/gtk/migrating-to-webkitgtk-6.0.md)
|
- Instructions for webkit-6.0 [here](https://github.com/WebKit/WebKit/blob/ed1422596dce5ff012e64a38faf402ac1674fc7e/Source/WebKit/gtk/migrating-to-webkitgtk-6.0.md)
|
||||||
- Instructions for GTK-4 [here](https://docs.gtk.org/gtk4/migrating-3to4.html)
|
- Instructions for GTK-4 [here](https://docs.gtk.org/gtk4/migrating-3to4.html)
|
||||||
|
@ -17,6 +14,7 @@
|
||||||
|
|
||||||
# Previously done
|
# Previously done
|
||||||
|
|
||||||
|
- [x] Fix PageUp/PageDown shortcuts.
|
||||||
- ~~[ ] Set [`webkit_web_context_set_sandbox_enabled`](<https://webkitgtk.org/reference/webkit2gtk/2.36.8/WebKitWebContext.html#webkit-web-context-set-sandbox-enabled>), as recommended [here](<https://blogs.gnome.org/mcatanzaro/2022/11/04/stop-using-qtwebkit/>)~~. Irrelevant with upgrade to libsoup3.
|
- ~~[ ] Set [`webkit_web_context_set_sandbox_enabled`](<https://webkitgtk.org/reference/webkit2gtk/2.36.8/WebKitWebContext.html#webkit-web-context-set-sandbox-enabled>), as recommended [here](<https://blogs.gnome.org/mcatanzaro/2022/11/04/stop-using-qtwebkit/>)~~. Irrelevant with upgrade to libsoup3.
|
||||||
- [x] Update to webkit2gtk-4.1
|
- [x] Update to webkit2gtk-4.1
|
||||||
- [x] Change README and point to last Ubuntu 20.04 commit
|
- [x] Change README and point to last Ubuntu 20.04 commit
|
||||||
|
|
45
config.h
45
config.h
|
@ -53,6 +53,13 @@ To remove plugins completely;
|
||||||
// GTK
|
// GTK
|
||||||
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
|
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
|
||||||
#define KEY(x) GDK_KEY_##x
|
#define KEY(x) GDK_KEY_##x
|
||||||
|
/*
|
||||||
|
There are two different constants for Page_Up/Page_Down:
|
||||||
|
This could possibly have something to so with having Page_Down/Page_Up
|
||||||
|
as part of a keypad with/without NumLock
|
||||||
|
See: https://docs.gtk.org/gdk3/?q=Page_Up
|
||||||
|
See: https://docs.gtk.org/gdk3/?q=GDK_KEY_KP
|
||||||
|
*/
|
||||||
|
|
||||||
// Shortcuts
|
// Shortcuts
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -87,25 +94,25 @@ static struct {
|
||||||
unsigned key;
|
unsigned key;
|
||||||
func id;
|
func id;
|
||||||
} shortcut[] = {
|
} shortcut[] = {
|
||||||
{ CTRL, KEY(h), goback },
|
{ CTRL, KEY(h), goback },
|
||||||
{ CTRL, KEY(j), goforward },
|
{ CTRL, KEY(j), goforward },
|
||||||
{ CTRL, KEY(r), refresh },
|
{ CTRL, KEY(r), refresh },
|
||||||
{ CTRL, KEY(R), refresh_force },
|
{ CTRL, KEY(R), refresh_force },
|
||||||
{ CTRL, KEY(H), back_to_home },
|
{ CTRL, KEY(H), back_to_home },
|
||||||
{ CTRL, KEY(equal), zoomin },
|
{ CTRL, KEY(equal), zoomin },
|
||||||
{ CTRL, KEY(minus), zoomout },
|
{ CTRL, KEY(minus), zoomout },
|
||||||
{ CTRL, KEY(0), zoom_reset },
|
{ CTRL, KEY(0), zoom_reset },
|
||||||
{ CTRL, KEY(Page_Up), prev_tab },
|
{ CTRL, KEY(KP_Page_Up), prev_tab }, /* also try KEY(Page_Up) if this doesn't work on your machine */
|
||||||
{ CTRL, KEY(Page_Down), next_tab },
|
{ CTRL, KEY(KP_Page_Down), next_tab }, /* ditto for KEY(Page_Down) */
|
||||||
{ CTRL, KEY(t), new_tab },
|
{ CTRL, KEY(t), new_tab },
|
||||||
{ CTRL, KEY(w), close_tab },
|
{ CTRL, KEY(w), close_tab },
|
||||||
{ 0x0, KEY(F11), toggle_fullscreen },
|
{ 0x0, KEY(F11), toggle_fullscreen },
|
||||||
{ CTRL, KEY(l), show_searchbar },
|
{ CTRL, KEY(l), show_searchbar },
|
||||||
{ CTRL, KEY(semicolon), hide_bar },
|
{ CTRL, KEY(semicolon), hide_bar },
|
||||||
{ CTRL, KEY(f), show_finder },
|
{ CTRL, KEY(f), show_finder },
|
||||||
{ CTRL, KEY(n), finder_next },
|
{ CTRL, KEY(n), finder_next },
|
||||||
{ CTRL, KEY(N), finder_prev },
|
{ CTRL, KEY(N), finder_prev },
|
||||||
{ CTRL, KEY(p), prettify }
|
{ CTRL, KEY(p), prettify }
|
||||||
};
|
};
|
||||||
/* ^ For controls more akin to normal browsers */
|
/* ^ For controls more akin to normal browsers */
|
||||||
/* Reference for the key shorthand:
|
/* Reference for the key shorthand:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#define STYLE_N 7274 + 1000
|
#define STYLE_N 7624 + 1000
|
||||||
|
|
||||||
void read_style_js(char* string)
|
void read_style_js(char* string)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef STYLE
|
#ifndef STYLE
|
||||||
#define STYLE
|
#define STYLE
|
||||||
|
|
||||||
#define STYLE_N 7274 + 1000
|
#define STYLE_N 7624 + 1000
|
||||||
|
|
||||||
void read_style_js(char* string);
|
void read_style_js(char* string);
|
||||||
|
|
||||||
|
|
35
rosenrot.c
35
rosenrot.c
|
@ -1,7 +1,7 @@
|
||||||
|
#include <gdk/gdk.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <webkit2/webkit2.h>
|
#include <webkit2/webkit2.h>
|
||||||
#include <gdk/gdk.h>
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "plugins/plugins.h"
|
#include "plugins/plugins.h"
|
||||||
|
@ -28,14 +28,13 @@ WebKitWebView* notebook_get_webview(GtkNotebook* notebook)
|
||||||
|
|
||||||
/* Load content*/
|
/* Load content*/
|
||||||
|
|
||||||
void show_bar(GtkNotebook* notebook);
|
void toggle_bar(GtkNotebook* notebook);
|
||||||
void load_uri(WebKitWebView* view, const char* uri)
|
void load_uri(WebKitWebView* view, const char* uri)
|
||||||
{
|
{
|
||||||
if (strlen(uri) == 0) {
|
if (strlen(uri) == 0) {
|
||||||
webkit_web_view_load_uri(view, "");
|
webkit_web_view_load_uri(view, "");
|
||||||
bar.entry_mode = _SEARCH;
|
bar.entry_mode = _SEARCH;
|
||||||
show_bar(notebook);
|
toggle_bar(notebook);
|
||||||
|
|
||||||
} else if (g_str_has_prefix(uri, "http://") || g_str_has_prefix(uri, "https://") || g_str_has_prefix(uri, "file://") || g_str_has_prefix(uri, "about:")) {
|
} else if (g_str_has_prefix(uri, "http://") || g_str_has_prefix(uri, "https://") || g_str_has_prefix(uri, "file://") || g_str_has_prefix(uri, "about:")) {
|
||||||
webkit_web_view_load_uri(view, uri);
|
webkit_web_view_load_uri(view, uri);
|
||||||
} else {
|
} else {
|
||||||
|
@ -210,17 +209,17 @@ void notebook_create_new_tab(GtkNotebook* notebook, const char* uri)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Top bar */
|
/* Top bar */
|
||||||
void show_bar(GtkNotebook* notebook)
|
void toggle_bar(GtkNotebook* notebook)
|
||||||
{
|
{
|
||||||
if (bar.entry_mode == _SEARCH) {
|
switch (bar.entry_mode) {
|
||||||
|
case _SEARCH:
|
||||||
const char* url = webkit_web_view_get_uri(notebook_get_webview(notebook));
|
const char* url = webkit_web_view_get_uri(notebook_get_webview(notebook));
|
||||||
gtk_entry_set_placeholder_text(bar.line, "Search");
|
gtk_entry_set_placeholder_text(bar.line, "Search");
|
||||||
gtk_entry_buffer_set_text(bar.line_text, url, strlen(url));
|
gtk_entry_buffer_set_text(bar.line_text, url, strlen(url));
|
||||||
gtk_widget_show(GTK_WIDGET(bar.widget));
|
gtk_widget_show(GTK_WIDGET(bar.widget));
|
||||||
gtk_window_set_focus(window, GTK_WIDGET(bar.line));
|
gtk_window_set_focus(window, GTK_WIDGET(bar.line));
|
||||||
} else if (bar.entry_mode == _HIDDEN) {
|
break;
|
||||||
gtk_widget_hide(GTK_WIDGET(bar.widget));
|
case _FIND:
|
||||||
} else {
|
|
||||||
const char* search_text = webkit_find_controller_get_search_text(
|
const char* search_text = webkit_find_controller_get_search_text(
|
||||||
webkit_web_view_get_find_controller(notebook_get_webview(notebook)));
|
webkit_web_view_get_find_controller(notebook_get_webview(notebook)));
|
||||||
|
|
||||||
|
@ -230,6 +229,12 @@ void show_bar(GtkNotebook* notebook)
|
||||||
gtk_entry_set_placeholder_text(bar.line, "Find");
|
gtk_entry_set_placeholder_text(bar.line, "Find");
|
||||||
gtk_widget_show(GTK_WIDGET(bar.widget));
|
gtk_widget_show(GTK_WIDGET(bar.widget));
|
||||||
gtk_window_set_focus(window, GTK_WIDGET(bar.line));
|
gtk_window_set_focus(window, GTK_WIDGET(bar.line));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// fallthrough
|
||||||
|
case _HIDDEN:
|
||||||
|
gtk_widget_hide(GTK_WIDGET(bar.widget));
|
||||||
|
break; // not needed now, but might reorder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Handle what happens when the user is on the bar and presses enter
|
// Handle what happens when the user is on the bar and presses enter
|
||||||
|
@ -332,12 +337,12 @@ int handle_shortcut(func id, GtkNotebook* notebook)
|
||||||
|
|
||||||
case show_searchbar:
|
case show_searchbar:
|
||||||
bar.entry_mode = _SEARCH;
|
bar.entry_mode = _SEARCH;
|
||||||
show_bar(notebook);
|
toggle_bar(notebook);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case show_finder:
|
case show_finder:
|
||||||
bar.entry_mode = _FIND;
|
bar.entry_mode = _FIND;
|
||||||
show_bar(notebook);
|
toggle_bar(notebook);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case finder_next:
|
case finder_next:
|
||||||
|
@ -354,12 +359,12 @@ int handle_shortcut(func id, GtkNotebook* notebook)
|
||||||
notebook_create_new_tab(notebook, NULL);
|
notebook_create_new_tab(notebook, NULL);
|
||||||
gtk_notebook_set_show_tabs(notebook, true);
|
gtk_notebook_set_show_tabs(notebook, true);
|
||||||
bar.entry_mode = _SEARCH;
|
bar.entry_mode = _SEARCH;
|
||||||
show_bar(notebook);
|
toggle_bar(notebook);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case hide_bar:
|
case hide_bar:
|
||||||
bar.entry_mode = _HIDDEN;
|
bar.entry_mode = _HIDDEN;
|
||||||
show_bar(notebook);
|
toggle_bar(notebook);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case prettify: {
|
case prettify: {
|
||||||
|
@ -392,8 +397,8 @@ int handle_signal_keypress(void* self, GdkEvent* event, GtkNotebook* notebook)
|
||||||
printf("Keypress state is: CONTROL\n");
|
printf("Keypress state is: CONTROL\n");
|
||||||
}
|
}
|
||||||
printf("Keypress value: %d\n", event_keyval);
|
printf("Keypress value: %d\n", event_keyval);
|
||||||
printf("PageUp: %d\n", KEY(Page_Up));
|
printf("PageUp: %d %d\n", KEY(Page_Up), GDK_KEY_KP_Page_Up);
|
||||||
printf("PageDown: %d\n", KEY(Page_Down));
|
printf("PageDown: %d %d\n", KEY(Page_Down),GDK_KEY_KP_Page_Down);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < sizeof(shortcut) / sizeof(shortcut[0]); i++)
|
for (int i = 0; i < sizeof(shortcut) / sizeof(shortcut[0]); i++)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user