diff --git a/include/config.h b/include/config.h index 6ab6baee..986f7aa2 100644 --- a/include/config.h +++ b/include/config.h @@ -127,6 +127,12 @@ struct Config { struct Colortriple unfocused; struct Colortriple urgent; } bar; + + /** What should happen when a new popup is opened during fullscreen mode */ + enum { + PDF_LEAVE_FULLSCREEN = 0, + PDF_IGNORE = 1 + } popup_during_fullscreen; }; /** diff --git a/src/cfgparse.l b/src/cfgparse.l index 66afb14b..b8b1d73d 100644 --- a/src/cfgparse.l +++ b/src/cfgparse.l @@ -99,6 +99,9 @@ none { return TOK_NONE; } 1pixel { return TOK_1PIXEL; } focus_follows_mouse { return TOKFOCUSFOLLOWSMOUSE; } workspace_bar { return TOKWORKSPACEBAR; } +popup_during_fullscreen { return TOK_POPUP_DURING_FULLSCREEN; } +ignore { return TOK_IGNORE; } +leave_fullscreen { return TOK_LEAVE_FULLSCREEN; } default { /* yylval.number = MODE_DEFAULT; */return TOKCONTAINERMODE; } stacking { /* yylval.number = MODE_STACK; */return TOKCONTAINERMODE; } tabbed { /* yylval.number = MODE_TABBED; */return TOKCONTAINERMODE; } diff --git a/src/cfgparse.y b/src/cfgparse.y index d3a5ecda..adb02122 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -233,6 +233,9 @@ void parse_file(const char *f) { %token TOKWORKSPACEBAR "workspace_bar" %token TOKCONTAINERMODE "default/stacking/tabbed" %token TOKSTACKLIMIT "stack-limit" +%token TOK_POPUP_DURING_FULLSCREEN "popup_during_fullscreen" +%token TOK_IGNORE "ignore" +%token TOK_LEAVE_FULLSCREEN "leave_fullscreen" %% @@ -260,6 +263,7 @@ line: | terminal | font | comment + | popup_during_fullscreen ; comment: @@ -641,3 +645,16 @@ binding_modifier: | TOKCONTROL { $$ = BIND_CONTROL; } | TOKSHIFT { $$ = BIND_SHIFT; } ; + +popup_during_fullscreen: + TOK_POPUP_DURING_FULLSCREEN WHITESPACE popup_setting + { + DLOG("popup_during_fullscreen setting: %d\n", $3); + config.popup_during_fullscreen = $3; + } + ; + +popup_setting: + TOK_IGNORE { $$ = PDF_IGNORE; } + | TOK_LEAVE_FULLSCREEN { $$ = PDF_LEAVE_FULLSCREEN; } + ; diff --git a/src/manage.c b/src/manage.c index cd82d020..53526f6a 100644 --- a/src/manage.c +++ b/src/manage.c @@ -247,9 +247,20 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki if (cwindow->transient_for != XCB_NONE || (cwindow->leader != XCB_NONE && cwindow->leader != cwindow->id && - con_by_window_id(cwindow->leader) != NULL)) + con_by_window_id(cwindow->leader) != NULL)) { + LOG("This window is transiert for another window, setting floating\n"); want_floating = true; + if (config.popup_during_fullscreen == PDF_LEAVE_FULLSCREEN) { + Con *ws = con_get_workspace(nc); + Con *fs = con_get_fullscreen_con(ws); + if (fs != NULL) { + LOG("There is a fullscreen window, leaving fullscreen mode\n"); + con_toggle_fullscreen(fs); + } + } + } + /* dock clients cannot be floating, that makes no sense */ if (cwindow->dock) want_floating = false;