Skip to content

Commit

Permalink
expand: add desk, pagex, pagey variables
Browse files Browse the repository at this point in the history
This adds a few more variables which exposes more internal state for use
in functions and modules.
  • Loading branch information
ThomasAdam committed Jun 15, 2021
1 parent f5f6fd5 commit 1686ee2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
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.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]::
Returns information about the selected monitor. These can be nested, for
example: $[monitor.$[monitor.primary].width]
+
Expand All @@ -1676,6 +1676,12 @@ monitor which has the mouse pointer.
+
"count" returns the number of active monitors.
+
"desk" returns the current desk displayed on the referenced monitor.
+
"pagex" returns the X page on the referenced monitor.
+
"pagey" returns the Y page of the referenced monitor.
+
"primary" is the name of the output set as primary via xrandr(1).

$[screen]::
Expand Down
22 changes: 21 additions & 1 deletion fvwm/expand.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,27 @@ static signed int expand_vars_extended(

if (strcmp(rest, "output") == 0) {
is_numeric = True;
val = (int)m->si->rr_output;
val = (int)mon->si->rr_output;
goto GOT_STRING;
}

if (strcmp(rest, "desk") == 0) {
is_numeric = True;
val = mon->virtual_scr.CurrentDesk;
goto GOT_STRING;
}

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

if (strcmp(rest, "pagey") == 0) {
is_numeric = True;
val = (int)(mon->virtual_scr.Vy /
monitor_get_all_heights());
goto GOT_STRING;
}
}
Expand Down

0 comments on commit 1686ee2

Please sign in to comment.