Fix new session creation.

This commit is contained in:
Glenn Y. Rolland 2013-12-27 12:42:57 +01:00
parent d6d5e66cfa
commit ef6c37e43e
2 changed files with 22 additions and 13 deletions

View file

@ -22,23 +22,27 @@ kotam_fail(){
} }
kotam_project_list() { kotam_project_list() {
local tmppwd=$(pwd)
echo "List of projects :" echo "List of projects :"
ls $KOTAM_CONFIG_DIR/*.kotam 2> /dev/null cd $KOTAM_CONFIG_DIR
find -maxdepth 1 -mindepth 1 -name '*.kotam' |sed -e 's|./| |' -e 's/.kotam$//'
cd $tmppwd
}
kotam_project_ensure() {
if [ ! -e "$KOTAM_CONFIG_DIR/$PROJECT.kotam" ]; then
kotam_fail "unknown project $PROJECT" >&2
fi
} }
kotam_project_edit() { kotam_project_edit() {
if [ ! -e "$KOTAM_CONFIG_DIR/$project.kotam" ]; then kotam_project_ensure
kotam_fail "unknown project $project" >&2 "$EDITOR" "$KOTAM_CONFIG_DIR/$PROJECT.kotam"
fi
"$EDITOR" "$KOTAM_CONFIG_DIR/$project.kotam"
} }
kotam_project_run(){ kotam_project_run(){
project="$arg" kotam_project_ensure
if [ ! -e "$KOTAM_CONFIG_DIR/$project.kotam" ]; then . "$KOTAM_CONFIG_DIR/$PROJECT.kotam"
kotam_fail "unknown project $project" >&2
fi
. "$KOTAM_CONFIG_DIR/$project.kotam"
} }
ACTION="" ACTION=""
@ -78,6 +82,7 @@ while [ $# -gt 0 ]; do
;; ;;
*) #enter into project *) #enter into project
ACTION="run" ACTION="run"
PROJECT="$arg"
;; ;;
esac esac
shift shift
@ -88,14 +93,17 @@ case "$ACTION" in
kotam_project_list kotam_project_list
;; ;;
create) create)
kotam__project_create kotam_project_create
;; ;;
edit) edit)
kotam__project_edit kotam_project_edit
;; ;;
delete) delete)
kotam_project_delete kotam_project_delete
;; ;;
run)
kotam_project_run
;;
*) *)
kotam_fail "undefined action $ACTION" kotam_fail "undefined action $ACTION"
;; ;;

View file

@ -11,7 +11,8 @@ kotam_newtab() {
#dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call \ #dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call \
# --print-reply /konsole/MainWindow_1 org.kde.KMainWindow.activateAction string:"new-tab" # --print-reply /konsole/MainWindow_1 org.kde.KMainWindow.activateAction string:"new-tab"
session=$(qdbus org.kde.konsole /Konsole newSession) TARGET=${KONSOLE_DBUS_SERVICE:-org.kde.konsole}
session=$(qdbus $TARGET /Konsole newSession)
} }
kotam_renametab() { kotam_renametab() {