#!/bin/bash

desktop="$HOME/Desktop"

options=""
for item in $(ls $desktop); do
    if [[ "$item" == *.desktop && -f "$desktop/$item" ]]; then
        continue
    fi
    options+=$item
    if [[ -d "$desktop/$item" ]]; then
        options+='/'
    fi
    options+="\n"
done

fsarg=$(echo -en "$options" | fuzzel --dmenu --prompt="Open with VSCode: Desktop/")
[ -z "$fsarg" ] || exec startb code "$desktop/$fsarg"
