The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

Changing window title

asked 2014-07-01 00:47:49 +0000

Rojo gravatar image

Is it possible to change what i3 shows as the window title? For example, when several windows are tabbed, it would be nice if I could chose how they are referred to. Ideally, this could be done dynamically, but if not possible, I would also be interested in workarounds for specific applications. For example, some way to make all Firefox windows show up as "Firefox" (instead of the selected tab's title). If this is not possible from i3 and it always shows some title property of the x window, anyone knows how one could change that property, or if it makes sense/is safe to do so?

Thanks

edit retag flag offensive close merge delete

Comments

Why would you do this with Firefox? Imagine if Firefox labeled every tab in its window "Website." How would that be helpful?

ANOKNUSA gravatar imageANOKNUSA ( 2014-07-01 13:58:35 +0000 )edit

@ANOKNUSA I am not trying to rename the tabs, but the whole window, so that if the Firefox Window and some other windows are in a tabbed or stacked layout, they are named in some way that's more meaningful

Rojo gravatar imageRojo ( 2014-07-01 14:01:57 +0000 )edit

@ANOKUSA Ideally, it could be changed dynamically. But if I had to choose some static name for firefox windows, perhaps I'd chose the profile name and create different profiles (or the session of the Session Manager addon I use, which already allows to append the anme to the window title)

Rojo gravatar imageRojo ( 2014-07-01 14:02:58 +0000 )edit

Firefox was just an example. Ideally I would find useful to be able to change the title of any window

Rojo gravatar imageRojo ( 2014-07-01 14:04:01 +0000 )edit

I understood what you were asking, but naming every Firefox window "Firefox" would make it *less* meaningful.

ANOKNUSA gravatar imageANOKNUSA ( 2014-07-01 21:14:56 +0000 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-07-02 00:26:24 +0000

majkinetor gravatar image

updated 2014-07-02 00:27:28 +0000

Do it with the shell script:

#!/usr/bin/env bash
# Depends on: xdotool, wmctrl

FOCUSED=$(wmctrl -lp | grep $(xprop -root | grep _NET_ACTIVE_WINDOW | head -1 | awk '{print $5}' | sed 's/,//' | sed 's/^0x/0x0/'))
FPID=$(echo $FOCUSED | awk '{print $3}')
FNME=$(echo $FOCUSED | cut -f -4  -d ' ' --complement)
xdotool search -all --pid $FPID --name "$FNME" set_window -name "$*"

You can even execute it via dmenu. Test in terminal to change its name

set_title my new name
edit flag offensive delete link more

Comments

Wonderful! Thanks! This didn't work for me, but changing the script to ``xdotool set_window --name "$*" `xdotool getactivewindow` `` seems to do the trick (have barely tested). Do you see anything missing or wrong with this?

Rojo gravatar imageRojo ( 2014-07-02 02:08:55 +0000 )edit

Your version looks even better! Just check what happens with multiple windows with the same name, above mumbo jumbo is mostly because of it. You could make it work by checking output of all variables, maybe `cut` command messed up. I noticed I have different wmctrl output depending on how I start it

majkinetor gravatar imagemajkinetor ( 2014-07-02 13:35:24 +0000 )edit
1

answered 2014-07-01 06:31:21 +0000

Adaephon gravatar image

Window titles are set by the applications not by i3. i3 simply relays what is set in the WM_NAME or _NET_WM_NAME attributes. While it would be possible to patch i3 to display something else (in fact i3 uses part of WM_CLASS of windows for the titles of surrounding containers), I don't think it will be a configurable feature anytime soon.

That leaves modifying the title from inside the application. Most applications have no easy way to change their window titles. Fortunatelly, for Firefox there seem to be a few add-ons that may be useful. For example customizetitlebarv2, which seems to be able to do what you want (but I did not test it).

Terminal windows are also quite easy to do. Unless your shell already sets the title somewhere a simple echo -e "\e]0;Your title here\a" should do.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-07-01 00:47:49 +0000

Seen: 966 times

Last updated: Jul 02 '14