As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label Vimperator. Show all posts

Click trapping is a good thing to prevent you from accidentally clicking on something while you only want to preview the output of your post. But I need to be able to click because I check related posts to see if I can add related internal links for currently writing post.

So, a quick solution:
" get rid of clickTrap of Blogger post writing preview
style yjlv.blogspot.com div.blogger-clickTrap { display: none }
or
" get rid of clickTrap of Blogger post writing preview
style [blog-name].blogspot.com div.blogger-clickTrap { display: none }
for non-custom domain blogs.

No add-on/plugin or whatsoever required, Vimperator/Pentadactyl makes things easier and fixes quick. One-liner, that's all. I used to remove it by using FireBug to delete that element, four clicks, I think.

I do think Blogger should offer an option to disable it, because not everyone is a fan of that. And I do prefer to check links by hovering over link anchors and read the status bar.

Also, on Blogger, you can code JavaScript in your blog post which is awesome for JavaScript topic bloggers, so some UI may be displayed and interaction is needed. Though this is very rare case, 99% people wouldn't code and I don't actually code directly on Blogger but with local file generated with reStructuredText. So this part doesn't cause trouble for me at all.

Once again, I switch to something better. But this time is different, it's not the Vimperator broken, well it is in some sense of interpretation. It's because the basis of philosophy. I would never expect myself switching because this kind of point of view. I always think people who so insist in using Open Source are like Saints. (Hope you get what I really mean in that)

Anyway, after I posted about encryption status in Vimperator, I stumbled on this wiki page, VimperatorVsPentadactyl. Now I see why they have been getting rid of us.

Right now, I have switched to Pentadactyl. Here is the diff of what I have changed. It virtually produces exactly same result as before.

A few things I have learnt:
  • Vim syntax file is generated by running :mks in Pentadactyl. It will put the file at right place for you.
  • Colorscheme extension is .penta.
  • guioptions not toolbars, since that's where it was. It also has option for statusline, so I don't need to hack the style anymore.
  • You need to define function in window in your ~/.pentadactylrc, i.e. window.func = function(){};. this !== window.
  • :if :elseif :else :endif is nice.

Pentadactyl intergates statusline with the Addon bar, so those addon button, you can see next to the statusline. I personally do not like this. But I like the loading indication, which is what Vimperator nuked. And the encryption status, also what Vimperator nuked. I now understand how many stuff Vimperator has erased.

I have known Pentadactyl long ago, at that time, Vimperator has made a lot of changes, so I decided not to switch. But, it doesn't really seem to change much, some of my code I didn't even touch.

Two things I have to complain is now I need to get used to C-V and C-Z after I finally got comfortable with inhuman Ins or S-Esc.

The latter is the worst keybinding throughout the computing history, though insert key isn't much better, that takes me eons to get used of them. They should've just tell those people, use your mouse to uninstall Vimperator, problem solved!

The second thing, the name is...

Time for the final step:

:extdelete Vimperator

Mission accomplished.


I hate that red thing!

Yes, I have Google+ account, so? Even I did use Google+, I would not want that red thing on my navigation bar. I bet there are 1,312 apps already on every operating system, on every pad, on every phone, in every web browser as addon, or in every app store (or even in your toilet while you are taking care of smelly business), which allow you to get notified about your... err... I have no idea what you can get notified. Because I don't use that cross, eh... I mean Plus.

I have been waiting patiently to see if Google will add an option in Account settings, but still nothing. I guess you Google+ users love that red thing.

I would like to use Evanesco, but I am out of practice. So, I used the best tool I have, instead, Vimperator, to fix that thing.


I could have just hidden the whole navigation bar, but I did use that gear icon a few times, so I kept the bar in minimum.

Side note: if you look closer, you could see Groups and Gmail have fixed width text. But that is another story and here is another compliant about Blogger's editor's HTML mode: Was that a designer who made a call of HTML mode's font? It's as if so many artists dislike Comic Sans and we programmers dislike variant width text when you are dealing with codes. It feels just as if you open Word to write a C code, so wrong!

