diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-04-02 19:39:08 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-04-02 19:39:08 +0200 |
commit | 46fa9a4ba30490af9e7a425d56cad6b651498e33 (patch) | |
tree | 38792417760a2f7ca6442ba4ce9d6260dc612688 /src | |
parent | update dist (diff) | |
download | xpybar-1.11.1.tar.gz xpybar-1.11.1.tar.bz2 xpybar-1.11.1.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 'src')
-rwxr-xr-x | src/__main__.py | 11 |
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 |