summaryrefslogtreecommitdiff
path: root/content/posts/2019-02-02-xdg-runtime-dir.md
blob: 1e5fac45413828d2d48c5fbaab7a6c1cdfa9ec31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
---
layout: post
title: XDG_RUNTIME_DIR on non-systemd systems
category: GNU/Linux
tags:
  - systemd
  - gentoo
---

On systemd/ConsoleKit systems this variable is set when the user logs in, if
neither is used and you need `XDG_RUNTIME_DIR` for some reason (eg Flatpak), it
can be easily set adding some lines to your `.bash_profile`:

```bash
if test -z "${XDG_RUNTIME_DIR}"; then
    export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir
    if ! test -d "${XDG_RUNTIME_DIR}"; then
        mkdir "${XDG_RUNTIME_DIR}"
        chmod 0700 "${XDG_RUNTIME_DIR}"
    fi
fi
```

---

**Sources**:

- [Weston](https://wiki.gentoo.org/wiki/Weston)