mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-25 21:39:45 +01:00
Disable sandbox when detecting WSL (fixes pwmt/zathura#50)
This commit is contained in:
parent
8eaadc8d6d
commit
8f3d20de88
4 changed files with 26 additions and 2 deletions
|
@ -1055,7 +1055,7 @@ sandbox
|
||||||
Defines the sandbox mode to use for the seccomp syscall filter. Possible
|
Defines the sandbox mode to use for the seccomp syscall filter. Possible
|
||||||
values are "none", "normal" and "strict". If "none" is used, the sandbox
|
values are "none", "normal" and "strict". If "none" is used, the sandbox
|
||||||
will be disabled. The use of "normal" will provide minimal protection and
|
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.
|
is a read only sandbox that is intended for viewing documents only.
|
||||||
|
|
||||||
* Value type: String
|
* 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.
|
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
|
window-icon-document
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
Defines whether the window document should be updated based on the first page of
|
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);
|
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;
|
bool_value = true;
|
||||||
girara_setting_add(gsession, "selection-notification", &bool_value, BOOLEAN, false, _("Enable notification after selecting text"), NULL, NULL);
|
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) \
|
#define DEFAULT_SHORTCUTS(mode) \
|
||||||
girara_shortcut_add(gsession, 0, GDK_KEY_a, NULL, sc_adjust_window, (mode), ZATHURA_ADJUST_BESTFIT, NULL); \
|
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;
|
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);
|
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
|
#endif // UTILS_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue