You are not logged in.
Jaejae wrote:m1sha wrote:So what's the preferred way to replace tabbing?
<ignore if not using a tiling WM>
I'm trying to use this in an Xmonad environment and I think it'd be fine to switch by putting the page I'm viewing in the master pane.
</ignore if not using a tiling WM>but can I
a) have uzbl realise it's been "minimized" and zoom out so I'm not looking a tiny corner of the page?
b) open link in new window with middle click?I've been considering a more general solution to this problem, a general purpose window tabber, I use dwm, and as far as I can see, there is no window tabbing patch, so something like this would be useful.
I imagine that such an application would have a simple tab bar, not unlike the Uzbl status bar, which would be controlled by keyboard shortcuts, and ideally be as flexible in this regard as Uzbl.The primary flaw in my plan is my almost complete lack of coding knowledge, past very elementary shell scripting
http://www.uzbl.org/faq.php "No tabs? Why do you need a new window for each page?" lists 3 possible approaches to this problem.
I don't understand why uzbl would need to "know" it has been minimized or whatever. opening links in new windows is possible yes.
No tabs? Why do you need a new window for each page?
We stick to "one page per uzbl instance" because that's a simple, clean and flexible method. We believe "multiple instances management" is something that must be handled outside of uzbl by a separate/different program. Here are some solutions:
* many window managers can (and should) handle this by default. Xmonads tabbed layout, Wmii's stacked layout and so on.
* you can write a custom script. The only thing you need to do is focus/maximize the instance you want, keep the others out of sight and use tools like dmenu and wmctrl to switch instances. This allows you to use application-specific properties (such as uzbl tag, name etc). For more information about this approach, see docs/multiple-instances-management (we'll maybe include some sample scripts in the future)
* We might implement a GtkPlug (Xembed child) in the future. So you could abuse that.
I read that and none of the solutions given seemed to help, I'm trying to do the first one, I'd rather not do the second if I don't have to and if the third comes along I'll see if I can work with it (even though Qt is the one true toolkit).
As for Uzbl "knowing" about resizing it's to make it identifiable. Maybe the easiest way to see what I mean is to try it. If the unused "tabs" are in small windows at the bottom of the screen and I want to switch to gmail or archlinux.org or whatever then it's hard to know which is which, the window might just be showing a little bit of text. OTOH if something visually identifiable came up when the window was resized (or even lost focus), say by zooming all the way out, or showing a big favicon, or just the name of the website it might make finding what you want a lot easier.
I know this and wanting one-click new windows only really become an issue when you use a lot of tabs simultaneously but I'm sure a few other users are guilty of that too.
Also thanks for all the great work you're doing!
Offline
I love the uzbl project. It's really what I'm looking for in a browser!
Yet I think it is crucial to be able to map links to numbers. I know this is possible with a javascript but still I would like to see it in core uzbl. This way one could query the socket for this map.
I would like to implement a download script that works like this (mapped to e.g. D): D [1,5-10,15,17] /path/to /save {filename%d.ext|filename-1,...filename-n}
This would call a script that converts the range given as first argument into the target links (based on that map I talked about) and call wget on the links.
I'm not sure one can realize this in javascript. One could also use that approach for bookmarks, opening links in "tabs" etc...
Offline
As far as uzbl is concerned, ':' is a character like any other. I did change the example keyboard shortcuts a bit though.
In the example, I use ':' as a means to insert any arbitrary command:# like this you can enter any command at runtime, interactively. prefixed by ':' bind :_ = chain '%s'
i see what happened, uzbl was seeing ":open www.google.com" as :_ with open as the argument, and not as :open _ as i had intended.
commenting the :_ bind makes my :open _ an :google _ commands work again
sorry for the false bug report.
//github/
Offline
Ok I have finished off some dodgy code to implement some form of tabbing in uzbl. It is based on what holizz started in uzbl_tabbed.py in the experimental branch. It isn't spectacular but it works.
#!/usr/bin/env python
import string, pygtk, gtk, sys, subprocess, os, re
pygtk.require('2.0')
show_tabs = False
temp_dir = "/tmp"
icon_path = "~/.local/share/uzbl/uzbl.png"
tab_colours = 'foreground = "khaki" background="#303030"'
selected_tab = 'foreground = "#303030" background="khaki"'
key_new_tab = '<control>t'
key_next_tab = '<control>q'
key_prev_tab = '<control>a'
def new_tab(accelgroup=None, acceleratable=None, accel_key=None, accel_mods=None):
ex = re.compile('uzbl_fifo_.')
fifos = ex.findall(str(os.listdir(temp_dir)))
num_tabs = len(fifos)
socket = gtk.Socket()
socket.show()
notebook.append_page(socket)
sid = socket.get_id()
subprocess.call(['sh', '-c', 'uzbl -s %s -n %s &' % (sid,num_tabs+1)])
notebook.set_current_page( notebook.get_n_pages()-1 )
def next_tab(accelgroup, acceleratable, accel_key, accel_mods):
if notebook.get_current_page()+1 == notebook.get_n_pages():
notebook.set_current_page(0)
else:
notebook.next_page()
def prev_tab(accelgroup, acceleratable, accel_key, accel_mods):
if notebook.get_current_page() == 0:
notebook.set_current_page(-1)
else:
notebook.prev_page()
def tab_added(notebook, child, page_num):
refresh_tab_list()
def tab_closed(notebook, child, page_num):
refresh_tab_list()
def tab_changed(notebook, page, page_num):
refresh_tab_list()
def refresh_tab_list():
ex = re.compile('uzbl_fifo_.')
fifos = ex.findall(str(os.listdir(temp_dir)))
if fifos:
fifos.sort()
else:
return
tab_message = '<span '+tab_colours+'> ' + str(range(1,len(fifos)+1)).strip('[]').replace(',','') + ' </span>'
for i, fifo in enumerate(fifos):
current_tab_message = tab_message.replace(' '+str(i+1)+' ', ' <span ' + selected_tab + '>' + str(i+1) + '</span> ')
file = open(os.path.join(temp_dir, fifo),'w')
file.write('set status_message = ' + current_tab_message + '\n')
file.close()
# create window
window = gtk.Window()
window.set_default_size(800,800)
window.set_title('Uzbl Browser')
window.set_icon( gtk.gdk.pixbuf_new_from_file(os.path.expanduser(icon_path)) )
window.show()
# create notebook
notebook = gtk.Notebook()
window.add(notebook)
notebook.set_show_tabs(show_tabs)
notebook.connect("page-added", tab_added)
notebook.connect("page-removed", tab_closed)
notebook.connect("switch-page", tab_changed)
notebook.show()
# add some keyboard shortcuts
accel_group = gtk.AccelGroup()
key, modifier = gtk.accelerator_parse(key_new_tab)
accel_group.connect_group(key, modifier, gtk.ACCEL_VISIBLE, new_tab)
key, modifier = gtk.accelerator_parse(key_next_tab)
accel_group.connect_group(key, modifier, gtk.ACCEL_VISIBLE, next_tab)
key, modifier = gtk.accelerator_parse(key_prev_tab)
accel_group.connect_group(key, modifier, gtk.ACCEL_VISIBLE, prev_tab)
window.add_accel_group(accel_group)
window.connect("destroy", lambda w: gtk.main_quit())
new_tab()
gtk.main()
some issues so far:
- the key commands to create/switch tabs are still sent on to uzbl.
- I don't know what the accelerator string for <control><tab> should be, so for now I am just using <control>q and <control>a, yes dodgy indeed.
- I use the 'page-added' notebook signal to refresh the tab list in the status bar, but it is emitted before the page is actually created, so my code doesn't see the new instance of uzbl (as it isn't created yet). Switching to another tab and back updates it properly.
- I am currently using the status_message variable to display the tabs in the status bar. Ideally I would like to use some other variable as status_message is used for the load handlers to give wait/recv/done info.
- status_background colour isn't honoured anymore, it goes back to the gtk default.
- the tab list isn't accurate if there are any instances of uzbl open outside of the notebook.
- new windows aren't caught in a new tab.
Anybody that wants to make any suggestions or improvements is more than welcome. Some of the issues mentioned above are easily solved, just I dont know/dont have time to figure out how.
edit: Oh yeah, you will need MSG somewhere in your status_format, I put mine directly after MODE. Markup doesn't matter, that is done in the python script.
Last edited by quigybo (2009-06-18 03:39:47)
Offline
Damn, should have tested it better before I posted it. Line 60 should be as follows;
current_tab_message = tab_message.replace(' '+str(i+1)+' ', ' <span ' + selected_tab + '>' + str(i+1) + '</span> ')
I have edited the original post too.
Offline
First off, this is hands down the best web browser ever, even with the current warts that come from being pre-alpha. To the devs I say keep up the amazing work, you're doing great!
Now, I've implemented vimperator-style quickmarks for anyone who's interested. Save this as '~/.config/uzbl/scripts/quickmarks.sh':
#!/bin/sh
# lc is the line count of the quickmarks file
# ln is the current line number in file
# line is the contents of line number ln
QUICKMARKS_FILE=$XDG_CONFIG_HOME/uzbl/quickmarks
lc=$(wc -l < $QUICKMARKS_FILE)
for (( ln=1 ; ln<=lc ; ln++ )); do
line=$(sed -n "$ln p" $QUICKMARKS_FILE)
letter=$(echo $line | cut -d " " -f 1)
url=$(echo $line | cut -d " " -f 2)
echo bind go$letter = uri $url
echo bind gn$letter = sh \"uzbl --uri $url\"
done
Then create ~/.config/uzbl/quickmarks and fill it with one quickmark per line, in the format "letter url". This is important; the script will not attempt to check that this file is in the expected format. For example:
a http://www.archlinux.org/
u uzbl.org
Then call it at the end of your config file like so:
sh "$XDG_CONFIG_HOME/uzbl/scripts/quickmarks.sh > $4"
Now, whenever you open uzbl, it will parse your quickmarks file and add keybindings to quickly move to your favorite web pages. With the example quickmarks file above, you could type 'goa' to take you to the Arch home page in the current window, or 'gnu' to take you to uzbl's page in a new window, etc.
If you don't like some of the decisions I made concerning file paths or key bindings, hopefully it's obvious what you need to change to customize it to your preference.
Last edited by fflarex (2009-06-19 17:02:34)
Offline
Definitely, I think this is a great browser.
I just put together a quick script to search through your history and load the most visited site that matches your inputted search terms.
#!/bin/bash
history_file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/history
fifo=$4
# grep for each search term
urls=`grep -i $8 "$history_file"`
while [ $# -ge 8 ]; do
search_terms="$search_terms $8"
urls=`echo "$urls" | grep -i $8`
shift
done
# find the most visited one
url=`echo "$urls" | awk '{print $3}' | sort -f | uniq -ci | sort -r | head -n 1 | awk '{print $2}'`
if [ $url ]; then
echo "uri $url" > $fifo
else
echo "uri http://google.com/search?sourceid=navclient&gfns=1&q=$search_terms" > $fifo
fi
It will search for urls that match all your search terms, then load the most visited one. If your search terms do not match any history items, a google search is performed instead. It can be called like this:
bind h _ = spawn /path/to/script.sh %s
It is really useful for going to commonly viewed sites, and because you can enter as many search terms as you like you can narrow it down really easily.
And as an aside, how can I set multiple variables to be shown in the status bar, like status_message / MSG but then user defined. It would be handy for the tab stuff I posted earlier, plus it would be nice to show status on files that you are downloading.
Offline
fflarex and quigybo, those look like pretty cool scripts.
@fflarex. avoid cat abuse. cat foo | wc -l == wc -l foo
@quigybo. if you use dmenu-vertical you can do really nice filtering. So an alternative way to implement your thing could be to order all url's by visit count and pipe them to the patched dmenu. If you then type characters in the dmenu input field it will select the most visited ones that match the query, in realtime. Eg it would be the same as our current load_from_history.sh but ordered by visit count instead of by recency.
Edit: oh yeah, feel free to put your scripts @ http://www.uzbl.org/wiki/scripts
This thread is no longer the most optimal means to reach the community.
Last edited by Dieter@be (2009-06-19 07:10:55)
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
@fflarex. avoid cat abuse. cat foo | wc -l == wc -l foo
I've changed the script to avoid cat, however 'cat foo | wc -l != wc -l foo'. It outputs the filename along with the line count, making it necessary to filter it. I ran a few unscientific, impromptu benchmarks and the cat method seems to be faster than piping the output through cut. Sed is slower than cut. Very insignificant performance difference, but it's consistently there. I'm considering changing it back. Even though it's ridiculous to optimize a shell script too much, I don't know that avoiding cat adds much to the clarity either. Anyways, I will look into adding this to uzbl's wiki later today.
Last edited by fflarex (2009-06-19 13:51:56)
Offline
@fflarex. avoid cat abuse. cat foo | wc -l == wc -l foo
i too hate the useless use of cat (usually as cat | grep or cat | awk... or even cat | grep | awk, ew...)
but i have to disagree when using it with wc (when you just want the number):
┌─[ 09:23 ][ blue:~ ]
└─> echo -e "some\nwords\ninto\na\nfile\n" > temp.txt
┌─[ 09:30 ][ blue:~ ]
└─> wc -l temp.txt
6 temp.txt
┌─[ 09:31 ][ blue:~ ]
└─> cat temp.txt | wc -l
6
┌─[ 09:32 ][ blue:~ ]
└─> time wc -l temp.txt | cut -d " " -f 1
6
real 0m0.004s
user 0m0.003s
sys 0m0.000s
┌─[ 09:31 ][ blue:~ ]
└─> time wc -l temp.txt | awk '{print $1}'
6
real 0m0.005s
user 0m0.000s
sys 0m0.003s
┌─[ 09:31 ][ blue:~ ]
└─> time cat temp.txt | wc -l
6
real 0m0.001s
user 0m0.000s
sys 0m0.000s
i rest my case.
anyways /OT
great browswer guys, gettin better every week
//github/
Offline
My mistake about the 'wc -l'. Carry on
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
Still cat abuse
[randy@voodoo test] $ echo -e "some\nwords\ninto\n\a\file\n" > file.txt
[randy@voodoo test] $ cat file.txt | wc -l
5
[randy@voodoo test] $ < file.txt | wc -l
5
[randy@voodoo test] $
archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson
Offline
Still cat abuse
[randy@voodoo test] $ echo -e "some\nwords\ninto\n\a\file\n" > file.txt [randy@voodoo test] $ cat file.txt | wc -l 5 [randy@voodoo test] $ < file.txt | wc -l 5 [randy@voodoo test] $
still pipe abuse (and not the good kind)
i think i've figured it out though.
┌─[ 12:33 ][ blue:~ ]
└─> wc -l < temp.txt
6
i just lost a bet... to my SELF!
[i hope ppl get that reference]
the linux word is sane again, cat is in fact still useless.
//github/
Offline
@Dieter_be: Yes I agree that it is very similar to what dmenu-vertical already does, it was just conventient for me this way if you already know which site should match the search terms. I won't bother putting it on the wiki, but I will put up the uzbl_tabbed.py script.
If anybody could help out and comment on some of the issues with the uzbl_tabbed.py script I posted above before I put it up on the wiki it would be much appreciated...
Offline
Hello i have one question about this browser
What with downloading files form rapidshare and other services (this browser don't have download manager).
Shell Scripter | C/C++/Python/Java Coder | ZSH
Offline
FYI: i've posted a script on the uzbl wiki that shows wget progress via a dzen bar placed just above the uzbl status bar when downloading files. just call it as the download handler in config.
the script:
#!/bin/sh
#
# Original dget.sh script:
# (c) 2007 by Robert Manea
#
# Modded for uzbl:
# 2009 by pbrisbin
#
# requires:
# dzen2
# wget
# xwininfo
# wmctrl (for now)
#
###
# the place to download to
DIR="$HOME/Downloads"
# how long to leave the 'finished' dialog up
SECS=2
# dzen format
BG='#303030'
FG='#606060'
FONT='-xos4-terminus-*-*-*-*-12-*-*-*-*-*-*-*'
# this allows simple up/down adjustments
pad=34
# these are passed in from uzbl
PID="$2"
XID="$3"
URL="$8"
# x-winid is coming over blank for me
# wmctrl provides a workaround
[ "$XID" = "" ] && XID=`wmctrl -lp | awk "/$PID/ '{print $1}'"`
# someone better with awk could probably parse this all at once
uzbl_X=`xwininfo -id $XID | awk '/Corners/ {print $2}' | cut -d '+' -f 2`
uzbl_Y=`xwininfo -id $XID | awk '/Corners/ {print $2}' | cut -d '+' -f 3`
uzbl_W=`xwininfo -id $XID | awk '/Width/ {print $2}'`
uzbl_H=`xwininfo -id $XID | awk '/Height/ {print $2}'`
# now that we have the uzbl geometry do whatever here
# to place it where you want
XPOS=$uzbl_X
YPOS=`expr $uzbl_Y + $uzbl_H - $pad`
WIDTH=$uzbl_W
HEIGHT=17
# the actual downloading...
# note: the button1 thing to cancel won't work for me
pushd "$DIR" &>/dev/null || exit 1
(wget --progress=dot --user-agent=Firefox "$URL" 2>&1; echo "Download complete."; sleep "$SECS") |\
dzen2 -ta c -w "$WIDTH" -h "$HEIGHT" -x "$XPOS" -y "$YPOS" -fg "$FG" -bg "$BG" -fn "$FONT" -e "button1=exec:pkill wget"
popd &>/dev/null
exit 0
/edit:
the script over at the uzbl wiki has been updated slightly; now the percentage reported by wget is piped through gdbar then onto dzen... the result is a much prettier progress bar in my opinion. i'm going to keep this post as is and put any changes i make in the uzbl wiki only.
Last edited by brisbin33 (2009-06-22 14:47:44)
//github/
Offline
Hello i have one question about this browser
What with downloading files form rapidshare and other services (this browser don't have download manager).
what about it? Surely you can use a script as download manager.
@brisbin33 put a screenie on that page kthxbye
Last edited by Dieter@be (2009-06-21 12:57:54)
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
Ok uzbl_tabbed.py is now up on the wiki for all to see.
It has been improved considerably from what I posted above, consider that one obsolete. I have also implemented a basic form of session saving/restoring. Enjoy.
Offline
@brisbin33: looks very pretty!
@quigybo: cool. A screenie wouldn't hurt either
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
Hi,
Is it possible to have a text box for launching uzbl (type url, press enter) as an xfce panel plugin?
Last edited by 9mqksfhn (2009-06-22 18:04:43)
Offline
Hi,
Is it possible to have a text box for launching uzbl (type url, press enter) as an xfce panel plugin?
Sure I guess. but you'll need to learn how to write xfce panel plugins. (which is not very hard but you need to know C)
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
There's already something here but it's for xfce 4.4 (doesn't seem to work in xfce 4.6): http://goodies.xfce.org/projects/panel- … ark-plugin + It has more features than I need. I just want to type a url and it opens in web browser rather than search.
Last edited by 9mqksfhn (2009-06-22 19:53:29)
Offline
There's already something here but it's for xfce 4.4 (doesn't seem to work in xfce 4.6): http://goodies.xfce.org/projects/panel- … ark-plugin + It has more features than I need. I just want to type a url and it opens in web browser rather than search.
Can't this be done with verve?
Otherwise you may want to look into something like gmrun, it is almost the same thing but is a separate pop-up app instead of in the panel. I prefer it over panel stuff as they take up space even if you aren't using them. Then you just need to set up a keyboard shortcut, this can be done through the xfce settings manager.
Offline
With the example quickmarks file above, you could type 'goa' to take you to the Arch home page in the current window, or 'gnu' to take you to uzbl's page in a new window, etc.
When I type 'go' or 'gn' it doesn't give me a chance to type the quickmark before it loads a blank url 'http:/' or opens a new window. I've made sure all my directories are set correctly, and that the quickmarks file is one per line. I can't even see what's wrong with the script - it looks like it should work.
Last edited by slyson (2009-06-23 09:28:41)
Offline