contour icon indicating copy to clipboard operation
contour copied to clipboard

Expose current profile's name through env var or `contour` front-end VT call

Open whisperity opened this issue 1 year ago • 3 comments

In order to allow shell scripts to rely on setting the environment up for a particular colour scheme and behaviour, the current (or startup) profile's name should be queryable either through an environment variable, or via a VT sequence and a front-end hook similar to contour capture.

Contour Terminal version

0.5.1.7247

Installer source

GitHub: release page

Operating System

macOS San Sequioya 15.1

Architecture

ARM64

Other Software

No response

Steps to reproduce

Add an environment variable into the Contour configuration, such as

profiles:
	master:
		environment:
			FOO: "Bar"
default_profile: "master"

Spawn a shell, echo $FOO, and nothing comes out.

Expected Behavior

The environment variables get defined. This used to work, at least on Linux some time ago.

Actual Behavior

Nothing comes out, the variable is left undefined.

Additional notes

$ contour debug "config"
[2024-10-16 15:10:27.823766] [config] Loading default profile: master
[2024-10-16 15:10:27.823772] [config] loading profile master
[2024-10-16 15:10:27.823809] [config] Defaulting TERM to contour.

While a lot of configuration options are mentioned in the log file as "loading entry: ...", environment is not.

whisperity avatar Oct 16 '24 13:10 whisperity

We dropped this functionality at some point, i suppose it is better to let shell define environment variables and not add this into config directly

Yaraslaut avatar Oct 17 '24 11:10 Yaraslaut

Oh, apologies, I missed the memo about this. 😉 I don't really have a hard need for this feature as long as we could at least query, from a shell script, which Contour profile was started (the name should be enough!) so I could create a script which branches on whether I'm using profile master, bright, or ssh.

whisperity avatar Oct 17 '24 12:10 whisperity

Yes, this we can do, expose environmental variable CONTOUR_PROFILE or something like this

Yaraslaut avatar Oct 17 '24 12:10 Yaraslaut