Add and use settings "show_bar_by_default" and "show_bar_per_tag"
This commit is contained in:
parent
f9a40cea89
commit
c86ad740f0
|
@ -3,7 +3,6 @@
|
|||
static const char wm_name[] = "PolytreeWM";
|
||||
|
||||
/* appearance */
|
||||
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" };
|
||||
static const char col_gray1[] = "#222222";
|
||||
|
|
20
dwm.c
20
dwm.c
|
@ -152,7 +152,7 @@ struct Monitor {
|
|||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
unsigned int tagset[2];
|
||||
int showbar;
|
||||
bool showbar;
|
||||
int topbar;
|
||||
Client *clients;
|
||||
Client *sel;
|
||||
|
@ -185,7 +185,7 @@ struct Pertag {
|
|||
float mfacts[TAGS_COUNT + 1]; /* mfacts per tag */
|
||||
unsigned int sellts[TAGS_COUNT + 1]; /* selected layouts */
|
||||
const Layout *ltidxs[TAGS_COUNT + 1][2]; /* matrix of tags and layouts indexes */
|
||||
int showbars[TAGS_COUNT + 1]; /* display bar for the current tag */
|
||||
bool showbars[TAGS_COUNT + 1]; /* display bar for the current tag */
|
||||
};
|
||||
|
||||
/*************************
|
||||
|
@ -660,7 +660,7 @@ createmon(void)
|
|||
m->tagset[0] = m->tagset[1] = 1;
|
||||
m->mfact = mfact;
|
||||
m->nmaster = settings_get_default_clients_in_master();
|
||||
m->showbar = showbar;
|
||||
m->showbar = settings_get_show_bar_by_default();
|
||||
m->topbar = topbar;
|
||||
m->lt[0] = &layouts[0];
|
||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||
|
@ -1851,6 +1851,7 @@ void
|
|||
togglebar(const Arg *arg)
|
||||
{
|
||||
selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
|
||||
|
||||
updatebarpos(selmon);
|
||||
resizebarwin(selmon);
|
||||
if (showsystray) {
|
||||
|
@ -1934,8 +1935,11 @@ toggleview(const Arg *arg)
|
|||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag] &&
|
||||
settings_get_show_bar_per_tag())
|
||||
{
|
||||
togglebar(NULL);
|
||||
}
|
||||
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
|
@ -2276,7 +2280,9 @@ view(const Arg *arg)
|
|||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt ^ 1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt ^ 1];
|
||||
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag]) {
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag] &&
|
||||
settings_get_show_bar_per_tag())
|
||||
{
|
||||
togglebar(NULL);
|
||||
}
|
||||
|
||||
|
@ -2319,7 +2325,9 @@ viewrel(const Arg *arg)
|
|||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt ^ 1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt ^ 1];
|
||||
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag]) {
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag] &&
|
||||
settings_get_show_bar_per_tag())
|
||||
{
|
||||
togglebar(NULL);
|
||||
}
|
||||
|
||||
|
|
22
settings.c
22
settings.c
|
@ -20,6 +20,8 @@ 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 bool show_bar_by_default = true;
|
||||
static bool show_bar_per_tag = false;
|
||||
static unsigned int snap_distance = 32;
|
||||
static bool swallow_floating = false;
|
||||
|
||||
|
@ -128,6 +130,26 @@ void settings_set_respect_resize_hints_in_floating_layout(const bool new_respect
|
|||
// TODO: notify WM to rearrange clients
|
||||
}
|
||||
|
||||
bool settings_get_show_bar_by_default()
|
||||
{
|
||||
return show_bar_by_default;
|
||||
}
|
||||
|
||||
void settings_set_show_bar_by_default(bool new_show_bar_by_default)
|
||||
{
|
||||
show_bar_by_default = new_show_bar_by_default;
|
||||
}
|
||||
|
||||
bool settings_get_show_bar_per_tag()
|
||||
{
|
||||
return show_bar_per_tag;
|
||||
}
|
||||
|
||||
void settings_set_show_bar_per_tag(bool new_show_bar_per_tag)
|
||||
{
|
||||
show_bar_per_tag = new_show_bar_per_tag;
|
||||
}
|
||||
|
||||
unsigned int settings_get_snap_distance()
|
||||
{
|
||||
return snap_distance;
|
||||
|
|
|
@ -37,6 +37,12 @@ void settings_set_max_clients_in_master(int new_max_clients_in_master);
|
|||
bool settings_get_respect_resize_hints_in_floating_layout();
|
||||
void settings_set_respect_resize_hints_in_floating_layout(bool new_respect_resize_hints_in_floating_layout);
|
||||
|
||||
bool settings_get_show_bar_by_default();
|
||||
void settings_set_show_bar_by_default(bool new_show_bar_by_default);
|
||||
|
||||
bool settings_get_show_bar_per_tag();
|
||||
void settings_set_show_bar_per_tag(bool new_show_bar_per_tag);
|
||||
|
||||
unsigned int settings_get_snap_distance();
|
||||
void settings_set_snap_distance(unsigned int new_snap_distance);
|
||||
|
||||
|
|
Loading…
Reference in New Issue