aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-04-02 19:39:08 +0200
committerMattias Andrée <maandree@operamail.com>2015-04-02 19:39:08 +0200
commit46fa9a4ba30490af9e7a425d56cad6b651498e33 (patch)
tree38792417760a2f7ca6442ba4ce9d6260dc612688
parentupdate dist (diff)
downloadxpybar-46fa9a4ba30490af9e7a425d56cad6b651498e33.tar.gz
xpybar-46fa9a4ba30490af9e7a425d56cad6b651498e33.tar.bz2
xpybar-46fa9a4ba30490af9e7a425d56cad6b651498e33.tar.xz
derp + add support for home directory by passwd entry rather than environment1.11.1
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rwxr-xr-xsrc/__main__.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/__main__.py b/src/__main__.py
index 0eca448..aca0e91 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -16,6 +16,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
+import os, sys, pwd
+
import Xlib.threaded # IMPORTANT (threading do not work otherwise, see XInitThreads)
import Xlib.display, Xlib.Xatom, Xlib.ext.randr, Xlib.X
from argparser import *
@@ -543,8 +545,11 @@ config_file = a(parser.opts['--configurations'])
## Load extension and configurations via xpybarrc
if config_file is None:
- for file in ('$XDG_CONFIG_HOME/%/%rc', '$HOME/.config/%/%rc', '$HOME/.%rc', '/etc/%rc'):
- file = file.replace('%', 'xpybarrc')
+ # TODO add support for $XDG_CONFIG_DIRS
+ files = ('$XDG_CONFIG_HOME/%/%rc', '$HOME/.config/%/%rc', '$HOME/.%rc',
+ '$~/.config/%/%rc', '$~/.%rc', '/etc/%rc')
+ for file in files:
+ file = file.replace('%', 'xpybar')
for arg in ('XDG_CONFIG_HOME', 'HOME'):
if '$' + arg in file:
if arg in os.environ:
@@ -553,6 +558,8 @@ if config_file is None:
file = None
break
if file is not None:
+ if file.startswith('$~'):
+ file = pwd.getpwuid(os.getuid()).pw_dir + file[2:]
file = file.replace('\0', '$')
if os.path.exists(file):
config_file = file