Provide the layout of the focused desk. of every monitor

This commit is contained in:
Bastien Dejean 2014-07-19 10:32:04 +02:00
parent d85d3133f9
commit aebb6713b4
6 changed files with 11 additions and 14 deletions

View file

@ -77,7 +77,7 @@ void change_layout(monitor_t *m, desktop_t *d, layout_t l)
{
d->layout = l;
arrange(m, d);
if (d == mon->desk)
if (d == m->desk)
put_status();
}

View file

@ -2,12 +2,12 @@
.\" Title: bspwm
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 07/18/2014
.\" Date: 07/19/2014
.\" Manual: Bspwm Manual
.\" Source: Bspwm 0.8.9
.\" Language: English
.\"
.TH "BSPWM" "1" "07/18/2014" "Bspwm 0\&.8\&.9" "Bspwm Manual"
.TH "BSPWM" "1" "07/19/2014" "Bspwm 0\&.8\&.9" "Bspwm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@ -1194,9 +1194,9 @@ Urgent focused desktop\&.
Urgent unfocused desktop\&.
.RE
.PP
\fIL(tiled|monocle)\fR
\fIL(T|M)\fR
.RS 4
Layout of the focused desktop of the focused monitor\&.
Layout of the focused desktop of a monitor\&.
.RE
.SH "ENVIRONMENT VARIABLES"
.PP

View file

@ -741,8 +741,8 @@ Each item has the form '<type><value>' where '<type>' is the first character of
'u<desktop_name>'::
Urgent unfocused desktop.
'L(tiled|monocle)'::
Layout of the focused desktop of the focused monitor.
'L(T|M)'::
Layout of the focused desktop of a monitor.
Environment Variables
---------------------

View file

@ -25,7 +25,7 @@ while read -r line ; do
case $item in
O*)
# focused occupied desktop
wm_infos="$wm_infos %{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u}${name}%{-u}"
wm_infos="$wm_infos %{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u}${name}%{B-}%{-u}"
;;
F*)
# focused free desktop
@ -49,8 +49,7 @@ while read -r line ; do
;;
L*)
# layout
layout=$(printf "%s" "${name}" | sed 's/\(.\).*/\U\1/')
wm_infos="$wm_infos %{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG}$layout"
wm_infos="$wm_infos %{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG}${name}"
;;
esac
shift

View file

@ -82,8 +82,7 @@ while read -r line ; do
;;
L*)
# layout
layout=$(printf "%s" "${item#?}" | sed 's/^\(.\).*/\U\1/')
wm_infos="${wm_infos}^fg()^bg()${PADDING}${PADDING}^fg($COLOR_LAYOUT_FG)^bg($COLOR_LAYOUT_BG)^ca(1, bspc desktop -l next)${PADDING}$layout${PADDING}^ca()"
wm_infos="${wm_infos}^fg()^bg()${PADDING}${PADDING}^fg($COLOR_LAYOUT_FG)^bg($COLOR_LAYOUT_BG)^ca(1, bspc desktop -l next)${PADDING}${item#?}${PADDING}^ca()"
;;
esac
shift

View file

@ -87,9 +87,8 @@ int print_status(FILE *stream)
c = toupper(c);
fprintf(stream, "%c%s:", c, d->name);
}
fprintf(stream, "L%c", (m->desk->layout == LAYOUT_TILED ? 'T' : 'M'));
}
if (mon != NULL && mon->desk != NULL)
fprintf(stream, "L%s", (mon->desk->layout == LAYOUT_TILED ? "tiled" : "monocle"));
fprintf(stream, "%s", "\n");
return fflush(stream);
}