diff --git a/fake_home/.config/rofi/config.rasi b/fake_home/.config/rofi/config.rasi index a69b13d..68d6b45 100644 --- a/fake_home/.config/rofi/config.rasi +++ b/fake_home/.config/rofi/config.rasi @@ -19,6 +19,9 @@ configuration { window { display-name: ""; } + projects { + display-name: ""; + } tabs { display-name: ""; fallback-icon: "firefox-beta"; diff --git a/fake_home/.rofi-list-git-repos.sh b/fake_home/.rofi-list-git-repos.sh index 39dd1fb..16e8148 100755 --- a/fake_home/.rofi-list-git-repos.sh +++ b/fake_home/.rofi-list-git-repos.sh @@ -5,12 +5,16 @@ GIT_DIRS=("$HOME/work" "$HOME/projects" "$HOME/git" "$HOME/WebStormProjects" "$H function open_app() { application="$1" project="$2" - exe=$(grep "Exec" "$HOME/.local/share/applications/jetbrains-$application.desktop" | sed 's/.*"\([^"]*\)".*/\1/') $exe "$project" &> /dev/null & } +function get_icon { + application=$1 + grep "Icon" "$HOME/.local/share/applications/jetbrains-$application.desktop" | sed 's/Icon=//' +} + function file_exists() { project="$1" file="$2" @@ -22,32 +26,35 @@ function file_exists() { fi } -function open_project() { +function get_project_type() { project="$1" if file_exists "$project" "pom.xml"; then - open_app "idea" "$project" + echo "idea" elif file_exists "$project" "package.json"; then - open_app "webstorm" "$project" + echo "webstorm" elif file_exists "$project" "cargo.toml" || file_exists "$project" "*.c"; then - open_app "clion" "$project" + echo "clion" elif file_exists "$project" "*.csproj"; then - open_app "rider" "$project" + echo "rider" elif file_exists "$project" "*.py"; then - open_app "pycharm" "$project" + echo "pycharm" elif file_exists "$project" "*.go"; then - open_app "goland" "$project" + echo "goland" else - open_app "idea" "$project" + echo "idea" fi } if [[ "$1" == "" ]]; then for dir in $(echo ${GIT_DIRS[*]}); do 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 done else - open_project "$1" + open_app "$(get_project_type "$1")" "$1" fi