moved rofi files
parent
db00b331ac
commit
53fa33d23c
@ -1,49 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# getting focused pwd
|
|
||||||
PID=$(xdotool getwindowfocus getwindowpid)
|
|
||||||
child=$PID
|
|
||||||
children=()
|
|
||||||
while [ -n "$child" ] ; do
|
|
||||||
children+=($child)
|
|
||||||
child=$(pgrep -P $child)
|
|
||||||
done
|
|
||||||
|
|
||||||
last_ps=$(ps ${children[-1]} | grep -v PID | awk '{print $5}')
|
|
||||||
|
|
||||||
if [ "$last_ps" == "tmux" ] ; then
|
|
||||||
current_pane=$(tmux list-panes | grep '(active)' | grep -o '^[0-9]')
|
|
||||||
cwd=$(tmux display-message -p -t $current_pane -F '#{pane_current_path}')
|
|
||||||
else
|
|
||||||
cwd=$(readlink -e /proc/${children[-1]}/cwd)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# change to the directory
|
|
||||||
cd $cwd
|
|
||||||
files=$(find * -type f)
|
|
||||||
|
|
||||||
selection=$(echo "$files" | rofi-dmenu)
|
|
||||||
|
|
||||||
# exit on quit
|
|
||||||
if [ -z "$selection" ] ; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# grab extension
|
|
||||||
extension=$(echo "$selection" | grep -o '.\([a-zA-Z]\+\)$')
|
|
||||||
|
|
||||||
# get proper opener
|
|
||||||
case "$extension" in
|
|
||||||
'.pdf') prg="zathura" ;;
|
|
||||||
'.md') prg="vim" ;;
|
|
||||||
'.png') prg="feh" ;;
|
|
||||||
'.jpg') prg="feh" ;;
|
|
||||||
'.jpeg') prg="feh" ;;
|
|
||||||
*) prg="xdg-open" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [[ "$1" == '-S' && "$prg" =~ [feh|zathura] ]] ; then
|
|
||||||
swallow $prg "$selection"
|
|
||||||
else
|
|
||||||
$prg "$selection"
|
|
||||||
fi
|
|
@ -1 +1 @@
|
|||||||
Subproject commit 0f52a172cc2bfc4f5f059f181cf37e8f2f1b69c2
|
Subproject commit 1ff331968225f5854d4790de73d2b8e2af545171
|
@ -1 +1 @@
|
|||||||
Subproject commit dbf546e61c0ca848f2474db55b601dead6d41f7e
|
Subproject commit 7dd2a2e4a6ad4423a5e8889550b53556711e8ce4
|
@ -1 +1 @@
|
|||||||
Subproject commit 045f006c50d782a6d3acbd8a07d1595322ff7e43
|
Subproject commit 0af598cbed78660066f8a8f4465844501ba5695b
|
@ -1 +1 @@
|
|||||||
Subproject commit 96670d5f16dcf23d590eb1d83d1de351b2e8fb15
|
Subproject commit 94999101e358385f3ca67a6ec9512f549196b802
|
@ -1 +1 @@
|
|||||||
Subproject commit c5672a5864bc78a932de438e4f64fefcee5c6ea6
|
Subproject commit 613dfb9d259166a40d0781e26b8ecd0f59648a25
|
@ -1 +1 @@
|
|||||||
Subproject commit 6d96a8a4906e91f44ddf97645d5c3c1980212402
|
Subproject commit a991497b9ff7ca59148d00105a0b5fe4eb8e48e3
|
@ -1 +1 @@
|
|||||||
Subproject commit 020bbf7d64cc2f0c5d2a4ab96d45b8014ef54ad2
|
Subproject commit d27117b8bc4f600657c7dd94310f60e784371eac
|
Loading…
Reference in New Issue