<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>i3 FAQ - Individual question feed</title><link>https://faq.i3wm.org/questions/</link><description>Frequently asked questions and answers about the i3 window manager</description><atom:link href="http://faq.i3wm.org/feeds/question/2172/" rel="self"></atom:link><language>en</language><copyright>Copyright i3, 2012</copyright><lastBuildDate>Fri, 02 Oct 2015 12:37:54 +0000</lastBuildDate><item><title>How do I find the criteria for use with i3 config commands like for_window (e.g. to force splashscreens and dialogs to show in floating mode)?</title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/</link><description>i3 does a very good job at showing splashscreens, "Save As..." dialogs, etc. in floating mode. However, some applications were not designed with (mainly) tiling window managers in mind (one could call that a bug ;-) ), and their splashscreens or other windows may look odd when started in i3.
Now, i3 has the ability to force these windows to be floating, but how do I get the necessary criteria for use with `for_window`, etc.?</description><pubDate>Wed, 10 Jul 2013 20:26:34 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/</guid></item><item><title>Answer by ack006 for &lt;p&gt;i3 does a very good job at showing splashscreens, "Save As..." dialogs, etc. in floating mode. However, some applications were not designed with (mainly) tiling window managers in mind (one could call that a bug ;-) ), and their splashscreens or other windows may look odd when started in i3.
Now, i3 has the ability to force these windows to be floating, but how do I get the necessary criteria for use with &lt;code&gt;for_window&lt;/code&gt;, etc.?&lt;/p&gt;
 </title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?answer=2174#post-id-2174</link><description>While `xwininfo` and `xprop` will provide the raw data needed to write the criteria, manually copy/pasting all the relevant pieces of output into a criterion list can be tedious, so I've written a small script to automate this.

