From patchwork Tue Oct 23 15:15:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 10653261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B79C313B5 for ; Tue, 23 Oct 2018 15:17:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98DCD29B93 for ; Tue, 23 Oct 2018 15:17:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87C8529BA0; Tue, 23 Oct 2018 15:17:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 29C0A29B93 for ; Tue, 23 Oct 2018 15:17:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B1E56E110; Tue, 23 Oct 2018 15:16:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 46F0D6E110 for ; Tue, 23 Oct 2018 15:16:57 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id q6-v6so2142320wrw.11 for ; Tue, 23 Oct 2018 08:16:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nNho+JynEYAUlW0VqZIsoOw7LLwz9nAidOsvMPrHAnU=; b=B3x0FtNmfjm1SspNPJVpDnnViBARE307XJf/7xcd/34HePPgGU7y4zo0Lqbsv5Mg/Z b+03VDiUfh4h9jCyvFOlmiPTWxiYrobrR25ZtOrZFxKR1MYkh8k8dSfyWfFpcy2oIqu6 KwT2UUCxivNmPJhPKU1hhVUuSLRdf+8ahtOuw9Zh6Y7RewRHUXTw+2GZY8G2979z8d81 CzZVK3/uFJnOqKp/amTg8gcxCzxjzVQqMF8mE3equUI3AaJ3N7EpjLMfm6NHz/v4BgCy CF9s7LsA9TgjDyHMQ9kHn+E9VO4tFFHmIO9VfM5l7XMApqWN+UurIXKcyl+PSCD0TxrS NH7g== X-Gm-Message-State: AGRZ1gK0LPIszXz3qxDXpcHAGVZMIWnyT9LVj3oTIKQbJLOS9a3b4bsg BCu6CPQZvgxVg1M4YhTitJq1rp82 X-Google-Smtp-Source: AJdET5cPhgMrzLf4xou26dViJYONHyPNLFvNQgI7HCJ7r0zoTwEy+L0kOe4HdKkPxFAhgIJxmoyOpg== X-Received: by 2002:a5d:4e03:: with SMTP id p3-v6mr1135512wrt.320.1540307815653; Tue, 23 Oct 2018 08:16:55 -0700 (PDT) Received: from arch-x1c3.cbg.collabora.co.uk ([2a00:5f00:102:0:9665:9cff:feee:aa4d]) by smtp.gmail.com with ESMTPSA id l67-v6sm2346731wma.20.2018.10.23.08.16.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Oct 2018 08:16:54 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH] WIP: dim: introduce XDG_CONFIG_HOME support Date: Tue, 23 Oct 2018 16:15:54 +0100 Message-Id: <20181023151554.10177-1-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emil.l.velikov@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Emil Velikov Currently we check for $DIM_CONFIG, falling back to $HOME/.dimrc. Instead of always setting DIM_CONFIG, add support for XDG_CONFIG_HOME aka ~/.config. Now we get $DIM_CONFIG > $XDG_CONFIG_HOME/dim/config > $HOME/.dimrc Ideally in the future we'll: a) warn and kill off the last one b) print an warning message each time DIM_CONFIG is set c) error out if XDG_CONFIG_HOME is not set ... or fallback to ~/.config ourselves Reason being, managing dotfiles with XDG is an order of magnitude easier and DIM_CONFIG should only be set as a temporary workaround. TODO: better sales pitch, update docs Signed-off-by: Emil Velikov --- As the WIP/TODO suggests, this is not the final version of the patch. Sending it out to get some feedback on the idea and a/b/c thinking. Thanks Emil --- dim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dim b/dim index 21e1e0d6ed45..93e90a4f96d0 100755 --- a/dim +++ b/dim @@ -36,7 +36,8 @@ set -e # # dim configuration file -DIM_CONFIG=${DIM_CONFIG:-$HOME/.dimrc} +XDG_DIM_CONFIG=${XDG_CONFIG_HOME:+$XDG_CONFIG_HOME/dim/config} +DIM_CONFIG=${DIM_CONFIG:-${XDG_DIM_CONFIG:-$HOME/.dimrc}} if [ -r $DIM_CONFIG ]; then # shellcheck source=/dev/null . $DIM_CONFIG