Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
User environment variables: where to set for broadest scope?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1172
Location: Edinburgh, UK

PostPosted: Sun Jun 21, 2015 2:46 pm    Post subject: User environment variables: where to set for broadest scope? Reply with quote

Hi,

Something I thought would be quite straightforward is proving not to be: I need to add an envvar to the execution environment for NetBeans (and potentially any future apps that use Swing), no matter in which way it is launched.

Here's the payload:
Code:

# For font antialiasing in Swing apps like NetBeans
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=lcd'


NetBeans is launched via a /bin/sh script, <netbeans-appdir>/bin/netbeans. That script might be executed in any of the following ways:
  • Locally, from my DE's menu (currently fluxbox; /usr/bin/startfluxbox is a /bin/sh script launched in ~/.xsession)
  • From a terminal (urxvtd, SHELL=/bin/bash)
  • Either of the above, but within a VNC session
  • Remotely, using X11 forwarding (ssh -X or -Y)

Places I have tried exporting the variable:
  • ~/.bashrc
  • ~/.bash_profile (above or below where .bashrc is sourced)
  • ~/.profile
  • ~/.xsession

None of these work in all of the above contexts, and most don't work in any of them apart from in a terminal :(

Isn't there a place where envvars can be set "globally" per-user, so they apply for anything that user runs? I'm sure I remember being able to do so before (for Firefox, Qt and maybe others), but that was a while back and possibly it just worked where I needed it to at the time, I dunno.

Caveats/unacceptable answers:
  • /etc/env.d/ is out, because I don't want all users to have this variable set.
  • Adding the export into the netbeans script itself would certainly work, but is inelegant and would be clobbered at every upgrade of the software.
  • Creating an outer wrapper script that runs netbeans with the var prefixed would also work, but not for those hypothetical other Swing apps (I'd need a wrapper per app), so that's out too.

C'mon Internet, impress me :wink:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum