aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README34
-rw-r--r--TODO6
-rwxr-xr-xuzblbin0 -> 23180 bytes
-rw-r--r--uzbl.c94
4 files changed, 85 insertions, 49 deletions
diff --git a/README b/README
index e436da9..f2c144c 100644
--- a/README
+++ b/README
@@ -1,32 +1,2 @@
-- Uzbl.
- In my opinion, any program can only be really useful if it complies to the unix philosophy.
- Web browsers are frequent violators of this principle. Time to change that!
-
-Right now uzbl is in a very early state but here are some ideas I would like to (not) implement
-
-- each instance of uzbl renders 1 page (eg it's a small wrapper around webkit), no tabbing, tab previews, or speed dial things. we have window managers for that.
-- simple ini config file ("profile") for keyboard, network,.. settings
-- implement some basic keyboard shortcuts for going up, down, refresh etc
-- listen to signals and do useful stuff when triggered.
-- open up a socket file/fifo/.. so we can easily control each instance by writing things like 'uri <foo>' to /tmp/uzbl-pid
-- MAYBE (if needed): 1 control application called uzblctrl or something. use this to modify the behavior of a uzbl instance (change url, refresh). use xdotool to get the window with focus. eg uzblctrl -win <id> -url <http://>.
- use xbindkeys to bind keys to call uzblctrl.
-- no bookmark management builtin. make your own solution. for pulling a bookmark a plaintxt-based program using dmenu would work great here. combine with uzbltcrl and xbindkeys.
- uzblctrl should support an option to query the current page so you can script something to add to your bookmarks. use zenity or something to add tags.
-- similar story for history.
-- no ad blocking built in. use the power of /etc/hosts. though uzblctrl should support an option to list all images on a page, so you can easily pick the links to ads to add them to your /etc/hosts. (dmenu can again be great here to automate this)
-- no download manager. allow user to pick wget/curl/a custom script/...
-- no build in command interpreters like ubiquity. uzbl should be accessible and you should use a shell or similar.
-- no "clear cookies/cache/..." menu items. rm ~/$XDG_{DATA,CACHE}_DIR/uzbl/{cache,cookies}/*
-
-
-to figure out:
-- password management. maybe an encrypted store that unlocks with an ssh key?
-- how to handle hyperlinks? number them like konqueror does?
-
-
-
-For more thoughts & ideas see http://bbs.archlinux.org/viewtopic.php?id=67463
-
-NOTE:
-- My c skills are very rusty, it will take me a while to get back up to speed
+Bugs:
+ - The control_thread function doesn't receive data all the time, and causes segfaults for some reason. \ No newline at end of file
diff --git a/TODO b/TODO
deleted file mode 100644
index 5b289e6..0000000
--- a/TODO
+++ /dev/null
@@ -1,6 +0,0 @@
-* implement all the ideas from README
-* see if we can get rid of gtk. I need no widgets at all, only the webkit page display no scrollbar, no statusbar.
-* figure out caching with webkit and in general how we can speed everything up
-* where to put proxy config? webkit support?
-* can we change the behavior of the rendering? eg to add numbers to all hyperlinks
-* figure out how webkit intercepts key input
diff --git a/uzbl b/uzbl
new file mode 100755
index 0000000..9bf70a9
--- /dev/null
+++ b/uzbl
Binary files differ
diff --git a/uzbl.c b/uzbl.c
index c66dd53..726bb1c 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -29,6 +29,16 @@
#include <gtk/gtk.h>
#include <webkit/webkit.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <pthread.h>
+
static GtkWidget* main_window;
static GtkWidget* uri_entry;
static GtkStatusbar* main_statusbar;
@@ -37,8 +47,6 @@ static gchar* main_title;
static gint load_progress;
static guint status_context_id;
-
-
static gchar* uri = NULL;
static gboolean verbose = FALSE;
@@ -50,8 +58,6 @@ static GOptionEntry entries[] =
};
-
-
static void
activate_uri_entry_cb (GtkWidget* entry, gpointer data)
{
@@ -157,9 +163,68 @@ static GtkWidget* create_window ()
return window;
}
+
+static bool parse_command(char *command)
+{
+ bool output;
+ output = true;
+
+ if(strcmp(command, "forward") == 0)
+ {
+ printf("Going forward\n");
+ webkit_web_view_go_forward (web_view);
+ }
+ else if(strcmp(command, "back") == 0)
+ {
+ printf("Going back\n");
+ webkit_web_view_go_back (web_view);
+ }
+ else if(strncmp("http://", command, 7) == 0)
+ {
+ printf("Loading URI \"%s\"\n", command);
+ uri = command;
+ webkit_web_view_load_uri (web_view, uri);
+ }
+ else
+ {
+ output = false;
+ }
+
+ return output;
+}
+
+static void control_fifo(void *threadid)
+{
+ char *cmd;
+ int num, fd;
+ char *fifoname = "/tmp/uzbl";
+
+ mknod(fifoname, S_IFIFO | 0666 , 0); /* Do some stuff to work with multiple instances later foo-$PID or something */
+ printf("Opened control fifo in %s\n", fifoname);
+
+ while (true)
+ {
+ fd = open(fifoname, O_RDONLY);
+ while (num > 0)
+ {
+ if ((num = read(fd, cmd, 300)) == -1)
+ perror("read");
+ else
+ {
+ cmd[num] = '\0';
+ if(! parse_command(cmd))
+ printf("Unknown command \"%s\"", cmd);
+ }
+ }
+ num = 1;
+ }
+ printf("Oops, this code should never be run.\n");
+}
+
int main (int argc, char* argv[])
{
gtk_init (&argc, &argv);
+
if (!g_thread_supported ())
g_thread_init (NULL);
@@ -169,19 +234,26 @@ int main (int argc, char* argv[])
main_window = create_window ();
gtk_container_add (GTK_CONTAINER (main_window), vbox);
- GError *error = NULL;
-
- GOptionContext* context = g_option_context_new ("- some stuff here maybe someday");
- g_option_context_add_main_entries (context, entries, NULL);
- g_option_context_add_group (context, gtk_get_option_group (TRUE));
- g_option_context_parse (context, &argc, &argv, &error);
+ GError *error = NULL;
+
+ GOptionContext* context = g_option_context_new ("- some stuff here maybe someday");
+ g_option_context_add_main_entries (context, entries, NULL);
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ g_option_context_parse (context, &argc, &argv, &error);
+ char *uri = "http://www.google.com";
+ if(argc == 2)
+ uri = argv[1];
webkit_web_view_load_uri (web_view, uri);
gtk_widget_grab_focus (GTK_WIDGET (web_view));
gtk_widget_show_all (main_window);
- gtk_main ();
+ pthread_t controlthread;
+ pthread_create(&controlthread, NULL, control_fifo, NULL);
+ gtk_main ();
+
+ pthread_exit(NULL);
return 0;
}