Merge lp:~keruspe/sakura/graphical-options into lp:~dabisu/sakura/sakura

Proposed by Marc-Antoine Perennou
Status: Merged
Approved by: David Gómez
Approved revision: 333
Merged at revision: 334
Proposed branch: lp:~keruspe/sakura/graphical-options
Merge into: lp:~dabisu/sakura/sakura
Diff against target: 168 lines (+61/-6)
1 file modified
src/sakura.c (+61/-6)
To merge this branch: bzr merge lp:~keruspe/sakura/graphical-options
Reviewer Review Type Date Requested Status
Marc-Antoine Perennou (community) Needs Resubmitting
David Gómez Needs Information
Review via email: mp+39749@code.launchpad.net

Description of the change

This add two options for the user:
One to start sakura with no window decoration
Another to start sakura maximized
This is kinda usefull, I use it all the time, and I didn't manage to find any other term than terminator supporting that, so it would be great if sakura did so.

To post a comment you must log in.
Revision history for this message
David Gómez (dabisu) wrote :

Hi, sorry for the late answer. Sakura has an option for fullscreen (borderless and maximized sakura). Do you have another use case for your patch? If not, i think it'd be enough to add a variable to remember the fullscreen state in the configuration. Right now is not configurable, but it's trivial to add it.

Revision history for this message
David Gómez (dabisu) :
review: Needs Information
Revision history for this message
Marc-Antoine Perennou (keruspe) wrote :

Fullscreen is kinda annoying, having a maximized borderless window let you switch apps in a way more handy way, and you keep your panel to keep you systray, clock and so on visible, it's really handier

lp:~keruspe/sakura/graphical-options updated
330. By David Gómez

* Merge branch

331. By David Gómez

* Merge branch for solving bug #540672 ("-e command line option")
* CMakeLists.txt:
 - Require vte version 0.26. vte_terminal_fork_command has been deprecated and vte_terminal_fork_command_full is only available from 0.26
