Skip to content

Commit

Permalink
screencast: Add envar to set allowed persist mode
Browse files Browse the repository at this point in the history
This is an experimental feature until a ui solution is wired up.

XDPW_PERSIST_MODE=<value>
<value>:
	"permanent": allow restoring a session permanent
	"transient": allow restoring a session while a programm runs
  • Loading branch information
columbarius committed Feb 20, 2023
1 parent 02e7431 commit e467a00
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/screencast/screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,21 @@ bool setup_target(struct xdpw_screencast_context *ctx, struct xdpw_session *sess
if (!target_initialized) {
target_initialized = xdpw_wlr_target_chooser(ctx, target);
//TODO: Chooser option to confirm the persist mode
sess->screencast_data.persist_mode = PERSIST_NONE;
const char *env_persist_str = getenv("XDPW_PERSIST_MODE");
if (env_persist_str) {
if (strcmp(env_persist_str, "transient") == 0) {
sess->screencast_data.persist_mode = sess->screencast_data.persist_mode > PERSIST_TRANSIENT
? PERSIST_TRANSIENT : sess->screencast_data.persist_mode;
} else if (strcmp(env_persist_str, "permanent") == 0) {
sess->screencast_data.persist_mode = sess->screencast_data.persist_mode > PERSIST_PERMANENT
? PERSIST_PERMANENT : sess->screencast_data.persist_mode;
} else {
sess->screencast_data.persist_mode = PERSIST_NONE;
}

} else {
sess->screencast_data.persist_mode = PERSIST_NONE;
}
}
if (!target_initialized) {
logprint(ERROR, "wlroots: no output found");
Expand Down

0 comments on commit e467a00

Please sign in to comment.