dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ee570f046c662c30fa001c853753833ab411e3a4
parent 2e1310169e1c929e096ac9e5738ad45557460fa7
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Fri,  8 Mar 2019 10:04:26 -0500

plumbing: cabl from video

Diffstat:
M.config/i3/config | 2+-
A.scripts/i3cmds/cabl | 26++++++++++++++++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/.config/i3/config b/.config/i3/config @@ -160,7 +160,7 @@ bindsym $mod+Shift+z gaps outer current minus 5 bindsym $mod+x exec --no-startup-id mpc pause; exec --no-startup-id pauseallmpv ; exec --no-startup-id i3lock -e -f -c 1d2021 bindsym $mod+Shift+x exec --no-startup-id prompt "Shutdown computer?" "$shutdown" -bindsym $mod+c exec --no-startup-id freealf +bindsym $mod+c exec --no-startup-id cabl bindsym $mod+Shift+c exec --no-startup-id camtoggle bindsym $mod+v exec --no-startup-id $term -e $EDITOR -c "VimwikiIndex" diff --git a/.scripts/i3cmds/cabl b/.scripts/i3cmds/cabl @@ -0,0 +1,26 @@ +#!/bin/bash +# Dependencies are xclip and xorg-xprop. +# qrencode required for qrcode generation. +# groff/zathura required for man pages. +prim="$(xclip -o)"; [ -z "$prim" ] && exit + +PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) +PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') +cd "$(readlink /proc/"$PID"/cwd)" +[ -f "$prim" ] && xdg-open "$prim" && exit +[ -d "$prim" ] && "$TERMINAL" "$prim" && exit + +websearch() { "$BROWSER" "https://duckduckgo.com/?q=$@" ;} +wikipedia() { "$BROWSER" "https://en.wikipedia.org/wiki/$@" ;} +wiktionary() { "$BROWSER" "https://en.wiktionary.org/wiki/$@" ;} +maps() { "$BROWSER" "https://www.openstreetmap.org/search?query=$@" ;} +ebay() { "$BROWSER" "https://www.ebay.com/sch/$@" ;} + +echo "$prim" | grep "^.*\.[A-Za-z]\+.*" >/dev/null && gotourl() { "$BROWSER" "$@" ;} +echo "$prim" | grep "^.*@.*\.[A-Za-z]\+$" >/dev/null && email() { xdg-email "$@" ;} +command -v qrencode >/dev/null && qrcode() { qrencode "$@" -s 10 -o /tmp/qr.png && xdg-open /tmp/qr.png ;} +man -k "^$prim$" >/dev/null && manual() { man -Tpdf "$prim" | zathura - ;} + +func="$(declare -F | awk '{print $3}' | dmenu -p "Plumb $prim to?" -i -l 15)" + +[ -z "$func" ] || "$func" "$prim"