@@ -25,8 +25,8 @@ use crossterm::{
2525use google:: { CalendarClient , GoogleAuth , TokenInfo } ;
2626use icloud:: { CalDavClient , ICalEvent , ICloudAuth } ;
2727use std:: io:: stdout;
28- use std:: os:: unix:: process:: CommandExt ;
2928use std:: time:: Duration as StdDuration ;
29+ use utils:: open_url;
3030use tokio:: sync:: mpsc;
3131
3232/// Messages from async tasks to main loop
@@ -516,10 +516,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
516516 // Join meeting
517517 if let Some ( event) = app. get_selected_event ( )
518518 && let Some ( ref url) = event. meeting_url {
519- let _ = std:: process:: Command :: new ( "xdg-open" )
520- . arg ( url)
521- . process_group ( 0 )
522- . spawn ( ) ;
519+ open_url ( url) ;
523520 }
524521 }
525522 ( KeyCode :: Char ( 'a' ) | KeyCode :: Char ( 'а' ) , _) => {
@@ -589,16 +586,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
589586 execute ! ( stdout( ) , Clear ( ClearType :: All ) ) . ok ( ) ;
590587 }
591588 ( KeyCode :: Char ( '1' ) , _) => {
592- let _ = std:: process:: Command :: new ( "xdg-open" )
593- . arg ( "https://calendar.google.com" )
594- . process_group ( 0 )
595- . spawn ( ) ;
589+ open_url ( "https://calendar.google.com" ) ;
596590 }
597591 ( KeyCode :: Char ( '2' ) , _) => {
598- let _ = std:: process:: Command :: new ( "xdg-open" )
599- . arg ( "https://www.icloud.com/calendar" )
600- . process_group ( 0 )
601- . spawn ( ) ;
592+ open_url ( "https://www.icloud.com/calendar" ) ;
602593 }
603594 ( KeyCode :: Char ( 'q' ) | KeyCode :: Char ( 'я' ) , _) => {
604595 break ;
@@ -652,16 +643,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
652643 execute ! ( stdout( ) , Clear ( ClearType :: All ) ) . ok ( ) ;
653644 }
654645 ( KeyCode :: Char ( '1' ) , _) => {
655- let _ = std:: process:: Command :: new ( "xdg-open" )
656- . arg ( "https://calendar.google.com" )
657- . process_group ( 0 )
658- . spawn ( ) ;
646+ open_url ( "https://calendar.google.com" ) ;
659647 }
660648 ( KeyCode :: Char ( '2' ) , _) => {
661- let _ = std:: process:: Command :: new ( "xdg-open" )
662- . arg ( "https://www.icloud.com/calendar" )
663- . process_group ( 0 )
664- . spawn ( ) ;
649+ open_url ( "https://www.icloud.com/calendar" ) ;
665650 }
666651 ( KeyCode :: Char ( 'g' ) | KeyCode :: Char ( 'г' ) , _) => {
667652 // Start Google auth flow (only if not already authenticated)
0 commit comments