Anyway, this is not really fixing anything, it just hides stuff. The script to retrieve the number of notifications still runs in background. And that is another point I want to make, that number is updated a least a second later or longer, how could you possibly to want that snail to deliver you so important social interactive responding interconnection index. Get a desktop notification app. (The snail: who's summoning me? Oh boy, a second please, I need to take a breath first.)

After fixing that thing, I found an interesting side-effect:


I kind of like this new Google homepage, so I didn't try to fix the fix.

Simply execute:

:set guioption!=s

Or you can bind it to any key you like.

1   Old content for Vimperator

I have wanted to hide the statusline for a long time, but never got any luck to do by myself and to find a solution. It’s hard to google it because people use wrong term. Some said “status bar,” some said “command line.” But the correct name is statusline, however more proper thing we are looking at is the grandparent node of statusline, bottombar. command line is only visible when you enter command line mode, so that’s really not the right name.

Anyway, I read the FAQ and found there is already an entry about auto-hiding1. The linked file is gone, but I did google and get the file. I didn’t try it because that plugin has too many functions that I don’t need and it’s too old, I doubt it would work with latest Vimperator. However, it did give me an idea what element ID I should be looking for at first.

Now I have the following code in my rc:

map <silent> <C-F8> :js toggle_bottombar()<CR>

:js << EOF
function toggle_bottombar() {
  var bb = document.getElementById('liberator-bottombar');
  if (!bb)
    return;
  bb.style.height = (bb.style.height == '') ? '0px' : '';
  bb.style.overflow = (bb.style.height == '') ? '' : 'hidden';
}
EOF

Using Ctrl+F8 to toggle. Note that when you want to enter a command, you need to bring bottombar back first manually. I am sure I can hook/wrap something so when enter command line, the bottombar can be brought back automatically, but I am too lazy to find out how to do that.

[1]Scroll down to “How can I hide the command line when it’s not in use?”

You probably have heard me worshiping Vimperator many times. Here is one more.

Note

In September, 2011, I switched to Pentadactyl. (2015-11-08T22:56:05Z)

For a long time, I had been struggling with browser’s about:blank or home (aka start) page. I need a page which is in dark, I couldn’t stand with bright color, they hurt my eyes. When I was using Chromium, I had to use theme. It’s inevitable on Chromium, you need to use a theme extension. I recall I could choose to use system color, but that seemed to bring other issue.

After I went back to Firefox for version 4 beta, I tried to find a solution. You could write a HTML page and set it as home page, it will be about:home. But, if you open a new tab, it’s about:blank. So, writing a dark blank home page won’t help. So, I changed the background color in Firefox preference dialog. But, again, I found many websites, actually lots of websites, have only specified either color or background-color in CSS, rather than set both or set none of them. That would be really a huge problem. I often saw black on dark background. I also tried to add styles in userChrome.css, but those I found on net, just didn’t work, probably not suitable for Firefox 4.

There is one solution I have known but never wanted to use, another add-on. There are add-ons for such task. But I would rather living with that bloody-eye-hurting white page than installing a new add-on. New add-on on Firefox? Not a chance to be installed by me.

Moments ago, somehow, I started to try PageLoad event in Vimperator. I have done that many times and also have tried to manipulate pages. No idea why I hadn’t tried before. Now I have the following codes to share,


" Set dark background
autocmd PageLoad about:blank js tabs.getTab(<tab>-1).linkedBrowser.contentDocument.body.style.backgroundColor = "#333"
" Reopen about:home when about:blank is loaded
autocmd PageLoad about:blank js tabs.getTab(<tab>-1).linkedBrowser.contentWindow.open('about:home')
" Reopen any page or URL when about:blank is read. Can use above and set home page to other page or URL
autocmd PageLoad about:blank js tabs.getTab(<tab>-1).linkedBrowser.contentWindow.open('file:///path/to/myhome.html')

Note

I am now using userContent.css to change about:blank background color. (2015-11-08T22:51:07Z)

Isn’t that wonderful? Vimperator saves me one more time. It is

You don’t really need to use Vimperator as we fans (of Vimperator and of Vim) do. You can make it use like normal Firefox—meaning you don’t have to press keys, but also be benefit from it.

Vimperator is awesome!

It’s not like that I don’t have Flash installed. But every time I click on the black speaker icon (and I have to use mouse to click), Flash gains the focus.

So I modified my ~/.vimperatorrc, I was thinking of using HTML5 Audio, unfortunately, MP3 is not supported.

So, I turned to use MPlayer via io.system(), it does a great job.

Now, after I click on speaker icon, I can continue to type Vimperator commands. If I want to go back to input box, I type gi. I also bind s key to play first pronunciation, of course, I have to press ESC first if the focus is on input box.

I noticed if I leave the page and go back to play, I will see errors. I am not sure what’s the problem, I guess I didn’t code it exactly right.

I think I used to press Ctrl+Shift+PageUp and Ctrl+Shift+PageDown when I started to use tabbing in Gnome Terminal or Gedit if I recall correctly.

I think Firefox did support such keys for some time, but I could be wrong. Chromium supports them. If you are a mouse person, you probably think this is not important. But if you also use multi-profile at the same time, i.e. using --no-remote for other profiles. The drag and drop for bookmarks or tabs doesn’t work for those browser processes with no-remote, which causes you can not drag a tab handler to re-order tabs, hence you need another way to re-order.

Using Vimperator proves that’s a great advantage once again. By adding the following lines to ~/.vimperatorrc:

map <C-S-PageUp> :tabm -1<CR>
map <C-S-PageDown> :tabm +1<CR>

I can use those keys to move a tab.

If you prefer JavaScript version, you can use:

map <C-S-PageUp> :js getBrowser().moveTabBackward()<CR>
map <C-S-PageDown> :js getBrowser().moveTabForward()<CR>

They work less perfect than Vimperator built-in command :tabm[ove] when the tab is the leftmost or rightmost tab and it also steals focus for tab handler.

1   Update on commandline.open() (2011-07-21T22:24:21Z)

Some months after I posted this, this didn’t work anymore. Yesterday, I finally decided to fix this. The JavaScript code is actually being evaluated, but the prompt with :bmark doesn’t show up. If I run manually, it still doesn’t sure, but the command has been entered into the history.

I read some plugins’ source code, but nothing really gave me any hint. They just work with virtually same commandline.open() code. But then I realized, they actually is executed after XMLHttpRequest().

So, the fix is

# map a :js my_bookmark_adder()<CR>
map a :js setTimeout(my_bookmark_adder, 0)<CR>

Or you can do it in the function.

I don’t know when and what actually cause this and I don’t really care. If you find out which commit causes this, feel free to tell me.

2   Original post

If you use bookmarks to organize your to-read list, or you bookmark on certain website a lot. You might want to tag with readlater or remove some words from bookmark titles, such as website’s name.

After latest nightly build update, Firefox 4's Statusbar has gone AWOL and Add-on bar just enrolled.

2010-09-24--12:55:34

There is a discussion, but I didn't really read it. All I know is I have to wait for Vimperator to update, so things will get back to what it used to be. Now the Vimperator's statusline stays on top of this new Add-on bar and looks very awkward.

I pulled some buttons from navigation and bookmark bars onto Add-on bar, so it won't look so empty.

Firefox 4's UI changes is truly a pain-in-ass for Vimperator. Everyday, I might be surprised.

Updated on 2010-09-25

Since I can't really do anything to this new Add-on bar, I decided to embrace it:



The only problem is the width of Vimperator's bar. I can't make it auto-adjust by the window size.
#addon-bar {
  -moz-appearance: none !important;
}

#addon-bar,
#addon-bar * {
  background: #222 !important;
  color: #ddc !important;
}

#liberator-statusline {
  background-color: transparent !important;
  width: 800px !important;
}

For a long time, YouTube and Google Groups always make me groan. I often ended up with searching something like o gm, I was opening Gmail actually.

Their search boxes steal my precious control. If you are using that slow mouse&mdash;point, point, and click, you probably have never noticed that YouTube and Google Groups kindly help you enter the search box, they thought it’s convenient for users. Wrong! When most of sites don’t help users with that—and “why they don’t? Think, YouTube and Google Groups!” you are only creating burden for users.

Luckily, it’s easy to fix with Vimperator:

" Get my damn focus back
autocmd PageLoad (www\\.youtube|groups.google)\\.com :normal &lt;Esc&gt;

I use autocmd to emulate a keypress of Escape to exiting Input mode.

A side note if you are also using Gmail’s and Reader’s shortcut keys a lot, the following command let you enter Pass through mode automatically:

" Enter passthrough mode automatically in Gmail, Reader
autocmd LocationChange .* js modes.passAllKeys = /(mail\.google\.com|www\.google\.com\/reader\/)/.test(buffer.URL)

I was hoping I could find a way to re-map a and A because I usually have to re-add bookmark after I wanted to Mark all as read using A, it’s a removal of bookmark. I couldn’t find any, but the method above is acceptable.

I asked for a new feature1 of Vimperator. Basically, I was not satisfied with the style of tabs bar (aka tabbrowser), they don’t look consistent with Vimperator’s statusline. After I asked for it, I realized it might get implemented, so I decided to make my own when I found out userChrome.css can do it. I can also added it to Vimperator plugin, it’s not a hard task, just put it in and modify the manifest. But it’s not customizable yet, it will require some programming in Vimperator’s code.

Anyway, here is what I have now:

http://farm5.static.flickr.com/4095/4946686947_a0584635d5_z.jpg

The Vimperator is using my own style, vimPgray. You can download my userChrome.css, it might not works as you seen in screenshot. I customized in Firefox 4 and some are from vimPgray, e.g. the text shadow, but you can add on your own.

They are now nearly perfect to me, all gray!

