~tardypad/dotfiles

32132db41eef36c1153ba0579cd177053e4baf86 — Damien Tardy-Panis 1 year, 10 months ago ccab4ba
use XDG_RUNTIME_DIR for temporary files with /tmp as fallback

XDG_RUNTIME_DIR folder is only accessible by the user (less conflict + security)
M files/docs/git/git-sed.scd => files/docs/git/git-sed.scd +4 -2
@@ 28,11 28,13 @@ _path_

# ENVIRONMENT VARIABLES

None
_XDG_RUNTIME_DIR_
	Path to user-specific base directory to store runtime files++
If unset, defaults to /tmp

# FILES

_/tmp/git-sed_
_$XDG_RUNTIME_DIR/git-sed_
	Temporary file to store sed results

# DEPENDENCIES

M files/docs/i3blocks/i3blocks-chat.scd => files/docs/i3blocks/i3blocks-chat.scd +2 -1
@@ 23,7 23,8 @@ None
# ENVIRONMENT VARIABLES

_XDG_RUNTIME_DIR_
	Path to user-specific base directory to store runtime files
	Path to user-specific base directory to store runtime files++
If unset, defaults to /tmp

# FILES


M files/docs/shell/do-not-disturb.scd => files/docs/shell/do-not-disturb.scd +2 -1
@@ 46,7 46,8 @@ This is the default action if none is specified
# ENVIRONMENT VARIABLES

_XDG_RUNTIME_DIR_
	Path to user-specific base directory to store runtime files
	Path to user-specific base directory to store runtime files++
If unset, defaults to /tmp

# FILES


M files/docs/shell/i3blocks-mode.scd => files/docs/shell/i3blocks-mode.scd +2 -1
@@ 34,7 34,8 @@ _toggle_
# ENVIRONMENT VARIABLES

_XDG_RUNTIME_DIR_
	Path to user-specific base directory to store runtime files
	Path to user-specific base directory to store runtime files++
If unset, defaults to /tmp

# FILES


M files/docs/shell/notify.scd => files/docs/shell/notify.scd +2 -1
@@ 35,7 35,8 @@ _body_
# ENVIRONMENT VARIABLES

_XDG_RUNTIME_DIR_
	Path to user-specific base directory to store runtime files
	Path to user-specific base directory to store runtime files++
If unset, defaults to /tmp

# FILES


M files/docs/shell/packages-updates.scd => files/docs/shell/packages-updates.scd +4 -2
@@ 26,11 26,13 @@ _update_

# ENVIRONMENT VARIABLES

None
_XDG_RUNTIME_DIR_
	Path to user-specific base directory to store runtime files++
If unset, defaults to /tmp

# FILES

_/tmp/packages-updates_
_$XDG_RUNTIME_DIR/packages-updates_
	Temporary directory for packages storage and operations

# DEPENDENCIES

M files/docs/shell/pomodoro.scd => files/docs/shell/pomodoro.scd +2 -1
@@ 40,7 40,8 @@ Default is 25 min
# ENVIRONMENT VARIABLES

_XDG_RUNTIME_DIR_
	Path to user-specific base directory to store runtime files
	Path to user-specific base directory to store runtime files++
If unset, defaults to /tmp

# FILES


M files/docs/shell/repo.scd => files/docs/shell/repo.scd +4 -2
@@ 42,11 42,13 @@ _pkg_name_

# ENVIRONMENT VARIABLES

None
_XDG_RUNTIME_DIR_
	Path to user-specific base directory to store runtime files++
If unset, defaults to /tmp

# FILES

_/tmp/repo_
_$XDG_RUNTIME_DIR/repo_
	Temporary directory for packages storage and operations

# DEPENDENCIES

M files/docs/shell/time-tracker.scd => files/docs/shell/time-tracker.scd +2 -1
@@ 72,7 72,8 @@ _XDG_DATA_HOME_
If unset, defaults to $HOME/.local/share

_XDG_RUNTIME_DIR_
	Path to user-specific base directory to store runtime files
	Path to user-specific base directory to store runtime files++
If unset, defaults to /tmp

# FILES


M files/docs/tmux/tmux-toggle-no-distraction.scd => files/docs/tmux/tmux-toggle-no-distraction.scd +2 -1
@@ 30,7 30,8 @@ _pane_
# ENVIRONMENT VARIABLES

_XDG_RUNTIME_DIR_
	Path to user-specific base directory to store runtime files
	Path to user-specific base directory to store runtime files++
If unset, defaults to /tmp

# FILES


