Subject: [bug#78308] [PATCH v2 8/9] services: Add vte-integration-service-type.

From: Maxim Cournoyer <[email-masked]>
Date: Tue, 13 May 2025 11:31:47 +0900

* gnu/services.scm (vte-integration-service-type): New service type.
* doc/guix.texi (Service Reference): Document it.

Change-Id: I7e4bc1b913b50a5a061894f9ddef27f1877b62a2
---
 doc/guix.texi    | 15 +++++++++++++++
 gnu/services.scm | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 655eac6168d..591d42f82f5 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -47593,6 +47593,21 @@ Service Reference
 @end example
 @end defvar
 
+@defvar vte-integration-service-type
+This services adds the @file{/etc/bashrc.d/vte.sh} to your system, which
+improves the Bash and Zsh experience when using VTE-powered terminal
+emulators.  This causes for example the current directory to be
+displayed in the terminal emulator's tab title, and the current
+directory to be preserved when creating a new tab, among other features.
+The value of the service is the @code{vte} package to use.
+
+@example
+(use-package-modules gnome)     ;for the `vte' package
+
+(service vte-integration-service-type vte)
+@end example
+@end defvar
+
 @defvar privileged-program-service-type
 Type for the ``privileged-program service''.  This service collects lists of
 executable file names, passed as gexps, and adds them to the set of
diff --git a/gnu/services.scm b/gnu/services.scm
index 159d357c3e7..ce15a39d063 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -47,6 +47,7 @@ (define-module (gnu services)
   #:use-module (guix deprecation)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages gnome)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages linux)
   #:use-module (gnu system privilege)
@@ -138,6 +139,7 @@ (define-module (gnu services)
             linux-builder-configuration-kernel
             linux-builder-configuration-modules
             linux-loadable-module-service-type
+            vte-integration-service-type
 
             %boot-service
             %activation-service
@@ -1027,6 +1029,19 @@ (define etc-bashrc-d-service-type
 Bash shells.")
    (default-value %default-etc-bashrc-d-files)))
 
+(define vte-integration-service-type
+  (service-type
+   (name 'vte-integration)
+   (extensions
+    (list (service-extension etc-bashrc-d-service-type
+                             (lambda (vte)
+                               (list (file-append
+                                      vte "/etc/profile.d/vte.sh"))))))
+   (default-value vte)                  ;the vte package to use
+   (description "A service for adding the @file{/etc/bashrc.d/vte.sh} script
+to your system, which improves the Bash and Zsh experience when using
+VTE-powered terminal emulators.")))
+
 (define (privileged-program->activation-gexp programs)
   "Return an activation gexp for privileged-program from PROGRAMS."
   (let ((programs
-- 
2.49.0