summaryrefslogtreecommitdiff
path: root/.zshrc
diff options
context:
space:
mode:
authorryukamish <[email protected]>2026-06-25 13:47:04 +0530
committerryukamish <[email protected]>2026-06-25 13:47:04 +0530
commit118f7db2ce7ec00ac94917f8c5a97c28b6387728 (patch)
treec4c58e6b2b726b534bf7b4aa7e14612d0cd8293f /.zshrc
parentb7535c43ee05e543842ea55da66c31aa444ea7af (diff)
add: launching sway with dbus
Diffstat (limited to '.zshrc')
-rw-r--r--.zshrc26
1 files changed, 26 insertions, 0 deletions
diff --git a/.zshrc b/.zshrc
index 2173b19..2518684 100644
--- a/.zshrc
+++ b/.zshrc
@@ -31,6 +31,32 @@ export SAVEHIST="${HISTSIZE}"
# ┃ Functions ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
+function _have {
+ prog="${1}"
+ os="${2}"
+
+ if [ "${os}" != "" ] && [ "${os}" != "${OS}" ]
+ then
+ return 1
+ fi
+
+ type "${prog}" > /dev/null
+ return "$?"
+}
+
+# Set the runtime variable
+if _have sway linux
+then
+ alias sway-launch="dbus-launch --exit-with-session sway"
+ 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
+fi
+
# === Media ===
function video-to-gif() {
fps="$3"