Commit 8f3d20de authored by Sebastian Ramacher's avatar Sebastian Ramacher

Disable sandbox when detecting WSL (fixes #50)

parent 8eaadc8d
......@@ -1055,7 +1055,7 @@ sandbox
Defines the sandbox mode to use for the seccomp syscall filter. Possible
values are "none", "normal" and "strict". If "none" is used, the sandbox
will be disabled. The use of "normal" will provide minimal protection and
allow normal use of seccomp with support for all features. The "strict" mode
allow normal use of zathura with support for all features. The "strict" mode
is a read only sandbox that is intended for viewing documents only.
* Value type: String
......@@ -1070,6 +1070,9 @@ Some features are disabled when using strict sandbox mode:
No feature regressions are expected when using normal sandbox mode.
When running under WSL, the default is "none" since seccomp is not supported in
that environment.
window-icon-document
^^^^^^^^^^^^^^^^^^^^
Defines whether the window document should be updated based on the first page of
......
......@@ -292,7 +292,9 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "selection-clipboard", string_value, STRING, false, _("The clipboard into which mouse-selected data will be written"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "selection-notification", &bool_value, BOOLEAN, false, _("Enable notification after selecting text"), NULL, NULL);
girara_setting_add(gsession, "sandbox", "normal", STRING, true, _("Sandbox level"), cb_sandbox_changed, NULL);
/* default to no sandbox when running in WSL */
string_value = running_under_wsl() ? "none" : "normal";
girara_setting_add(gsession, "sandbox", string_value, STRING, true, _("Sandbox level"), cb_sandbox_changed, NULL);
#define DEFAULT_SHORTCUTS(mode) \
girara_shortcut_add(gsession, 0, GDK_KEY_a, NULL, sc_adjust_window, (mode), ZATHURA_ADJUST_BESTFIT, NULL); \
......
......@@ -298,3 +298,15 @@ parse_color(GdkRGBA* color, const char* str)
}
return true;
}
bool
running_under_wsl(void)
{
bool result = false;
char* content = girara_file_read("/proc/version");
if (content != NULL && g_strstr_len(content, -1, "Microsoft")) {
result = true;
}
free(content);
return result;
}
......@@ -130,4 +130,11 @@ unsigned int find_first_page_column(const char* first_page_column_list,
*/
bool parse_color(GdkRGBA* color, const char* str);
/**
* Check if zathura is running under the Linux subsystem on Windows.
*
* @return true if running under WSL, false otherwise
*/
bool running_under_wsl(void);
#endif // UTILS_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment