Closed machinedgod closed 2 years ago
@machinedgod The title is changed by on_webview_notify_title
in src/main.c. This is normally done every time the title is changed by the website. But as you mentioned there are pages that constantly change the title.
Could you say why you want to get the title and what you intend to do with this information?
If a command line option is acceptable for you - you could use --class=foo
or --name=bar
to set the WM_CLASS. But this seems to be what you currently use, isn't it?
Thank you for the solution sir, I'll attempt this first thing tomorrow.
If a command line option is acceptable for you - you could use --class=foo or --name=bar to set the WM_CLASS. But this seems to be what you currently use, isn't it?
This is perfectly acceptable - I just didn't know that I can set this manually using --class
and --name
. I did check the man beforehand, but didn't see anything that could help me (which doesn't mean it isn't there :))
Could you say why you want to get the title and what you intend to do with this information?
I don't care so much about the page title content - I just care that it doesn't change to unknown strings after Vimb opens the URL.
I want vimb instances to behave differently depending on which URL they have open - in respect with my desktop compositor and window manager. The simplest thing I have, to detect specific windows - is filtering by WM_CLASS and WM_NAME.
Example xprop
output when chatting with my friend:
WM_CLASS(STRING) = "vimb", "Vimb"
WM_NAME(STRING) = "Burn"
If I select another friend:
WM_CLASS(STRING) = "vimb", "Vimb"
WM_NAME(STRING) = "falledone"
For comparison, YouTube instance with a video:
WM_CLASS(STRING) = "vimb", "Vimb"
WM_NAME(STRING) = "Episode 256: An Insider's View of the Supply Chain - YouTube"
I can always detect this Vimb is on YouTube, because I can always test WMNAME for "- YouTube" suffix.
Right now, I hacked the problem it with a list of all possible titles that Discord can have, but obviously this'll break the moment I join a new server, channel, or get a new friend.
Hope this clears it out :-)
Hi all, I rely on WM_NAME and WM_CLASS to do the layout management. As title binds to WM_NAME, and as most of websites modify it in a sane manner, this is fairly easy to do: for example - I detect that
vimb
window is currently watching YouTube channel, and modify background transparency for it.Thing is, some websites are less than nice, and modify window titles in context-less manner. One example I'm currently struggling with is Discord - it changes title to reflect current channel or person you're talking to, without any indication whatsoever that this is a Discord website.
It seems its re-running this whenever windows gains focus, because using
:e! document.title="DISCORD"
didn't show a change when queried withxprop
(I have no window decorations). I also haven't found any AutoCommands that would execute on every refocus.So, I am now looking for a way to prevent website from doing this. I am aware that this might break some (very, very poorly written) javascript code that might rely on the title to branch - but I am OK breaking terribly written code anyway.
Thanks!
P.S. a commandline launch option to set windows title (like for example most of terminal emulators have), would be lovely! I don't mind writing a patch myself if I know it'd be accepted into the mainline.