Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url in window title #468

Open
JJK96 opened this issue Jan 8, 2018 · 8 comments
Open

url in window title #468

JJK96 opened this issue Jan 8, 2018 · 8 comments
Labels

Comments

@JJK96
Copy link

JJK96 commented Jan 8, 2018

Is it possible to have more control about what is shown in the window title, for example it would be useful to have the url of the current page in there so that keepass auto-type works better.

@fanglingsu
Copy link
Owner

@JJK96 I've already thought about something like this to allow the user to configure seomthing like the set statusline in vim. How does the keepass auto-type work? And how does it communicate with vimb?

@JJK96
Copy link
Author

JJK96 commented Jan 10, 2018

Keepass looks at the title of a window (any window, not specifically vimb) and compares that to the data you have stored with the key. So for example if the title contains the word github it will enter your github password.

Now, some websites dont have a very descriptive title, something like "Log in", for those websites it would be useful to have the url in the title so that keepass can also compare that.

@fanglingsu
Copy link
Owner

Sounds interesting! At the time you could change the title by hand (:e! document.title="The new title"), until we have a generic solution, so that the keepass can pick this up. I know that this is more a workaround, but with some key binding this is done really fast.

@JJK96
Copy link
Author

JJK96 commented Jan 10, 2018

thanks for the hint, I have found another solution, I placed

document.title+=' '+document.URL 

in scripts.js, which does exactly what I suggested.

edit: I just noticed that this does not work for when I open a page through a link. Is that intended behaviour?

@fanglingsu
Copy link
Owner

fanglingsu commented Jan 10, 2018

Oh, this is even better. If you have vimb compiles with autocmd support, following should help you to do this automatically.

augroup titlechange
autocmd LoadFinished * e! document.title+=' '+document.URL;
augroup end

I think id does not work properly in scripts.js, because it's not ensured that the dom is available at the time the script is executed. But you might observe the dom:loaded event.

@JJK96
Copy link
Author

JJK96 commented Jan 10, 2018

That works even better indeed, I changd LoadFinished to LoadCommitted however

@fanglingsu
Copy link
Owner

If LoadCommitted work, fine. But the LoadCommited might be fired before the DOM and the title are available.

@JJK96
Copy link
Author

JJK96 commented Jan 10, 2018

I noticed that indeed it did not go correctly for every website.

Thank you for your support, I think that this fixes my problem and any other problem where the title has to be edited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants