Skip to content

Commit c901cb8

Browse files
committed
Port to chezmoi
0 parents  commit c901cb8

File tree

127 files changed

+14682
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+14682
-0
lines changed

bin/executable_MouseCenter

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# Get the necessary info
3+
#Script copied from https://github.com/tatou-tatou
4+
IFS=" " read -a window <<< $(wattr whxy $(pfw))
5+
6+
# Find the center of the window
7+
center_x=$(( ${window[0]} / 2 + ${window[2]} ))
8+
center_y=$(( ${window[1]} / 2 + ${window[3]} ))
9+
10+
# Move mouse
11+
xdotool mousemove $center_x $center_y

bin/executable_WindowSelector

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# Script copied from AUR package dswitcher, and modified for theming and placement and removed unnecessary functions.
3+
if ! [ -f "$HOME/.dmenurc" ]; then
4+
cp /usr/share/dmenu/dmenurc $HOME/.dmenurc
5+
fi
6+
. $HOME/.dmenurc
7+
8+
width=$(wattr w $(lsw -r))
9+
height=$(wattr h $(lsw -r))
10+
bar_width=$(( $width / 3 ))
11+
left_shift=$(( ($width - $bar_width) / 2 ))
12+
top_shift=$PANEL_HEIGHT
13+
14+
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)
15+
[[ -z "$num" ]] && exit
16+
wmctrl -l | sed -n "$num p" | cut -c -10 | xargs wmctrl -i -a

bin/executable_adjust-new-window

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#! /bin/bash
2+
#External rule that always splits the biggest window of the desktop
3+
#Originally copied from https://github.com/ikn/ and
4+
#modified to use splitting method of https://github.com/baskerville/bspwm/tree/master/examples/external_rules/pseudo_automatic_mode
5+
6+
bwid=$(bspc query -N -n biggest.tiled)
7+
if bspc query -N -n "@/.!automatic" > /dev/null ; then
8+
echo "node=@/"
9+
else
10+
# only do something if there's already a tiled window on this desktop
11+
if [ -n "$(bspc query -N -n biggest.tiled)" ]; then
12+
if [ -n "$(bspc query -N -n biggest.tiled.\!automatic)" ]; then
13+
# we have a presel: use it by choosing the 'target' window
14+
echo node=biggest.tiled.\!automatic
15+
else
16+
# no presel exists: transplant into the biggest window
17+
if [ -n "$bwid" ] ; then
18+
wattr wh $bwid | {
19+
read width height
20+
if [ $width -gt $height ] ; then
21+
echo node=biggest.tiled.\!private split_dir=west
22+
else
23+
echo node=biggest.tiled.\!private split_dir=south
24+
fi
25+
}
26+
fi
27+
fi
28+
fi
29+
fi

bin/executable_application_switcher

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Search through open programs and switch to their tag
4+
# original source: https://github.com/orschiro/dmenu-scripts-collection/blob/master/dmenu_running_apps/dmenu_running_apps
5+
# http://spiralofhope.com/wmctrl-examples.html
6+
if ! [ -f "$HOME/.dmenurc" ]; then
7+
cp /usr/share/dmenu/dmenurc $HOME/.dmenurc
8+
fi
9+
. $HOME/.dmenurc
10+
11+
width=$(wattr w $(lsw -r))
12+
height=$(wattr h $(lsw -r))
13+
bar_width=$(( $width / 2 ))
14+
left_shift=$(( ($width - $bar_width) / 2 ))
15+
top_shift=$PANEL_HEIGHT
16+
17+
application=$(
18+
# List all running programs
19+
wmctrl -l |\
20+
21+
# Titles only
22+
cut -d' ' -f5- |\
23+
24+
# Pipe to dmenu ($@ to include font settings from dwm/config.h)
25+
dmenu -i -p 'Switch to' $DMENU_OPTIONS -l 10 -x $left_shift -y $top_shift -w $bar_width $@
26+
)
27+
28+
# remove special characters that mess up with xdotool search ([]~)
29+
application=$(echo $application | sed 's/\[/./' | sed 's/\]/./' | sed 's/\~/./')
30+
31+
# Switch to chosen application
32+
case $application in
33+
gimp | truecrypt)
34+
xdotool search --onlyvisible -classname "$application" windowactivate &> /dev/null
35+
;;
36+
*)
37+
xdotool search ".*${application}.*" windowactivate &> /dev/null
38+
;;
39+
esac

bin/executable_auto-presel

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /bin/sh
2+
# Original script by https://github.com/ikn/ , modified to use splitting method of
3+
# https://github.com/baskerville/bspwm/tree/master/examples/external_rules/pseudo_automatic_mode
4+
fwid=$(bspc query -N -n focused)
5+
6+
wattr wh $fwid | {
7+
read width height
8+
if [ $width -gt $height ] ; then
9+
bspc node -p \~east
10+
else
11+
bspc node -p \~south
12+
fi
13+
}

bin/executable_autogap

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/dash
2+
3+
if [ "$(pgrep -cx autogap)" -gt 1 ] ; then
4+
killall autogap && exit 0
5+
else
6+
7+
bspc config top_padding 0
8+
bspc config left_padding 0
9+
bspc config right_padding 0
10+
bspc config bottom_padding 0
11+
bspc config -m $(bspc query -M | awk NR==1) top_padding $PANEL_HEIGHT
12+
bspc config gapless_monocle true
13+
14+
bspc subscribe | while read line; do
15+
W=$(bspc query -N -n .local.\!floating | wc -l)
16+
G=$(echo "51 - ($W - 1) * 10" | bc)
17+
[ "$G" -lt 1 ] && G=1
18+
bspc config --desktop focused window_gap $G
19+
done
20+
21+
fi

bin/executable_autostart

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/dash
2+
xdg-open ~/.config/bspwm/autostart

bin/executable_bspc-zen

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# Original script by https://github.com/tatou-tatou. Modified to match new bspwm syntax
3+
case $1 in
4+
desktop-add)
5+
eval "`spacefm -g --label 'Type the name of the new workspace:' --input "" --button cancel --button ok`"
6+
[ -z "$dialog_input1" ] && exit
7+
bspc monitor -a "$dialog_input1"
8+
bspc desktop "$dialog_input1" -f
9+
;;
10+
desktop-remove)
11+
eval "`spacefm -g --label 'Select the workspace you want to remove' --vsep --list $(bspc query -D --names) --hsep --button cancel --button ok --window-size 300x300`"
12+
[ -z "$dialog_list1" ] && exit
13+
bspc desktop "$dialog_list1" -r
14+
;;
15+
move-to-desktop)
16+
eval "`spacefm -g --label 'Move to workspace:' --vsep --list $(bspc query -D --names) --hsep --button cancel --button ok --window-size 300x300`"
17+
[ -z "$dialog_list1" ] && exit
18+
bspc node -d "$dialog_list1"
19+
;;
20+
desktop-rename)
21+
eval "`spacefm -g --label 'Rename the current workspace to:' --input "" --button cancel --button ok`"
22+
[ -z "$dialog_input1" ] && exit
23+
bspc desktop -n "$dialog_input1"
24+
;;
25+
desktop-swap)
26+
eval "`spacefm -g --label 'Swap with:' --vsep --list $(bspc query -D --names) --hsep --button cancel --button ok --window-size 300x300`"
27+
[ -z "$dialog_list1" ] && exit
28+
bspc desktop -s "$dialog_list1"
29+
;;
30+
esac

bin/executable_bspcp

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/sh
2+
i=1
3+
case $1 in
4+
dsktp) # Add or remove a desktop
5+
case $2 in
6+
add)
7+
current=$(bspc query -D | wc -l)
8+
if [ "$current" -lt "10" ]; then
9+
new=$((current + 1))
10+
bspc monitor -a $new
11+
else
12+
notify-send "You already have ten desktops" "Are those really necessary? Consider closing unneeded windows." -i warning
13+
fi
14+
;;
15+
rm)
16+
current=$(bspc query -D | wc -l)
17+
if [ "$current" -gt "4" ]; then
18+
bspc monitor -r $(bspc query -D | sed -n ${current}p)
19+
else
20+
notify-send "You currently have four desktops" "That can be considered a bare minimum. You should not remove more." -i warning
21+
fi
22+
;;
23+
esac
24+
;;
25+
empty)
26+
nextFreeDesktop=$(bspc query -D -d next.free)
27+
28+
if [ -z "$nextFreeDesktop" ]
29+
then
30+
nextFreeDesktop=$(( $(bspc query -D | wc -l) + 1 ))
31+
bspc monitor -a $nextFreeDesktop
32+
fi
33+
34+
case $2 in
35+
move)
36+
bspc window -d $nextFreeDesktop
37+
;;
38+
next)
39+
bspc rule -a \* -o desktop=$nextFreeDesktop follow=true
40+
;;
41+
esac
42+
;;
43+
tile) # Force every existing window to tile (the opposite is dumb IMHO)
44+
for window in $(bspc query -N -d focused)
45+
do
46+
bspc node $window -t tiled
47+
done
48+
;;
49+
float) # Force every existing window to float and place the windows
50+
for window in $(bspc query -N -d focused)
51+
do
52+
bspc node $window -t floating
53+
let i++
54+
done
55+
;;
56+
57+
*)
58+
exit
59+
;;
60+
esac

bin/executable_bspwm-session

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#! /bin/dash
2+
#
3+
# bspwm-session
4+
# From https://github.com/baskerville/bspwm/blob/master/contrib/freedesktop/bspwm-session ,
5+
# modified to copy example configs unless user already has some.
6+
# Later modified to drop multiuser support.
7+
# This script is a session launcher for bspwm.
8+
# It is based on similar scripts included with Openbox.
9+
10+
# Trap: make sure everything started in ~/.config/bspwm/autostart is
11+
# signalled when this script exits or dies. Also clean up $state_path.
12+
on_exit() {
13+
for child in $(jobs -p); do
14+
jobs -p | grep -q $child && kill $child
15+
done
16+
# Extra paranoia
17+
[ -d "${state_path}" && -w "${state_path}" ] && rm -rf -- "${state_path}"
18+
}
19+
20+
trap on_exit EXIT QUIT INT 30
21+
#Create example configs if configs are not present
22+
[ ! -f ${HOME}/.config/sxhkd/sxhkdrc ] && cp /etc/skel/.config/sxhkd/sxhkdrc ${HOME}/.config/sxhkd/sxhkdrc
23+
[ ! -f ${HOME}/.config/bspwm/bspwmrc ] && cp /etc/skel/.config/bspwm/bspwmrc ${HOME}/.config/bspwm/bspwmrc
24+
[ ! -f ${HOME}/.config/bspwm/autostart ] && touch ${HOME}/.config/bspwm/autostart
25+
# Environment and autostart:
26+
27+
for file in /etc/profile ${HOME}/.profile ${HOME}/.config/bspwm/autostart ; do
28+
[ -r "${file}" ] && . "${file}"
29+
done
30+
31+
# Launch sxhkd:
32+
[ -e /bin/dash ] && export SXHKD_SHELL="/bin/dash"
33+
sxhkd &
34+
# Launch bspwm:
35+
bspwm

bin/executable_bspwm_rename_desktop

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
DMENU_NF="#A3A6AB"
4+
DMENU_NB="#34322E"
5+
DMENU_SF="#F6F9FF"
6+
DMENU_SB="#5C5955"
7+
8+
DESKTOP_NAME=`echo '' | dmenu -b $DMENU_THEME -p 'Rename:'`
9+
if [ -z $DESKTOP_NAME ]; then
10+
exit 0
11+
fi
12+
13+
bspc desktop -n "$DESKTOP_NAME"

bin/executable_bspwm_resize.sh

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
size=${2:-'10'}
4+
dir=$1
5+
6+
# Find current window mode
7+
is_tiled() {
8+
bspc query -T -n | grep -q '"state":"tiled"'
9+
}
10+
# If the window is floating, move it
11+
if ! is_tiled; then
12+
#only parse input if window is floating,tiled windows accept input as is
13+
case "$dir" in
14+
west) switch="-w"
15+
sign="-"
16+
;;
17+
east) switch="-w"
18+
sign="+"
19+
;;
20+
north) switch="-h"
21+
sign="-"
22+
;;
23+
south) switch="-h"
24+
sign="+"
25+
;;
26+
esac
27+
xdo resize ${switch} ${sign}${size}
28+
29+
# Otherwise, window is tiled: switch with window in given direction
30+
else
31+
case "$dir" in
32+
west) bspc node @west -r -$size || bspc node @east -r -${size}
33+
;;
34+
east) bspc node @west -r +$size || bspc node @east -r +${size}
35+
;;
36+
north) bspc node @south -r -$size || bspc node @north -r -${size}
37+
;;
38+
south) bspc node @south -r +$size || bspc node @north -r +${size}
39+
;;
40+
esac
41+
fi

bin/executable_bspwmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/dash
2+
xdg-open ~/.config/bspwm/bspwmrc

bin/executable_cancel_presels

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
for window in $(bspc query -N -d focused); do bspc node $window -p cancel; done

bin/executable_clickpasser

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
#Script to allow clicking desktop in bspwm even if focus_follows_pointer is enabled
3+
pkill -USR2 -x sxhkd; \
4+
bspc config focus_follows_pointer off; \
5+
xdotool click $@; \
6+
bspc config focus_follows_pointer on; \
7+
pkill -USR2 -x sxhkd

bin/executable_default-browser

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
. $HOME/.profile
3+
$BROWSER $@

bin/executable_default-editor

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
. $HOME/.profile
3+
$GUI_EDITOR $@

bin/executable_default-terminal

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
. $HOME/.profile
3+
$TERMINAL $@

bin/executable_edge-switcher

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
function on_exit {
3+
for child in $(jobs -p); do
4+
jobs -p | grep -q $child && kill $child
5+
done
6+
# Extra paranoia
7+
[[ -d "${state_path}" && -w "${state_path}" ]] && rm -rf -- "${state_path}"
8+
}
9+
10+
trap on_exit EXIT SIGHUP SIGINT SIGTERM
11+
12+
xdotool behave_screen_edge left exec bspc desktop -f prev &
13+
xdotool behave_screen_edge right exec bspc desktop -f next &

bin/executable_euclid_balancer

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/dash
2+
3+
if [ "$(pgrep -cx euclid_balancer)" -gt 1 ] ; then
4+
killall euclid_balancer && exit 0
5+
else
6+
7+
bspc subscribe node_add node_remove node_state node_geometry | while read line; do
8+
for wid in $(bspc query -N -d -n .window); do
9+
bspc node "${wid}#@north" -B || true
10+
bspc node "${wid}#@south" -B || true
11+
done
12+
done
13+
14+
fi

bin/executable_euclid_mode

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#! /bin/sh
2+
3+
fwid=$(bspc query -N -n focused.automatic)
4+
wid=$1
5+
class=$2
6+
instance=$3
7+
title=$(xtitle "$wid")
8+
#floats=$(bspc query -N -n .local.floating | wc -l)
9+
if bspc query -N -n "@/.!automatic" > /dev/null ; then
10+
echo "node=@/"
11+
fi
12+
if [ -n "$fwid" ] ; then
13+
echo "split_dir=south"
14+
fi
15+
#window-placer $floats $wid

0 commit comments

Comments
 (0)