Git Product home page Git Product logo

Comments (15)

mathstuf avatar mathstuf commented on May 15, 2024

This could be a variable that uzbl-tabbed pays attention to.

from uzbl.

GSI avatar GSI commented on May 15, 2024

Is there a way to prevent closing the window when closing the last tab?

I was very accustomed to that too, but that was due to "firefox bias" :)

Now I don't actually see any reason for a feature like that - what do you need an empty browser for? You'll most likely want to navigate to another site anyway, so why bother about what's currently open?

from uzbl.

spcmd avatar spcmd commented on May 15, 2024

I don't like to keep open any page if I don't need it. Reasons mainly: resource usage, privacy. I also have my own customized home page and I'd like to see that if my browser is "empty". I also don't like to relaunch the browser every time, so this is why I need a solution for this.

from uzbl.

keis avatar keis commented on May 15, 2024

The best place to implement this would be inside tabbed. UzblTabbed.tab_closed has some very simple logic that calls quit() when there is no more open pages. Configurable by some setting this should instead by calling new_tab()

from uzbl.

spcmd avatar spcmd commented on May 15, 2024

Today I wrote a little "workaround". Can be used as a temporary solution until uzbl gets a proper option/setting for this:

exit_keep_last_tab.sh

#!/bin/sh

count_tabs=$(pgrep uzbl | wc -l)

if [ "$count_tabs" -gt 1 ]; then
    echo "exit" > "$UZBL_FIFO"
else
    echo "set uri = file://@config_home/uzbl/newtab.html" > "$UZBL_FIFO"
fi

Then I set the key binding for this in the config:

# close tabs (keep the last tab open)
@cbind d = spawn @scripts_dir/exit_keep_last_tab.sh

from uzbl.

mathstuf avatar mathstuf commented on May 15, 2024

Just an FYI, that will fail for any number of reasons because the pgrep uzbl (and the wc -l is better replaced with the -c flag to pgrep) will false-positive for instances outside of the uzbl-tabbed, other users running uzbl, and probably others.

from uzbl.

spcmd avatar spcmd commented on May 15, 2024

Yeah, you are right, pgrep -c is better. For the instance part: I use the uzbl-tabbed once, I don't use other tabbed or single window instances, so it's okay for me at the moment.

But a proper config setting or something would be better of course. :)

from uzbl.

mathstuf avatar mathstuf commented on May 15, 2024

I figured, but before others go and run with this script, the caveats might be useful to know :) .

from uzbl.

spcmd avatar spcmd commented on May 15, 2024

Unfortunately my script is not working well with the git version of uzbl. It was okay with the quite old Arch Linux package, but today I installed the git version (tabbed-next) from the AUR and the tab closing is "hanging" for seconds with the script I wrote. I added a notification for the script to check the execution time, it was okay (instant), but for some reason the tab didn't get closed until a few seconds.

The interesting thing is if I hit any key after the close, then it closes instantly. I can hit the d key twice and it closes instantly. It isn't a key binding conflict, I tried with different keys.

I tried with the FIFO and the socket too, I tried the git master branch too, the results are all the same.

from uzbl.

mathstuf avatar mathstuf commented on May 15, 2024

There's some buffering happening in the I/O system :/ . Thought that was finally fixed.

from uzbl.

GSI avatar GSI commented on May 15, 2024

@spcmd

Reasons mainly: resource usage, privacy.

Given you mention "resource usage", I realized that your process of opening an entirely new window may be (unneccesarily?) complicated.

Otherwise you could just close the window altogether.

I use Mod4+[SOMEKEY] to fire up the browser, so I don't worry about accidently closing my instance and then having to navigate to some icon to click.

Also, I always made heavy use of tabs. After switching to dwm I realized that I was just solving a problem I wouldn't need to have in the first place.

Tabs leave you guessing about their contents until you switch (back) to them. A proper WM let's you preview contents of all windows and switch quickly.

Also, tabs cause additional headache:
When you rotate through them and any of the websites sets the focus to a form field, uzbl, by default, goes into insert mode. So you have to press Esc to continue rotating.

Now I exclusively use uzbl-browser. In my opinion, uzbl-tabbed could be dropped altogether. Actually it should be dropped in order to free up the limited developer time available for more important parts of uzbl.

The browser surf, for example, implements the Xembed specification so it can be "tabbed" using an according tool like http://tools.suckless.org/tabbed

=> Unix philosophy

from uzbl.

GSI avatar GSI commented on May 15, 2024

Ah, and why not just start your browser with this command:

while 1 ; do uzbl-tabbed ; done

=> Whenever you close the last tab, you get a fresh uzbl.

from uzbl.

spcmd avatar spcmd commented on May 15, 2024

@GSI

With some tiling WMs you can live without tabbed, but if someone uses for example Openbox, it won't be a nice user experience. Also, every modern browser have tabs, even w3m (which is a CLI/TUI browser) has this feature. And it's a preference. I prefer tabs.

When you rotate through them and any of the websites sets the focus to a form field, uzbl, by default, goes into insert mode. So you have to press Esc to continue rotating.

With the older version of uzbl this worked for me (mostly):

@on_event   LOAD_FINISH    event ESCAPE
@on_event   FOCUS_GAINED   event ESCAPE

Seems like it doesn't work anymore. But maybe it can be fixed somehow.

For the while loop part: it works, but it's slower than redirecting the last page to a custom home page (local file) or a blank page, because it always restarts the whole browser. Maybe it's not a problem if you have a SSD, but with a HDD (especially when it's under load) it could be relatively slow.

I know this tab thing isn't the biggest problem, we can use a "workaround" like the script I wrote above. That I/O buffering issue which was mentioned before is more of a problem now (but it's another topic/issue I think).

from uzbl.

keis avatar keis commented on May 15, 2024

Just to clear a few things up.

uzbl-core also implements xembed and should in theory work with suckless tabbed or some similiar tool. In fact uzbl-tabbed works exactly the same way by launching a full uzbl for each tab and it turns out to not be a big deal performance wise.

autofocus is implemented in the config, you could simply drop that line if you don't want it

from uzbl.

GSI avatar GSI commented on May 15, 2024

from uzbl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.