1 个不稳定版本
0.1.0 | 2023年8月1日 |
---|
#752 在 配置 中
13KB
290 行
项目启动器(Rust语言实现)
尝试用Rust重写我的项目启动器,它原本是一个rofi脚本
#!/bin/bash
# Path to your project configuration files
PROJECTS_DIR="$HOME/Projects/.launch"
# Get list of project configuration files
PROJECTS_CONFIGS=$(ls $PROJECTS_DIR/*.yml)
# Loop through the tmuxp configuration files and read their descriptions
for CONFIG in $PROJECTS_CONFIGS; do
NAME=$(grep -i '^Name:' ${CONFIG}.desc | cut -d ' ' -f 2-)
DESCRIPTION=$(grep -i '^Description:' ${CONFIG}.desc | cut -d ' ' -f 2-)
TAGS=$(grep -i '^Tags:' ${CONFIG}.desc | cut -d ' ' -f 2-)
if [ -z "$MENU_ITEMS" ]; then
MENU_ITEMS="$NAME | $DESCRIPTION | $TAGS | $CONFIG"
else
MENU_ITEMS="$MENU_ITEMS\n$NAME | $DESCRIPTION | $TAGS | $CONFIG"
fi
done
# Rofi theme location
ROFITHEME="$HOME/.config/rofi/themes/dracula.rasi"
# Prompt user to select a configuration file using dmenu
SELECTED=$(echo -e "$MENU_ITEMS" | rofi -theme $ROFITHEME -dmenu -i -l 10 -p "Select a tmuxp configuration:" | rev | cut -d '|' -f 1 | rev)
# Launch the selected configuration file with tmuxp
if [ ! -z "$SELECTED" ]; then
# Launch the selected project
tmuxp load $SELECTED
fi
依赖项
~6–18MB
~191K SLoC