summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.a/plumb.sh51
-rwxr-xr-x.a/sys/on-wm-session.sh3
-rw-r--r--.gitignore1
-rw-r--r--.sxhkdrc3
-rw-r--r--.zshrc10
5 files changed, 67 insertions, 1 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
+
diff --git a/.a/sys/on-wm-session.sh b/.a/sys/on-wm-session.sh
index 3075c0d..454073f 100755
--- a/.a/sys/on-wm-session.sh
+++ b/.a/sys/on-wm-session.sh
@@ -13,7 +13,8 @@ lxpolkit &
xautolock -detectsleep -secure -time 15 -locker ~/.a/sys/lock.sh & # auto lock screen
tint2 & # taskbar
picom & # compositor
-setxkbmap -layout "us,bg-custom" -option "grp:alt_shift_toggle,lv3:win_switch" & # keyboard switching
+setxkbmap -layout "us,bg-custom" -option "grp:alt_shift_toggle,lv3:switch,caps:hyper" -v & # keyboard switching
+sxhkd -c "$HOME/.sxhkdrc"
if [[ $device == "desktop" ]]; then
xset m 1 1 # disable mouse acceleration (not a very proper way to do it, I know)
diff --git a/.gitignore b/.gitignore
index 90248fc..7362950 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@
!.tmux.conf
!.screenrc
!.dmrc
+!.sxhkdrc
!.a
.a/sys/lockscreen.png
diff --git a/.sxhkdrc b/.sxhkdrc
new file mode 100644
index 0000000..60641ff
--- /dev/null
+++ b/.sxhkdrc
@@ -0,0 +1,3 @@
+# Hyper_L + Right mouse button
+mod4 + button3
+ $HOME/.a/plumb.sh
diff --git a/.zshrc b/.zshrc
index 4ee9a08..5fcff79 100644
--- a/.zshrc
+++ b/.zshrc
@@ -126,6 +126,16 @@ device='desktop' # can be either "desktop" (default when empty), "server" or "an
alias cds="cdrepo source"
# }}}
+ # plumb.sh {{{
+
+ plumb-store-cwd () {
+ pwd > /tmp/plumb-cwd
+ }
+ zle -N plumb-store-cwd
+ bindkey "^[[5;7~" plumb-store-cwd
+
+ # }}}
+
# Run in the background
bgr () {
nohup sh -c "$@" 2>&1 &