@@ -534,9 +534,13 @@ fn handle_copy_entity_key(
534534 . collect ( ) ;
535535
536536 if !entities. is_empty ( ) {
537+ #[ allow( unused_variables) ] // TODO: try to remove when the arboard alternative gets in
537538 if let Ok ( json) = serde_json:: to_string ( & entities) {
538- let mut clipboard = arboard:: Clipboard :: new ( ) ?;
539- clipboard. set_text ( json) ?;
539+ #[ cfg( feature = "arboard" ) ]
540+ {
541+ let mut clipboard = arboard:: Clipboard :: new ( ) ?;
542+ clipboard. set_text ( json) ?;
543+ }
540544 }
541545 }
542546 }
@@ -560,8 +564,18 @@ fn handle_paste_entity_key(
560564 || keyboard_input. pressed ( KeyCode :: ControlRight ) ;
561565
562566 if ctrl_pressed && keyboard_input. just_pressed ( KeyCode :: KeyV ) {
563- let mut clipboard = arboard:: Clipboard :: new ( ) ?;
564- if let Ok ( text) = clipboard. get_text ( ) {
567+ #[ allow( unused_variables) ] // TODO: try to remove when the arboard alternative gets in
568+ let text_to_paste: Option < String > = None ;
569+
570+ #[ cfg( feature = "arboard" ) ]
571+ let text_to_paste = {
572+ let mut clipboard = arboard:: Clipboard :: new ( ) ?;
573+ clipboard. get_text ( ) . ok ( )
574+ } ;
575+
576+ // TODO: add fallback when arboard is not enabled or doesn't work
577+
578+ if let Some ( text) = text_to_paste {
565579 if let Ok ( entities) = serde_json:: from_str :: < Vec < YoleckRawEntry > > ( & text) {
566580 if !entities. is_empty ( ) {
567581 for prev_selected in query. iter ( ) {
0 commit comments