summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bin/downloads3
-rwxr-xr-xbin/bin/keyboard2
-rwxr-xr-xbin/bin/monitor2
-rwxr-xr-xbin/bin/password2
-rwxr-xr-xbin/bin/tmux_attach5
-rwxr-xr-xbin/bin/username5
6 files changed, 13 insertions, 6 deletions
diff --git a/bin/bin/downloads b/bin/bin/downloads
index 46d64bd..45dc41f 100755
--- a/bin/bin/downloads
+++ b/bin/bin/downloads
@@ -1,4 +1,5 @@
-#!/bin/bash
+#!/usr/bin/env bash
+
download_dir="$HOME/Downloads"
target=$(find $download_dir -regex '.*\.\(pdf\|PDF\|djvu\|ps\)' -printf "%f\n" | dmenu -i -p "Open File:")
[[ -n $target ]] && exec zathura "$download_dir/$target"
diff --git a/bin/bin/keyboard b/bin/bin/keyboard
index c63f027..ca67828 100755
--- a/bin/bin/keyboard
+++ b/bin/bin/keyboard
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
# Xcape settings
killall -9 xcape
diff --git a/bin/bin/monitor b/bin/bin/monitor
index c3b81db..ce12c04 100755
--- a/bin/bin/monitor
+++ b/bin/bin/monitor
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
XRANDR=$(which xrandr)
diff --git a/bin/bin/password b/bin/bin/password
index 065672b..f94379a 100755
--- a/bin/bin/password
+++ b/bin/bin/password
@@ -1,2 +1,2 @@
-#! /bin/bash
+#!/usr/bin/env bash
passmenu
diff --git a/bin/bin/tmux_attach b/bin/bin/tmux_attach
index 80add99..7fd5750 100755
--- a/bin/bin/tmux_attach
+++ b/bin/bin/tmux_attach
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
SESSIONS=$(tmux list-sessions | cut -d':' -f1)
+ATTACHED_SESSIONS=$(tmux list-sessions | grep attached | cut -d':' -f1)
TMUXINATOR=$(tmuxinator list | sed '1d' | sed 's/\s\+/\n/g')
UNION=$(cat <(echo "$SESSIONS") <(echo "$TMUXINATOR") | sort | uniq | sed "/^$/d")
@@ -8,7 +9,9 @@ SESSION=$(echo "$UNION" | dmenu -i -p "Session:" | tr -d '[[:space:]]')
[[ -n $SESSION ]] || exit
# Rename i3 workspace
-command -v i3-msg && i3-msg workspace "$SESSION"
+! grep -Fxq "$SESSION" <(echo "$ATTACHED_SESSIONS") \
+ && command -v i3-msg \
+ && i3-msg workspace "$SESSION"
grep -Fxq "$SESSION" <(echo "$TMUXINATOR") \
&& COMMAND="tmuxinator start $SESSION" \
diff --git a/bin/bin/username b/bin/bin/username
index 704ea98..b124733 100755
--- a/bin/bin/username
+++ b/bin/bin/username
@@ -1,3 +1,4 @@
-#!/bin/bash
-target=$(find $HOME/.password-store/ -name "*.gpg" -exec sh -c 'echo ${1#*password-store/}' _ {} \; | dmenu -i -p "Get identifier for:")
+#!/usr/bin/env bash
+
+target=$(find $HOME/.password-store/ -name "*.gpg" -printf "%P\n" | dmenu -i -p "Get identifier for:")
basename $target .gpg | xclip -i