Run script when X window title changes

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












This script changes Firefox window titles from this pattern [PageName] - Mozilla Firefox to just [pageName]:



pids=$(xdotool search --class "Firefox")
for pid in $pids; do
name=$(xdotool getwindowname $pid)
new_title=$(echo $name | sed "s/- Mozilla Firefox//")

if [[ $name == "$name" ]] && [[ $name != "" ]]; then
xdotool search --name "$name" set_window --name "$new_title"
fi
done


Does anyone know if there is something like an OnWindowChange hook or another solution, that allows to run the script automatically, whenever a window title changes or a new window is created?



I'm using i3 window manager. Maybe there is a way to hook this up there?







share|improve this question


















  • 1




    try ` xprop -spy -root _NET_ACTIVE_WINDOW`
    – Ipor Sircer
    Dec 15 '17 at 14:44










  • In the X11 protocol, it's called a PropertyNotify event. I don't think i3 can react to that but Devilspie probably can.
    – Gilles
    Dec 15 '17 at 21:12














up vote
1
down vote

favorite












This script changes Firefox window titles from this pattern [PageName] - Mozilla Firefox to just [pageName]:



pids=$(xdotool search --class "Firefox")
for pid in $pids; do
name=$(xdotool getwindowname $pid)
new_title=$(echo $name | sed "s/- Mozilla Firefox//")

if [[ $name == "$name" ]] && [[ $name != "" ]]; then
xdotool search --name "$name" set_window --name "$new_title"
fi
done


Does anyone know if there is something like an OnWindowChange hook or another solution, that allows to run the script automatically, whenever a window title changes or a new window is created?



I'm using i3 window manager. Maybe there is a way to hook this up there?







share|improve this question


















  • 1




    try ` xprop -spy -root _NET_ACTIVE_WINDOW`
    – Ipor Sircer
    Dec 15 '17 at 14:44










  • In the X11 protocol, it's called a PropertyNotify event. I don't think i3 can react to that but Devilspie probably can.
    – Gilles
    Dec 15 '17 at 21:12












up vote
1
down vote

favorite









up vote
1
down vote

favorite











This script changes Firefox window titles from this pattern [PageName] - Mozilla Firefox to just [pageName]:



pids=$(xdotool search --class "Firefox")
for pid in $pids; do
name=$(xdotool getwindowname $pid)
new_title=$(echo $name | sed "s/- Mozilla Firefox//")

if [[ $name == "$name" ]] && [[ $name != "" ]]; then
xdotool search --name "$name" set_window --name "$new_title"
fi
done


Does anyone know if there is something like an OnWindowChange hook or another solution, that allows to run the script automatically, whenever a window title changes or a new window is created?



I'm using i3 window manager. Maybe there is a way to hook this up there?







share|improve this question














This script changes Firefox window titles from this pattern [PageName] - Mozilla Firefox to just [pageName]:



pids=$(xdotool search --class "Firefox")
for pid in $pids; do
name=$(xdotool getwindowname $pid)
new_title=$(echo $name | sed "s/- Mozilla Firefox//")

if [[ $name == "$name" ]] && [[ $name != "" ]]; then
xdotool search --name "$name" set_window --name "$new_title"
fi
done


Does anyone know if there is something like an OnWindowChange hook or another solution, that allows to run the script automatically, whenever a window title changes or a new window is created?



I'm using i3 window manager. Maybe there is a way to hook this up there?









share|improve this question













share|improve this question




share|improve this question








edited Dec 15 '17 at 21:08









Gilles

507k12010031530




507k12010031530










asked Dec 15 '17 at 14:37









Rotareti

2731313




2731313







  • 1




    try ` xprop -spy -root _NET_ACTIVE_WINDOW`
    – Ipor Sircer
    Dec 15 '17 at 14:44










  • In the X11 protocol, it's called a PropertyNotify event. I don't think i3 can react to that but Devilspie probably can.
    – Gilles
    Dec 15 '17 at 21:12












  • 1




    try ` xprop -spy -root _NET_ACTIVE_WINDOW`
    – Ipor Sircer
    Dec 15 '17 at 14:44










  • In the X11 protocol, it's called a PropertyNotify event. I don't think i3 can react to that but Devilspie probably can.
    – Gilles
    Dec 15 '17 at 21:12







1




1




try ` xprop -spy -root _NET_ACTIVE_WINDOW`
– Ipor Sircer
Dec 15 '17 at 14:44




try ` xprop -spy -root _NET_ACTIVE_WINDOW`
– Ipor Sircer
Dec 15 '17 at 14:44












In the X11 protocol, it's called a PropertyNotify event. I don't think i3 can react to that but Devilspie probably can.
– Gilles
Dec 15 '17 at 21:12




In the X11 protocol, it's called a PropertyNotify event. I don't think i3 can react to that but Devilspie probably can.
– Gilles
Dec 15 '17 at 21:12















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f411069%2frun-script-when-x-window-title-changes%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f411069%2frun-script-when-x-window-title-changes%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay