mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
[Window] Allow rofi to stay active on closing a window
```css configuration { window { close-on-delete: false; } } ``` fixes: #1071
This commit is contained in:
parent
19dfb67606
commit
8720409ad3
3 changed files with 55 additions and 9 deletions
16
doc/rofi.1
16
doc/rofi.1
|
@ -887,6 +887,22 @@ Default: \fI"wmctrl \-i \-R {window}"\fP
|
|||
.PP
|
||||
Show window thumbnail (if available) as icon in the window switcher.
|
||||
|
||||
.PP
|
||||
You can stop rofi from existing when closing a window (allowing multiple to be closed in a row).
|
||||
|
||||
.PP
|
||||
.RS
|
||||
|
||||
.nf
|
||||
configuration {
|
||||
window {
|
||||
close\-on\-delete: false;
|
||||
}
|
||||
}
|
||||
|
||||
.fi
|
||||
.RE
|
||||
|
||||
.SS Combi settings
|
||||
.PP
|
||||
\fB\fC\-combi\-modi\fR \fImode1\fP,\fImode2\fP
|
||||
|
|
|
@ -525,6 +525,16 @@ Default: *"wmctrl -i -R {window}"*
|
|||
Show window thumbnail (if available) as icon in the window switcher.
|
||||
|
||||
|
||||
You can stop rofi from existing when closing a window (allowing multiple to be closed in a row).
|
||||
|
||||
```css
|
||||
configuration {
|
||||
window {
|
||||
close-on-delete: false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Combi settings
|
||||
|
||||
`-combi-modi` *mode1*,*mode2*
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "timings.h"
|
||||
|
||||
#include "rofi-icon-fetcher.h"
|
||||
#include "mode-private.h"
|
||||
|
||||
#define WINLIST 32
|
||||
|
||||
|
@ -181,20 +182,27 @@ static int winlist_append ( winlist *l, xcb_window_t w, client *d )
|
|||
return l->len - 1;
|
||||
}
|
||||
|
||||
static void client_free ( client *c )
|
||||
{
|
||||
if ( c == NULL ) {
|
||||
return;
|
||||
}
|
||||
if ( c->icon ) {
|
||||
cairo_surface_destroy ( c->icon );
|
||||
}
|
||||
g_free ( c->title );
|
||||
g_free ( c->class );
|
||||
g_free ( c->name );
|
||||
g_free ( c->role );
|
||||
g_free ( c->wmdesktopstr );
|
||||
}
|
||||
static void winlist_empty ( winlist *l )
|
||||
{
|
||||
while ( l->len > 0 ) {
|
||||
client *c = l->data[--l->len];
|
||||
if ( c != NULL ) {
|
||||
if ( c->icon ) {
|
||||
cairo_surface_destroy ( c->icon );
|
||||
}
|
||||
g_free ( c->title );
|
||||
g_free ( c->class );
|
||||
g_free ( c->name );
|
||||
g_free ( c->role );
|
||||
g_free ( c->wmdesktopstr );
|
||||
g_free ( c );
|
||||
client_free ( c );
|
||||
g_free ( c );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -710,6 +718,18 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
|
|||
else if ( ( mretv & ( MENU_ENTRY_DELETE ) ) == MENU_ENTRY_DELETE ) {
|
||||
xcb_ewmh_request_close_window ( &( xcb->ewmh ), xcb->screen_nbr, rmpd->ids->array[selected_line], XCB_CURRENT_TIME, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER );
|
||||
xcb_flush ( xcb->connection );
|
||||
ThemeWidget *wid = rofi_config_find_widget ( sw->name, NULL, TRUE );
|
||||
Property *p = rofi_theme_find_property ( wid, P_BOOLEAN, "close-on-delete", TRUE );
|
||||
if ( p && p->type == P_BOOLEAN && p->value.b == FALSE ){
|
||||
// Force a reload.
|
||||
client_free ( rmpd->ids->data[selected_line] );
|
||||
g_free ( rmpd->ids->data[selected_line] );
|
||||
memmove(&(rmpd->ids->array[selected_line]), &(rmpd->ids->array[selected_line+1]), rmpd->ids->len-selected_line);
|
||||
memmove(&(rmpd->ids->data[selected_line]), &(rmpd->ids->data[selected_line+1]), rmpd->ids->len-selected_line);
|
||||
rmpd->ids->len--;
|
||||
|
||||
retv = RELOAD_DIALOG;
|
||||
}
|
||||
}
|
||||
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
||||
GError *error = NULL;
|
||||
|
|
Loading…
Reference in a new issue