From 6262eb64cebfe7e83dd4b49648894a7d0b0459c7 Mon Sep 17 00:00:00 2001
From: Andres Montano <andres.montano@tecnalia.com>
Date: Wed, 22 Jun 2022 09:07:12 +0200
Subject: [PATCH] Update melodic dockerfile

---
 dockerfiles/DevenvMelodic.Dockerfile |  6 +++++-
 dotfiles/.p10k.zsh                   |  2 +-
 dotfiles/docker.bash                 | 10 +++++++---
 dotfiles/ros.bash                    | 15 +++++++++------
 dotfiles/terminator/config           |  2 ++
 5 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/dockerfiles/DevenvMelodic.Dockerfile b/dockerfiles/DevenvMelodic.Dockerfile
index ca70dd8..cabe0b5 100644
--- a/dockerfiles/DevenvMelodic.Dockerfile
+++ b/dockerfiles/DevenvMelodic.Dockerfile
@@ -1,5 +1,7 @@
 FROM osrf/ros:melodic-desktop-full
+
 ENV ROS_DISTRO melodic
+ENV RUNNING_IN_DOCKER true
 
 # Avoid warnings by switching to noninteractive
 ENV DEBIAN_FRONTEND=noninteractive
@@ -194,7 +196,9 @@ RUN apt-get update && apt-get install -y \
     ros-melodic-interactive-marker-twist-server \
     ros-melodic-industrial-core \
     ros-melodic-lms1xx \
-    ros-melodic-serial
+    ros-melodic-serial \
+    ros-melodic-spacenav-node \
+    spacenavd
 
 # Update final image
 RUN apt-get update && apt-get -y upgrade && apt-get -y autoremove
diff --git a/dotfiles/.p10k.zsh b/dotfiles/.p10k.zsh
index 3a99c7a..477a4a3 100644
--- a/dotfiles/.p10k.zsh
+++ b/dotfiles/.p10k.zsh
@@ -1591,7 +1591,7 @@
   #  p10k segment -f 208 -i '⭐' -t '%n'
   #}
   function prompt_docker() {
-    if [[ -f /ros_entrypoint.sh ]]; then
+    if [[ -n $RUNNING_IN_DOCKER ]]; then
       p10k segment -f 226 -i $'\uF308'
     fi
   }
diff --git a/dotfiles/docker.bash b/dotfiles/docker.bash
index 484cbed..1678135 100644
--- a/dotfiles/docker.bash
+++ b/dotfiles/docker.bash
@@ -45,15 +45,19 @@ function drma() {
 }
 
 function dat() {
-	docker exec -it melodic bash -c "cd ~/ros/melodic/$1 && bash"
+	docker exec -it melodic bash -c "cd ~/ros/melodic/$1 && $ext"
+}
+
+function datmelodic() {
+	docker exec -it melodic bash -c "cd ~/ros/melodic/$1 && zsh"
 }
 
 function datnoetic() {
-	docker exec -it noetic bash
+	docker exec -it noetic -c "cd ~/ros/noetic/$1 && $ext"
 }
 
 function datkinetic() {
-	docker exec -it kinetic bash
+	docker exec -it kinetic -c "cd ~/ros/kinetic/$1 && $ext"
 }
 
 function runpythonsyntax(){
diff --git a/dotfiles/ros.bash b/dotfiles/ros.bash
index a45dbd9..42b2b08 100644
--- a/dotfiles/ros.bash
+++ b/dotfiles/ros.bash
@@ -25,29 +25,32 @@ function sourcews(){
 
 # Source the current workspace
 function sourcethis(){
-    pwd_bck=${PWD}
+    pwd_st=${PWD}
     roshome && source ./devel/setup.${ext} && smon
-    cd ${pwd_bck}
+    cd ${pwd_st}
 }
 
 # Automatic catkin build
 function cb() {
+    pwd_cb=${PWD}
+    roshome
     catkin build --summarize "$@"
     sourcethis
+    cd ${pwd_cb}
 }
 
 # Clean workspace (delete the generated folders, then catkin build)
 function cbclean(){
-    roshome && rm -rf build devel install && cb
+    roshome && rm -rf build devel install && catkin build --summarize
 }
 
 # Initialize catkin workspace, configure and build it
 function cib(){
-    catkin init && catkin config --extend /opt/ros/${ROS_DISTRO} && cb
+    catkin init && catkin config --extend /opt/ros/${ROS_DISTRO} && catkin build --summarize
 }
 
 # If terminal starts in a ws, auto source it (useful for vscode)
-pwd_bck=${PWD}
+pwd_init=${PWD}
 cropped=${PWD#${HOME}/ros/${ROS_DISTRO}/}
 WS_name=${cropped%%/*}
 WS_path=${HOME}/ros/${ROS_DISTRO}/${WS_name}
@@ -55,7 +58,7 @@ FILE=${WS_path}/devel/setup.${ext}
 if [[ -f $FILE ]]; then
   cd ${WS_path}
   source $FILE
-  cd ${pwd_bck}
+  cd ${pwd_init}
 else
   source /opt/ros/${ROS_DISTRO}/setup.${ext}
 fi
diff --git a/dotfiles/terminator/config b/dotfiles/terminator/config
index 0b86a0a..5c0686c 100644
--- a/dotfiles/terminator/config
+++ b/dotfiles/terminator/config
@@ -12,7 +12,9 @@
     cursor_color = "#aaaaaa"
     font = Hack Nerd Font Mono 12
     show_titlebar = False
+    scrollbar_position = hidden
     scrollback_infinite = True
+    custom_command = byobu
     use_system_font = False
     copy_on_selection = True
 [layouts]
-- 
GitLab