@@ -71,8 +71,9 @@ void WayfireBackgroundApp::create(int argc, char **argv)
7171void WayfireBackgroundApp::on_activate ()
7272{
7373 WayfireShellApp::on_activate ();
74-
7574 prep_cache ();
75+ // Initial setup of timer etc.
76+ change_background ();
7677}
7778
7879void WayfireBackgroundApp::prep_cache ()
@@ -92,7 +93,10 @@ void WayfireBackgroundApp::handle_new_output(WayfireOutput *output)
9293{
9394 backgrounds[output] = std::unique_ptr<WayfireBackground>(
9495 new WayfireBackground (output));
95- change_background ();
96+ if (!current_background.empty ())
97+ {
98+ backgrounds[output]->gl_area ->show_image (current_background);
99+ }
96100}
97101
98102void WayfireBackgroundApp::handle_output_removed (WayfireOutput *output)
@@ -108,7 +112,8 @@ std::string WayfireBackgroundApp::get_application_name()
108112std::vector<std::string> WayfireBackgroundApp::get_background_list (std::string path)
109113{
110114 wordexp_t exp;
111- std::cout << " Looking in " << path << std::endl;
115+ LOGD (" Looking for background images in " , path);
116+
112117 /* Expand path */
113118 if (wordexp (path.c_str (), &exp, 0 ))
114119 {
@@ -187,18 +192,20 @@ void WayfireBackgroundApp::change_background()
187192 std::string background_path = WfOption<std::string>{" background/image" };
188193 auto list = get_background_list (background_path);
189194 auto idx = find (list.begin (), list.end (), current_background) - list.begin ();
190-
191- std::cout << current_background << " " << idx << std::endl;
192195 idx = (idx + 1 ) % list.size ();
193- // gl_area->show_image(list[idx]);
194- for ( auto & it : backgrounds )
196+
197+ if (current_background != list[idx] )
195198 {
196- it.second ->gl_area ->show_image (list[idx]);
199+ for (auto & it : backgrounds)
200+ {
201+ it.second ->gl_area ->show_image (list[idx]);
202+ }
203+
204+ current_background = list[idx];
205+ write_cache (list[idx]);
197206 }
198207
199- write_cache (list[idx]);
200208 reset_cycle_timeout ();
201- current_background = list[idx];
202209}
203210
204211gboolean WayfireBackgroundApp::sigusr1_handler (void *instance)
0 commit comments