commit
a4af9e7e41
1
config
1
config
|
@ -5,7 +5,6 @@
|
||||||
#dynamic_title = true
|
#dynamic_title = true
|
||||||
font = Monospace 9
|
font = Monospace 9
|
||||||
#fullscreen = true
|
#fullscreen = true
|
||||||
#geometry = 640x480
|
|
||||||
#icon_name = terminal
|
#icon_name = terminal
|
||||||
#mouse_autohide = false
|
#mouse_autohide = false
|
||||||
#scroll_on_output = false
|
#scroll_on_output = false
|
||||||
|
|
|
@ -23,8 +23,6 @@ Set the termite window's title to \fITITLE\fP. This disables dynamic
|
||||||
titles.
|
titles.
|
||||||
.IP "\fB\-d\fR, \fB\-\-directory\fR\fB=\fR\fIDIRECTORY\fR"
|
.IP "\fB\-d\fR, \fB\-\-directory\fR\fB=\fR\fIDIRECTORY\fR"
|
||||||
Tell termite to change to \fIDIRECTORY\fP when launching.
|
Tell termite to change to \fIDIRECTORY\fP when launching.
|
||||||
.IP "\fB\-\-geometry\fR\fB=\fR\fIGEOMETRY\fR"
|
|
||||||
Override the window geometry in pixels.
|
|
||||||
.IP "\fB\-\-icon\fR\f8=\fR\fIICON\fR"
|
.IP "\fB\-\-icon\fR\f8=\fR\fIICON\fR"
|
||||||
Override the window icon name.
|
Override the window icon name.
|
||||||
.IP "\fB\-\-hold\fR"
|
.IP "\fB\-\-hold\fR"
|
||||||
|
|
|
@ -37,8 +37,6 @@ Whether to hide url hints not matching input in url hints mode.
|
||||||
The font description for the terminal's font.
|
The font description for the terminal's font.
|
||||||
.IP \fIfullscreen\fR
|
.IP \fIfullscreen\fR
|
||||||
Enables entering fullscreen mode by pressing F11.
|
Enables entering fullscreen mode by pressing F11.
|
||||||
.IP \fIgeometry\fR
|
|
||||||
The default window geometry for new terminal windows.
|
|
||||||
.IP \fIicon_name\fR
|
.IP \fIicon_name\fR
|
||||||
The name of the icon to be used for the terminal process.
|
The name of the icon to be used for the terminal process.
|
||||||
.IP \fImodify_other_keys\fR
|
.IP \fImodify_other_keys\fR
|
||||||
|
|
31
termite.cc
31
termite.cc
|
@ -160,9 +160,9 @@ static void overlay_show(search_panel_info *info, overlay_mode mode, VteTerminal
|
||||||
static void get_vte_padding(VteTerminal *vte, int *left, int *top, int *right, int *bottom);
|
static void get_vte_padding(VteTerminal *vte, int *left, int *top, int *right, int *bottom);
|
||||||
static char *check_match(VteTerminal *vte, GdkEventButton *event);
|
static char *check_match(VteTerminal *vte, GdkEventButton *event);
|
||||||
static void load_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
static void load_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
||||||
config_info *info, char **geometry, char **icon, bool *show_scrollbar);
|
config_info *info, char **icon, bool *show_scrollbar);
|
||||||
static void set_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
static void set_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
||||||
config_info *info, char **geometry, char **icon, bool *show_scrollbar,
|
config_info *info, char **icon, bool *show_scrollbar,
|
||||||
GKeyFile *config);
|
GKeyFile *config);
|
||||||
static long first_row(VteTerminal *vte);
|
static long first_row(VteTerminal *vte);
|
||||||
|
|
||||||
|
@ -1417,7 +1417,7 @@ static void load_theme(GtkWindow *window, VteTerminal *vte, GKeyFile *config, hi
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar,
|
static void load_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar,
|
||||||
GtkWidget *hbox, config_info *info, char **geometry, char **icon,
|
GtkWidget *hbox, config_info *info, char **icon,
|
||||||
bool *show_scrollbar) {
|
bool *show_scrollbar) {
|
||||||
const std::string default_path = "/termite/config";
|
const std::string default_path = "/termite/config";
|
||||||
GKeyFile *config = g_key_file_new();
|
GKeyFile *config = g_key_file_new();
|
||||||
|
@ -1453,19 +1453,14 @@ static void load_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollba
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
set_config(window, vte, scrollbar, hbox, info, geometry, icon, show_scrollbar, config);
|
set_config(window, vte, scrollbar, hbox, info, icon, show_scrollbar, config);
|
||||||
}
|
}
|
||||||
g_key_file_free(config);
|
g_key_file_free(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
static void set_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
||||||
config_info *info, char **geometry, char **icon, bool *show_scrollbar_ptr,
|
config_info *info, char **icon, bool *show_scrollbar_ptr,
|
||||||
GKeyFile *config) {
|
GKeyFile *config) {
|
||||||
if (geometry) {
|
|
||||||
if (auto s = get_config_string(config, "options", "geometry")) {
|
|
||||||
*geometry = *s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto cfg_bool = [config](const char *key, gboolean value) {
|
auto cfg_bool = [config](const char *key, gboolean value) {
|
||||||
return get_config<gboolean>(g_key_file_get_boolean,
|
return get_config<gboolean>(g_key_file_get_boolean,
|
||||||
|
@ -1624,7 +1619,7 @@ int main(int argc, char **argv) {
|
||||||
gboolean version = FALSE, hold = FALSE;
|
gboolean version = FALSE, hold = FALSE;
|
||||||
|
|
||||||
GOptionContext *context = g_option_context_new(nullptr);
|
GOptionContext *context = g_option_context_new(nullptr);
|
||||||
char *role = nullptr, *geometry = nullptr, *execute = nullptr, *config_file = nullptr;
|
char *role = nullptr, *execute = nullptr, *config_file = nullptr;
|
||||||
char *title = nullptr, *icon = nullptr;
|
char *title = nullptr, *icon = nullptr;
|
||||||
bool show_scrollbar = false;
|
bool show_scrollbar = false;
|
||||||
const GOptionEntry entries[] = {
|
const GOptionEntry entries[] = {
|
||||||
|
@ -1633,7 +1628,6 @@ int main(int argc, char **argv) {
|
||||||
{"role", 'r', 0, G_OPTION_ARG_STRING, &role, "The role to use", "ROLE"},
|
{"role", 'r', 0, G_OPTION_ARG_STRING, &role, "The role to use", "ROLE"},
|
||||||
{"title", 't', 0, G_OPTION_ARG_STRING, &title, "Window title", "TITLE"},
|
{"title", 't', 0, G_OPTION_ARG_STRING, &title, "Window title", "TITLE"},
|
||||||
{"directory", 'd', 0, G_OPTION_ARG_STRING, &directory, "Change to directory", "DIRECTORY"},
|
{"directory", 'd', 0, G_OPTION_ARG_STRING, &directory, "Change to directory", "DIRECTORY"},
|
||||||
{"geometry", 0, 0, G_OPTION_ARG_STRING, &geometry, "Window geometry", "GEOMETRY"},
|
|
||||||
{"hold", 0, 0, G_OPTION_ARG_NONE, &hold, "Remain open after child process exits", nullptr},
|
{"hold", 0, 0, G_OPTION_ARG_NONE, &hold, "Remain open after child process exits", nullptr},
|
||||||
{"config", 'c', 0, G_OPTION_ARG_STRING, &config_file, "Path of config file", "CONFIG"},
|
{"config", 'c', 0, G_OPTION_ARG_STRING, &config_file, "Path of config file", "CONFIG"},
|
||||||
{"icon", 'i', 0, G_OPTION_ARG_STRING, &icon, "Icon", "ICON"},
|
{"icon", 'i', 0, G_OPTION_ARG_STRING, &icon, "Icon", "ICON"},
|
||||||
|
@ -1713,11 +1707,11 @@ int main(int argc, char **argv) {
|
||||||
};
|
};
|
||||||
|
|
||||||
load_config(GTK_WINDOW(window), vte, scrollbar, hbox, &info.config,
|
load_config(GTK_WINDOW(window), vte, scrollbar, hbox, &info.config,
|
||||||
geometry ? nullptr : &geometry, icon ? nullptr : &icon, &show_scrollbar);
|
icon ? nullptr : &icon, &show_scrollbar);
|
||||||
|
|
||||||
reload_config = [&]{
|
reload_config = [&]{
|
||||||
load_config(GTK_WINDOW(window), vte, scrollbar, hbox, &info.config,
|
load_config(GTK_WINDOW(window), vte, scrollbar, hbox, &info.config,
|
||||||
nullptr, nullptr, nullptr);
|
nullptr, nullptr);
|
||||||
};
|
};
|
||||||
signal(SIGUSR1, [](int){ reload_config(); });
|
signal(SIGUSR1, [](int){ reload_config(); });
|
||||||
|
|
||||||
|
@ -1779,15 +1773,6 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geometry) {
|
|
||||||
gtk_widget_show_all(panel_overlay);
|
|
||||||
gtk_widget_show_all(info.panel.entry);
|
|
||||||
if (!gtk_window_parse_geometry(GTK_WINDOW(window), geometry)) {
|
|
||||||
g_printerr("invalid geometry string: %s\n", geometry);
|
|
||||||
}
|
|
||||||
g_free(geometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
gtk_window_set_icon_name(GTK_WINDOW(window), icon);
|
gtk_window_set_icon_name(GTK_WINDOW(window), icon);
|
||||||
g_free(icon);
|
g_free(icon);
|
||||||
|
|
Loading…
Reference in New Issue