mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-11 13:50:48 -05:00
Add [no]focus restore option.
This commit is contained in:
parent
6fc686c50d
commit
750dbad729
7 changed files with 28 additions and 3 deletions
|
@ -173,5 +173,7 @@ Settings config = {
|
||||||
.benchmark_ui = FALSE,
|
.benchmark_ui = FALSE,
|
||||||
|
|
||||||
/** normalize match */
|
/** normalize match */
|
||||||
.normalize_match = FALSE
|
.normalize_match = FALSE,
|
||||||
|
/** restore focus */
|
||||||
|
.restore_focus = TRUE
|
||||||
};
|
};
|
||||||
|
|
|
@ -442,6 +442,12 @@ Use Pango markup to format output wherever possible.
|
||||||
.PP
|
.PP
|
||||||
Make \fBrofi\fP react like a normal application window. Useful for scripts like Clerk that are basically an application.
|
Make \fBrofi\fP react like a normal application window. Useful for scripts like Clerk that are basically an application.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
\fB\fC\-[no\-]restore\-focus\fR
|
||||||
|
|
||||||
|
.PP
|
||||||
|
Make rofi restore focus to window that held it when launched.
|
||||||
|
|
||||||
.SS Matching
|
.SS Matching
|
||||||
.PP
|
.PP
|
||||||
\fB\fC\-matching\fR \fImethod\fP
|
\fB\fC\-matching\fR \fImethod\fP
|
||||||
|
|
|
@ -254,6 +254,10 @@ Use Pango markup to format output wherever possible.
|
||||||
|
|
||||||
Make **rofi** react like a normal application window. Useful for scripts like Clerk that are basically an application.
|
Make **rofi** react like a normal application window. Useful for scripts like Clerk that are basically an application.
|
||||||
|
|
||||||
|
`-[no-]restore-focus`
|
||||||
|
|
||||||
|
Make rofi restore focus to window that held it when launched.
|
||||||
|
|
||||||
### Matching
|
### Matching
|
||||||
|
|
||||||
`-matching` *method*
|
`-matching` *method*
|
||||||
|
|
|
@ -205,6 +205,8 @@ typedef struct
|
||||||
gboolean benchmark_ui;
|
gboolean benchmark_ui;
|
||||||
|
|
||||||
gboolean normalize_match;
|
gboolean normalize_match;
|
||||||
|
/** Restore focus */
|
||||||
|
gboolean restore_focus;
|
||||||
} Settings;
|
} Settings;
|
||||||
/** Global Settings structure. */
|
/** Global Settings structure. */
|
||||||
extern Settings config;
|
extern Settings config;
|
||||||
|
|
|
@ -751,11 +751,15 @@ static void helper_eval_add_str ( GString *str, const char *input, int l, int ma
|
||||||
else {
|
else {
|
||||||
if ( nc > l ) {
|
if ( nc > l ) {
|
||||||
int bl = g_utf8_offset_to_pointer ( input_nn, l ) - input_nn;
|
int bl = g_utf8_offset_to_pointer ( input_nn, l ) - input_nn;
|
||||||
g_string_append_len ( str, input_nn, bl );
|
char *tmp = g_regex_escape_string(input_nn, bl);
|
||||||
|
g_string_append ( str, tmp );
|
||||||
|
g_free(tmp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
spaces = l - nc;
|
spaces = l - nc;
|
||||||
g_string_append ( str, input_nn );
|
char *tmp = g_regex_escape_string(input_nn, -1);
|
||||||
|
g_string_append ( str, tmp );
|
||||||
|
g_free(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( spaces-- ) {
|
while ( spaces-- ) {
|
||||||
|
@ -819,6 +823,7 @@ static char *_get_display_value ( const Mode *sw, unsigned int selected_line, in
|
||||||
if ( c->active ) {
|
if ( c->active ) {
|
||||||
*state |= ACTIVE;
|
*state |= ACTIVE;
|
||||||
}
|
}
|
||||||
|
*state |= MARKUP;
|
||||||
return get_entry ? _generate_display_string ( rmpd, c ) : NULL;
|
return get_entry ? _generate_display_string ( rmpd, c ) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1187,6 +1187,10 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
|
||||||
|
|
||||||
void rofi_xcb_set_input_focus ( xcb_window_t w )
|
void rofi_xcb_set_input_focus ( xcb_window_t w )
|
||||||
{
|
{
|
||||||
|
if ( config.restore_focus == FALSE ) {
|
||||||
|
xcb->focus_revert = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
xcb_generic_error_t *error;
|
xcb_generic_error_t *error;
|
||||||
xcb_get_input_focus_reply_t *freply;
|
xcb_get_input_focus_reply_t *freply;
|
||||||
xcb_get_input_focus_cookie_t fcookie = xcb_get_input_focus ( xcb->connection );
|
xcb_get_input_focus_cookie_t fcookie = xcb_get_input_focus ( xcb->connection );
|
||||||
|
|
|
@ -233,6 +233,8 @@ static XrmOption xrmOptions[] = {
|
||||||
"DRUN: If enabled, reload the cache with desktop file content.", CONFIG_DEFAULT },
|
"DRUN: If enabled, reload the cache with desktop file content.", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "normalize-match", { .snum = &config.normalize_match }, NULL,
|
{ xrm_Boolean, "normalize-match", { .snum = &config.normalize_match }, NULL,
|
||||||
"Normalize string when matching (implies -no-show-match).", CONFIG_DEFAULT },
|
"Normalize string when matching (implies -no-show-match).", CONFIG_DEFAULT },
|
||||||
|
{ xrm_Boolean, "restore-focus", { .snum = &config.restore_focus }, NULL,
|
||||||
|
"Restore focus on close to window that had it on rofi start.", CONFIG_DEFAULT },
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Dynamic array of extra options */
|
/** Dynamic array of extra options */
|
||||||
|
|
Loading…
Reference in a new issue