Skip to content

Commit

Permalink
expand: add prev_{desk,pagex,pagey}
Browse files Browse the repository at this point in the history
Add further variables, for ascertaining what the previous desk, pagex,
pagey is for a given monitor.
  • Loading branch information
ThomasAdam committed Jul 13, 2021
1 parent 48a2838 commit 91b27a1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
8 changes: 7 additions & 1 deletion doc/fvwm3/fvwm3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ $[pointer.screen]::
+
This command is deprecated; use $[monitor.current] instead.

$[monitor.<n>.x], $[monitor.<n>.y], $[monitor.<n>.width], $[monitor.<n>.height], $[monitor.<n>.desk], $[monitor.<n>.pagex], $[monitor.<n>.pagey] $[monitor.primary], $[monitor.current], $[monitor.output], $[monitor.count]::
$[monitor.<n>.x], $[monitor.<n>.y], $[monitor.<n>.width], $[monitor.<n>.height], $[monitor.<n>.desk], $[monitor.<n>.pagex], $[monitor.<n>.pagey] $[monitor.primary], $[monitor.current], $[monitor.output], $[monitor.count], $[monitor.<n>.prev_desk], $[monitor.<n>.prev_pagex], $[monitor.<n>.prev_pagey]::
Returns information about the selected monitor. These can be nested, for
example: $[monitor.$[monitor.primary].width]
+
Expand All @@ -1683,6 +1683,12 @@ monitor which has the mouse pointer.
"pagey" returns the Y page of the referenced monitor.
+
"primary" is the name of the output set as primary via xrandr(1).
+
"prev_desk" returns the previous desk on the referenced monitor.
+
"prev_pagex" returns the previous X page on the referenced monitor.
+
"prev_pagey" retuns the previous Y page on the referenced monitor.

$[screen]::
The screen number fvwm is running on. Useful for setups with multiple
Expand Down
20 changes: 20 additions & 0 deletions fvwm/expand.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,26 @@ static signed int expand_vars_extended(
monitor_get_all_heights());
goto GOT_STRING;
}

if (strcmp(rest, "prev_desk") == 0) {
is_numeric = True;
val = m->virtual_scr.prev_desk_and_page_desk;
goto GOT_STRING;
}

if (strcmp(rest, "prev_pagex") == 0) {
is_numeric = True;
val = (int)(m->virtual_scr.prev_page_x /
monitor_get_all_widths());
goto GOT_STRING;
}

if (strcmp(rest, "prev_pagey") == 0) {
is_numeric = True;
val = (int)(m->virtual_scr.prev_page_y /
monitor_get_all_heights());
goto GOT_STRING;
}
}
break;
}
Expand Down

0 comments on commit 91b27a1

Please sign in to comment.