<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Trucs Libres &#187; wmctrl</title>
	<atom:link href="http://fr.positon.org/tag/wmctrl/feed" rel="self" type="application/rss+xml" />
	<link>http://fr.positon.org</link>
	<description></description>
	<lastBuildDate>Tue, 23 Feb 2016 20:01:11 +0000</lastBuildDate>
	<language>fr-FR</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.7.1</generator>
	<item>
		<title>Alternative intelligente à Alt+Tab : un script &#8220;Run or Raise&#8221;</title>
		<link>http://fr.positon.org/alternative-intelligente-a-alttab-un-script-run-or-raise</link>
		<comments>http://fr.positon.org/alternative-intelligente-a-alttab-un-script-run-or-raise#comments</comments>
		<pubDate>Thu, 15 Aug 2013 22:29:00 +0000</pubDate>
		<dc:creator><![CDATA[dooblem]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[wmctrl]]></category>

		<guid isPermaLink="false">http://positon.org:81/?p=122</guid>
		<description><![CDATA[http://vickychijwani.github.io/2012/04/15/blazing-fast-application-switching-in-linux/ J&#8217;ai fait quelques améliorations sur le script. Plus de fonctionnalités, mais un peu plus complexe. Utilisation de /bin/sh pour pouvoir utiliser dash à la place de bash (plus léger) Utilisation de exec pour lancer la commande pour remplacer le script courant (sinon vous avez des procéssus inutile dans ps) Remonte toutes les fenêtres de [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a href="http://vickychijwani.github.io/2012/04/15/blazing-fast-application-switching-in-linux/" title="http://vickychijwani.github.io/2012/04/15/blazing-fast-application-switching-in-linux/">http://vickychijwani.github.io/2012/04/15/blazing-fast-application-switching-in-linux/</a></p>
<p>J&#8217;ai fait quelques améliorations sur le script. Plus de fonctionnalités, mais un peu plus complexe.</p>
<ul>
<li>Utilisation de /bin/sh pour pouvoir utiliser dash à la place de bash (plus léger)</li>
<li>Utilisation de exec pour lancer la commande pour remplacer le script courant (sinon vous avez des procéssus inutile dans ps)</li>
<li>Remonte toutes les fenêtres de la même classe : utile pour remonter tous les terminaux par exemple</li>
<li>&#8220;Mode bascule&#8221; : lancé une seconde fois, les fenêtres sont minimisées. Pour cela le script dépend de xdotool. wmctrl ne sais pas faire encore (à venir dans une version future. L&#8217;auteur a commité une option -Y sur github pour ça).</li>
</ul>
<p>Installez le script <code>/home/USER/bin/run-or-raise</code> et ajoutez quelques raccourcis clavier dans votre gestionnaire de fenêtres et voila!</p>
<pre>
&lt;Super&gt;f /home/USER/bin/run-or-raise Navigator.Firefox firefox
</pre>
<pre>
#!/bin/sh
# syntax: run-or-raise WM_CLASS_name COMMAND
#   WM_CLASS_name : the WM_CALL_name of the window (from wmctrl -lx output)
#   COMMAND : the command to run if nothing to raise

#logfile=/tmp/$(basename $0).log
#exec &gt; $logfile 2&gt;&amp;1

# get windows ids matching WM_CLASS_name
WINIDS=$(wmctrl -lx | awk '{ if ($3 == &quot;'&quot;$1&quot;'&quot;) print $1}')

# run if nothing started. exec will end the script
[ -z &quot;$WINIDS&quot; ] &amp;&amp; exec &quot;$2&quot;

# if the window is active, we minimize all the windows of the class
ACTIVEWIN=$(wmctrl -a :ACTIVE: -v 2&gt;&amp;1 | sed -n 's/^Using window: \(.*\)/\1/p')
MINIMIZE=false
if echo &quot;$WINIDS&quot; | grep -q &quot;$ACTIVEWIN&quot;; then
        MINIMIZE=true
fi

for ID in $WINIDS; do
        if $MINIMIZE; then
                xdotool windowminimize &quot;$ID&quot;
        else
                wmctrl -i -a &quot;$ID&quot;
        fi
done
</pre>
]]></content:encoded>
			<wfw:commentRss>http://fr.positon.org/alternative-intelligente-a-alttab-un-script-run-or-raise/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
	</channel>
</rss>
