@@ -19,9 +19,9 @@ use gtk::{
1919 gio:: { spawn_blocking, Cancellable , ListStore , Settings } ,
2020 glib:: { self , clone, spawn_future_local, BoxedAnyObject , Bytes } ,
2121 prelude:: * ,
22- Align , Application , ApplicationWindow , Box , Button , DropDown , FileDialog , GridView , ListItem ,
23- ListScrollFlags , MenuButton , Orientation , Picture , Popover , ProgressBar , ScrolledWindow ,
24- SignalListItemFactory , SingleSelection , StringObject , Switch , Text , TextBuffer ,
22+ Align , Application , ApplicationWindow , Box , Button , DropDown , FileDialog , GridView , Label ,
23+ ListItem , ListScrollFlags , MenuButton , Orientation , Picture , Popover , ProgressBar ,
24+ ScrolledWindow , SignalListItemFactory , SingleSelection , StringObject , Switch , Text , TextBuffer ,
2525} ;
2626use log:: debug;
2727use std:: {
@@ -47,6 +47,10 @@ struct SensitiveWidgetsHelper {
4747
4848pub fn build_ui ( app : & Application , args : & Cli ) {
4949 let window = create_application_window ( app) ;
50+ if get_available_wallpaper_changers ( ) . is_empty ( ) {
51+ create_no_changers_window ( & window) ;
52+ return ;
53+ }
5054 let settings = Settings :: new ( APP_ID ) ;
5155 let image_list_store = ListStore :: new :: < BoxedAnyObject > ( ) ;
5256 let removed_images_list_store = ListStore :: new :: < BoxedAnyObject > ( ) ;
@@ -832,3 +836,53 @@ fn textbuffer_to_string(text_buffer: &TextBuffer) -> String {
832836 . text ( & text_buffer. start_iter ( ) , & text_buffer. end_iter ( ) , false )
833837 . to_string ( )
834838}
839+
840+ fn create_no_changers_window ( window : & ApplicationWindow ) {
841+ let application_box = create_application_box ( ) ;
842+ let text_box = Box :: builder ( )
843+ . halign ( Align :: Center )
844+ . valign ( Align :: Center )
845+ . orientation ( Orientation :: Horizontal )
846+ . build ( ) ;
847+ let confirm_button = Button :: builder ( )
848+ . label ( gettext ( "Ok" ) )
849+ . vexpand ( true )
850+ . hexpand ( true )
851+ . can_shrink ( true )
852+ . has_tooltip ( true )
853+ . tooltip_text ( gettext ( "Close waytrogen" ) )
854+ . valign ( Align :: End )
855+ . halign ( Align :: Center )
856+ . hexpand ( true )
857+ . build ( ) ;
858+ let error_message_label = Label :: builder ( )
859+ . margin_top ( 12 )
860+ . margin_start ( 12 )
861+ . margin_bottom ( 12 )
862+ . margin_end ( 12 )
863+ . label ( gettext (
864+ "No wallpaper changers detected.\n
865+ Please install one or more of the following:\n \n
866+ - Hyprpaper\n
867+ - Swaybg\n
868+ - Mpvpaper\n
869+ - SWWW\n \n
870+ If waytrogen continues failing to detect an installed changer,\n
871+ please feel free open issue on the GitHub repository:\n
872+ https://github.com/nikolaizombie1/waytrogen/issues" ,
873+ ) )
874+ . halign ( Align :: Center )
875+ . valign ( Align :: Center )
876+ . build ( ) ;
877+ confirm_button. connect_clicked ( clone ! (
878+ #[ strong]
879+ window,
880+ move |_| {
881+ window. close( ) ;
882+ }
883+ ) ) ;
884+ text_box. append ( & error_message_label) ;
885+ application_box. append ( & text_box) ;
886+ application_box. append ( & confirm_button) ;
887+ window. set_child ( Some ( & application_box) ) ;
888+ }
0 commit comments