You are not logged in.

#76 2009-04-24 08:15:40

dodobas
Member
From: Croatia
Registered: 2009-04-21
Posts: 12

Re: uzbl. A browser that adheres to the unix philosophy.

Barrucadu, trying

make

produced an error:

uzbl.c:247: warning: passing argument 3 of 'pthread_create' from incompatible pointer type

smile


It would also be great to have my computer built into my skull. That way I could surf the Net during useless periods of life, such as when people talk to me.

Offline

#77 2009-04-24 08:16:49

HashBox
Member
Registered: 2009-01-22
Posts: 271

Re: uzbl. A browser that adheres to the unix philosophy.

Nice Barrucadu! You should be able to add pid by doing something like this I suppose:

char fifoname[16];
sprintf(fifoname, "/tmp/uzbl%d", getpid());

And for removing the fifo on exit you can use unlink() IIRC smile

Another couple of things maybe worth mentioning, you can use mkfifo instead of mknod (just in case you weren't aware), and the segfaults you mentioned? Are they related to the fifo code?

@dodobas, changing static void control_fifo to static int control_fifo will fix this I think?

Edit: I'm going to fork this yet again and play with the code and see what I can fix and cleanup. It's also a grand opportunity for me to learn how to use git smile

Edit2: I think I pushed it correctly? http://github.com/HashBox/uzbl/tree/master
If you want me to put your name somewhere Barrucadu I have no objections to that, just let me know smile

Last edited by HashBox (2009-04-24 09:46:33)

Offline

#78 2009-04-24 10:15:45

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: uzbl. A browser that adheres to the unix philosophy.

Wow! I've been mostly away these days, and look what it's been happening here!
This is one of the things I've been dreaming about so much. The only thing it would need would be Vim keybindings like Vimperator and it would be absolutely perfect as a standalone web browser big_smile

I'll surely try it out once I get a bit of time. Thanks for your work!


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#79 2009-04-24 12:30:32

Wra!th
Member
Registered: 2009-03-31
Posts: 342

Re: uzbl. A browser that adheres to the unix philosophy.

I rolled my own today (from scratch I might add).
tMWtscw
If anyone wants the source seeing how it has an UI and all of you seem to think UIs are such vile things, lemme know and I'll post.

Features:
tabs, address entry.
Buttons:
New tab(tabs are scrollable eg if too many, your get arrows), close selected tab, history back/forward, load url from the address text entry (can also be used with Return..no need to press "LOAD")
PS: it's 82 lines of code btw big_smile

Last edited by Wra!th (2009-04-24 12:37:26)


MacGregor DESPITE THEM!
7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00

Offline

#80 2009-04-24 12:37:35

greyarea
Member
Registered: 2008-09-30
Posts: 10

Re: uzbl. A browser that adheres to the unix philosophy.

HashBox wrote:

Edit2: I think I pushed it correctly? http://github.com/HashBox/uzbl/tree/master
If you want me to put your name somewhere Barrucadu I have no objections to that, just let me know smile

I'm certainly no expert but I think you did it wrong, you're supposed to go to Dieter's repo and click 'fork' wink
See: http://github.com/guides/fork-a-project … ifications

This project is awesome, I was getting tired of firefox consuming so much RAM..

Offline

#81 2009-04-24 13:03:23

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: uzbl. A browser that adheres to the unix philosophy.

@ HashBox Well done for fixing up my code, I'll work on making the parse_command function a little nicer.

Offline

#82 2009-04-24 14:08:24

dusanx
Member
Registered: 2008-11-28
Posts: 132

Re: uzbl. A browser that adheres to the unix philosophy.

Still too stupid to use git tongue

Everything mentioned before plus proper key handling (see key_press_cb):

- Alt+Left arrow = back
- Alt+Right arrow = forward
- h or H = Home (actually initial uri)
- Edit fields are not broken any more - bug fixed

This is just a test but navigation works and you can remap keys in code easily.

// Original code taken from the example webkit-gtk+ application. see notice below.

/*
 * Copyright (C) 2006, 2007 Apple Inc.
 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <gtk/gtk.h>
#include <webkit/webkit.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>

static GtkWidget* main_window;
static GtkWidget* uri_entry;
static WebKitWebView* web_view;
static gchar* main_title;
static gchar selected_url[500];
static gint load_progress;



static gchar* uri = NULL;
static gboolean verbose = FALSE;

static GOptionEntry entries[] =
{
  { "uri", 'u', 0, G_OPTION_ARG_STRING, &uri, "Uri to load", NULL },
  { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL },
  { NULL }
};

static void
activate_uri_entry_cb (GtkWidget* entry, gpointer data)
{
    const gchar* uri = gtk_entry_get_text (GTK_ENTRY (entry));
    g_assert (uri);
    webkit_web_view_load_uri (web_view, uri);
}

static void update_title (GtkWindow* window)
{
    GString* string = g_string_new (main_title);
    g_string_append (string, " - Uzbl browser");
    if (load_progress < 100)
        g_string_append_printf (string, " (%d%%)", load_progress);

    if (selected_url[0]!=0) {
        g_string_append_printf (string, " -> (%s)", selected_url);
    }

    gchar* title = g_string_free (string, FALSE);
    gtk_window_set_title (window, title);
    g_free (title);
}

static void
link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data)
{
    selected_url[0]='\0';
    if (link) {
        strcpy (selected_url,link);
    }
    update_title (GTK_WINDOW (main_window));
}

static void
title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data)
{
    if (main_title)
        g_free (main_title);
    main_title = g_strdup (title);
    update_title (GTK_WINDOW (main_window));
}

static void
progress_change_cb (WebKitWebView* page, gint progress, gpointer data)
{
    load_progress = progress;
    update_title (GTK_WINDOW (main_window));
}

static void
load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data)
{
    const gchar* uri = webkit_web_frame_get_uri(frame);
    if (uri)
        gtk_entry_set_text (GTK_ENTRY (uri_entry), uri);
}

static void
destroy_cb (GtkWidget* widget, gpointer data)
{
    gtk_main_quit ();
}

static void
go_back_cb (GtkWidget* widget, gpointer data)
{
    webkit_web_view_go_back (web_view);
}

static void
go_forward_cb (GtkWidget* widget, gpointer data)
{
    webkit_web_view_go_forward (web_view);
}

static gboolean
key_press_cb (WebKitWebView* page, GdkEventKey* event)
{
    gboolean result=FALSE; //TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
    //BACK
    if ((event->type==GDK_KEY_PRESS) && (event->keyval==GDK_Left) && (event->state & GDK_MOD1_MASK)) { 
        webkit_web_view_go_back (web_view);
        result=TRUE;
    }
    //FORWARD
    if ((event->type==GDK_KEY_PRESS) && (event->keyval==GDK_Right) && (event->state & GDK_MOD1_MASK)) { 
        webkit_web_view_go_forward (web_view);
        result=TRUE;
    }
    //HOME (KIND OF)
    if ((event->type==GDK_KEY_PRESS) && ((event->keyval==GDK_H) || (event->keyval==GDK_h))) { 
    webkit_web_view_load_uri (web_view, uri); 
        result=TRUE;
    }

    return(result);
}


static GtkWidget*
create_browser ()
{
    GtkWidget* scrolled_window = gtk_scrolled_window_new (NULL, NULL);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_NEVER);

    web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (web_view));

    g_signal_connect (G_OBJECT (web_view), "title-changed", G_CALLBACK (title_change_cb), web_view);
    g_signal_connect (G_OBJECT (web_view), "load-progress-changed", G_CALLBACK (progress_change_cb), web_view);
    g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (load_commit_cb), web_view);
    g_signal_connect (G_OBJECT (web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), web_view);
    g_signal_connect (G_OBJECT (web_view), "key-press-event", G_CALLBACK(key_press_cb), web_view);


    return scrolled_window;
}

static GtkWidget* create_window ()
{
    GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
    gtk_widget_set_name (window, "Uzbl browser");
    g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL);

    return window;
}

int main (int argc, char* argv[])
{
    gtk_init (&argc, &argv);
    if (!g_thread_supported ())
        g_thread_init (NULL);

    GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox), create_browser (), TRUE, TRUE, 0);

    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);


    webkit_web_view_load_uri (web_view, uri);

    gtk_widget_grab_focus (GTK_WIDGET (web_view));
    gtk_widget_show_all (main_window);
    gtk_main ();

    return 0;
}

Edit: I have small local 'quickdial' html with google search and I don't need anything else smile
Edit: OK, just 'h' when typed in edit field makes uzbl to go home -> need to add modifier

Last edited by dusanx (2009-04-24 14:15:48)


Gnome -> Openbox -> Awesome -> XMonad -> dwm .
http://github.com/dusanx/uzbl/

Offline

#83 2009-04-24 14:17:01

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 1,959
Website

Re: uzbl. A browser that adheres to the unix philosophy.

Yeah the easiest way to contribute, track each others progress is to fork from me or one of the people who forked from me by clicking the button on the github page.
Then you can do nice things such as getting graphs of of the branching/merging thing ( see http://github.com/Dieterbe/uzbl/network ), and you can also do "pull requests": if you created something nice, you can do a pull request and I can pull in the patch in my code (and I believe indivudual forkers can also pull in from each other), stuff like that is quite cool.

http://github.com/guides/home has several good guides about probably all things you want to know.

I'll look at your guys fifo code tonight.  I'm also thinking about how to get data in and out the program.  A fifo is afaik only half duplex, so for things like querying the current url I wonder how we should implement that.

PS: really cool to see how many people started hacking and playing, it's cool if we can make this a community effort smile


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#84 2009-04-24 14:22:42

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: uzbl. A browser that adheres to the unix philosophy.

Dieter@be wrote:

I'll look at your guys fifo code tonight.  I'm also thinking about how to get data in and out the program.  A fifo is afaik only half duplex, so for things like querying the current url I wonder how we should implement that.

I thought about that and the best thing I could come up with was having a file /tmp/uzbl_$PID_info, and any command output would be dumped into that. There's probably a far better way though.

Dieter@be wrote:

PS: really cool to see how many people started hacking and playing, it's cool if we can make this a community effort smile

Arch browser big_smile

edit: Commands are now added by the add_command function: static void add_command (char* cmdstr, void* function). So now parse_command() doesn't need a big list of if statements to work big_smile

Last edited by Barrucadu (2009-04-24 14:43:52)

Offline

#85 2009-04-24 14:57:15

sentientswitch
Member
Registered: 2009-04-24
Posts: 6

Re: uzbl. A browser that adheres to the unix philosophy.

Very nice project, can't wait until it becomes uzbl as my main browser (har har har).

I've taken the liberty of starting the wiki page with some basic info, hope you don't mind wink

You can basically ignore my repo atm, I've just been getting used to using git/github and haven't made any contributions. I know some c++ so I may be able to help a little if I get time.

Offline

#86 2009-04-24 15:14:40

dusanx
Member
Registered: 2008-11-28
Posts: 132

Re: uzbl. A browser that adheres to the unix philosophy.


Gnome -> Openbox -> Awesome -> XMonad -> dwm .
http://github.com/dusanx/uzbl/

Offline

#87 2009-04-24 15:38:58

dusanx
Member
Registered: 2008-11-28
Posts: 132

Re: uzbl. A browser that adheres to the unix philosophy.

Barrucadu wrote:

Arch browser big_smile

Noooo! uzbl is perfect smile

Q: I want to merge your fork (add it to mine). How?


Gnome -> Openbox -> Awesome -> XMonad -> dwm .
http://github.com/dusanx/uzbl/

Offline

#88 2009-04-24 15:59:28

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: uzbl. A browser that adheres to the unix philosophy.

dusanx wrote:

Q: I want to merge your fork (add it to mine). How?

Not a clue. When I copied HashBox's code I think I followed some guide on the github website, I can't remember what commands I used.

Offline

#89 2009-04-24 16:07:32

btartsa
Member
Registered: 2004-07-26
Posts: 222

Re: uzbl. A browser that adheres to the unix philosophy.

Excellent work guys!

I think Archway would be a cool name for this project:

archway (plural archways)

   1. A passageway covered by an arch, particularly one made of masonry.
   2. A doorway with a semilunar-shaped top.

Maybe a forker would like to use it? I think it says it all smile

I like that idea of a configurable statusbar and controls that can be activated from a keyboard shortcut.

Offline

#90 2009-04-24 16:37:36

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: uzbl. A browser that adheres to the unix philosophy.

Hmm, I think we should decide on some style guidelines so whenever code is merged it doesn't require a big restructuring.

Offline

#91 2009-04-24 16:39:39

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 1,959
Website

Re: uzbl. A browser that adheres to the unix philosophy.

Barrucadu wrote:
dusanx wrote:

Q: I want to merge your fork (add it to mine). How?

Not a clue. When I copied HashBox's code I think I followed some guide on the github website, I can't remember what commands I used.

Barrucuda, the code on your github contains lots of bogus changes in comparison to mine.  (eg lot's of whitespace changes in the LICENSE file)


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#92 2009-04-24 16:44:28

dusanx
Member
Registered: 2008-11-28
Posts: 132

Re: uzbl. A browser that adheres to the unix philosophy.

Dieter@be wrote:
Barrucadu wrote:
dusanx wrote:

Q: I want to merge your fork (add it to mine). How?

Not a clue. When I copied HashBox's code I think I followed some guide on the github website, I can't remember what commands I used.

Barrucuda, the code on your github contains lots of bogus changes in comparison to mine.  (eg lot's of whitespace changes in the LICENSE file)

Yes and looks like some functions are missing? Maybe I did not looked correctly?


Gnome -> Openbox -> Awesome -> XMonad -> dwm .
http://github.com/dusanx/uzbl/

Offline

#93 2009-04-24 17:11:13

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: uzbl. A browser that adheres to the unix philosophy.

@ Dieter@be: Not sure why, I just copied that straight from yours.
@ dusanx: Missing functions?

Offline

#94 2009-04-24 17:21:47

dusanx
Member
Registered: 2008-11-28
Posts: 132

Re: uzbl. A browser that adheres to the unix philosophy.

Barrucadu wrote:

@ dusanx: Missing functions?

My bad smile

&function_call is what I missed.


Gnome -> Openbox -> Awesome -> XMonad -> dwm .
http://github.com/dusanx/uzbl/

Offline

#95 2009-04-24 17:32:12

Shunpike
Member
From: France
Registered: 2009-01-28
Posts: 47

Re: uzbl. A browser that adheres to the unix philosophy.

btartsa wrote:

Excellent work guys!

I think Archway would be a cool name for this project:

archway (plural archways)

   1. A passageway covered by an arch, particularly one made of masonry.
   2. A doorway with a semilunar-shaped top.

Maybe a forker would like to use it? I think it says it all smile

I like that idea of a configurable statusbar and controls that can be activated from a keyboard shortcut.

big_smile
Call it Mario. Because Mario always beats B(r)owser hands down wink

Offline

#96 2009-04-24 17:33:17

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: uzbl. A browser that adheres to the unix philosophy.

It's already got a name.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#97 2009-04-24 17:44:59

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 1,959
Website

Re: uzbl. A browser that adheres to the unix philosophy.

Guys, I've been thinking a bit about which widgets we should and which we shouldn't have.
I think we should have 1 small bar at the top with the most crucial widgets (and for those who want it: the ability to have tabs there as well)

i've put my thoughts/reasoning into the README but github is slow to update the page so here it is:

WIDGET ROADMAP:
* statusbar? (the bar you see in pretty much every gtk program at the bottom. eg firefox)
  consumes too much space (if always visible) for the little it is used.  (+ you can put only 1 message in it at a time!)
  -> option 1: no statusbar at all. when hovering over a link (or pressing key to preview the url without changing page) -> show url in tooltip on page.
  -> option 2: toggle visibility of statusbar on/off when hovering over a link. since it's at the bottom I don't think it will disturb too much.
* viewing progress/state of pageload?  most programs use statusbar for this.
  -> option 1: titlebar can show a percentage when it's loading a new page.
  -> option 2: toggle a statusbar everytime we start loading a new page.
* uri bar -> yes, even though we can write stuff to the fifo, it can still be convenient to change the url manually and stuff, so a widget in uzbl itself is good.
* tabs -> yes. you don't have to use them, but you can.
* back/forward/.. buttons? -> no: use keyboard shortcuts.
* searching in a page? not sure.. maybe we can abuse the statusbar for that too.
  eg toggle it on when the user wants to search for something and then do searching in some vim-like fashion.
  we don't need a gtk text entry widget, just a feedback display of what the current command is.
* scrollbar? no: use keyboard shortcuts.  we should however have some info about the page length and where we are.
  -> option 1: put a percentage in the window title                 
  -> option 2: everytime you hit a key to change position, temporarily make a statusbar visible and put the percentage in the statusbar.
  what will we do with pages who are too wide? horizontal scrolling?

all of the above goes in 1 bar at the top of the program. there should be a key to toggle visibility of it and one to toggle visibilety + focus on the entrybar at once.

input welcome!

Last edited by Dieter@be (2009-04-24 17:50:08)


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#98 2009-04-24 17:50:14

Wra!th
Member
Registered: 2009-03-31
Posts: 342

Re: uzbl. A browser that adheres to the unix philosophy.

Wow big surprise


MacGregor DESPITE THEM!
7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00

Offline

#99 2009-04-24 17:55:54

Shunpike
Member
From: France
Registered: 2009-01-28
Posts: 47

Re: uzbl. A browser that adheres to the unix philosophy.

Dieter@be : You should mix the concepts of "status bar" and "uri bar", pretty much like Vim does. Like a one-line command prompt. Tabs should definetly not go into uzbl IMO.

And the bar should not go at the top of the top of the program, but anywhere the user wants to ;-)

Offline

#100 2009-04-24 17:57:12

XFire
Member
From: UK
Registered: 2008-05-11
Posts: 192

Re: uzbl. A browser that adheres to the unix philosophy.

Instead of having a dedicated address bar, could there be a pop-up where the address can be typed in?

Or

You could also integrate the status bar into the address bar, there is a firefox plugin, called fission which does that, which would save space. If possible you could get it to do the loading bar in the address bar, thus saving space.

I agree with the back/forward shortcuts on the keyboard, the buttons waste a lot of space.

Also - I love the browser, its nice to just have the page and the title bar, no crap in between.

Last edited by XFire (2009-04-24 17:57:53)


There is a difference between bleeding [edge] and haemorrhaging. - Allan

Offline

Board footer

Powered by FluxBB