hyprwm/hyprlang

handle env var globbing/splitting

Closed this issue · 8 comments

kojq commented

From hyprwm/Hyprland/issues/5172, we should handle env var globbing/splitting.

kojq commented

Description:

We will use the bind = WIN, N, togglespecialworkspace, hi throughout this.

input:

workspace = special:hi, on-created-empty:foot -H echo $HOSTNAME $TERM

output:

arch linux

input:

workspace = special:hi, on-created-empty:foot -H echo $TERM$HOSTNAME

output:

linuxarch

input:

workspace = special:hi, on-created-empty:foot -H echo $TERMINAL

output:

linuxINAL

input:

workspace = special:hi, on-created-empty:foot -H echo $HOSTNAME$TERM

output:


Now, with definitions in config.

input:

$HI=hello
workspace = special:hi, on-created-empty:foot -H echo $HI

output:

hello

input:

$TERMINAL=foot
workspace = special:hi, on-created-empty:foot -H echo $TERMINAL

output:

foot
  1. The problem are we facing in hyprwm/Hyprland/issues/5172 is when we set a var to something that is or contains another hyprlang var, we now interpret global var (with globbing/splitting) having priority over a hyprlang var.

  2. #32 wants to pass this info into the source keyword without defining (error occurs)

# this is a comment: $HOSTNAME=laptop
source=~/.config/hypr/$HOSTNAME.conf

odd, these seem to work on my end.

image

image

workspace = special:hi, on-created-empty:foot -H echo $TERMINAL

if $TERM is defined, but $TERMINAL isn't, the output of linuxINAL is expected, documented and just how it always has been

kojq commented

When defined, yeah. The issue is it is no longer considered defined when doing recursive vars.

please give a minimal reproducible example.

kojq commented

from hyprwm/Hyprland/issues/5172:

$TERMINAL = alacritty
$comms = [workspace special:hyprake] $TERMINAL --class hyprake
workspace = special:hyprake, on-created-empty:$comms
kojq commented

bind = WIN, N, togglespecialworkspace, hyprake

result is no terminal

kojq commented

This should help you see what is happening (linuxINAL):

$TERMINAL = foot
$comms = $TERMINAL
workspace = special:hyprake, on-created-empty:foot -H echo $comms
bind = WIN, N, togglespecialworkspace, hyprake