You are not logged in.

#1 2024-06-15 22:28:38

wonn
Member
Registered: 2024-06-03
Posts: 24

Alacritty is ignoring environment variables set in .xinitrc

I'm trying to be able to use fcitx inside alacritty, and I've discovered that my problem is due to alacritty not properly obtaining environment variables from ~/.xinitrc. Other programs work fine, but if I run alacritty and then 'echo $VARIABLE' where my .xinitrc has 'export VARIABLE = value', it returns nothing, not 'value'. If I set the same variables in .zshrc and then launch alacritty from a terminal, it works correctly and I can use fcitx just fine. Why is it not working from .xinitrc? Is there somewhere else I can try exporting these variables from so that I don't have to launch alacritty twice to get it to work with fcitx?

I'm using i3 with ly-dm as the display manager; let me know what else you might need to know.

Offline

#2 2024-06-15 22:57:52

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,726

Re: Alacritty is ignoring environment variables set in .xinitrc

DMs don't generally execute .xinitrc. That's really just for xinit/startx.

Online

#3 2024-06-15 23:17:26

wonn
Member
Registered: 2024-06-03
Posts: 24

Re: Alacritty is ignoring environment variables set in .xinitrc

Interesting, then, that they seem to be exported as far as every other program is concerned. What's a better place to put them, then?

Offline

#4 2024-06-16 05:43:45

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,950

Re: Alacritty is ignoring environment variables set in .xinitrc

ly isn't a GUI DM, you'll likely startx/xinit from there?
If you want to figure, add an indicator like "touch /tmp/yeah_ran_xinit" to your xinitrc.

but if I run alacritty and then 'echo $VARIABLE' where my .xinitrc has 'export VARIABLE = value', it returns nothing, not 'value'

1. Please don't paraphrase, https://bbs.archlinux.org/viewtopic.php?id=57855
Post your xinitrc and the actual $VARIABLE you're looking for
2. you're not looking at the environment of alacritty but the shell process inside this way.

tr '\0' '\n' < /proc/$(pidof alacritty)/environ

or probably also

tr '\0' '\n' < /proc/$PPID/environ

3. Provide the details of the actual, fcitx related, problem

Online

#5 2024-06-16 22:26:09

wonn
Member
Registered: 2024-06-03
Posts: 24

Re: Alacritty is ignoring environment variables set in .xinitrc

The actual xinitrc is

#!/bin/bash

export GTK_IM_MODULE="fcitx"
export QT_IM_MODULE="fcitx"
export XMODIFIERS="@im=fcitx"

export INPUT_METHOD="fcitx"
export XIM="fcitx"
export XIM_PROGRAM="fcitx"
export SDL_IM_MODULE="fcitx"

xrdb ~/.Xresources

exec i3

'echo $XMODIFIERS' will return blank, even though I'm pretty darn sure that this file is the only reason the system knows to start i3, and therefore it must be being run. Another reason to believe it's being run is that fcitx worked in nothing until I put those lines in there, and now it works in everything except alacritty.

The actual problem is simply that fcitx does not function inside an alacritty window, unless I set those variables inside zsh and then run another alacritty window from that zsh instance. If I open an alacritty window with drun or alt+space, I cannot use any fcitx IMEs inside that window.

Offline

#6 2024-06-16 22:46:13

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,950

Re: Alacritty is ignoring environment variables set in .xinitrc

Your xinitrc is broken (last link below, 2nd note on what to include at least)

Be more sure about the invocation by adding a marker.
Also maybe add "export FOO=BAR" and see whether that makes it.
What does your i3 config look like?
Do the i3/alacritty processes still have this environment?
What if you run "alacritty &" before "exec i3"? Does that instance have the XMODIFIERS variable?
Is eg. an xterm likewise affected?

Online

Board footer

Powered by FluxBB