change background if frame has no title

I would like to change my background canvas according to whether my frame has a title. This is the form I'm using (etoolbox):

\setbeamertemplate{background canvas}{
% First frame
}{%
% Last frame
}{%
%\if{\frametitle}{empty}{
% Empty frames
}{%
% Other frames
}%
}%
}


• I've not tested but, is \ifstrempty{\beamer@frametitle}{<true>}{<false>} what you are looking for? – Ignasi Feb 7 '14 at 18:21
• That didn't work, I'm just getting the "false" background. code is now like this: \setbeamertemplate{background canvas}{ \ifstrempty{beamer@frametitle}{ % Empty frames }{% % Other frames }% } Don't really know why... – Joe H. Feb 8 '14 at 8:01

You can use a conditional \ifx to test for \insertframetitle to see if it's empty and act accordingly, A simple example adding an image with a "B" in frames with title, and an image with an "A" for frames with titles:

\documentclass{beamer}
\usepackage{tikz}

\makeatletter
\setbeamertemplate{background canvas}{%
\ifx\insertframetitle\@empty
\tikz[remember picture,overlay]
\node[opacity=0.2] at (current page.center)
{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}};
\else
\tikz[remember picture,overlay]
\node[opacity=0.2] at (current page.center)
{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-b}};
\fi%
}
\makeatother

\begin{document}

\begin{frame}
\frametitle{A frame with a title}
test
\end{frame}

\begin{frame}
test
\end{frame}

\end{document}


• works like charm, even in my nested etoolbox statement.Thanks a lot. – Joe H. Feb 8 '14 at 8:12