diff --git a/Makefile b/Makefile index 5dc3d4f..6a19c64 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ else CXXFLAGS += -D NDEBUG -O3 endif -LDLIBS := -lm -lpthread -lscgui -lSDL2 -lcairo -lscerror -lscstring -lscscreensaver -ldl +LDLIBS := -lm -lpthread -lscgui -lSDL2 -lcairo -lscerror -lscstring -lscscreensaver -ldl -lscnumerics .PHONY: all clean install modules new diff --git a/main.cpp b/main.cpp index 5d83d73..73e287a 100644 --- a/main.cpp +++ b/main.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include const int WIDTH {1600}; @@ -88,10 +89,11 @@ int main(int argc, const char * argv[]) { try { // gather plugins #if DEBUG - sc::plugin::scan_plugins(sc::dirname(sc::tool_path(argv[0])) + "/plugins", "saver"); + std::string plugin_dir {sc::dirname(sc::tool_path(argv[0])) + "/plugins"}; #else - sc::plugin::scan_plugins("/usr/local/share/screensaver/plugins", "saver"); + std::string plugin_dir {"/usr/local/share/screensaver/plugins"}; #endif + sc::plugin::scan_plugins(plugin_dir, "saver"); std::unique_ptr saver; bool random_saver {false}; int opt_char, opt_val; @@ -130,7 +132,9 @@ int main(int argc, const char * argv[]) { if (optind == argc) { // here when no file args if (random_saver) { - saver = sc::plugin::random_choice()(); + std::vector names {sc::plugin::names()}; + std::string name {sc::random::choice(names)}; + saver = sc::plugin::get(name)(); } else { saver = sc::plugin::get("Default")(); }