Compare commits
2 Commits
38eee1eb44
...
e98f5e9b29
Author | SHA1 | Date | |
---|---|---|---|
e98f5e9b29 | |||
5c56652e87 |
6
TODO.md
6
TODO.md
|
@ -1,12 +1,9 @@
|
|||
# To do
|
||||
|
||||
## Quality of life:
|
||||
|
||||
- [ ] 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>)?
|
||||
- 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.
|
||||
- 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)
|
||||
|
@ -17,6 +14,7 @@
|
|||
|
||||
# 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.
|
||||
- [x] Update to webkit2gtk-4.1
|
||||
- [x] Change README and point to last Ubuntu 20.04 commit
|
||||
|
|
11
config.h
11
config.h
|
@ -53,6 +53,13 @@ To remove plugins completely;
|
|||
// GTK
|
||||
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
|
||||
#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
|
||||
typedef enum {
|
||||
|
@ -95,8 +102,8 @@ static struct {
|
|||
{ CTRL, KEY(equal), zoomin },
|
||||
{ CTRL, KEY(minus), zoomout },
|
||||
{ CTRL, KEY(0), zoom_reset },
|
||||
{ CTRL, KEY(Page_Up), prev_tab },
|
||||
{ CTRL, KEY(Page_Down), next_tab },
|
||||
{ CTRL, KEY(KP_Page_Up), prev_tab }, /* also try KEY(Page_Up) if this doesn't work on your machine */
|
||||
{ CTRL, KEY(KP_Page_Down), next_tab }, /* ditto for KEY(Page_Down) */
|
||||
{ CTRL, KEY(t), new_tab },
|
||||
{ CTRL, KEY(w), close_tab },
|
||||
{ 0x0, KEY(F11), toggle_fullscreen },
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define STYLE_N 7274 + 1000
|
||||
#define STYLE_N 7624 + 1000
|
||||
|
||||
void read_style_js(char* string)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef STYLE
|
||||
#define STYLE
|
||||
|
||||
#define STYLE_N 7274 + 1000
|
||||
#define STYLE_N 7624 + 1000
|
||||
|
||||
void read_style_js(char* string);
|
||||
|
||||
|
|
35
rosenrot.c
35
rosenrot.c
|
@ -1,7 +1,7 @@
|
|||
#include <gdk/gdk.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <webkit2/webkit2.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "plugins/plugins.h"
|
||||
|
@ -28,14 +28,13 @@ WebKitWebView* notebook_get_webview(GtkNotebook* notebook)
|
|||
|
||||
/* Load content*/
|
||||
|
||||
void show_bar(GtkNotebook* notebook);
|
||||
void toggle_bar(GtkNotebook* notebook);
|
||||
void load_uri(WebKitWebView* view, const char* uri)
|
||||
{
|
||||
if (strlen(uri) == 0) {
|
||||
webkit_web_view_load_uri(view, "");
|
||||
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:")) {
|
||||
webkit_web_view_load_uri(view, uri);
|
||||
} else {
|
||||
|
@ -210,17 +209,17 @@ void notebook_create_new_tab(GtkNotebook* notebook, const char* uri)
|
|||
}
|
||||
|
||||
/* 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));
|
||||
gtk_entry_set_placeholder_text(bar.line, "Search");
|
||||
gtk_entry_buffer_set_text(bar.line_text, url, strlen(url));
|
||||
gtk_widget_show(GTK_WIDGET(bar.widget));
|
||||
gtk_window_set_focus(window, GTK_WIDGET(bar.line));
|
||||
} else if (bar.entry_mode == _HIDDEN) {
|
||||
gtk_widget_hide(GTK_WIDGET(bar.widget));
|
||||
} else {
|
||||
break;
|
||||
case _FIND:
|
||||
const char* search_text = webkit_find_controller_get_search_text(
|
||||
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_widget_show(GTK_WIDGET(bar.widget));
|
||||
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
|
||||
|
@ -332,12 +337,12 @@ int handle_shortcut(func id, GtkNotebook* notebook)
|
|||
|
||||
case show_searchbar:
|
||||
bar.entry_mode = _SEARCH;
|
||||
show_bar(notebook);
|
||||
toggle_bar(notebook);
|
||||
break;
|
||||
|
||||
case show_finder:
|
||||
bar.entry_mode = _FIND;
|
||||
show_bar(notebook);
|
||||
toggle_bar(notebook);
|
||||
break;
|
||||
|
||||
case finder_next:
|
||||
|
@ -354,12 +359,12 @@ int handle_shortcut(func id, GtkNotebook* notebook)
|
|||
notebook_create_new_tab(notebook, NULL);
|
||||
gtk_notebook_set_show_tabs(notebook, true);
|
||||
bar.entry_mode = _SEARCH;
|
||||
show_bar(notebook);
|
||||
toggle_bar(notebook);
|
||||
break;
|
||||
|
||||
case hide_bar:
|
||||
bar.entry_mode = _HIDDEN;
|
||||
show_bar(notebook);
|
||||
toggle_bar(notebook);
|
||||
break;
|
||||
|
||||
case prettify: {
|
||||
|
@ -392,8 +397,8 @@ int handle_signal_keypress(void* self, GdkEvent* event, GtkNotebook* notebook)
|
|||
printf("Keypress state is: CONTROL\n");
|
||||
}
|
||||
printf("Keypress value: %d\n", event_keyval);
|
||||
printf("PageUp: %d\n", KEY(Page_Up));
|
||||
printf("PageDown: %d\n", KEY(Page_Down));
|
||||
printf("PageUp: %d %d\n", KEY(Page_Up), GDK_KEY_KP_Page_Up);
|
||||
printf("PageDown: %d %d\n", KEY(Page_Down),GDK_KEY_KP_Page_Down);
|
||||
}
|
||||
|
||||
for (int i = 0; i < sizeof(shortcut) / sizeof(shortcut[0]); i++)
|
||||
|
|
Loading…
Reference in New Issue
Block a user