aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rwxr-xr-xalternative/bspswallow12
-rwxr-xr-xbspswallow14
3 files changed, 8 insertions, 24 deletions
diff --git a/README.md b/README.md
index 5e7c3c8..3f580f1 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,12 @@
# bspswallow
Adds functionality provided by the dwm "swallow" patch to bspwm.
+This branch uses baskerville's xwinfo instead of xprop and sed, possibly increasing the speed.
+
# Dependencies
* bspwm (obviously)
-* xprop
+* xwinfo (https://github.com/baskerville/xwinfo or on AUR as xwinfo-git)
# Installation
Add two files to ~/.config/bspwm
@@ -13,7 +15,7 @@ Add two files to ~/.config/bspwm
* terminals - list of classes of terminals that you want to be swallowed
-If a class isn't available (such as with xev) then the command of origin can be used.
+If a class isn't available (such as with xev) use 'N/A' to set for all (this shouldn't be an issue as xev is most likely the only case)
(example files are included in "examples")
diff --git a/alternative/bspswallow b/alternative/bspswallow
index 832f191..129e10a 100755
--- a/alternative/bspswallow
+++ b/alternative/bspswallow
@@ -1,14 +1,6 @@
#!/bin/sh
# Get class of a wid
-get_class() {
- id=$1
- if [ -z "$id" ]; then
- echo ""
- else
- xprop -id "$id" | sed -n '/WM_CLASS\|WM_COMMAND/s/.*"\(.*\)".*/\1/p'
- fi
-}
swallow() {
addedtodesktop=$2
@@ -18,8 +10,8 @@ swallow() {
swallowingid=$(bspc query -N -n last)
if [ "$addedtodesktop" = "$lasttermdesktop" ]; then
- grep "^$(get_class "$swallowerid")$" ~/.config/bspwm/swallow || return
- grep "^$(get_class "$swallowingid")$" ~/.config/bspwm/terminals || return
+ grep "^$(xwinfo -c "$swallowerid")$" ~/.config/bspwm/swallow || return
+ grep "^$(xwinfo -c "$swallowingid")$" ~/.config/bspwm/terminals || return
echo "$swallowerid $swallowingid" >> /tmp/swallowids
bspc node "$swallowingid" --flag hidden=on
fi
diff --git a/bspswallow b/bspswallow
index 35784a2..c1fc5af 100755
--- a/bspswallow
+++ b/bspswallow
@@ -1,15 +1,5 @@
#!/bin/sh
-# Get class of a wid
-get_class() {
- id=$1
- if [ -z "$id" ]; then
- echo ""
- else
- xprop -id "$id" | sed -n '/WM_CLASS\|WM_COMMAND/s/.*"\(.*\)".*/\1/p'
- fi
-}
-
swallow() {
addedtodesktop=$2
lasttermdesktop=$(bspc query -D -n last)
@@ -18,8 +8,8 @@ swallow() {
swallowingid=$(bspc query -N -n last)
if [ "$addedtodesktop" = "$lasttermdesktop" ]; then
- cat ~/.config/bspwm/noswallow ~/.config/bspwm/terminals | grep "^$(get_class "$swallowerid")$" && return
- grep "^$(get_class "$swallowingid")$" ~/.config/bspwm/terminals || return
+ cat ~/.config/bspwm/noswallow ~/.config/bspwm/terminals | grep "^$(xwinfo -c "$swallowerid")$" && return
+ grep "^$(xwinfo -c "$swallowingid")$" ~/.config/bspwm/terminals || return
echo "$swallowerid $swallowingid" >> /tmp/swallowids
bspc node "$swallowingid" --flag hidden=on
fi