upload c file, makefile, and version file

This commit is contained in:
amogus3016 2021-12-12 13:02:46 -05:00 committed by GitHub
parent 5f3bf107b3
commit 37be59c49c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 0 deletions

4
Makefile Normal file
View File

@ -0,0 +1,4 @@
sherpa: sherpa.c
$(CC) sherpa.c -o sherpa -Wall
printf("Installing latest version of sherpa...")
printf("Installed successfully")

10
sherpa-v.py Normal file
View File

@ -0,0 +1,10 @@
print ("Sherpa Terminal Emulator Version 0.1")
print ("___________________")
print ("| |")
print ("| // |")
print ("| // |")
print ("| // |")
print ("| // |")
print ("| // |")
print ("| |")
print ("|_________________|")

46
sherpa.c Normal file
View File

@ -0,0 +1,46 @@
#include <vte/vte.h>
static void
child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_Data)
{
if (!terminal) return;
if (pid == -1) gtk_main_quit();
}
int
main(int argc, char *argv[])
{
GtkWidget *window, *terminal;
/* init gtk window and terminal */
gtk_init(&argc, &argv);
terminal = vte_terminal_new();
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Sherpa");
/* start new shell */
gchar **envp = g_get_environ();
gchar **command = (gchar *[]){g_strdup(g_environ_getenv(envp, "SHELL")), NULL };
g_strfreev(envp);
vte_terminal_spawn_async(VTE_TERMINAL(terminal),
VTE_PTY_DEFAULT,
NULL, /* working dir */
command, /* command */
NULL, /* environment */
0, /* spawn flags */
NULL, NULL, /* child setup */
NULL, /* child pid */
-1, /* timeout */
NULL, /* cancellable */
child_ready, /* callback */
NULL); /* user_data */
/* connect signals */
g_signal_connect(window, "delete-event", gtk_main_quit, NULL);
g_signal_connect(terminal, "child-exited", gtk_main_quit, NULL);
/* combine widgets and run main loop */
gtk_container_add(GTK_CONTAINER(window), terminal);
gtk_widget_show_all(window);
gtk_main();
}