adding bin files
This commit is contained in:
parent
363dc6c974
commit
1dc6b93bd5
16
bin/WindowSelector
Executable file
16
bin/WindowSelector
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Script copied from AUR package dswitcher, and modified for theming and placement and removed unnecessary functions.
|
||||||
|
if ! [ -f "$HOME/.dmenurc" ]; then
|
||||||
|
cp /usr/share/dmenu/dmenurc $HOME/.dmenurc
|
||||||
|
fi
|
||||||
|
. $HOME/.dmenurc
|
||||||
|
|
||||||
|
width=$(wattr w $(lsw -r))
|
||||||
|
height=$(wattr h $(lsw -r))
|
||||||
|
bar_width=$(( $width / 3 ))
|
||||||
|
left_shift=$(( ($width - $bar_width) / 2 ))
|
||||||
|
top_shift=$PANEL_HEIGHT
|
||||||
|
|
||||||
|
num=$(wmctrl -l | sed 's/ / /' | cut -d " " -f 4- | nl -w 3 -n rn | sed -r 's/^([ 0-9]+)[ \t]*(.*)$/\1 - \2/' | dmenu -i -l 10 -x $left_shift -y $top_shift -w $bar_width -fn $DMENU_FN -nb $DMENU_NB -nf $DMENU_NF -sf $DMENU_SF -sb $DMENU_SB | cut -d '-' -f -1)
|
||||||
|
[[ -z "$num" ]] && exit
|
||||||
|
wmctrl -l | sed -n "$num p" | cut -c -10 | xargs wmctrl -i -a
|
13
bin/bspwm_rename_desktop
Executable file
13
bin/bspwm_rename_desktop
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DMENU_NF="#A3A6AB"
|
||||||
|
DMENU_NB="#34322E"
|
||||||
|
DMENU_SF="#F6F9FF"
|
||||||
|
DMENU_SB="#5C5955"
|
||||||
|
|
||||||
|
DESKTOP_NAME=`echo '' | dmenu -b $DMENU_THEME -p 'Rename:'`
|
||||||
|
if [ -z $DESKTOP_NAME ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
bspc desktop -n "$DESKTOP_NAME"
|
41
bin/bspwm_resize.sh
Executable file
41
bin/bspwm_resize.sh
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
size=${2:-'10'}
|
||||||
|
dir=$1
|
||||||
|
|
||||||
|
# Find current window mode
|
||||||
|
is_tiled() {
|
||||||
|
bspc query -T -n | grep -q '"state":"tiled"'
|
||||||
|
}
|
||||||
|
# If the window is floating, move it
|
||||||
|
if ! is_tiled; then
|
||||||
|
#only parse input if window is floating,tiled windows accept input as is
|
||||||
|
case "$dir" in
|
||||||
|
west) switch="-w"
|
||||||
|
sign="-"
|
||||||
|
;;
|
||||||
|
east) switch="-w"
|
||||||
|
sign="+"
|
||||||
|
;;
|
||||||
|
north) switch="-h"
|
||||||
|
sign="-"
|
||||||
|
;;
|
||||||
|
south) switch="-h"
|
||||||
|
sign="+"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
xdo resize ${switch} ${sign}${size}
|
||||||
|
|
||||||
|
# Otherwise, window is tiled: switch with window in given direction
|
||||||
|
else
|
||||||
|
case "$dir" in
|
||||||
|
west) bspc node @west -r -$size || bspc node @east -r -${size}
|
||||||
|
;;
|
||||||
|
east) bspc node @west -r +$size || bspc node @east -r +${size}
|
||||||
|
;;
|
||||||
|
north) bspc node @south -r -$size || bspc node @north -r -${size}
|
||||||
|
;;
|
||||||
|
south) bspc node @south -r +$size || bspc node @north -r +${size}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
9
bin/colorshow
Executable file
9
bin/colorshow
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
for x in {0..8}; do
|
||||||
|
for i in {30..37}; do
|
||||||
|
for a in {40..47}; do
|
||||||
|
echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
done
|
||||||
|
echo ""
|
73
bin/dmenu_recent
Executable file
73
bin/dmenu_recent
Executable file
@ -0,0 +1,73 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Originally based on code by Dieter Plaetinck.
|
||||||
|
# Pretty much re-written by Mina Nagy (mnzaki)
|
||||||
|
|
||||||
|
if ! [ -f "$HOME/.dmenurc" ]; then
|
||||||
|
cp /usr/share/dmenu/dmenurc $HOME/.dmenurc
|
||||||
|
fi
|
||||||
|
. $HOME/.dmenurc
|
||||||
|
|
||||||
|
#dmenu_cmd="dmenu $DMENU_OPTIONS"
|
||||||
|
dmenu_cmd="dmenu $DMENU_OPTIONS"
|
||||||
|
terminal="$TERMINAL -e"
|
||||||
|
max_recent=199 # Number of recent commands to track
|
||||||
|
|
||||||
|
cache_dir="${XDG_CACHE_HOME:-$HOME/.cache}/dmenu-recent"
|
||||||
|
recent_cache="$cache_dir/recent"
|
||||||
|
rest_cache="$cache_dir/all"
|
||||||
|
known_types=" background terminal terminal_hold "
|
||||||
|
|
||||||
|
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/dmenu-recent"
|
||||||
|
mkdir -p "$cache_dir"
|
||||||
|
mkdir -p "$config_dir"
|
||||||
|
touch "$recent_cache"
|
||||||
|
|
||||||
|
# Without this, it won't remember $type
|
||||||
|
GREP_OPTIONS='--color=never'
|
||||||
|
|
||||||
|
IFS=:
|
||||||
|
if stest -dqr -n "$rest_cache" $PATH 2>/dev/null; then
|
||||||
|
stest -flx $PATH | sort -u | grep -vf "$recent_cache" > "$rest_cache"
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=" "
|
||||||
|
cmd=$(cat "$recent_cache" "$rest_cache" | $dmenu_cmd -p run: "$@") || exit
|
||||||
|
|
||||||
|
if ! grep -qx "$cmd" "$recent_cache" &> /dev/null; then
|
||||||
|
grep -vx "$cmd" "$rest_cache" > "$rest_cache.$$"
|
||||||
|
mv "$rest_cache.$$" "$rest_cache"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$cmd" > "$recent_cache.$$"
|
||||||
|
grep -vx "$cmd" "$recent_cache" | head -n "$max_recent" >> "$recent_cache.$$"
|
||||||
|
mv "$recent_cache.$$" "$recent_cache"
|
||||||
|
|
||||||
|
# Figure out how to run the command based on the command name, disregarding
|
||||||
|
# arguments, if any.
|
||||||
|
word0=${cmd%% *}
|
||||||
|
match="^$word0$"
|
||||||
|
|
||||||
|
get_type () {
|
||||||
|
while type=$(echo $known_types | xargs -n1 | $dmenu_cmd -p Type:); do
|
||||||
|
[[ $known_types =~ " $type " ]] || continue
|
||||||
|
echo "$word0" >> "$config_dir/$type"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
echo $type
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! type=$(grep -lx "$match" -R "$config_dir"); then
|
||||||
|
type=$(get_type)
|
||||||
|
else
|
||||||
|
type=${type##*/}
|
||||||
|
if ! [[ $known_types =~ " $type " ]]; then
|
||||||
|
rm "$config_dir/$type"
|
||||||
|
type=$(get_type)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ "$type" = "background" ]] && exec $cmd
|
||||||
|
[[ "$type" = "terminal" ]] && exec $TERMINAL -e "$cmd"
|
||||||
|
[[ "$type" = "terminal_hold" ]] &&
|
||||||
|
exec $TERMINAL -e sh -c "$cmd && echo Press Enter to kill me... && read line"
|
22
bin/emoji
Executable file
22
bin/emoji
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Give dmenu list of all unicode characters to copy.
|
||||||
|
# Shows the selected character in dunst if running.
|
||||||
|
|
||||||
|
# Must have xclip installed to even show menu.
|
||||||
|
xclip -h >/dev/null || exit
|
||||||
|
|
||||||
|
if [ -e ~/.config/fontawesome ]; then
|
||||||
|
chosen=$(grep -v "#" -h ~/.config/emoji ~/.config/fontawesome | dmenu -i -l 20 -fn Monospace-18)
|
||||||
|
else
|
||||||
|
chosen=$(grep -v "#" ~/.config/emoji | dmenu -i -l 20 -fn Monospace-18)
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "$chosen" != "" ] || exit
|
||||||
|
|
||||||
|
c=$(echo "$chosen" | sed "s/ .*//")
|
||||||
|
echo "$c" | tr -d '\n' | xclip -sel clip
|
||||||
|
notify-send "'$c' copied to clipboard." &
|
||||||
|
|
||||||
|
s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}')
|
||||||
|
echo "$s" | tr -d '\n' | xclip
|
||||||
|
notify-send "'$s' copied to primary." &
|
14
bin/euclid_balancer
Executable file
14
bin/euclid_balancer
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/dash
|
||||||
|
|
||||||
|
if [ "$(pgrep -cx euclid_balancer)" -gt 1 ] ; then
|
||||||
|
killall euclid_balancer && exit 0
|
||||||
|
else
|
||||||
|
|
||||||
|
bspc subscribe node_add node_remove node_state node_geometry | while read line; do
|
||||||
|
for wid in $(bspc query -N -d -n .window); do
|
||||||
|
bspc node "${wid}#@north" -B || true
|
||||||
|
bspc node "${wid}#@south" -B || true
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
fi
|
15
bin/euclid_mode
Executable file
15
bin/euclid_mode
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
fwid=$(bspc query -N -n focused.automatic)
|
||||||
|
wid=$1
|
||||||
|
class=$2
|
||||||
|
instance=$3
|
||||||
|
title=$(xtitle "$wid")
|
||||||
|
#floats=$(bspc query -N -n .local.floating | wc -l)
|
||||||
|
if bspc query -N -n "@/.!automatic" > /dev/null ; then
|
||||||
|
echo "node=@/"
|
||||||
|
fi
|
||||||
|
if [ -n "$fwid" ] ; then
|
||||||
|
echo "split_dir=south"
|
||||||
|
fi
|
||||||
|
#window-placer $floats $wid
|
85
bin/euclid_mover
Executable file
85
bin/euclid_mover
Executable file
@ -0,0 +1,85 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Originally by https://github.com/windelicato/
|
||||||
|
|
||||||
|
size=${2:-'20'}
|
||||||
|
dir=$1
|
||||||
|
|
||||||
|
transplanter() {
|
||||||
|
bspc node ${dir} -p south && bspc node -n ${dir}
|
||||||
|
}
|
||||||
|
|
||||||
|
northplanter() {
|
||||||
|
bspc node north -p north && bspc node -n north
|
||||||
|
}
|
||||||
|
|
||||||
|
rootplanter() {
|
||||||
|
bspc node @/ -p ${dir} && bspc node -n @/ || bspc node -s next.local && bspc node -n @/
|
||||||
|
bspc node @/ -p cancel
|
||||||
|
}
|
||||||
|
|
||||||
|
bspc config pointer_follows_focus true
|
||||||
|
# Find current window mode
|
||||||
|
is_floating() {
|
||||||
|
bspc query -T -n | grep -q '"state":"floating"'
|
||||||
|
}
|
||||||
|
# If the window is floating, move it
|
||||||
|
if is_floating; then
|
||||||
|
#only parse input if window is floating,tiled windows accept input as is
|
||||||
|
case "$dir" in
|
||||||
|
west) switch="-x"
|
||||||
|
sign="-"
|
||||||
|
;;
|
||||||
|
east) switch="-x"
|
||||||
|
sign="+"
|
||||||
|
;;
|
||||||
|
north) switch="-y"
|
||||||
|
sign="-"
|
||||||
|
;;
|
||||||
|
*) switch="-y"
|
||||||
|
sign="+"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
xdo move ${switch} ${sign}${size}
|
||||||
|
|
||||||
|
# Otherwise, window is tiled: switch with window in given direction
|
||||||
|
else
|
||||||
|
if [[ $(bspc query -N -n .local.\!floating | wc -l) != 2 ]]; then
|
||||||
|
case "$dir" in
|
||||||
|
north) northplanter || rootplanter
|
||||||
|
;;
|
||||||
|
*) transplanter || rootplanter
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
case "$dir" in
|
||||||
|
east) bspc node -s east || bspc query -N -n west.local || \
|
||||||
|
if bspc query -N -n south.local ; then
|
||||||
|
bspc node @/ -R 90
|
||||||
|
else
|
||||||
|
bspc node @/ -R 270
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
west) bspc node -s west || bspc query -N -n east.local || \
|
||||||
|
if bspc query -N -n north.local ; then
|
||||||
|
bspc node @/ -R 90
|
||||||
|
else
|
||||||
|
bspc node @/ -R 270
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
south) bspc node -s south || bspc query -N -n north.local || \
|
||||||
|
if bspc query -N -n west.local ; then
|
||||||
|
bspc node @/ -R 90
|
||||||
|
else
|
||||||
|
bspc node @/ -R 270
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*) bspc node -s north || bspc query -N -n south.local || \
|
||||||
|
if bspc query -N -n west.local ; then
|
||||||
|
bspc node @/ -R 270
|
||||||
|
else
|
||||||
|
bspc node @/ -R 90
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
13
bin/focusmover
Executable file
13
bin/focusmover
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#Focus windows by direction, works with multihead
|
||||||
|
#called like this in sxhkdrc:
|
||||||
|
#super + {a,s,w,d}
|
||||||
|
# focusmover {west,south,north,east}
|
||||||
|
bspc config pointer_follows_monitor true; \
|
||||||
|
bspc config pointer_follows_focus true; \
|
||||||
|
dir=$@; \
|
||||||
|
if ! bspc node -f $dir; then \
|
||||||
|
bspc monitor -f $dir; \
|
||||||
|
fi; \
|
||||||
|
bspc config pointer_follows_monitor false; \
|
||||||
|
bspc config pointer_follows_focus false
|
22
bin/linkhandler
Executable file
22
bin/linkhandler
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Feed script a url or file location.
|
||||||
|
# If an image, it will view in sxiv,
|
||||||
|
# if a video or gif, it will view in mpv
|
||||||
|
# if a music file or pdf, it will download,
|
||||||
|
# otherwise it opens link in browser.
|
||||||
|
|
||||||
|
# If no url given. Opens browser. For using script as $BROWSER.
|
||||||
|
[ -z "$1" ] && { "$BROWSER"; exit; }
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*)
|
||||||
|
setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;;
|
||||||
|
*png|*jpg|*jpe|*jpeg|*gif)
|
||||||
|
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
|
||||||
|
*mp3|*flac|*opus|*mp3?source*)
|
||||||
|
setsid -f tsp curl -LO "$1" >/dev/null 2>&1 ;;
|
||||||
|
*)
|
||||||
|
if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR" "$1"
|
||||||
|
else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi ;;
|
||||||
|
esac
|
2
bin/md2ghtml
Executable file
2
bin/md2ghtml
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
mdfolder=$HOME/.config/markdown
|
||||||
|
pandoc --self-contained --template=$mdfolder/template/template.html -c $mdfolder/css/page.css -c $mdfolder/css/markdown.css -c $mdfolder/css/highlight.css -o "$2" "$1"
|
5
bin/md2pdf
Executable file
5
bin/md2pdf
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MDFILE="$1"
|
||||||
|
|
||||||
|
[ -r $MDFILE -a -f $MDFILE ] && pandoc $MDFILE -t html -o ${MDFILE[@]/%md/pdf} || echo "what a freak"
|
5
bin/scrot_copy
Executable file
5
bin/scrot_copy
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
scrot -s -o /tmp/screenshot.png
|
||||||
|
xclip -sel clip -i /tmp/screenshot.png -t "image/png"
|
||||||
|
|
23
bin/search
Executable file
23
bin/search
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
QUERY=$@
|
||||||
|
|
||||||
|
if [[ -z $QUERY ]]; then
|
||||||
|
QUERY=$(dmenu -p "Search Query: " < /dev/null )
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -n $QUERY ]] || exit
|
||||||
|
|
||||||
|
QUERY=$(echo $QUERY | sed 's/ /+/g')
|
||||||
|
|
||||||
|
RESULT=$(curl "http://s.herisson.ovh/search?q=$QUERY&format=json")
|
||||||
|
|
||||||
|
TITLES=$(echo "$RESULT" | jq -r '.results[] | .title')
|
||||||
|
LINKS=$(echo "$RESULT" | jq -r '.results[] | .url')
|
||||||
|
|
||||||
|
SELECT=$(paste -d ": " <(seq $(echo "$TITLES" | wc -l)) <(echo "$TITLES") <(echo "$LINKS")| dmenu -l 15 | cut -d: -f1)
|
||||||
|
|
||||||
|
[[ -n $SELECT ]] || exit
|
||||||
|
|
||||||
|
echo "$LINKS" | head -n $SELECT | tail -1 | xclip -sel clip
|
||||||
|
|
22
bin/search_open
Executable file
22
bin/search_open
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
QUERY=$@
|
||||||
|
|
||||||
|
if [[ -z $QUERY ]]; then
|
||||||
|
QUERY=$(dmenu -p "Search Query: " < /dev/null )
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -n $QUERY ]] || exit
|
||||||
|
|
||||||
|
QUERY=$(echo $QUERY | sed 's/ /+/g')
|
||||||
|
|
||||||
|
RESULT=$(curl "http://s.herisson.ovh/search?q=$QUERY&format=json")
|
||||||
|
|
||||||
|
TITLES=$(echo "$RESULT" | jq -r '.results[] | .title')
|
||||||
|
LINKS=$(echo "$RESULT" | jq -r '.results[] | .url')
|
||||||
|
|
||||||
|
SELECT=$(paste -d ": " <(seq $(echo "$TITLES" | wc -l)) <(echo "$TITLES") <(echo "$LINKS")| dmenu -l 15 | cut -d: -f1)
|
||||||
|
|
||||||
|
[[ -n $SELECT ]] || exit
|
||||||
|
|
||||||
|
echo "$LINKS" | head -n $SELECT | tail -1 | xargs xdg-open
|
14
bin/switchkblayout
Executable file
14
bin/switchkblayout
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
key=`setxkbmap -query | grep layout | awk '{print $2}'`
|
||||||
|
|
||||||
|
if [[ $key == "fr" ]]; then
|
||||||
|
setxkbmap us
|
||||||
|
elif [[ $key == "us" ]]; then
|
||||||
|
setxkbmap dvorak
|
||||||
|
else
|
||||||
|
setxkbmap fr
|
||||||
|
fi
|
||||||
|
key=`setxkbmap -query | grep layout | awk '{print $2}'`
|
||||||
|
notify-send "Keyboard Layout: $key"
|
||||||
|
|
3
bin/tordone
Executable file
3
bin/tordone
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
notify-send "✔ Transmission-daemon" "$TR_TORRENT_NAME has completely downloaded."
|
6
bin/transadd
Executable file
6
bin/transadd
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
pgrep -x transmission-da >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon...") && sleep 3
|
||||||
|
|
||||||
|
# ssh 192.168.1.100 "transmission-remote -a \"$@\"" && notify-send "🔻 Transmission-daemon" "Torrent Added."
|
||||||
|
transmission-remote -a "$@" && notify-send "🔻 Transmission-daemon" "Torrent Added."
|
5
bin/wacom-to-first-screen.sh
Executable file
5
bin/wacom-to-first-screen.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
Display="DVI-D-0" #find it with xrandr
|
||||||
|
|
||||||
|
Stylusid=$(xinput | grep -Po 'Wacom (.*)' | grep -Po 'id=(\d*)' | grep -Po '\d*')
|
||||||
|
|
||||||
|
$(echo $Stylusid | tr ' ' '\n' | xargs -i xinput map-to-output {} $Display)
|
43
bin/windowgrabber
Executable file
43
bin/windowgrabber
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Originally by https://github.com/windelicato/
|
||||||
|
# edited beyound recognition
|
||||||
|
|
||||||
|
follower() {
|
||||||
|
if [ "$(pgrep -cx windowgrabber)" = 1 ] ; then
|
||||||
|
bspc config pointer_follows_focus false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
trap 'follower' INT TERM QUIT EXIT
|
||||||
|
|
||||||
|
size=${2:-'20'}
|
||||||
|
dir=$1
|
||||||
|
|
||||||
|
bspc config pointer_follows_focus true
|
||||||
|
# Find current window mode
|
||||||
|
is_floating() {
|
||||||
|
bspc query -T -n | grep -q '"state":"floating"'
|
||||||
|
}
|
||||||
|
# If the window is floating, move it
|
||||||
|
if is_floating; then
|
||||||
|
#only parse input if window is floating,tiled windows accept input as is
|
||||||
|
case "$dir" in
|
||||||
|
west) switch="-x"
|
||||||
|
sign="-"
|
||||||
|
;;
|
||||||
|
east) switch="-x"
|
||||||
|
sign="+"
|
||||||
|
;;
|
||||||
|
north) switch="-y"
|
||||||
|
sign="-"
|
||||||
|
;;
|
||||||
|
*) switch="-y"
|
||||||
|
sign="+"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
xdo move ${switch} ${sign}${size}
|
||||||
|
|
||||||
|
# Otherwise, window is tiled: switch with window in given direction
|
||||||
|
else
|
||||||
|
bspc node -n ${dir}.!automatic || bspc node -s ${dir} || bspc node -m ${dir} && bspc monitor -f
|
||||||
|
fi
|
26
bin/windowpromoter
Executable file
26
bin/windowpromoter
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/sh
|
||||||
|
|
||||||
|
receptacle=$(bspc query -N -n ".leaf.!window.local" | awk NR==1)
|
||||||
|
|
||||||
|
window_promotion()
|
||||||
|
{
|
||||||
|
if [ -n "$receptacle" ] > /dev/null ; then
|
||||||
|
bspc node -n "$receptacle"
|
||||||
|
elif [ -z "$(bspc query -N -n last.!automatic.local)" ]; then \
|
||||||
|
bspc node -s biggest.!focused.local; \
|
||||||
|
else \
|
||||||
|
bspc node -n last.!automatic.local; \
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if bspc query -N -n "@/.!automatic" > /dev/null ; then
|
||||||
|
bspc node -n @/ || window_promotion
|
||||||
|
else
|
||||||
|
if [ -n "$receptacle" ] > /dev/null ; then
|
||||||
|
bspc node -n "$receptacle"
|
||||||
|
elif [ -z "$(bspc query -N -n last.!automatic.local)" ]; then \
|
||||||
|
bspc node -s biggest.!focused.local; \
|
||||||
|
else \
|
||||||
|
bspc node -n last.!automatic.local; \
|
||||||
|
fi
|
||||||
|
fi
|
51
bin/workspaces_multimonitor
Executable file
51
bin/workspaces_multimonitor
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#all_monitors=$(xrandr -q | awk '/connected/ {print $1}')
|
||||||
|
#default_screen=$(xrandr | awk '/ connected/ {print $1;exit;}')
|
||||||
|
#extra_monitors=$(xrandr -q | awk '/connected/ {print $1}' | grep -v $default_screen)
|
||||||
|
|
||||||
|
##First, configure stuff with xrandr
|
||||||
|
#[[ $(who) != "" ]] && USER=$(who | grep :0\) | cut -f 1 -d ' ') || \
|
||||||
|
#USER=$(echo /home/* | cut -f 3 -d '/')
|
||||||
|
|
||||||
|
#export DISPLAY=:0.0
|
||||||
|
#export XAUTHORITY=/home/$USER/.Xauthority
|
||||||
|
|
||||||
|
#for monitor in $extra_monitors; do
|
||||||
|
# prev_mon=$(xrandr | awk '/connected/ {print $1}' | grep -B1 "^$monitor" | grep -vE "^$monitor|^--$")
|
||||||
|
# xrandr --output $monitor \
|
||||||
|
# --auto \
|
||||||
|
# --right-of $prev_mon
|
||||||
|
#done
|
||||||
|
|
||||||
|
##Then, create workspaces on all monitors
|
||||||
|
I=1
|
||||||
|
M=$(bspc query -M | wc -l)
|
||||||
|
if [[ "$M" == 1 ]]; then
|
||||||
|
bspc monitor -d I II III IV V VI VII VIII IX X
|
||||||
|
elif [[ "$M" == 2 ]]; then
|
||||||
|
bspc monitor $(bspc query -M | awk NR==1) -d I II III IV V
|
||||||
|
bspc monitor $(bspc query -M | awk NR==2) -d VI VII VIII IX X
|
||||||
|
elif [[ "$M" == 3 ]]; then
|
||||||
|
bspc monitor $(bspc query -M | awk NR==1) -d I II III IV
|
||||||
|
bspc monitor $(bspc query -M | awk NR==2) -d V VI VII
|
||||||
|
bspc monitor $(bspc query -M | awk NR==3) -d VIII IX X
|
||||||
|
elif [[ "$M" == 4 ]]; then
|
||||||
|
bspc monitor $(bspc query -M | awk NR==1) -d I II III
|
||||||
|
bspc monitor $(bspc query -M | awk NR==2) -d IV V VI
|
||||||
|
bspc monitor $(bspc query -M | awk NR==3) -d VII VIII
|
||||||
|
bspc monitor $(bspc query -M | awk NR==4) -d IX X
|
||||||
|
elif [[ "$M" == 5 ]]; then
|
||||||
|
bspc monitor $(bspc query -M | awk NR==1) -d I II
|
||||||
|
bspc monitor $(bspc query -M | awk NR==2) -d III IV
|
||||||
|
bspc monitor $(bspc query -M | awk NR==3) -d V VI
|
||||||
|
bspc monitor $(bspc query -M | awk NR==4) -d VII VIII
|
||||||
|
bspc monitor $(bspc query -M | awk NR==5) -d IX X
|
||||||
|
else
|
||||||
|
for monitor in $(bspc query -M); do
|
||||||
|
bspc monitor $monitor \
|
||||||
|
-n "$I" \
|
||||||
|
-d $I/{a,b,c}
|
||||||
|
let I++
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user