Add settings "enable_swallowing" and "swallow_floating"
This commit is contained in:
parent
c04e59d42d
commit
2fa068dfe9
4 changed files with 32 additions and 6 deletions
|
@ -3,7 +3,6 @@
|
|||
static const char wm_name[] = "PolytreeWM";
|
||||
|
||||
/* appearance */
|
||||
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
|
|
8
dwm.c
8
dwm.c
|
@ -522,11 +522,9 @@ attachstack(Client *c)
|
|||
void
|
||||
swallow(Client *p, Client *c)
|
||||
{
|
||||
|
||||
if (c->noswallow || c->isterminal)
|
||||
return;
|
||||
if (c->noswallow && !swallowfloating && c->isfloating)
|
||||
return;
|
||||
if (!settings_get_enable_swallowing()) return;
|
||||
if (c->noswallow || c->isterminal) return;
|
||||
if (!settings_get_swallow_floating() && c->isfloating) return;
|
||||
|
||||
detach(c);
|
||||
detachstack(c);
|
||||
|
|
23
settings.c
23
settings.c
|
@ -15,11 +15,13 @@ static int border_width = 2;
|
|||
static int default_clients_in_master = 1;
|
||||
static bool enable_border_for_single_window = true;
|
||||
static bool enable_gap_for_single_window = true;
|
||||
static bool enable_swallowing = true;
|
||||
static bool focus_on_wheel = true;
|
||||
static int gap_size = 10;
|
||||
static int max_clients_in_master = 0; // 0 for no maximum
|
||||
static bool respect_resize_hints_in_floating_layout = false;
|
||||
static unsigned int snap_distance = 32;
|
||||
static bool swallow_floating = false;
|
||||
|
||||
int settings_get_border_width()
|
||||
{
|
||||
|
@ -68,6 +70,17 @@ void settings_set_enable_gap_for_single_window(const bool new_enable_gap_for_sin
|
|||
// TODO: notify WM to rearrange clients
|
||||
}
|
||||
|
||||
bool settings_get_enable_swallowing()
|
||||
{
|
||||
return enable_swallowing;
|
||||
}
|
||||
|
||||
void settings_set_enable_swallowing(const bool new_enable_swallowing)
|
||||
{
|
||||
enable_swallowing = new_enable_swallowing;
|
||||
}
|
||||
|
||||
|
||||
bool settings_get_focus_on_wheel()
|
||||
{
|
||||
return focus_on_wheel;
|
||||
|
@ -126,3 +139,13 @@ void settings_set_snap_distance(unsigned int new_snap_distance)
|
|||
if (new_snap_distance < MAX_SNAP_DISTANCE) new_snap_distance = MAX_SNAP_DISTANCE;
|
||||
snap_distance = new_snap_distance;
|
||||
}
|
||||
|
||||
bool settings_get_swallow_floating()
|
||||
{
|
||||
return swallow_floating;
|
||||
}
|
||||
|
||||
void settings_set_swallow_floating(const bool new_swallow_floating)
|
||||
{
|
||||
swallow_floating = new_swallow_floating;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@ void settings_set_enable_border_for_single_window(bool new_enable_border_for_sin
|
|||
bool settings_get_enable_gap_for_single_window();
|
||||
void settings_set_enable_gap_for_single_window(bool new_enable_gap_for_single_window);
|
||||
|
||||
bool settings_get_enable_swallowing();
|
||||
void settings_set_enable_swallowing(bool new_enable_swallowing);
|
||||
|
||||
bool settings_get_focus_on_wheel();
|
||||
void settings_set_focus_on_wheel(bool new_focus_on_wheel);
|
||||
|
||||
|
@ -30,4 +33,7 @@ void settings_set_respect_resize_hints_in_floating_layout(bool new_respect_resiz
|
|||
unsigned int settings_get_snap_distance();
|
||||
void settings_set_snap_distance(unsigned int new_snap_distance);
|
||||
|
||||
bool settings_get_swallow_floating();
|
||||
void settings_set_swallow_floating(bool new_swallow_floating);
|
||||
|
||||
#endif // _SETTINGS_H
|
||||
|
|
Loading…
Add table
Reference in a new issue