Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expand: add prev_{desk,pagex,pagey} #579

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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