diff options
| author | Syndamia <kamen@syndamia.com> | 2023-01-02 18:38:47 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2023-01-02 18:38:47 +0200 |
| commit | 77bd44842e79a4c8f06add6917cdec4ebd6ee5eb (patch) | |
| tree | 64aeafd481bf7b885a547f6aeb9f7de96d645eae /.a/plumb.sh | |
| parent | d464e7352cfc1078e7bef77c07777a54a0148c83 (diff) | |
| download | dotfiles-77bd44842e79a4c8f06add6917cdec4ebd6ee5eb.tar dotfiles-77bd44842e79a4c8f06add6917cdec4ebd6ee5eb.tar.gz dotfiles-77bd44842e79a4c8f06add6917cdec4ebd6ee5eb.zip | |
[plumb] Implemented initial setup for plumb
Diffstat (limited to '.a/plumb.sh')
| -rwxr-xr-x | .a/plumb.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/.a/plumb.sh b/.a/plumb.sh new file mode 100755 index 0000000..817cf7e --- /dev/null +++ b/.a/plumb.sh @@ -0,0 +1,51 @@ +#/bin/bash + + +# +# Get selection text and go to window directory +# + +selection="$(xclip -o)" + +# Copied from https://odysee.com/@Luke:7/plumbing-in-linux-la-plan-9-from-bell:e +pid=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) +pid1=$(pstree -lpA "$pid" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') +cd "$(readlink /proc/"$pid1"/cwd)" + +wname="$(cat /proc/"$pid"/comm)" +if [ $wname == "terminator" ]; then + xdotool key Control+Alt+Page_Up + sleep 0.1 + cd "$(cat /tmp/plumb-cwd)" +fi + +# +# Create jgmenu menu +# + +menu="" +function matches() { + echo "$selectoin" | grep "$1" >/dev/null 2>&1 +} + +#matches "[[:alnum:]]*" && menu+="Run,echo 2\n" + +# +# Execution menu option +# + +if [ -z $menu ]; then + action="1" +else + action=$(echo -ne "Open,echo 1\n$menu" | jgmenu --vsimple --at-pointer) +fi + +case "$action" in + 1) + xdg-open "$selection" + ;; + *) + notify-send "Bad action!" + ;; +esac + |
