Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default class EntryAbility extends RustAbility {
});
setTimeout(() => {
windowStage.getMainWindow((err, data) => {
data.setWindowDecorHeight(32)
data.setWindowDecorHeight(44)
data.setWindowDecorVisible(false);
})
}, 40)
Expand Down
30 changes: 0 additions & 30 deletions src/apps/vcoder/entry/src/main/module.json5
Original file line number Diff line number Diff line change
Expand Up @@ -34,45 +34,15 @@
}
],
"requestPermissions": [
{
"name": "ohos.permission.PREPARE_APP_TERMINATE"
},
{
"name": "ohos.permission.INTERNET"
},
// {
// "name": "ohos.permission.GET_ALL_PROCESSES"
// },
{
"name": "ohos.permission.READ_WRITE_USER_FILE"
},
// {
// "name": "ohos.permission.SECURE_PASTE"
// },
{
"name": "ohos.permission.CUSTOM_SANDBOX"
},
// {
// "name": "ohos.permission.MANAGE_USER_IDM"
// },
// {
// "name": "ohos.permission.ACCESS_PIN_AUTH"
// },
// {
// "name": "ohos.permission.ACCESS_USER_AUTH_INTERNAL"
// },
// {
// "name": "ohos.permission.DUMP"
// },
// {
// "name": "ohos.permission.READ_DIAGNOSTIC_LOGS"
// },
// {
// "name": "ohos.permission.READ_DFX_SYSEVENT"
// },
// {
// "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
// },
{
"name": "ohos.permission.READ_CALENDAR",
"reason": "$string:module_desc",
Expand Down
27 changes: 13 additions & 14 deletions src/apps/vcoder/entry/src/main/resources/base/element/string.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
}
]
"string": [{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "Bitfun"
}
]
}
41 changes: 39 additions & 2 deletions src/crates/core/src/service/terminal/src/shell/detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,22 @@ impl ShellDetector {

#[cfg(not(windows))]
{
if let Some(bash_path) = Self::find_bash_with_which() {
if let Some(zsh_path) = Self::find_zsh_with_which() {
return DetectedShell {
shell_type: ShellType::Zsh,
path: zsh_path.clone(),
version: Self::get_shell_version(zsh_path.to_str().unwrap_or_default()),
display_name: "zsh".to_string(),
};
} else if let Some(bash_path) = Self::find_bash_with_which() {
return DetectedShell {
shell_type: ShellType::Bash,
path: bash_path.clone(),
version: Self::get_shell_version(bash_path.to_str().unwrap_or_default()),
display_name: "bash".to_string(),
};
} else {
}
{
log::error!("bash not found");
}
// Try to use $SHELL environment variable
Expand Down Expand Up @@ -313,6 +321,35 @@ impl ShellDetector {
None
}

#[cfg(not(windows))]
fn find_zsh_with_which() -> Option<PathBuf> {
let output = std::process::Command::new("which").arg("zsh").output();
match output {
Ok(output) => {
if output.status.success() {
let path_str = String::from_utf8_lossy(&output.stdout).trim().to_string();
if !path_str.is_empty() {
let path = PathBuf::from(path_str);
if path.exists() {
return Some(path);
} else {
log::warn!("zsh path not exist");
}
} else {
log::warn!("zsh not exist");
}
} else {
let stderr = String::from_utf8_lossy(&output.stderr);
log::error!("which zsh error: {}", stderr.trim());
}
}
Err(e) => {
log::error!("which zsh error: {}", e);
}
};
None
}

#[cfg(not(windows))]
fn find_bash_with_which() -> Option<PathBuf> {
let output = std::process::Command::new("which").arg("bash").output();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
# ---------------------------------------------------------------------------------------------
# Shell Integration for Zsh
# ---------------------------------------------------------------------------------------------
builtin autoload -Uz add-zsh-hook is-at-least

add-zsh-hook() {
local hook_name= "$1"
local func_name= "$2"
local -a hook_array

case "${hook_name}" in
precmd)
hook_array=("${(@)precmd_functions[@]}")
precmd_functions+=("${func_name}")
;;
preexec)
preexec_functions+=("${func_name}")
;;
*)
return 1
;;
esac
}

if ! builtin type is-at-least >/dev/null 2>&1; then
is-at-least() {
local required="$1"
local current="${ZSH_VERSION}"
[[ "${current}" == $(echo -e "${required}\n${current}" sort -V | head -n1) ]]
}
fi

# Prevent the script recursing when setting up
if [ -n "$TERMINAL_SHELL_INTEGRATION" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function BasicsLoggingSection() {
if (!runtimeInfo?.sessionLogDir) return '';
return runtimeInfo.sessionLogDir.replace(
'/data/storage/el2/base/files/bitfun',
'/storage/Users/currentUser/appdata/el2/base/com.huawei.bitfunide/files/bitfun'
'/storage/Users/currentUser/appdata/el2/base/com.huawei.BitFun/files/bitfun'
);
}, [runtimeInfo?.sessionLogDir]);

Expand Down
Loading