* po/*:
 - Updated

332. By David Gómez

* src/sakura.c:
 - Added missing term->pid to vte_terminal_fork_command_full call

Revision history for this message
David Gómez (dabisu) wrote :

Ok, i understand now how you use it.

Is there any use case where you use these two options separately? If not, i think it'd be better to have only one option, just for the sake of simplicity. I mean at the GUI level, but keep it separated in the code. Could you change the branch for this before i merge it? Just connect that same menu item to both callbacks:

g_signal_connect(G_OBJECT(item_whatever), "activate", G_CALLBACK(sakura_borderless), NULL);
g_signal_connect(G_OBJECT(item_whatever), "activate", G_CALLBACK(sakura_maximized), NULL);

lp:~keruspe/sakura/graphical-options updated
333. By Marc-Antoine Perennou

Allow starting sakura borderless and maximized

Revision history for this message
Marc-Antoine Perennou (keruspe) wrote :

Done (now r333)

review: Needs Resubmitting
Revision history for this message
David Gómez (dabisu) wrote :

Sorry for the late answer. Already merged

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/sakura.c'
2--- src/sakura.c 2010-11-23 12:10:13 +0000
3+++ src/sakura.c 2010-12-13 19:12:14 +0000
4@@ -165,6 +165,8 @@
5 bool audible_bell;
6 bool visible_bell;
7 bool blinking_cursor;
8+ bool borderless;
9+ bool maximized;
10 bool full_screen;
11 bool keep_fc; /* Global flag to indicate that we don't want changes in the files and columns values */
12 GtkWidget *item_clear_background; /* We include here only the items which need to be hided */
13@@ -306,7 +308,7 @@
14 { "font", 'f', 0, G_OPTION_ARG_STRING, &option_font, N_("Select initial terminal font"), NULL },
15 { "ntabs", 'n', 0, G_OPTION_ARG_INT, &option_ntabs, N_("Select initial number of tabs"), NULL },
16 { "execute", 'x', 0, G_OPTION_ARG_STRING, &option_execute, N_("Execute command"), NULL },
17- { "xterm-execute", 'e', 0, G_OPTION_ARG_NONE, &option_xterm_execute, N_("Execute command (xterm compatible)"), NULL },
18+ { "xterm-execute", 'e', 0, G_OPTION_ARG_NONE, &option_xterm_execute, N_("Execute command (xterm compatible)"), NULL },
19 { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &option_xterm_args, NULL, NULL },
20 { "login", 'l', 0, G_OPTION_ARG_NONE, &option_login, N_("Login shell"), NULL },
21 { "title", 't', 0, G_OPTION_ARG_STRING, &option_title, N_("Set window title"), NULL },
22@@ -582,7 +584,7 @@
23
24 if ( (title!=NULL) && (g_strcmp0(title, "") !=0) ) {
25 chopped_title = g_strndup(title, 40); /* Should it be configurable? */
26- gtk_label_set_text(GTK_LABEL(term->label), chopped_title);
27+ gtk_label_set_text(GTK_LABEL(term->label), chopped_title);
28 gtk_window_set_title(GTK_WINDOW(sakura.main_window), window_title);
29 free(chopped_title);
30 } else { /* Use the default values */
31@@ -1192,6 +1194,32 @@
32
33
34 static void
35+sakura_borderless (GtkWidget *widget, void *data)
36+{
37+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
38+ gtk_window_set_decorated (GTK_WINDOW(sakura.main_window), FALSE);
39+ g_key_file_set_value(sakura.cfg, cfg_group, "borderless", "Yes");
40+ } else {
41+ gtk_window_set_decorated (GTK_WINDOW(sakura.main_window), TRUE);
42+ g_key_file_set_value(sakura.cfg, cfg_group, "borderless", "No");
43+ }
44+}
45+
46+
47+static void
48+sakura_maximized (GtkWidget *widget, void *data)
49+{
50+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
51+ gtk_window_maximize (GTK_WINDOW(sakura.main_window));
52+ g_key_file_set_value(sakura.cfg, cfg_group, "maximized", "Yes");
53+ } else {
54+ gtk_window_unmaximize (GTK_WINDOW(sakura.main_window));
55+ g_key_file_set_value(sakura.cfg, cfg_group, "maximized", "No");
56+ }
57+}
58+
59+
60+static void
61 sakura_set_palette(GtkWidget *widget, void *data)
62 {
63 struct terminal *term;
64@@ -1436,7 +1464,7 @@
65
66 term_data_id = g_quark_from_static_string("sakura_term");
67
68- /* Harcode TERM enviroment variable. With versions of vte>=0.26.0 behaviour seems to be different
69+ /* Harcode TERM enviroment variable. With versions of vte>=0.26.0 behaviour seems to be different
70 and if TERM is not defined we get errors from several applications */
71 g_setenv("TERM", "xterm", FALSE);
72
73@@ -1574,6 +1602,20 @@
74 sakura.blinking_cursor= (strcmp(cfgtmp, "Yes")==0) ? 1 : 0;
75 g_free(cfgtmp);
76
77+ if (!g_key_file_has_key(sakura.cfg, cfg_group, "borderless", NULL)) {
78+ g_key_file_set_value(sakura.cfg, cfg_group, "borderless", "No");
79+ }
80+ cfgtmp = g_key_file_get_value(sakura.cfg, cfg_group, "borderless", NULL);
81+ sakura.borderless= (strcmp(cfgtmp, "Yes")==0) ? 1 : 0;
82+ g_free(cfgtmp);
83+
84+ if (!g_key_file_has_key(sakura.cfg, cfg_group, "maximized", NULL)) {
85+ g_key_file_set_value(sakura.cfg, cfg_group, "maximized", "No");
86+ }
87+ cfgtmp = g_key_file_get_value(sakura.cfg, cfg_group, "maximized", NULL);
88+ sakura.maximized= (strcmp(cfgtmp, "Yes")==0) ? 1 : 0;
89+ g_free(cfgtmp);
90+
91 if (!g_key_file_has_key(sakura.cfg, cfg_group, "word_chars", NULL)) {
92 g_key_file_set_value(sakura.cfg, cfg_group, "word_chars", DEFAULT_WORD_CHARS);
93 }
94@@ -1755,7 +1797,7 @@
95 *item_select_background, *item_set_title, *item_full_screen,
96 *item_toggle_scrollbar, *item_options, *item_input_methods,
97 *item_opacity_menu, *item_show_first_tab, *item_audible_bell, *item_visible_bell,
98- *item_blinking_cursor,
99+ *item_blinking_cursor, *item_borderless_maximized,
100 *item_palette, *item_palette_tango, *item_palette_linux, *item_palette_xterm, *item_palette_rxvt,
101 *item_show_close_button;
102 GtkAction *action_open_link, *action_copy_link, *action_new_tab, *action_set_name, *action_close_tab,
103@@ -1805,6 +1847,7 @@
104 item_audible_bell=gtk_check_menu_item_new_with_label(_("Set audible bell"));
105 item_visible_bell=gtk_check_menu_item_new_with_label(_("Set visible bell"));
106 item_blinking_cursor=gtk_check_menu_item_new_with_label(_("Set blinking cursor"));
107+ item_borderless_maximized=gtk_check_menu_item_new_with_label(_("Make Sakura borderless and maximized"));
108 item_input_methods=gtk_menu_item_new_with_label(_("Input methods"));
109 item_palette_tango=gtk_radio_menu_item_new_with_label(NULL, "Tango");
110 item_palette_linux=gtk_radio_menu_item_new_with_label_from_widget(GTK_RADIO_MENU_ITEM(item_palette_tango), "Linux");
111@@ -1848,6 +1891,10 @@
112 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_blinking_cursor), TRUE);
113 }
114
115+ if (sakura.borderless && sakura.maximized) {
116+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_borderless_maximized), TRUE);
117+ }
118+
119 cfgtmp = g_key_file_get_string(sakura.cfg, cfg_group, "palette", NULL);
120 if (strcmp(cfgtmp, "linux")==0) {
121 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_palette_linux), TRUE);
122@@ -1896,6 +1943,7 @@
123 gtk_menu_shell_append(GTK_MENU_SHELL(options_menu), item_audible_bell);
124 gtk_menu_shell_append(GTK_MENU_SHELL(options_menu), item_visible_bell);
125 gtk_menu_shell_append(GTK_MENU_SHELL(options_menu), item_blinking_cursor);
126+ gtk_menu_shell_append(GTK_MENU_SHELL(options_menu), item_borderless_maximized);
127 gtk_menu_shell_append(GTK_MENU_SHELL(options_menu), gtk_separator_menu_item_new());
128 gtk_menu_shell_append(GTK_MENU_SHELL(options_menu), item_set_title);
129 gtk_menu_shell_append(GTK_MENU_SHELL(options_menu), item_opacity_menu);
130@@ -1912,7 +1960,7 @@
131 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item_options), options_menu);
132 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item_palette), palette_menu);
133
134- //gtk_menu_shell_append(GTK_MENU_SHELL(sakura.labels_menu), item_label_new_tab);
135+ //gtk_menu_shell_append(GTK_MENU_SHELL(sakura.labels_menu), item_label_new_tab);
136
137 /* ... and finally assign callbacks to menuitems */
138 g_signal_connect(G_OBJECT(action_new_tab), "activate", G_CALLBACK(sakura_new_tab), NULL);
139@@ -1932,6 +1980,8 @@
140 g_signal_connect(G_OBJECT(item_audible_bell), "activate", G_CALLBACK(sakura_audible_bell), NULL);
141 g_signal_connect(G_OBJECT(item_visible_bell), "activate", G_CALLBACK(sakura_visible_bell), NULL);
142 g_signal_connect(G_OBJECT(item_blinking_cursor), "activate", G_CALLBACK(sakura_blinking_cursor), NULL);
143+ g_signal_connect(G_OBJECT(item_borderless_maximized), "activate", G_CALLBACK(sakura_borderless), NULL);
144+ g_signal_connect(G_OBJECT(item_borderless_maximized), "activate", G_CALLBACK(sakura_maximized), NULL);
145 g_signal_connect(G_OBJECT(action_opacity), "activate", G_CALLBACK(sakura_opacity_dialog), NULL);
146 g_signal_connect(G_OBJECT(action_set_title), "activate", G_CALLBACK(sakura_set_title_dialog), NULL);
147 g_signal_connect(G_OBJECT(item_palette_tango), "activate", G_CALLBACK(sakura_set_palette), "tango");
148@@ -2304,6 +2354,11 @@
149 /* Disable stupid blinking cursor */
150 vte_terminal_set_cursor_blink_mode (VTE_TERMINAL(term->vte), sakura.blinking_cursor ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF);
151
152+ /* Apply user defined window configuration */
153+ gtk_window_set_decorated (GTK_WINDOW(sakura.main_window), sakura.borderless ? FALSE : TRUE);
154+ if (sakura.maximized) {
155+ gtk_window_maximize (GTK_WINDOW(sakura.main_window));
156+ }
157
158 /* Grrrr. Why the fucking label widget in the notebook STEAL the fucking focus? */
159 gtk_widget_grab_focus(term->vte);
160@@ -2466,7 +2521,7 @@
161 {
162 nargv[n]="-e";
163 n++;
164- nargv[n]="--";
165+ nargv[n]="--";
166 nargc = argc+1;
167 } else {
168 nargv[n]=g_strdup(argv[i]);

Subscribers

People subscribed via source and target branches