[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automatically set eww-download-directory according xdg dir

From: Garreau\, Alexandre
Subject: Automatically set eww-download-directory according xdg dir
Date: Mon, 29 Oct 2018 20:54:29 +0100
User-agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian

I guess this is the right place to ask about Eww.

Currently `eww-download-directory' is unconditionally set to
“~/Downloads”, which, I guess, is the default download directory most
desktop and file-managers will create and read when the installation is
set up in english.  But XDG (and most systems nowadays, except Mac OS X
if I’m right, which translate directory names in applications display
iirc) tends to localize directories in the user language set up at
installation.  So, after installation, by default, my directory was
“~/Téléchargements/”, except then, I tweaked “~/.config/user-dirs.dirs”,
so now I have short dir names in my home, like “~/dl/”.  Instead of
reading (or rather, sourcing it from bashrc then using the env var… but
on my system by default this isn’t done so it won’t work in most configs
I guess) that last config file, I guess the canonical way to get the
appropriate XDG directories is first to call the “xdg-user-dir” command,
like this:

#+BEGIN_SRC emacs-lisp
  (defcustom eww-download-directory
       (call-process "xdg-user-dir" nil t nil "DOWNLOAD")
     0 -1)
    "Directory where files will downloaded."
    :version "24.4"
    :group 'eww
    :type 'string)

I am not sure this is the simplest way to call a process and get its
output as string, without using the shell (there seem to be a
shell-command-to-string, but no call-process-to-string, writing another
mail about this).

May I suggest to change Eww so it acts according XDG?

Or should, instead, a xdg.el file be created where to put variables (or
functions) referring to correct (and up-to-date) names of XDG variables:
desktop, download, templates, publicshare, documents, music, pictures,
and videos, and maybe “xdg-settings get default-url-scheme-handler”.
Maybe among other xdg stuff, such as localization language, or… dunno
yet, but there must be things to get.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]