Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
2017-05-03 16:10:13 +03:00
commit c78cb78ff0
72 changed files with 3570 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
#!/usr/bin/bash
while read -r _ _ did wid _; do
for d in "$@"; do
if [[ $d == "$did" ]]; then
bspc node "$wid" -t floating
fi
done
done < <( bspc subscribe node_manage )

View File

@@ -0,0 +1,45 @@
#!/usr/bin/bash
usage() {
printf 'No help available'
}
main() {
while (( $# )); do
case "$1" in
(-h) usage;;
(-d) desktop=$2; shift;;
(--) shift; break;;
(*) break;;
esac
shift
done
setting=$1
shift
desktop=${desktop:-"focused"}
case "$setting" in
(padding)
if [[ "$1" =~ ^(north|west|south|east)$ ]]; then
direction=$1
fi
if [[ "$direction" ]]; then
bspc config -d "$desktop" "${direction}_padding" "$1"
else
for d in top bottom right left; do
bspc config -d "$desktop" "${d}_padding" "$1"
done
fi
;;
(gaps)
bspc config -d "$desktop" window_gap "$1"
;;
esac
}
main "$@"

View File

@@ -0,0 +1,43 @@
#!/usr/bin/bash
ensure_dir() {
declare d
for d in "$@"; do
if ! [[ -d "$d" ]]; then
if ! mkdir -p "$d"; then
return $?
fi
fi
done
return 0
}
# Set XDG_RUNTIME_DIR
if ! [[ "$XDG_RUNTIME_DIR" ]]; then
XDG_RUNTIME_DIR="/run/user/$UID"
fi
# Define some workdirs
bspwm_rundir="$XDG_RUNTIME_DIR/bspwm"
bspwm_statedir="$bspwm_rundir/state"
# Ensure the workdirs exist
ensure_dir "$bspwm_rundir" "$bspwm_statedir" || exit $?
case "$1" in
(save)
# Save state
bspc query -T > "$bspwm_statedir/tree"
bspc query -H > "$bspwm_statedir/hist"
bspc query -S > "$bspwm_statedir/stack"
;;
(restore)
# Restore state, if any
[[ -f "$bspwm_statedir/tree" ]] && bspc restore -T "$bspwm_statedir/tree"
[[ -f "$bspwm_statedir/hist" ]] && bspc restore -H "$bspwm_statedir/hist"
[[ -f "$bspwm_statedir/stack" ]] && bspc restore -S "$bspwm_statedir/stack"
;;
esac