From 63118697eed48dfebe1ec100610976cbff52d21c Mon Sep 17 00:00:00 2001 From: mutantturkey Date: Tue, 5 Mar 2013 09:08:33 -0500 Subject: Automatically set a default window size if unset This resolves problems when the window manager does not set a default size. I noticed this while using KDE3's KWin. Previously it went unfixed because my main window manger always assigns a size. This should resolve the problem. * Added DEFAULT_WINDOW_WIDTH and DEFAULT_WINDOW_HEIGHT * DEFAULT_WINDOW_WIDTH = 600 * DEFAULT_WINDOW_HEIGHT = 800 * If either height or width is missing from the svte configuration in the users directory, use the defaults. --- config.mk | 7 +------ defaults.h | 8 ++++++++ svte.c | 5 +++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/config.mk b/config.mk index 58b302f..e6b173a 100644 --- a/config.mk +++ b/config.mk @@ -16,7 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . - # svte version: VERSION = 0.1.4.1 @@ -28,20 +27,16 @@ MANPREFIX = ${PREFIX}/share/man # includes and libs - GTKINC=$(shell pkg-config --cflags gtk+-2.0 vte ) GTKLIB=-lvte INCS = -I. -I/usr/include ${GTKINC} LIBS = -L/usr/lib -lc ${GTKLIB} + # flags CPPFLAGS = -DVERSION=\"${VERSION}\" CFLAGS = -mtune=native -std=gnu99 -O3 ${INCS} ${CPPFLAGS} LDFLAGS = -s ${LIBS} -# Solaris -#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" -#LDFLAGS = ${LIBS} - # compiler and linker CC = cc diff --git a/defaults.h b/defaults.h index 3e36bf8..0cad826 100644 --- a/defaults.h +++ b/defaults.h @@ -42,6 +42,14 @@ #define DEFAULT_ALLOW_BOLD TRUE #endif +#ifndef DEFAULT_WINDOW_HEIGHT +#define DEFAULT_WINDOW_HEIGHT 800 +#endif + +#ifndef DEFAULT_WINDOW_WIDTH +#define DEFAULT_WINDOW_WIDTH 600 +#endif + #ifndef DEFAULT_NUM_SCROLLBACK_LINES #define DEFAULT_NUM_SCROLLBACK_LINES -1 #endif diff --git a/svte.c b/svte.c index 3cc4477..44827f6 100644 --- a/svte.c +++ b/svte.c @@ -572,6 +572,11 @@ static void parse_config_file(gchar *config_file) { config->font = DEFAULT_FONT; } + if (NULL == config->window_width || NULL == config->window_height) { + config->window_width = DEFAULT_WINDOW_WIDTH; + config->window_height = DEFAULT_WINDOW_HEIGHT; + } + if(NULL == config->browser_command) { config->browser_command = DEFAULT_BROWSER_COMMAND; } -- cgit v1.2.3 From 810f378ff8ce79ef220da92dad9bc837a8ecb925 Mon Sep 17 00:00:00 2001 From: mutantturkey Date: Tue, 5 Mar 2013 09:27:12 -0500 Subject: Add appropriate version option svte now should follow unix conventions a bit more appropriately. It will now take --version or -v and prints a \n after printing the version number. --- svte.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svte.c b/svte.c index 44827f6..263a59d 100644 --- a/svte.c +++ b/svte.c @@ -92,7 +92,7 @@ static GOptionEntry options[] = { "Path to configuration file to use.", NULL }, { "execute", 'e', 0, G_OPTION_ARG_STRING, &start_program, "execute this command.", NULL }, - { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, + { "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, "Print version information and exit", NULL }, { NULL } }; @@ -598,7 +598,7 @@ int main(int argc, char* argv[]) { } if (show_version) { - printf(VERSION); + printf("%s \n", VERSION); return 0; } -- cgit v1.2.3 From e2f527c3f0e557b6d59d8c6884d9ae1666a93109 Mon Sep 17 00:00:00 2001 From: mutantturkey Date: Tue, 5 Mar 2013 10:04:08 -0500 Subject: Added a basic man file for svte I have created a basic man file for svte, it is very basic but gives all the basic information needed. Has shortcuts, command line args, and important files. More might be needed later. Still need to modify the Makefile. --- svte.1 | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 svte.1 diff --git a/svte.1 b/svte.1 new file mode 100644 index 0000000..cb6eb3b --- /dev/null +++ b/svte.1 @@ -0,0 +1,45 @@ +.TH SVTE 1 svte\-VERSION +.SH NAME +svte \- simple virtual terminal emulator +.SH SYNOPSIS +.B svte +.RB [ \-c +.IR config-file ] +.RB [ \-e +.IR execute ] +.RB [ \-v ] +.P +.BR svte " ..." +.SH DESCRIPTION +.B svte +svte is a terminal that is flexible and has a small codebase. Its aim is to be +lightweight and fast, while providing nice integration with a modern Linux +environment. svte is yet another minimal GTK incarnation of VTE. +.P +.SH OPTIONS +.TP +.B \-c, --config-file +use the config file provided by this argument instead of the default (~/.svterc) +.TP +.B \-e, --execute +svte will launch indicated program instead of the users default shell. xterm +style. +.TP +.B \-v, --version +print current version +.SH USAGE +svte is completely controlled by the keyboard. The shortcuts are not yet +configurable. +.TP +.B Ctrl + Shift + t +Open a new tab. +.TP +.B Ctrl + Shift + n +Open a new window. +.TP +.B Ctrl + Shift + w +Close current tab, if there is only one tab, close the window +.SH FILES +.TP +.I /home/$USER/.svtrc +The default svte config file that svte will attempt to read. -- cgit v1.2.3 From 65a018a190ed68181de73defe0841c0caa50c8dc Mon Sep 17 00:00:00 2001 From: mutantturkey Date: Tue, 5 Mar 2013 10:14:26 -0500 Subject: Added manpage to Makefile --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 641e0b0..c243a48 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,9 @@ dist: clean @rm -rf svte-${VERSION} install: all + @echo installing manpage to ${DESTDIR}${MANPREFIX}/man1 + @mkdir -p ${DESTDIR}${MANPREFIX}/man1 + @cp -f svte.1 ${DESTDIR}${MANPREFIX}/man1/svte.1 @echo installing executable file to ${DESTDIR}${PREFIX}/bin @mkdir -p ${DESTDIR}${PREFIX}/bin @cp -f svte ${DESTDIR}${PREFIX}/bin @@ -62,6 +65,8 @@ install: all uninstall: @echo removing executable file from ${DESTDIR}${PREFIX}/bin @rm -f ${DESTDIR}${PREFIX}/bin/svte + @echo removing manpage from ${DESTDIR}${MANPREFIX}/man1/ + @rm -f ${DESTDIR}${MANPREFIX}/man1/svte.1 .PHONY: all options clean dist install uninstall -- cgit v1.2.3 From 6afe2c27b1de059a21294b5831ebe22247265e81 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Wed, 11 Sep 2013 17:38:58 -0400 Subject: add font size increase and decrease, kind of crappy because we are just increasing the size by the '2000' metric since PangoFontDescription isn't a set size, but is dynamic based on dpi and other crap --- svte.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/svte.c b/svte.c index 263a59d..5e9d762 100644 --- a/svte.c +++ b/svte.c @@ -76,6 +76,7 @@ static void tab_focus(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, struct window *w); static void set_window_title(term *t); static void launch_url(char *url); +static void zoom(gboolean b, struct term *t); static inline term* get_current_term(window *w); static inline term* get_nth_term(window *w, guint page); @@ -122,6 +123,17 @@ static void launch_url(char *url) { g_spawn_command_line_async(g_strconcat(config->browser_command, " ", url, NULL), NULL); } +static void zoom(gboolean b, struct term *t) { + + int size = -2000; + if(b) + size = 2000; + PangoFontDescription *font = vte_terminal_get_font(VTE_TERMINAL(t->vte)); + pango_font_description_set_size(font, pango_font_description_get_size(font) + size); + vte_terminal_set_font(VTE_TERMINAL(t->vte), font); + +} + /* key event handler */ gboolean event_key(GtkWidget *widget, GdkEventKey *event, window *w) { @@ -148,6 +160,14 @@ gboolean event_key(GtkWidget *widget, GdkEventKey *event, window *w) { vte_terminal_paste_clipboard(VTE_TERMINAL(get_current_term(w)->vte)); return TRUE; } + if (g == GDK_plus) { + zoom(TRUE, get_current_term(w)); + return TRUE; + } + if (g == GDK_underscore) { + zoom(FALSE, get_current_term(w)); + return TRUE; + } if (g == GDK_C) { vte_terminal_copy_clipboard(VTE_TERMINAL(get_current_term(w)->vte)); return TRUE; @@ -173,7 +193,7 @@ gboolean event_key(GtkWidget *widget, GdkEventKey *event, window *w) { return TRUE; } } - + if(g == GDK_KEY_Forward) { tab_switch(TRUE, w); return TRUE; -- cgit v1.2.3 From 3377c7b1e766afb54949c0b2b758888e3de6ff86 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Wed, 11 Sep 2013 17:40:39 -0400 Subject: update makefile to remove mt references and bump version --- Makefile | 4 ++-- config.mk | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c243a48..0c49d72 100644 --- a/Makefile +++ b/Makefile @@ -43,13 +43,13 @@ svte: ${OBJ} clean: @echo cleaning - @rm -f svte ${OBJ} mt-${VERSION}.tar.gz + @rm -f svte ${OBJ} svte-${VERSION}.tar.gz dist: clean @echo creating dist tarball @mkdir -p svte-${VERSION} @cp -R Makefile config.mk ${SRC} svte-${VERSION} - @tar -cf svte-${VERSION}.tar mt-${VERSION} + @tar -cf svte-${VERSION}.tar svte-${VERSION} @gzip svte-${VERSION}.tar @rm -rf svte-${VERSION} diff --git a/config.mk b/config.mk index e6b173a..bf83dc0 100644 --- a/config.mk +++ b/config.mk @@ -17,7 +17,7 @@ # along with this program. If not, see . # svte version: -VERSION = 0.1.4.1 +VERSION = 0.1.4.2 # Customize below to fit your system -- cgit v1.2.3