Skip to content

Commit

Permalink
support vscode on Raspberry Pi OS
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Lupton <b@lupton.cc>
  • Loading branch information
balupton committed Mar 17, 2024
1 parent d0db026 commit 4a82a5f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion commands/dorothy
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@ function dorothy_() (
# ensure_minimal_dependencies <-- if they are editing, then we assume they are already setup
ensure_permissions_configured
if test "$(edit --dry --only-editor)" == 'code'; then
code -- "$DOROTHY/.vscode/workspace.code-workspace"
edit -- "$DOROTHY/.vscode/workspace.code-workspace"
else
edit -- "$DOROTHY"
fi
Expand Down
7 changes: 7 additions & 0 deletions commands/edit
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ function edit_() (
if test "$prompt" = 'no' -o "$sudo" = 'yes'; then
continue
fi
if is-kde; then
# https://code.visualstudio.com/docs/editor/settings-sync#_recommended-configure-the-keyring-to-use-with-vs-code
if command-missing kwalletmanager5; then
setup-util --quiet --cli=kwalletmanager5 APT='kwalletmanager'
fi
array+=('--password-store=kwallet5')
fi
if test "$wait" = 'yes'; then
array+=('-w')
fi
Expand Down
52 changes: 52 additions & 0 deletions commands/is-kde
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash

function is_kde() (
source "$DOROTHY/sources/bash.bash"

# =====================================
# Arguments

function help {
cat <<-EOF >/dev/stderr
ABOUT:
Checks if the desktop environment is KDE or LXDE (LXDE is KDE based)
USAGE:
is-kde
RETURNS:
[0] if the desktop environment is KDE or LXDE
[1] if the desktop environment is not KDE nor LXDE
EOF
if test "$#" -ne 0; then
echo-error "$@"
fi
return 22 # EINVAL 22 Invalid argument
}

# process
local item
while test "$#" -ne 0; do
item="$1"
shift
case "$item" in
'--help' | '-h') help ;;
'--'*) help "An unrecognised flag was provided: $item" ;;
*) help "An unrecognised argument was provided: $item" ;;
esac
done

# =====================================
# Action

if [[ "${DESKTOP_SESSION}" = 'LXDE'* ]] || [[ "${DESKTOP_SESSION}" = 'KDE'* ]]; then
return 0
else
return 1
fi
)

# fire if invoked standalone
if test "$0" = "${BASH_SOURCE[0]}"; then
is_kde "$@"
fi

0 comments on commit 4a82a5f

Please sign in to comment.