diff --git a/LUA_API.rst b/LUA_API.rst
index 9ecd2e55e..59a52e596 100644
--- a/LUA_API.rst
+++ b/LUA_API.rst
@@ -613,6 +613,15 @@ can be omitted.
Gui module
----------
+* ``dfhack.gui.getCurViewscreen()``
+
+ Returns the viewscreen that is current in the core.
+
+* ``dfhack.gui.getFocusString(viewscreen)``
+
+ Returns a string representation of the current focus position
+ in the ui. The string has a "screen/foo/bar/baz..." format.
+
* ``dfhack.gui.getSelectedWorkshopJob([silent])``
When a job is selected in *'q'* mode, returns the job, else
diff --git a/Lua API.html b/Lua API.html
index 7ce777c42..e2d4ec23e 100644
--- a/Lua API.html
+++ b/Lua API.html
@@ -868,6 +868,13 @@ can be omitted.
+dfhack.gui.getCurViewscreen()
+Returns the viewscreen that is current in the core.
+
+dfhack.gui.getFocusString(viewscreen)
+Returns a string representation of the current focus position
+in the ui. The string has a "screen/foo/bar/baz..." format.
+
dfhack.gui.getSelectedWorkshopJob([silent])
When a job is selected in 'q' mode, returns the job, else
prints error unless silent and returns nil.
diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp
index d4c3b157d..9dfb39754 100644
--- a/library/LuaApi.cpp
+++ b/library/LuaApi.cpp
@@ -61,6 +61,7 @@ distribution.
#include "df/unit.h"
#include "df/item.h"
#include "df/material.h"
+#include "df/viewscreen.h"
#include "df/assumed_identity.h"
#include "df/nemesis_record.h"
#include "df/historical_figure.h"
@@ -652,6 +653,8 @@ static const LuaWrapper::FunctionReg dfhack_module[] = {
/***** Gui module *****/
static const LuaWrapper::FunctionReg dfhack_gui_module[] = {
+ WRAPM(Gui, getCurViewscreen),
+ WRAPM(Gui, getFocusString),
WRAPM(Gui, getSelectedWorkshopJob),
WRAPM(Gui, getSelectedJob),
WRAPM(Gui, getSelectedUnit),
diff --git a/library/MiscUtils.cpp b/library/MiscUtils.cpp
index 8658788bb..b73d730c1 100644
--- a/library/MiscUtils.cpp
+++ b/library/MiscUtils.cpp
@@ -36,6 +36,7 @@ distribution.
#include
#include
+#include
#include
#include