mirror of
https://github.com/VectorKappa/dotfiles.git
synced 2025-12-20 00:36:09 +01:00
25 lines
739 B
Bash
Executable File
25 lines
739 B
Bash
Executable File
#!/bin/sh
|
|
# A fuzzy file-finder and opener based on dmenu
|
|
# Requires: dmenu, xdg-utils
|
|
if ! [ -f "$HOME/.dmenurc" ]; then
|
|
cp /usr/share/dmenu/dmenurc $HOME/.dmenurc
|
|
fi
|
|
. $HOME/.dmenurc
|
|
|
|
eval $(xdotool getmouselocation --shell)
|
|
menu_widht=600
|
|
monitor_widht=$(wattr w $(lsw -r))
|
|
monitor_height=$(wattr h $(lsw -r))
|
|
lines=20
|
|
menu_height=$(( $lines * 23 ))
|
|
maxx=$(( $monitor_widht - $menu_widht ))
|
|
miny=$PANEL_HEIGHT
|
|
maxy=$(( $monitor_height - $menu_height ))
|
|
XP=$X
|
|
[[ $XP -gt $maxx ]] && XP=$maxx
|
|
YP=$Y
|
|
[[ $YP -lt $miny ]] && YP=$miny
|
|
[[ $YP -gt $maxy ]] && YP=$maxy
|
|
|
|
find ~/ | sed 's/ /\\ /g' | sort -f | dmenu -i -l $lines -y $YP -x $XP -w $menu_widht -fn $DMENU_FN -nb $DMENU_NB -nf $DMENU_NF -sf $DMENU_SF -sb $DMENU_SB | xargs xdg-open
|