thestinger / termite

Termite is obsoleted by Alacritty. Termite was a keyboard-centric VTE-based terminal, aimed at use within a window manager with tiling and/or tabbing support.
https://github.com/alacritty/alacritty
2.74k stars 241 forks source link

Enable drag and drop text into termite from another program #707

Closed Wambonaut closed 3 years ago

BarbUk commented 4 years ago

This is a nice feature.

Drag and droping a file from a file manager produce two issues:

A modification to handle drag and drop of file:

static void target_drag_data_received(GtkWidget *,
                GdkDragContext     *,
                gint                ,
                gint                ,
                GtkSelectionData   *data,
                guint               ,
                guint               ,
                            keybind_info vte_info){
    VteTerminal *vte =vte_info.vte;

    std::string selection(reinterpret_cast<const char *>( gtk_selection_data_get_text(data) ));
    std::string needle = "file://";
    if (selection.compare(0, needle.length(), needle) == 0) {
        selection.erase(0, needle.length());
    }

    selection.erase(std::remove(selection.begin(), selection.end(), '\n'), selection.end());
    const char * t = selection.c_str();
    vte_terminal_feed_child (vte, t, -1);
}
thestinger commented 3 years ago

Termite is obsolete. Please use Alacritty instead. See https://github.com/thestinger/termite#termite-is-obsoleted-by-alacritty for more details.