aboutsummaryrefslogtreecommitdiff
path: root/home/bin/open-project
blob: bb9894627ebbbbb59bec7a0bb099f5973609a81c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

kind="$1"
root="$HOME/src/driver"
projects=$(find "$root" -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort)
project=$(echo "$projects" | dmenu -p "Open project:")
[ "$?" -eq 0 ] || exit 1
dir=$(realpath "$root/$project")

# Rename workspace
i3-msg rename workspace to \
       "$(i3-msg -t get_workspaces | jq '.[] | select(.focused==true).num'):$project" > /dev/null

case "$kind" in
    intellij|"")
	idea "$dir" &
	sakura -d "$dir" &
	sakura -d "$dir" &
    ;;
    *)
	echo "unknown project kind $kind"
	exit 1
esac

#i3-msg "append_layout ~/layout.json; exec emacsclient --alternate-editor=\"\" --create-frame \"$dir\"; exec gnome-terminal --working-directory=\"$dir\" -x sh -c sbt; exec gnome-terminal --working-directory=\"$dir\""