Running the script and clicking on a window will output all the criteria for it, ready to be copy/pasted after an i3 config command (remove any criteria that aren't needed).

Tip: to catch a splashscreen or transient popup "as it happens", run the script like this (using The GIMP as an example):

    $ gimp-2.8 &amp; ./i3-get-window-criteria

and click on the splashscreen as soon as it appears.

Example output for the above command:

    [class="Gimp-2.8" id=81788931 instance="gimp-2.8" title="GIMP Startup" window_role="gimp-startup"]

This output can be copy/pasted where needed, then edited to remove any criteria which would make the filter too specific for a particular use case.

Here's the script: 

    #!/bin/sh

    # i3-get-window-criteria - Get criteria for use with i3 config commands

    # To use, run this script, then click on a window.
    # Output is in the format: [&lt;name&gt;=&lt;value&gt; &lt;name&gt;=&lt;value&gt; ...]

    # Known problem: when WM_NAME is used as fallback for the 'title="&lt;string&gt;"' criterion,
    # quotes in "&lt;string&gt;" are not escaped properly. This is a problem with the output of `xprop`,
    # reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807

    PROGNAME=`basename "$0"`

    # Check for xwininfo and xprop
    for cmd in xwininfo xprop; do
        if ! which $cmd &gt; /dev/null 2&gt;&amp;1; then
            echo "$PROGNAME: $cmd: command not found" &gt;&amp;2
            exit 1
        fi
    done

    match_int='[0-9][0-9]*'
    match_string='".*"'
    match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference

    {
        # Run xwininfo, get window id
        window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
        echo "id=$window_id"

        # Run xprop, transform its output into i3 criteria. Handle fallback to
        # WM_NAME when _NET_WM_NAME isn't set
        xprop -id $window_id |
            sed -nr \
                -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
                -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
                -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
                -e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
                -e '${g; p}'
    } | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'
</description><pubDate>Wed, 10 Jul 2013 20:42:58 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?answer=2174#post-id-2174</guid></item><item><title>Comment by diablo465 for &lt;p&gt;While &lt;code&gt;xwininfo&lt;/code&gt; and &lt;code&gt;xprop&lt;/code&gt; will provide the raw data needed to write the criteria, manually copy/pasting all the relevant pieces of output into a criterion list can be tedious, so I've written a small script to automate this.&lt;/p&gt;

&lt;p&gt;Running the script and clicking on a window will output all the criteria for it, ready to be copy/pasted after an i3 config command (remove any criteria that aren't needed).&lt;/p&gt;

&lt;p&gt;Tip: to catch a splashscreen or transient popup "as it happens", run the script like this (using The GIMP as an example):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ gimp-2.8 &amp;amp; ./i3-get-window-criteria
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and click on the splashscreen as soon as it appears.&lt;/p&gt;

&lt;p&gt;Example output for the above command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[class="Gimp-2.8" id=81788931 instance="gimp-2.8" title="GIMP Startup" window_role="gimp-startup"]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This output can be copy/pasted where needed, then edited to remove any criteria which would make the filter too specific for a particular use case.&lt;/p&gt;

&lt;p&gt;Here's the script: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh

# i3-get-window-criteria - Get criteria for use with i3 config commands

# To use, run this script, then click on a window.
# Output is in the format: [&amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; &amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; ...]

# Known problem: when WM_NAME is used as fallback for the 'title="&amp;lt;string&amp;gt;"' criterion,
# quotes in "&amp;lt;string&amp;gt;" are not escaped properly. This is a problem with the output of `xprop`,
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807

PROGNAME=`basename "$0"`

# Check for xwininfo and xprop
for cmd in xwininfo xprop; do
    if ! which $cmd &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then
        echo "$PROGNAME: $cmd: command not found" &amp;gt;&amp;amp;2
        exit 1
    fi
done

match_int='[0-9][0-9]*'
match_string='".*"'
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference

{
    # Run xwininfo, get window id
    window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
    echo "id=$window_id"

    # Run xprop, transform its output into i3 criteria. Handle fallback to
    # WM_NAME when _NET_WM_NAME isn't set
    xprop -id $window_id |
        sed -nr \
            -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
            -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
            -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
            -e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
            -e '${g; p}'
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'
&lt;/code&gt;&lt;/pre&gt;
</title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=3357#comment-3357</link><description>good feedback, I wish to add 1 to this but does not have the privilege.</description><pubDate>Tue, 04 Feb 2014 05:10:17 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=3357#comment-3357</guid></item><item><title>Comment by Pete Priority for &lt;p&gt;While &lt;code&gt;xwininfo&lt;/code&gt; and &lt;code&gt;xprop&lt;/code&gt; will provide the raw data needed to write the criteria, manually copy/pasting all the relevant pieces of output into a criterion list can be tedious, so I've written a small script to automate this.&lt;/p&gt;

&lt;p&gt;Running the script and clicking on a window will output all the criteria for it, ready to be copy/pasted after an i3 config command (remove any criteria that aren't needed).&lt;/p&gt;

&lt;p&gt;Tip: to catch a splashscreen or transient popup "as it happens", run the script like this (using The GIMP as an example):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ gimp-2.8 &amp;amp; ./i3-get-window-criteria
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and click on the splashscreen as soon as it appears.&lt;/p&gt;

&lt;p&gt;Example output for the above command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[class="Gimp-2.8" id=81788931 instance="gimp-2.8" title="GIMP Startup" window_role="gimp-startup"]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This output can be copy/pasted where needed, then edited to remove any criteria which would make the filter too specific for a particular use case.&lt;/p&gt;

&lt;p&gt;Here's the script: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh

# i3-get-window-criteria - Get criteria for use with i3 config commands

# To use, run this script, then click on a window.
# Output is in the format: [&amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; &amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; ...]

# Known problem: when WM_NAME is used as fallback for the 'title="&amp;lt;string&amp;gt;"' criterion,
# quotes in "&amp;lt;string&amp;gt;" are not escaped properly. This is a problem with the output of `xprop`,
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807

PROGNAME=`basename "$0"`

# Check for xwininfo and xprop
for cmd in xwininfo xprop; do
    if ! which $cmd &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then
        echo "$PROGNAME: $cmd: command not found" &amp;gt;&amp;amp;2
        exit 1
    fi
done

match_int='[0-9][0-9]*'
match_string='".*"'
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference

{
    # Run xwininfo, get window id
    window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
    echo "id=$window_id"

    # Run xprop, transform its output into i3 criteria. Handle fallback to
    # WM_NAME when _NET_WM_NAME isn't set
    xprop -id $window_id |
        sed -nr \
            -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
            -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
            -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
            -e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
            -e '${g; p}'
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'
&lt;/code&gt;&lt;/pre&gt;
</title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=6772#comment-6772</link><description>This doesn't catch the window class of certain windows (like Mathematica's preference window) that don't have a window instance property. Fixed by adding
&lt;code&gt;-e "s/^WM_CLASS\(STRING\) = ($match_qstring)$/class=\1/p" \&lt;/code&gt;
after the first WM_CLASS line.</description><pubDate>Fri, 02 Oct 2015 12:34:28 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=6772#comment-6772</guid></item><item><title>Comment by Pete Priority for &lt;p&gt;While &lt;code&gt;xwininfo&lt;/code&gt; and &lt;code&gt;xprop&lt;/code&gt; will provide the raw data needed to write the criteria, manually copy/pasting all the relevant pieces of output into a criterion list can be tedious, so I've written a small script to automate this.&lt;/p&gt;

&lt;p&gt;Running the script and clicking on a window will output all the criteria for it, ready to be copy/pasted after an i3 config command (remove any criteria that aren't needed).&lt;/p&gt;

&lt;p&gt;Tip: to catch a splashscreen or transient popup "as it happens", run the script like this (using The GIMP as an example):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ gimp-2.8 &amp;amp; ./i3-get-window-criteria
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and click on the splashscreen as soon as it appears.&lt;/p&gt;

&lt;p&gt;Example output for the above command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[class="Gimp-2.8" id=81788931 instance="gimp-2.8" title="GIMP Startup" window_role="gimp-startup"]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This output can be copy/pasted where needed, then edited to remove any criteria which would make the filter too specific for a particular use case.&lt;/p&gt;

&lt;p&gt;Here's the script: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh

# i3-get-window-criteria - Get criteria for use with i3 config commands

# To use, run this script, then click on a window.
# Output is in the format: [&amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; &amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; ...]

# Known problem: when WM_NAME is used as fallback for the 'title="&amp;lt;string&amp;gt;"' criterion,
# quotes in "&amp;lt;string&amp;gt;" are not escaped properly. This is a problem with the output of `xprop`,
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807

PROGNAME=`basename "$0"`

# Check for xwininfo and xprop
for cmd in xwininfo xprop; do
    if ! which $cmd &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then
        echo "$PROGNAME: $cmd: command not found" &amp;gt;&amp;amp;2
        exit 1
    fi
done

match_int='[0-9][0-9]*'
match_string='".*"'
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference

{
    # Run xwininfo, get window id
    window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
    echo "id=$window_id"

    # Run xprop, transform its output into i3 criteria. Handle fallback to
    # WM_NAME when _NET_WM_NAME isn't set
    xprop -id $window_id |
        sed -nr \
            -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
            -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
            -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
            -e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
            -e '${g; p}'
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'
&lt;/code&gt;&lt;/pre&gt;
</title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=6773#comment-6773</link><description>See: &lt;a href="https://gist.github.com/PetePriority/9589fcf1820a36dd000a/revisions"&gt;https://gist.github.com/PetePriority/9589fcf1820a36dd000a/revisions&lt;/a&gt;</description><pubDate>Fri, 02 Oct 2015 12:37:54 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=6773#comment-6773</guid></item><item><title>Comment by joepd for &lt;p&gt;While &lt;code&gt;xwininfo&lt;/code&gt; and &lt;code&gt;xprop&lt;/code&gt; will provide the raw data needed to write the criteria, manually copy/pasting all the relevant pieces of output into a criterion list can be tedious, so I've written a small script to automate this.&lt;/p&gt;

&lt;p&gt;Running the script and clicking on a window will output all the criteria for it, ready to be copy/pasted after an i3 config command (remove any criteria that aren't needed).&lt;/p&gt;

&lt;p&gt;Tip: to catch a splashscreen or transient popup "as it happens", run the script like this (using The GIMP as an example):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ gimp-2.8 &amp;amp; ./i3-get-window-criteria
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and click on the splashscreen as soon as it appears.&lt;/p&gt;

&lt;p&gt;Example output for the above command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[class="Gimp-2.8" id=81788931 instance="gimp-2.8" title="GIMP Startup" window_role="gimp-startup"]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This output can be copy/pasted where needed, then edited to remove any criteria which would make the filter too specific for a particular use case.&lt;/p&gt;

&lt;p&gt;Here's the script: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh

# i3-get-window-criteria - Get criteria for use with i3 config commands

# To use, run this script, then click on a window.
# Output is in the format: [&amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; &amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; ...]

# Known problem: when WM_NAME is used as fallback for the 'title="&amp;lt;string&amp;gt;"' criterion,
# quotes in "&amp;lt;string&amp;gt;" are not escaped properly. This is a problem with the output of `xprop`,
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807

PROGNAME=`basename "$0"`

# Check for xwininfo and xprop
for cmd in xwininfo xprop; do
    if ! which $cmd &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then
        echo "$PROGNAME: $cmd: command not found" &amp;gt;&amp;amp;2
        exit 1
    fi
done

match_int='[0-9][0-9]*'
match_string='".*"'
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference

{
    # Run xwininfo, get window id
    window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
    echo "id=$window_id"

    # Run xprop, transform its output into i3 criteria. Handle fallback to
    # WM_NAME when _NET_WM_NAME isn't set
    xprop -id $window_id |
        sed -nr \
            -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
            -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
            -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
            -e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
            -e '${g; p}'
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'
&lt;/code&gt;&lt;/pre&gt;
</title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=2179#comment-2179</link><description>Q + A deserve +1. Thanks for sharing! </description><pubDate>Wed, 10 Jul 2013 22:11:46 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=2179#comment-2179</guid></item><item><title>Comment by ack006 for &lt;p&gt;While &lt;code&gt;xwininfo&lt;/code&gt; and &lt;code&gt;xprop&lt;/code&gt; will provide the raw data needed to write the criteria, manually copy/pasting all the relevant pieces of output into a criterion list can be tedious, so I've written a small script to automate this.&lt;/p&gt;

&lt;p&gt;Running the script and clicking on a window will output all the criteria for it, ready to be copy/pasted after an i3 config command (remove any criteria that aren't needed).&lt;/p&gt;

&lt;p&gt;Tip: to catch a splashscreen or transient popup "as it happens", run the script like this (using The GIMP as an example):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ gimp-2.8 &amp;amp; ./i3-get-window-criteria
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and click on the splashscreen as soon as it appears.&lt;/p&gt;

&lt;p&gt;Example output for the above command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[class="Gimp-2.8" id=81788931 instance="gimp-2.8" title="GIMP Startup" window_role="gimp-startup"]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This output can be copy/pasted where needed, then edited to remove any criteria which would make the filter too specific for a particular use case.&lt;/p&gt;

&lt;p&gt;Here's the script: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh

# i3-get-window-criteria - Get criteria for use with i3 config commands

# To use, run this script, then click on a window.
# Output is in the format: [&amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; &amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; ...]

# Known problem: when WM_NAME is used as fallback for the 'title="&amp;lt;string&amp;gt;"' criterion,
# quotes in "&amp;lt;string&amp;gt;" are not escaped properly. This is a problem with the output of `xprop`,
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807

PROGNAME=`basename "$0"`

# Check for xwininfo and xprop
for cmd in xwininfo xprop; do
    if ! which $cmd &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then
        echo "$PROGNAME: $cmd: command not found" &amp;gt;&amp;amp;2
        exit 1
    fi
done

match_int='[0-9][0-9]*'
match_string='".*"'
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference

{
    # Run xwininfo, get window id
    window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
    echo "id=$window_id"

    # Run xprop, transform its output into i3 criteria. Handle fallback to
    # WM_NAME when _NET_WM_NAME isn't set
    xprop -id $window_id |
        sed -nr \
            -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
            -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
            -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
            -e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
            -e '${g; p}'
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'
&lt;/code&gt;&lt;/pre&gt;
</title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=2180#comment-2180</link><description>Glad you like it :-) Bug (possibly in xprop) reported upstream, let's see what happens. https://bugs.freedesktop.org/show_bug.cgi?id=66807</description><pubDate>Thu, 11 Jul 2013 01:50:06 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=2180#comment-2180</guid></item><item><title>Comment by bruno.braga for &lt;p&gt;While &lt;code&gt;xwininfo&lt;/code&gt; and &lt;code&gt;xprop&lt;/code&gt; will provide the raw data needed to write the criteria, manually copy/pasting all the relevant pieces of output into a criterion list can be tedious, so I've written a small script to automate this.&lt;/p&gt;

&lt;p&gt;Running the script and clicking on a window will output all the criteria for it, ready to be copy/pasted after an i3 config command (remove any criteria that aren't needed).&lt;/p&gt;

&lt;p&gt;Tip: to catch a splashscreen or transient popup "as it happens", run the script like this (using The GIMP as an example):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ gimp-2.8 &amp;amp; ./i3-get-window-criteria
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and click on the splashscreen as soon as it appears.&lt;/p&gt;

&lt;p&gt;Example output for the above command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[class="Gimp-2.8" id=81788931 instance="gimp-2.8" title="GIMP Startup" window_role="gimp-startup"]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This output can be copy/pasted where needed, then edited to remove any criteria which would make the filter too specific for a particular use case.&lt;/p&gt;

&lt;p&gt;Here's the script: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh

# i3-get-window-criteria - Get criteria for use with i3 config commands

# To use, run this script, then click on a window.
# Output is in the format: [&amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; &amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; ...]

# Known problem: when WM_NAME is used as fallback for the 'title="&amp;lt;string&amp;gt;"' criterion,
# quotes in "&amp;lt;string&amp;gt;" are not escaped properly. This is a problem with the output of `xprop`,
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807

PROGNAME=`basename "$0"`

# Check for xwininfo and xprop
for cmd in xwininfo xprop; do
    if ! which $cmd &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then
        echo "$PROGNAME: $cmd: command not found" &amp;gt;&amp;amp;2
        exit 1
    fi
done

match_int='[0-9][0-9]*'
match_string='".*"'
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference

{
    # Run xwininfo, get window id
    window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
    echo "id=$window_id"

    # Run xprop, transform its output into i3 criteria. Handle fallback to
    # WM_NAME when _NET_WM_NAME isn't set
    xprop -id $window_id |
        sed -nr \
            -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
            -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
            -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
            -e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
            -e '${g; p}'
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'
&lt;/code&gt;&lt;/pre&gt;
</title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=2181#comment-2181</link><description>Nice script, but for me it's not what I need... if you use this to a browser, for instance, it brings also the webpage title into the i3 rule, which is not optimum... I'd rather have the list of options in an i3 config syntax, and let the user copy&amp;paste whatever he/she wants to use. Makes sense?</description><pubDate>Thu, 11 Jul 2013 02:09:30 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=2181#comment-2181</guid></item><item><title>Comment by ack006 for &lt;p&gt;While &lt;code&gt;xwininfo&lt;/code&gt; and &lt;code&gt;xprop&lt;/code&gt; will provide the raw data needed to write the criteria, manually copy/pasting all the relevant pieces of output into a criterion list can be tedious, so I've written a small script to automate this.&lt;/p&gt;

&lt;p&gt;Running the script and clicking on a window will output all the criteria for it, ready to be copy/pasted after an i3 config command (remove any criteria that aren't needed).&lt;/p&gt;

&lt;p&gt;Tip: to catch a splashscreen or transient popup "as it happens", run the script like this (using The GIMP as an example):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ gimp-2.8 &amp;amp; ./i3-get-window-criteria
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and click on the splashscreen as soon as it appears.&lt;/p&gt;

&lt;p&gt;Example output for the above command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[class="Gimp-2.8" id=81788931 instance="gimp-2.8" title="GIMP Startup" window_role="gimp-startup"]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This output can be copy/pasted where needed, then edited to remove any criteria which would make the filter too specific for a particular use case.&lt;/p&gt;

&lt;p&gt;Here's the script: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh

# i3-get-window-criteria - Get criteria for use with i3 config commands

# To use, run this script, then click on a window.
# Output is in the format: [&amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; &amp;lt;name&amp;gt;=&amp;lt;value&amp;gt; ...]

# Known problem: when WM_NAME is used as fallback for the 'title="&amp;lt;string&amp;gt;"' criterion,
# quotes in "&amp;lt;string&amp;gt;" are not escaped properly. This is a problem with the output of `xprop`,
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807

PROGNAME=`basename "$0"`

# Check for xwininfo and xprop
for cmd in xwininfo xprop; do
    if ! which $cmd &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then
        echo "$PROGNAME: $cmd: command not found" &amp;gt;&amp;amp;2
        exit 1
    fi
done

match_int='[0-9][0-9]*'
match_string='".*"'
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference

{
    # Run xwininfo, get window id
    window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
    echo "id=$window_id"

    # Run xprop, transform its output into i3 criteria. Handle fallback to
    # WM_NAME when _NET_WM_NAME isn't set
    xprop -id $window_id |
        sed -nr \
            -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
            -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
            -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
            -e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
            -e '${g; p}'
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'
&lt;/code&gt;&lt;/pre&gt;
</title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=2182#comment-2182</link><description>The output *is* in i3 config format. You can simply delete whatever criteria you don't want, and keep the rest.</description><pubDate>Thu, 11 Jul 2013 02:35:28 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=2182#comment-2182</guid></item><item><title>Answer by Michael for &lt;p&gt;i3 does a very good job at showing splashscreens, "Save As..." dialogs, etc. in floating mode. However, some applications were not designed with (mainly) tiling window managers in mind (one could call that a bug ;-) ), and their splashscreens or other windows may look odd when started in i3.
Now, i3 has the ability to force these windows to be floating, but how do I get the necessary criteria for use with &lt;code&gt;for_window&lt;/code&gt;, etc.?&lt;/p&gt;
 </title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?answer=2173#post-id-2173</link><description>Use xprop. Also, file a bug report at the application to make the app set the correct hints for splashscreen windows etc., so that window managers can do the right thing.</description><pubDate>Wed, 10 Jul 2013 20:29:33 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?answer=2173#post-id-2173</guid></item><item><title>Comment by ack006 for &lt;p&gt;Use xprop. Also, file a bug report at the application to make the app set the correct hints for splashscreen windows etc., so that window managers can do the right thing.&lt;/p&gt;
</title><link>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=2175#comment-2175</link><description>Ha :-) I asked the question to be able to share my script with you all, you answered first ;-) I will report a bug (in my case in Eclipse) ASAP.</description><pubDate>Wed, 10 Jul 2013 20:45:26 +0000</pubDate><guid>https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode/?comment=2175#comment-2175</guid></item></channel></rss>