Many changes

This commit is contained in:
2024-01-25 00:55:35 -07:00
commit f5f1a2b69c
56 changed files with 4123 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
#!/bin/sh
# Open an app in float mode
bspc rule -a \* -o state=floating && $@

View File

@@ -0,0 +1,14 @@
#!/bin/sh
if [ ! -z $1 ]; then
# FLOATING_DESKTOP_ID=$(bspc query -D -d '^3')
FLOATING_DESKTOP_ID=$1
bspc subscribe node_add | while read -a msg ; do
desk_id=${msg[2]}
wid=${msg[4]}
[ "$FLOATING_DESKTOP_ID" = "$desk_id" ] && bspc node "$wid" -t floating
done
else
echo "No desktop provided"
fi

60
modules/bspwm/scripts/bsp-smove Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/sh
# A more fluid way of moving windows with BSPWM, which is meant to be
# implemented in SXHKD. If there is a window in the given direction,
# swap places with it. Else if there is a receptacle move to it
# ("consume" its place). Otherwise create a receptacle in the given
# direction by splitting the entire viewport (circumvents the tiling
# scheme while respecting the current split ratio configuration). In
# the latter scenario, inputting the direction twice will thus move the
# focused window out of its current layout and into the receptacle.
#
# Part of my dotfiles: https://gitlab.com/protesilaos/dotfiles
#
# Copyright (c) 2019 Protesilaos Stavrou <info@protesilaos.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
[ "$#" -eq 1 ] || { echo "Pass only one argument: north,east,south,west"; exit 1; }
# Check if argument is a valid direction.
case "$1" in
north|east|south|west)
dir="$1"
;;
*)
echo "Not a valid argument."
echo "Use one of: north,east,south,west"
exit 1
;;
esac
_query_nodes() {
bspc query -N -n "$@"
}
# Do not operate on floating windows!
[ -z "$(_query_nodes focused.floating)" ] || { echo "Only move tiled windows."; exit 1; }
receptacle="$(_query_nodes 'any.leaf.!window')"
# This regulates the behaviour documented in the description.
if [ -n "$(_query_nodes "${dir}.!floating")" ]; then
bspc node -s "$dir"
elif [ -n "$receptacle" ]; then
bspc node focused -n "$receptacle" --follow
else
bspc node @/ -p "$dir" -i && bspc node -n "$receptacle" --follow
fi

View File

@@ -0,0 +1,17 @@
#!/bin/sh
declare -A layout_symbols
layout_symbols[monocle]="mono"
layout_symbols[tiled]="tiled"
send_symbol() {
echo ${layout_symbols[$1]}
}
# Optional, sends first output. This requires jq
send_symbol $(bspc query -T --desktop focused | jq -r '.layout')
bspc subscribe desktop_layout | while read -a msg ; do
send_symbol ${msg[3]}
done

View File

@@ -0,0 +1,37 @@
#!/bin/bash
if [ $# = 0 ]; then
cat <<EOF
Usage: $(basename "${0}") process_name [executable_name] [--take-first]
process_name As recognized by 'xdo' command
executable_name As used for launching from terminal
--take-first In case 'xdo' returns multiple process IDs
EOF
exit 0
fi
# Get id of process by class name and then fallback to instance name
id=$(xdo id -N "${1}" || xdo id -n "${1}")
executable=${1}
shift
while [ -n "${1}" ]; do
case ${1} in
--take-first)
id=$(head -1 <<<"${id}" | cut -f1 -d' ')
;;
*)
executable=${1}
;;
esac
shift
done
if [ -z "${id}" ]; then
${executable}
else
while read -r instance; do
bspc node "${instance}" --flag hidden --to-monitor focused --focus
done <<<"${id}"
fi

1830
modules/bspwm/scripts/pfetch Executable file

File diff suppressed because it is too large Load Diff

9
modules/bspwm/scripts/rofi-ask Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
# Take password prompt from STDIN, print password to STDOUT
# the sed piece just removes the colon from the provided
# prompt: rofi -p already gives us a colon
rofi -dmenu \
-password \
-no-fixed-num-lines \
-p "$(printf "$1" | sed s/://)"

View File

@@ -0,0 +1,5 @@
#!/bin/sh
awk '/^[a-z]/ && last {print "<small>",$0,"\t",last,"</small>"} {last=""} /^#/{last=$0}' ~/.config/sxhkd/sxhkdrc{,.common} |
column -t -s $'\t' |
rofi -dmenu -i -markup-rows -no-show-icons -width 1000 -lines 15

View File

@@ -0,0 +1,9 @@
#!/bin/sh
id=$(bspc query -N -n);
if [ "$(tabc printclass $id)" == "tabbed" ]; then
bspc node -p $1;
tabc detach $id;
else \
tabc attach $id $(bspc query -N -n $1);
fi