diff options
author | David Čuček | 2023-04-09 01:34:54 +0200 |
---|---|---|
committer | David Čuček | 2023-04-09 01:34:54 +0200 |
commit | 1b2feb14e2a75e06a9ebe85c9e5d6670b774735c (patch) | |
tree | 9981fa3ed2619825febf7e91f5c950294af113cc | |
parent | 2f780ffc373a57459f5c845461a999ea4e5e8579 (diff) | |
download | aur-1b2feb14e2a75e06a9ebe85c9e5d6670b774735c.tar.gz |
minor updates
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 4 | ||||
-rwxr-xr-x | code-oss.sh | 42 |
3 files changed, 39 insertions, 11 deletions
@@ -1,7 +1,7 @@ pkgbase = code-translucent pkgdesc = The Open Source build of Visual Studio Code (vscode) editor with translucent window, official marketplace, unblocked proprietary features and wayland support! pkgver = 1.77.1 - pkgrel = 2 + pkgrel = 3 url = https://github.com/microsoft/vscode arch = x86_64 arch = i686 @@ -40,6 +40,6 @@ pkgbase = code-translucent sha512sums = SKIP sha512sums = 9de3f195e711814e1e457e8ccb6383c6000bc83ee707f2bc138fe66c3cf6c35a6e9c755594afb5fbf8c4f05c3c87f7f3b8714e7947b62094ead6f5f1b81f5b24 sha512sums = 5030e5644c01d63534218f0195d8d78f51db2007fd0e375752db2c2800e5d4a297921e4ff5fcf3b70d92c98081f6964885af75d395c94b0f02927125f0dc58d3 - sha512sums = f68e4be0756584ab78d42b1dfb4e86a97485aaf67d63cc4aef4e6bef98fe85fce0c47bf1f85f39ad982ec9ffac45122344f976f5320e97114946781149ea561f + sha512sums = d1620dc3995c83639baea60ce58becf2b8c7501e1bcb81d4a96e60bf9e26489f99ba7ead9306ad703145bd3ce12c00ecdc20568d25c0b67dac716031ce3ccf35 pkgname = code-translucent @@ -2,7 +2,7 @@ pkgname="code-translucent" pkgver=1.77.1 -pkgrel=2 +pkgrel=3 pkgdesc="The Open Source build of Visual Studio Code (vscode) editor with translucent window, official marketplace, unblocked proprietary features and wayland support!" arch=( @@ -61,7 +61,7 @@ sha512sums=( "SKIP" "9de3f195e711814e1e457e8ccb6383c6000bc83ee707f2bc138fe66c3cf6c35a6e9c755594afb5fbf8c4f05c3c87f7f3b8714e7947b62094ead6f5f1b81f5b24" "5030e5644c01d63534218f0195d8d78f51db2007fd0e375752db2c2800e5d4a297921e4ff5fcf3b70d92c98081f6964885af75d395c94b0f02927125f0dc58d3" - "f68e4be0756584ab78d42b1dfb4e86a97485aaf67d63cc4aef4e6bef98fe85fce0c47bf1f85f39ad982ec9ffac45122344f976f5320e97114946781149ea561f" + "d1620dc3995c83639baea60ce58becf2b8c7501e1bcb81d4a96e60bf9e26489f99ba7ead9306ad703145bd3ce12c00ecdc20568d25c0b67dac716031ce3ccf35" ) case "${CARCH}" in diff --git a/code-oss.sh b/code-oss.sh index f4038d10bacb..483ea84d7b4d 100755 --- a/code-oss.sh +++ b/code-oss.sh @@ -1,22 +1,50 @@ #!/usr/bin/env bash +shopt -s nocasematch + declare -r CODE_BIN_PATH="/opt/code-translucent/bin/code-oss" -declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-~/.config}" -declare -r CODE_CONF_PATH="$XDG_CONFIG_HOME/code-flags.conf" +declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" +declare -r CODE_CONF_PATH="${XDG_CONFIG_HOME}/code-flags.conf" + +in_array() { + + local -n array=$1 + local -r pattern=$2 + + for value in "${array[@]}"; do + [[ "${value}" =~ $pattern ]] \ + && return 0 + done + + return 1 + +} main() { + local -a CODE_USER_FLAGS=() + [[ -e "${CODE_BIN_PATH}" ]] \ || { echo "'${CODE_BIN_PATH}' does not exist?!"; exit 1; } [[ -f "${CODE_CONF_PATH}" ]] \ - && { local CODE_USER_FLAGS="$(sed 's/#.*//' $CODE_CONF_PATH | tr '\n' ' ')"; } + && { mapfile -t CODE_USER_FLAGS <<< "$(sed 's/#.*//' ${CODE_CONF_PATH})"; } + + [[ "${XDG_SESSION_TYPE}" == "wayland" ]] && { + + unset DISPLAY + + in_array CODE_USER_FLAGS '^--ozone-platform=wayland$' \ + || CODE_USER_FLAGS+=('--ozone-platform=wayland') + + in_array CODE_USER_FLAGS '^--enable-features=.*UseOzonePlatform' \ + || CODE_USER_FLAGS+=('--enable-features=UseOzonePlatform') + + } - [[ "${XDG_SESSION_TYPE}" == "wayland" ]] \ - && { unset DISPLAY; exec "${CODE_BIN_PATH}" --enable-features=UseOzonePlatform --ozone-platform=wayland "$@" "${CODE_USER_FLAGS}"; } \ - || { exec "${CODE_BIN_PATH}" "$@" "${CODE_USER_FLAGS}"; } + exec "${CODE_BIN_PATH}" "${CODE_USER_FLAGS[@]}" "$@" - exit 0; + exit 0 } |