Few issues:

  1. The all tabs button (#alltabs-button), I was able to replace it with css content, but the dropdown menu would not show up for some unknown reason after I clicked the button.
  2. I tried to replace the loading images from Firefox 4 with Unicode Block Elements (U+2581-8), but the layout was messed up.
  3. The close button and new tab button are just okay.
  4. I didn’t change the styles of menu/location/etc.

Someday my Vimperator and Firefox will be flawless.

[1]http://code.google.com/p/vimperator-labs/issues/detail?id=399 is gone.

http://farm5.static.flickr.com/4135/4928325322_134fa21633.jpg

I am using Firefox 64-bit beta 5 prerelease nightly build, it works well on my Gentoo. And Vimperator also works, well, from the repository, of course. I have to edit the install.rdf because it only sets up up to beta 4. I bumped the version and built the xpi, it works great!

Almost all addons are not compatible with beta 5, AdBlock is the only one has an update for beta 5 prerelease, but I disabled it later. The reason I don’t want to use AdBlock is same as I have with Chrome. The speed has been improved, though it is still slower than Chrome.

I think I should get some numbers, so I tested it with first website I could find from search.

Before I show you the results, I must tell you that I just wanted to get a rough idea about how fast they could execute JavaScript, I didn’t try to make sure my system is all ready for the benchmark test to run. I had some programs running behind but they were not heavy tasks. Firefox 3.6.8 (8 addons) and Chromium (2 extensions) have some addons installed, but I don’t think it would make big difference if I disable them.

Now, here is the chart and numbers:

http://chart.apis.google.com/chart?chxl=1:|||(ms)|Time||&chxr=0,0,1400&chxt=y,y&chbh=a&chs=800x320&cht=bvg&chco=A2C180,FF9900,BBCCED,7777CC&chds=0,1400,0,1400,0,1400,0,1400&chd=t:447.4|480.8|719.4|1255.8&chdl=Chromium+6.0.490.1|Opera+10.61|Firefox+4.0b5pre|Firefox+3.6.8&chg=-1,7,4,0&chtt=Browsers+SunSpider+Tests"
BrowserTotal
Chromium 6.0.490.10447.4ms +/- 12.3%
Opera 10.610480.8ms +/- 01.4%
Firefox 4.0b5pre0719.4ms +/- 01.9%
Firefox 3.6.81255.8ms +/- 01.2%

From the results, Fireforx 4.0b5pre is about 60.8% slower, but a benchmark is an intense test in different special cases. The real use might not result in such difference. When I just fired it up, I immediately felt the performance improved and I couldn’t real tell if it’s faster or slower than Chromium. The memory usage also seems improved, though I haven’t used it thoroughly.

Vimperator is always something very important addon for me, I even tried to create a similar way to open bookmark in Chromium. Since it’s already in beta stage and stable enough for me, so I think I should probably go back to Firefox and Vimperator. Hope the future release could have more performance improvement. UI improvement is really useless to me since I use Vimperator.

If you have read my last few posts, then you should know I am trying to make my desktop look dark. I feel darkness somehow could look great if everything is set up well.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0s4Va09hFTzrh3pXMj4kNV3hraDFThHTlDw8_tcpM3_e6U7opsVSCpRHnDAFtyXA9XzfJZ2vunwGrC8twa4n7kNlHJ-HHcaCaPvI-7rbNhb5neDypypSPEzaJJ5Tj6K8OfdOgIhD34wk/s400/Going%20Dark.png

My Window Manager is Fluxbox, it took me few hours to adjust Fluxbox, Most of programs I use are GTK+, so I installed a dark theme Clearlooks ZenBurn for GTK+. But there is a problem for those programs, the icon theme. They usually have high contrast in dark background, but I didn’t try to install a new one, or say I couldn’t find a good one. However, that’s still fine to me with many of them. As for QT apps, I decided not to touch them.

OpenOffice is the worst one under the dark theme, you could see by yourself. Firefox is okay, by the way, I also made a Vimperator colorscheme for it. Chromium is fine with this theme, there are one or two good dark theme which you can download from Google, but I would say just switch to GTK+ theme.

The most serious problem is the websites, only few websites provides theme and that doesn’t mean you will get a theme working nice with darkness. I was thinking if I should develop one extension for Chrome, which can automatically adjust the colors, then I stumbled upon userstyles.org. It has dark themes for most popular websites, and amazingly, with Chrome, you can install them as extension just for a few clicks. But they don’t always work if the websites get updated.

As for terminal apps, that would be much better since they usually only use 16 colors and that you have full control of those colors. You can simply reduce the saturation or lightness of the colors, so to low the contrast. One app I know is using theme is Midnight Commander.

I don’t have desktop image but pure plain color. The only thing I have on desktop is Conky. I changed the colors but it definitely wouldn’t fit your taste.

When I try to change Layout of blogs on Blogger, those popups are always opened as new tab. I disabled some and re-enabled addons, then I found out this is about Vimperator. It always overrides browser.link.open_newwindow.restriction with value 0. Which caused the popups open as in a new tab. No matter how you manually reset or issue a command :set popup=2 in Vimperator, that goes back to 0 after Firefox restarts.



After read the :help, Vimperator does support a configuration file, ~/.vimperatorrc. That functions like a .vimrc. Simply write your commands in, so I have

set popups=2
in ~/.vimperatorrc.



RTFM is the solution.