Skip to content

Commit

Permalink
Update automatic shortcuts creation
Browse files Browse the repository at this point in the history
  • Loading branch information
VHSgunzo committed Feb 18, 2024
1 parent 47ec4d2 commit 20012f1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Add DB script for `Caliber`
* Add prefix `syswinepfx` to DB scripts for games that runs on `System` wine
* Update automatic shortcuts creation

# v0.78.2.5

Expand Down
34 changes: 29 additions & 5 deletions lux-wine
Original file line number Diff line number Diff line change
Expand Up @@ -2172,9 +2172,11 @@ check_shrt() (
)

shrt_loop() {
WPFXSHRTDIRS=(
WPFXDESKDIRS=(
"$WINEPREFIX/drive_c/users/steamuser/Desktop"
"$WINEPREFIX/drive_c/users/Public/Desktop"
)
WPFXMENUDIRS=(
"$WINEPREFIX/drive_c/users/steamuser/AppData/Roaming/Microsoft/Windows/Start Menu"
"$WINEPREFIX/drive_c/ProgramData/Microsoft/Windows/Start Menu"
)
Expand All @@ -2201,10 +2203,12 @@ shrt_loop() {
while pidof wineserver &>/dev/null
do
sleep 1 2>/dev/null
WPREFIXLNK=($(find_wpfxlnk "${WPFXSHRTDIRS[@]}"))
WPREFIXLNK=($(find_wpfxlnk "${WPFXDESKDIRS[@]}"))
WPREFIXLNK+=($(find_wpfxlnk "${WPFXMENUDIRS[@]}"))
unset LU_EXE EXE_ARG
shrt_from_lnk "${WPREFIXLNK[@]}"
WPREFIXURL=($(find_wpfxurl "${WPFXSHRTDIRS[@]}"))
WPREFIXURL=($(find_wpfxurl "${WPFXDESKDIRS[@]}"))
WPREFIXURL+=($(find_wpfxurl "${WPFXMENUDIRS[@]}"))
unset LU_EXE EXE_ARG
shrt_from_url "${WPREFIXURL[@]}"
check_tray
Expand Down Expand Up @@ -3714,8 +3718,20 @@ shrt_from_lnk() {
unset exe_ico lnk_exe_ico lnk_args
lnk_data="$(exiftool "$lnk_file")"
lnk_name="$(basename "$lnk_file")"
if grep -qwo 'Start Menu/Programs'<<<"$lnk_file"
then
old_lnk_name="$lnk_name"
lnk_name="$(basename "$(dirname "$lnk_file")"|sed 's| \[GOG.com\]||i')"
IGNLNKDIRS=('by.xatab')
IGNLNKNAMES=('Запустить игру.lnk' 'Launch the game.lnk')
if [[ "${IGNLNKDIRS[@],,}" =~ "${lnk_name,,}" ]]
then lnk_name="$old_lnk_name"
elif [[ ! "${IGNLNKNAMES[@],,}" =~ "${old_lnk_name,,}" ]]
then lnk_name+=" - $old_lnk_name"
fi
fi
lnk_name_alnum="${lnk_name//[^[:alnum:] ._-]/}"
SHRT_NAME="$(echo "$lnk_name"|sed 's|\.lnk$||i')"
SHRT_NAME="$(sed 's|\.lnk$||i'<<<"$lnk_name")"
lnk_exe_drive="$(lnk_data_get 'Local Base Path'|drive_tolower)"
lnk_exe="$(ipath "$(lnk_data_get 'Local Base Path'|fix_path)"|head -1)"
lnk_exe_ico="$(lnk_data_get 'Icon File Name')"
Expand Down Expand Up @@ -3796,8 +3812,16 @@ shrt_from_url() {
dos2unix "$url_file" &>/dev/null
unset LU_EXE exe_ico url_exe_ico url_name url_exe_ico_drive
url_file_name="$(basename "$url_file")"
if grep -qwo 'Start Menu/Programs'<<<"$url_file"
then
old_url_name="$url_file_name"
url_file_name="$(basename "$(dirname "$url_file")"|sed 's| \[GOG.com\]||i')"
IGNURLNAMES=('Запустить игру.url' 'Launch the game.url')
[[ "${IGNURLNAMES[@],,}" =~ "${old_url_name,,}" ]]||\
url_file_name+=" - $old_url_name"
fi
url_file_name_alnum="${url_file_name//[^[:alnum:] ._-]/}"
SHRT_NAME="$(echo "$url_file_name"|sed 's|\.url$||i')"
SHRT_NAME="$(sed 's|\.url$||i'<<<"$url_file_name")"
url_name="$(url_data_get 'URL')"
url_proto="$(echo "$url_name"|sed 's|://.*||g')"
if [[ ! "${IGNPROTO[@]}" =~ "$url_proto" ]]
Expand Down

0 comments on commit 20012f1

Please sign in to comment.