Compare commits
2 Commits
1196d79423
...
38a242c999
Author | SHA1 | Date |
---|---|---|
randomuser | 38a242c999 | |
randomuser | a22c5fa20c |
2
Makefile
2
Makefile
|
@ -35,6 +35,8 @@ sh:
|
|||
cp -f sh/brightness $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/git-credential-gitpass $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/capture $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/toggle-contingency-mode $(DESTDIR)$(PREFIX)/bin
|
||||
ln -sf $(DESTDIR)$(PREFIX)/bin/tmenu_run $(DESTDIR)$(PREFIX)/bin/regenerate
|
||||
|
||||
check:
|
||||
shellcheck sh/*
|
||||
|
|
10
sh/tmenu_run
10
sh/tmenu_run
|
@ -4,9 +4,15 @@ tmenu_path () {
|
|||
IFS=" :"
|
||||
for i in $PATH; do
|
||||
for j in "$i"/*; do
|
||||
[ -f "$j" ] && [ -x "$j" ] && printf "%s\n" "$j"
|
||||
[ -f "$j" ] && [ -x "$j" ] && printf "%s\n" "$j" | xargs basename
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
tmenu_path | tmenu | ${SHELL:-"/bin/sh"} &
|
||||
if [ "$1" = "-g" ] || [ "$(basename $0)" = "regenerate" ]; then
|
||||
mkdir -p $HOME/.local/share
|
||||
tmenu_path > $HOME/.local/share/tmenu_cache
|
||||
xmessage "regeneration complete"
|
||||
else
|
||||
cat $HOME/.local/share/tmenu_cache | tmenu | ${SHELL:-"/bin/sh"} &
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
pid=$(pgrep sxhkd)
|
||||
|
||||
for i in $pid; do
|
||||
inv_id=$(cat /proc/$i/cmdline | awk -F'\0' '{print $3}')
|
||||
|
||||
echo $inv_id
|
||||
[ -z "$inv_id" ] && contingency_mode="off"
|
||||
[ "$inv_id" = *"contingency" ] && contingency_mode="on"
|
||||
done
|
||||
|
||||
killall sxhkd
|
||||
|
||||
trackpoint=$(xinput | grep "TrackPoint" | awk -F'\t' '{print $2}' | awk -F'=' '{print $2}')
|
||||
touchpad=$(xinput | grep "TouchPad" | awk -F'\t' '{print $2}' | awk -F'=' '{print $2}')
|
||||
|
||||
if [ "$contingency_mode" = "off" ]; then
|
||||
sxhkd -c $HOME/.config/sxhkd/contingency &
|
||||
xinput disable "$trackpoint"
|
||||
xinput disable "$touchpad"
|
||||
xmessage "contingency mode enabled."
|
||||
else
|
||||
sxhkd &
|
||||
xinput enable "$trackpoint"
|
||||
xinput enable "$touchpad"
|
||||
killall xmessage
|
||||
fi
|
Loading…
Reference in New Issue