Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Desktop Environments
  • Search

Where can I set system-wide $XDG_CONFIG_HOME?

Problems with GUI applications? Questions about X, KDE, Gnome, Fluxbox, etc.? Come on in. NOTE: For multimedia, go up one forum
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

Where can I set system-wide $XDG_CONFIG_HOME?

  • Quote

Post by VinzC » Sun Jan 09, 2011 10:24 am

Hi.

This is something I've been struggling with for a couple of years and I thought I had found something but I was plain wrong. So here it is.

By default Xfce stores its data in ~/.config and ~/.cache and I want these directories in ~/.xfce4/(config|cache) instead. So I thought I could set these in /etc/env.d/90xsession:

Code: Select all

XDG_CONFIG_HOME=~/.xfce4/config
XDG_CACHE_HOME=~/.xfce4/cache
but it doesn't work:

Code: Select all

XDG_CONFIG_HOME='~/.xfce4/config'
XDG_CACHE_HOME='~/.xfce4/cache'
Mind the single quotes:

Code: Select all

ls: no such file or directory
I've tried inserting "$HOME" but it doesn't work either:

Code: Select all

XDG_CONFIG_HOME=$HOME/.xfce4/config
XDG_CACHE_HOME=$HOME/.xfce4/cache
but it doesn't work:

Code: Select all

XDG_CONFIG_HOME=HOME/.xfce4/config
XDG_CACHE_HOME=HOME/.xfce4/cache
... :evil:

I've yet tried to set these in ~/.bashrc, in /etc/bash/bashrc, ~/.bash_profile... No! way! Xfce xinit script still obsesses on creating these damn directories directly under my HOME directory.

Can anyone tell me where the heck I can put these directives?

Thanks a lot in advance.
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Top
sebaro
Veteran
Veteran
User avatar
Posts: 1141
Joined: Mon Jul 03, 2006 5:49 am
Location: Romania
Contact:
Contact sebaro
Website

  • Quote

Post by sebaro » Sun Jan 09, 2011 11:16 am

You can try put it in /etc/env.d/30xdg-data-local, or you can use export:

Code: Select all

export XDG_CONFIG_HOME="$HOME/.xfce4/config"
But remember that all programs use those directories not only xfce.
Top
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

  • Quote

Post by VinzC » Sun Jan 09, 2011 2:24 pm

Thanks sebaro.

However that doesn't work:

Code: Select all

XDG_CACHE_HOME=HOME/.xfce/cache
XDG_CONFIG_HOME=HOME/.xfce/config
The problem is environment scripts don't seem to parse the $HOME environment variable (or any variable at all). But if Xfce start script does reference these variables, there must be a place where to change them, am I right?

EDIT: Okay, I'm screwed!
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=5 wrote:Important: You cannot use shell variables when defining other variables. This means things like FOO="$BAR" (where $BAR is another variable) are forbidden.
What am I supposed to do now?

If I change any file that belongs to Xfce, it'll be overwritten each time I upgrade or recompile Xfce. If I (try to) use shell scripts in $HOME (not even guaranteed to work AFAICS) I need to write a new script if I change my shell. I want something that is independent of the shell. And putting these instructions in $HOME/.xinitrc won't work either as that file is processed after $XDG_xxx_HOME variables are used.

Any other idea?
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Top
sebaro
Veteran
Veteran
User avatar
Posts: 1141
Joined: Mon Jul 03, 2006 5:49 am
Location: Romania
Contact:
Contact sebaro
Website

  • Quote

Post by sebaro » Sun Jan 09, 2011 4:23 pm

If I understand it right you have a multi-user system, that's why you want to use $HOME?

You could also try

Code: Select all

export XDG_CONFIG_HOME="${HOME}/.xfce4/config"
in
/etc/profile (system)
~/.bashrc or ~/.bash_profile (user).
Top
Anon-E-moose
Watchman
Watchman
User avatar
Posts: 6566
Joined: Fri May 23, 2008 7:31 pm
Location: Dallas area

  • Quote

Post by Anon-E-moose » Sun Jan 09, 2011 4:53 pm

I recently switched from xfce to lxde and I wanted to have XDG_CONFIG_HOME and other variables set
set so I put this in my .xinitrc file

Code: Select all

