Add jetbrains icons to project search
This commit is contained in:
parent
fbea6384b5
commit
6c464b87df
|
@ -19,6 +19,9 @@ configuration {
|
||||||
window {
|
window {
|
||||||
display-name: "";
|
display-name: "";
|
||||||
}
|
}
|
||||||
|
projects {
|
||||||
|
display-name: "";
|
||||||
|
}
|
||||||
tabs {
|
tabs {
|
||||||
display-name: "";
|
display-name: "";
|
||||||
fallback-icon: "firefox-beta";
|
fallback-icon: "firefox-beta";
|
||||||
|
|
|
@ -6,11 +6,15 @@ function open_app() {
|
||||||
application="$1"
|
application="$1"
|
||||||
project="$2"
|
project="$2"
|
||||||
|
|
||||||
|
|
||||||
exe=$(grep "Exec" "$HOME/.local/share/applications/jetbrains-$application.desktop" | sed 's/.*"\([^"]*\)".*/\1/')
|
exe=$(grep "Exec" "$HOME/.local/share/applications/jetbrains-$application.desktop" | sed 's/.*"\([^"]*\)".*/\1/')
|
||||||
$exe "$project" &> /dev/null &
|
$exe "$project" &> /dev/null &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_icon {
|
||||||
|
application=$1
|
||||||
|
grep "Icon" "$HOME/.local/share/applications/jetbrains-$application.desktop" | sed 's/Icon=//'
|
||||||
|
}
|
||||||
|
|
||||||
function file_exists() {
|
function file_exists() {
|
||||||
project="$1"
|
project="$1"
|
||||||
file="$2"
|
file="$2"
|
||||||
|
@ -22,32 +26,35 @@ function file_exists() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function open_project() {
|
function get_project_type() {
|
||||||
project="$1"
|
project="$1"
|
||||||
|
|
||||||
if file_exists "$project" "pom.xml"; then
|
if file_exists "$project" "pom.xml"; then
|
||||||
open_app "idea" "$project"
|
echo "idea"
|
||||||
elif file_exists "$project" "package.json"; then
|
elif file_exists "$project" "package.json"; then
|
||||||
open_app "webstorm" "$project"
|
echo "webstorm"
|
||||||
elif file_exists "$project" "cargo.toml" || file_exists "$project" "*.c"; then
|
elif file_exists "$project" "cargo.toml" || file_exists "$project" "*.c"; then
|
||||||
open_app "clion" "$project"
|
echo "clion"
|
||||||
elif file_exists "$project" "*.csproj"; then
|
elif file_exists "$project" "*.csproj"; then
|
||||||
open_app "rider" "$project"
|
echo "rider"
|
||||||
elif file_exists "$project" "*.py"; then
|
elif file_exists "$project" "*.py"; then
|
||||||
open_app "pycharm" "$project"
|
echo "pycharm"
|
||||||
elif file_exists "$project" "*.go"; then
|
elif file_exists "$project" "*.go"; then
|
||||||
open_app "goland" "$project"
|
echo "goland"
|
||||||
else
|
else
|
||||||
open_app "idea" "$project"
|
echo "idea"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$1" == "" ]]; then
|
if [[ "$1" == "" ]]; then
|
||||||
for dir in $(echo ${GIT_DIRS[*]}); do
|
for dir in $(echo ${GIT_DIRS[*]}); do
|
||||||
if [ -e "$dir" ]; then
|
if [ -e "$dir" ]; then
|
||||||
find $dir -maxdepth 1 -mindepth 1 -type d
|
projects=$(find $dir -maxdepth 1 -mindepth 1 -type d)
|
||||||
|
for project in $projects; do
|
||||||
|
echo -en "$project\0icon\x1f$(get_icon "$(get_project_type "$project")")\n"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
open_project "$1"
|
open_app "$(get_project_type "$1")" "$1"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue