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

Message ID c82f4afeac5c9ae44eb2570d185a5593c16b23a3.1746682206.git.maxim.cournoyer@gmail.com
State New
Headers
Series VTE integration support / Shell startup files refactor |

Commit Message

Maxim Cournoyer May 8, 2025, 6:02 a.m. UTC
  * 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(+)
  

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 3c80ed24679..1eafd4eaa0e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -47555,6 +47555,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