aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-30 21:27:55 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-30 21:27:55 +1200
commita8f5866ed977325532998e800401057c8f767ac6 (patch)
tree63e772fd89f5fb240d4808beb86c2e01cfd97aa2
parentAdd an idea (diff)
downloaddotfiles-a8f5866ed977325532998e800401057c8f767ac6.tar.gz
dotfiles-a8f5866ed977325532998e800401057c8f767ac6.zip
Add x()
-rw-r--r--README.markdown1
-rw-r--r--sh/shrc.d/x.sh7
2 files changed, 8 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index 5ec7556a..99883c97 100644
--- a/README.markdown
+++ b/README.markdown
@@ -207,6 +207,7 @@ in `sh/shrc.d` to be loaded by any POSIX interactive shell. Those include:
`vi(1)` and `view(1)` implementation if it's available.
* `vr()` tries to change to the root directory of a source control
repository.
+* `x()` is a one-key shortcut for `exec startx`.
There are a few other little tricks defined for other shells, mostly in
`bash/bashrc.d`:
diff --git a/sh/shrc.d/x.sh b/sh/shrc.d/x.sh
new file mode 100644
index 00000000..ed921c68
--- /dev/null
+++ b/sh/shrc.d/x.sh
@@ -0,0 +1,7 @@
+# Most systems won't have X, so we'll only define this if we have startx(1)
+command -v startx >/dev/null 2>&1 || return
+
+# Quick one-key command to launch an X session
+x() {
+ exec startx "$@"
+}