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; d->layout = l;
arrange(m, d); arrange(m, d);
if (d == mon->desk) if (d == m->desk)
put_status(); put_status();
} }

View file

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

View file

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

View file

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

View file

@ -82,8 +82,7 @@ while read -r line ; do
;; ;;
L*) L*)
# layout # 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}${item#?}${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}$layout${PADDING}^ca()"
;; ;;
esac esac
shift shift

View file

@ -87,9 +87,8 @@ int print_status(FILE *stream)
c = toupper(c); c = toupper(c);
fprintf(stream, "%c%s:", c, d->name); 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"); fprintf(stream, "%s", "\n");
return fflush(stream); return fflush(stream);
} }