M files/scripts/git/git-sed => files/scripts/git/git-sed +1 -1
@@ 3,7 3,7 @@
init_variables() {
  COMMAND=${0##*/}

  TMP_FILE='/tmp/git-sed'
  TMP_FILE="${XDG_RUNTIME_DIR:-/tmp}/git-sed"
  trap 'rm -f "${TMP_FILE}"' EXIT

  SCRIPT=

M files/scripts/i3blocks/i3blocks-chat => files/scripts/i3blocks/i3blocks-chat +1 -1
@@ 1,6 1,6 @@
#!/bin/sh

COUNT_FILE_PATH="${XDG_RUNTIME_DIR}/chat_count"
COUNT_FILE_PATH="${XDG_RUNTIME_DIR:-/tmp}/chat_count"

MODE="$( i3blocks-mode )"


M files/scripts/shell/do-not-disturb => files/scripts/shell/do-not-disturb +1 -1
@@ 3,7 3,7 @@
init_variables() {
  COMMAND=${0##*/}

  FILE_PATH="${XDG_RUNTIME_DIR}/do_not_disturb"
  FILE_PATH="${XDG_RUNTIME_DIR:-/tmp}/do_not_disturb"

  ACTION='status'
  DURATION_MIN=

M files/scripts/shell/i3blocks-mode => files/scripts/shell/i3blocks-mode +1 -1
@@ 3,7 3,7 @@
init_variables() {
  COMMAND=${0##*/}

  FULL_FILE_PATH="${XDG_RUNTIME_DIR}/i3blocks_mode_full"
  FULL_FILE_PATH="${XDG_RUNTIME_DIR:-/tmp}/i3blocks_mode_full"
  SIGNAL_MAX=10

  ACTION='show'

M files/scripts/shell/notify => files/scripts/shell/notify +1 -1
@@ 54,7 54,7 @@ send_notification() {
  fi

  if [ -n "${IDENTIFIER}" ]; then
    NOTIFICATION_FILE="${XDG_RUNTIME_DIR}/notification_${IDENTIFIER}"
    NOTIFICATION_FILE="${XDG_RUNTIME_DIR:-/tmp}/notification_${IDENTIFIER}"
    if [ -f "${NOTIFICATION_FILE}" ]; then
      REPLACE_ID=$( cat "${NOTIFICATION_FILE}" )
    fi

M files/scripts/shell/packages-updates => files/scripts/shell/packages-updates +2 -1
@@ 3,7 3,7 @@
init_variables() {
  COMMAND=${0##*/}

  TMP_DIR='/tmp/packages-updates'
  TMP_DIR="${XDG_RUNTIME_DIR:-/tmp}/packages-updates"
  trap 'rm -rf "${TMP_DIR}"' EXIT

  ACTION=


@@ 29,6 29,7 @@ exit_error() {
} >&2

list_packages_updates() {
  rm -rf "${TMP_DIR}"
  mkdir -p "${TMP_DIR}"
  ln -s "$( pacman-conf DBPath )/local" "${TMP_DIR}"
  fakeroot -- pacman -Sy -b "${TMP_DIR}" --logfile /dev/null > /dev/null

M files/scripts/shell/pomodoro => files/scripts/shell/pomodoro +1 -1
@@ 3,7 3,7 @@
init_variables() {
  COMMAND=${0##*/}

  FILE_PATH="${XDG_RUNTIME_DIR}/pomodoro"
  FILE_PATH="${XDG_RUNTIME_DIR:-/tmp}/pomodoro"
  DURATION_MIN=25

  ACTION='status'

M files/scripts/shell/repo => files/scripts/shell/repo +2 -1
@@ 3,7 3,7 @@
init_variables() {
  COMMAND=${0##*/}

  TMP_DIR='/tmp/repo'
  TMP_DIR="${XDG_RUNTIME_DIR:-/tmp}/repo"
  trap 'rm -rf "${TMP_DIR}"' EXIT

  REPO=


@@ 52,6 52,7 @@ exit_error() {
} >&2

import_env() {
  rm -rf "${TMP_DIR}"
  mkdir -p "${TMP_DIR}"
  scp -q "surg:/srv/pkgs/${REPO}/${REPO}.files.tar.xz" "${TMP_DIR}"
  scp -q "surg:/srv/pkgs/${REPO}/${REPO}.db.tar.xz" "${TMP_DIR}"

M files/scripts/shell/time-tracker => files/scripts/shell/time-tracker +1 -1
@@ 3,7 3,7 @@
init_variables() {
  COMMAND=${0##*/}

  CURRENT_FILE_PATH="${XDG_RUNTIME_DIR}/time_tracker"
  CURRENT_FILE_PATH="${XDG_RUNTIME_DIR:-/tmp}/time_tracker"
  LOGGING_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/time_tracker"

  ACTION='status'

M files/scripts/tmux/tmux-toggle-no-distraction => files/scripts/tmux/tmux-toggle-no-distraction +1 -1
@@ 3,7 3,7 @@
TARGET="$1"

init_variables() {
  FILE_PATH="${XDG_RUNTIME_DIR}/tmux_no_distraction"
  FILE_PATH="${XDG_RUNTIME_DIR:-/tmp}/tmux_no_distraction"

  [ -n "${DISPLAY}" ] || return