This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Force custom manual titles for individual windows?

Tags: None
(comma "," separated)
Owen_R
Registered Member
Posts
8
Karma
0
[EDIT: nevermind figured out a kludge-around the limitation (by just making links of all the folders directly in my home dir).
I doubt the way I was trying to do it is possible through kwin anyway...?]

I see under the "edit window specific settings" thing that Kwin provides, that you can *match* windows by their titles (exact, regex, or substring), and then use that match to apply certain custom settings...

But I can't find a way to take an individual window and force it to have and keep a custom title.

How can I do this?

If I could only do this manual title setting thing, then I could use it with the "Present Windows" desktop effect to get a workflow that would work *really* well for me....



(For a concrete idea of what I'm trying to do and why:

I have like a couple dozen text editor windows open (Sublime 2, which by default gives a title to its window from the full path/file name of the file in the active tab).

They each have a dozen to a few dozen files open in them, in tabs.

I want to force each window to have a particular name, regardless of which tab in the window has focus.

I want to force them to have names like:

12-noun
13-verb
14-adjective
15-pronoun
16-adverb
17-article
18-preposition
19-conjunction
32-sentypes
33-constituents
34-phrases
35-predicates
36-orderargs
37-clauses
38-negation

(I have a p wide vertical taskbar, so all the window titles are visible there, but of course they're all "~/Dropbox/blahblahrestofthelongpath......")

See, I'm rewriting and reorganizing a p much exhaustive German reference grammar.

That's why I need such a ridiculously huge schmozzle of windows and tabs open at once, and a weird way of organizing and moving between them....)

[Kubuntu 13.10]
luebking
Karma
0
xprop -f _NET_WM_NAME 8u -set _NET_WM_NAME "foo is bar"

but that's not a rule nor last forever (the window may set aother title anytime) - maybe still of help
Owen_R
Registered Member
Posts
8
Karma
0
Oh, that's cool! Just enter command with new name, and click on the window just like xkill.

But yeah, the application just rewrites the title whenever you switch to a different tab (in dolphin, firefox, sublime, etc. obviously a really common behavior).

I am so not a leet enough dude to figure out how to hack around that... I mean, I guess you could watch for these renaming events, which come from ? and go to ? and... yeah, I have no idea.

Thanks, though!
luebking
Karma
0
there's "xprop -spy", one would call it in a loop and change the title once it updates - would require one running script per window, though.
Owen_R
Registered Member
Posts
8
Karma
0
Aha... I see `xprop -spy` spits out tons of strings for various things that happen in/to the window.

The only one I care about here is:
_NET_WM_ICON_NAME(UTF8_STRING) = "[whatever the new window title is]"
right?

So abstractly, the script I want would be something like this?:

Code: Select all
name_i_want = [accept input]
window_id   = xprop [give me that + mouse icon, and I'll click on a window, and you output the id of the window I clicked on]
loop
   spy_string = [wait for the output of `xprop -spy` to update, then take that]
   if spy_string starts_with( '_NET_WM_ICON_NAME(UTF8_STRING) = ' )
      if not spy_string ends_with( name_i_want )
         xprop [rename the window with window_id to name_i_want]
         # so modify the command `xprop -f _NET_WM_NAME 8u -set _NET_WM_NAME "bluh"` somehow to use an id rather than the + mouse icon?


Uhhhh that's a lot of logical residue. Could you point me towards the real-code I need to replace that with?

Thanks!
luebking
Karma
0
something along this should work:

Code: Select all
#!/bin/sh
WANTED="$1"
WINDOW="$2"
while true; do
    xprop -spy _NET_WM_NAME -id "$WINDOW" | { read TITLE;  if [ "$TITLE" != "$WANTED" ]; then
    xprop -f _NET_WM_NAME 8u -set _NET_WM_NAME "$WANTED" -id "$WINDOW"
fi }
done


Code: Select all
$ force_title "foo is bar" 123456
Owen_R
Registered Member
Posts
8
Karma
0
Hey, thanks by the way. xD

I never used the help you gave me, got busy, and forgot about it until today.

Then I dug up your answer again and wrote a proper script. (I posted it as an answer to someone asking about the same problem here: http://unix.stackexchange.com/a/209338/119208 )
airdrik
Registered Member
Posts
1854
Karma
5
OS
Hmm... the spam bots are getting more interesting in their commentary.


airdrik, proud to be a member of KDE forums since 2008-Dec.


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]