XDG_CONFIG_HOME="$HOME/.config"
XDG_MENU_PREFIX="lxde-"
XSESSION="LXDE"
export XDG_MENU_PREFIX XSESSION XDG_CONFIG_HOME
above where I call lxsession
UM780 xtx, 6.18 zen kernel, gcc 15, openrc, wayland
minixforum m1-s1 max -- same software as above but used for ai learning


Zealots are gonna be zealots, just like haters are gonna be haters
Top
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

  • Quote

Post by VinzC » Sun Jan 09, 2011 4:56 pm

Ah, I didn't try editing /etc/profile, that's true. Instead, I suppose any *.sh script I'll put into /etc/profile.d/ will suffice?

Code: Select all

...
else
	# Setup a bland default prompt.  Since this prompt should be useable
	# on color and non-color terminals, as well as shells that don't
	# understand sequences such as \h, don't put anything special in it.
	PS1="${USER:-$(type whoami >/dev/null && whoami)}@$(type uname >/dev/null && uname -n) \$ "
fi

for sh in /etc/profile.d/*.sh ; do
	[ -r "$sh" ] && . "$sh"
done
unset sh
Yes, I have a multi-user system on which I want all my user accounts to store their Xfce config and cache under ~/.xfce4/ . I must then make sure /etc/profile is run *everytime* a shell script from Xfce is run. Thanks for the tip. I'll try that and report here.
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Top
Anon-E-moose
Watchman
Watchman
User avatar
Posts: 6566
Joined: Fri May 23, 2008 7:31 pm
Location: Dallas area

  • Quote

Post by Anon-E-moose » Sun Jan 09, 2011 5:03 pm

The problem with either "$HOME" or "~" in /etc/env.d/* is that they are only parsed once at system startup (if I'm not mistaken)
and both those would equate to "/"

Or if /etc/profile doesn't work, look at the system xinitrc file
UM780 xtx, 6.18 zen kernel, gcc 15, openrc, wayland
minixforum m1-s1 max -- same software as above but used for ai learning


Zealots are gonna be zealots, just like haters are gonna be haters
Top
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

  • Quote

Post by VinzC » Sun Jan 09, 2011 10:50 pm

Anon-E-moose wrote:I recently switched from xfce to lxde and I wanted to have XDG_CONFIG_HOME and other variables set
set so I put this in my .xinitrc file
As I mentioned the problem with .xinitrc is that it's called too late in the process. I might be wrong but Xfce scripts have already checked for XDG_* variables when .xinitrc is called. I don't remember exactly but I know I have looked up for various solutions and the .xinitrc comes too late.

BTW I've added a custom script to /etc/profile.d/ and now it works:

Code: Select all

# XFCE4: change default home directory
XFCE_BASE_DIR=~/.xfce4
[ -d ${XFCE_BASE_DIR} ] || mkdir -p ${XFCE_BASE_DIR}

export XDG_CONFIG_HOME=$XFCE_BASE_DIR/config
export XDG_CACHE_HOME=$XFCE_BASE_DIR/cache
So far, I've had to patch blueman because the latter doesn't honour XDG_CONFIG_HOME:

Code: Select all

--- old/blueman/plugins/config/File.py	2010-12-25 10:41:55.000000000 +0100
+++ new/blueman/plugins/config/File.py	2011-01-09 23:35:38.613000007 +0100
@@ -37,7 +37,11 @@
 
 dbus.service.Object.SUPPORTS_MULTIPLE_OBJECT_PATHS = True
 
-cfg_path = os.path.expanduser('~/.config/blueman/blueman.cfg')
+if os.environ['XDG_CONFIG_HOME']:
+	cfg_dir = '%s/blueman' % os.environ['XDG_CONFIG_HOME']
+else:
+	cfg_dir = os.path.expanduser('~/.config/blueman')
+cfg_path = '%s/blueman.cfg' % cfg_dir
 
 class Monitor(dbus.service.Object):
 	__id__ = 0
@@ -89,9 +93,9 @@
 	def on_load(self, section):
 		
 		if not File.__db__:
-			if not os.path.exists(os.path.expanduser('~/.config/blueman')):
+			if not os.path.exists(cfg_dir):
 				try:
-					os.makedirs(os.path.expanduser('~/.config/blueman'))
+					os.makedirs(cfg_dir)
 				except:
 					pass
 			try:
Will close my test session, reopen it and do further checks.

EDIT: Patch updated (File.py creates the directory if it doesn't exist).
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Top
Post Reply

8 posts • Page 1 of 1

Return to “Desktop Environments”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic