aboutsummaryrefslogtreecommitdiff
path: root/.functions
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2022-01-05 00:01:24 +0800
committerGuangxiong Lin <[email protected]>2022-01-05 00:04:29 +0800
commitc2100f3801d69e768e43259f279f2c66858b10fc (patch)
tree147dcd5d0e0742ffdd82f537b2fe96e24dead623 /.functions
parent3e2447ac7ab3ef20595d545cd4df70d5afcee1d7 (diff)
downloaddotfiles-c2100f3801d69e768e43259f279f2c66858b10fc.tar.gz
dotfiles-c2100f3801d69e768e43259f279f2c66858b10fc.tar.bz2
dotfiles-c2100f3801d69e768e43259f279f2c66858b10fc.zip
Add open function based on xdg-open
Diffstat (limited to '.functions')
-rw-r--r--.functions17
1 files changed, 12 insertions, 5 deletions
diff --git a/.functions b/.functions
index b34c848..33d3e0e 100644
--- a/.functions
+++ b/.functions
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
fco () {
local tags branches target
branches=$(
@@ -15,11 +17,6 @@ fco () {
git checkout $(awk '{print $2}' <<<$target)
}
-fjrnl () {
- title=$(jrnl --short | fzf --tac --no-sort) \
- && jrnl -on $(echo $title | cut -c 1-16) $1
-}
-
fs () {
local session
session=$(tmux list-sessions -F "#{session_name}" \
@@ -34,3 +31,13 @@ tm() {
fi
session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --exit-0) && tmux $change -t "$session" || echo "No sessions found."
}
+
+open () {
+ if [ -f /usr/bin/xdg-open ]; then
+ nohup xdg-open "$*" > /dev/null 2>&1 &
+ elif [ -f /usr/bin/open ]; then
+ /usr/bin/open "$*"
+ else
+ echo "No usable program is found"
+ fi
+}