File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ tracing = "0.1"
1616tracing-subscriber = { version = " 0.3" , features = [" env-filter" ] }
1717serde = { version = " 1.0" , features = [" derive" ] }
1818serde_json = " 1.0.140"
19- vte4 = " 0.9"
19+ vte4 = { version = " 0.9" , features = [ " v0_76 " ] }
2020
2121[dependencies .adw ]
2222package = " libadwaita"
Original file line number Diff line number Diff line change @@ -553,6 +553,38 @@ impl DistroShelfWindow {
553553
554554 let terminal = vte4:: Terminal :: new ( ) ;
555555
556+ // Create context menu actions
557+ let action_group = gio:: SimpleActionGroup :: new ( ) ;
558+
559+ let copy_action = gio:: SimpleAction :: new ( "copy" , None ) ;
560+ copy_action. connect_activate ( clone ! (
561+ #[ weak]
562+ terminal,
563+ move |_, _| {
564+ terminal. copy_clipboard_format( vte4:: Format :: Text ) ;
565+ }
566+ ) ) ;
567+ action_group. add_action ( & copy_action) ;
568+
569+ let paste_action = gio:: SimpleAction :: new ( "paste" , None ) ;
570+ paste_action. connect_activate ( clone ! (
571+ #[ weak]
572+ terminal,
573+ move |_, _| {
574+ terminal. paste_clipboard( ) ;
575+ }
576+ ) ) ;
577+ action_group. add_action ( & paste_action) ;
578+
579+ terminal. insert_action_group ( "terminal" , Some ( & action_group) ) ;
580+
581+ // Create context menu
582+ let menu_model = gio:: Menu :: new ( ) ;
583+ menu_model. append ( Some ( "Copy" ) , Some ( "terminal.copy" ) ) ;
584+ menu_model. append ( Some ( "Paste" ) , Some ( "terminal.paste" ) ) ;
585+
586+ terminal. set_context_menu_model ( Some ( & menu_model) ) ;
587+
556588 // Create a container for the terminal with a reload button overlay
557589 let terminal_overlay = gtk:: Overlay :: new ( ) ;
558590 terminal_overlay. set_child ( Some ( & terminal) ) ;
You can’t perform that action at this time.
0 commit comments