diff --git a/bspwm/.config/bspwm/scripts/autopresel b/bspwm/.config/bspwm/scripts/autopresel new file mode 100755 index 0000000..ece1194 --- /dev/null +++ b/bspwm/.config/bspwm/scripts/autopresel @@ -0,0 +1,29 @@ +#! /bin/sh + +fwid=$(bspc query -N -n focused.automatic) +wid=$1 +class=$2 +instance=$3 +title=$(xtitle "$wid") +receptacle=$(bspc query -N -n ".leaf.!window.local" | awk NR==1) +#floats=$(bspc query -N -n .local.floating | wc -l) + +if bspc query -N -n "@/.!automatic" > /dev/null ; then + echo "node=@/" +fi + +if [ -n "$receptacle" ] > /dev/null ; then + echo "node=$receptacle" +elif [ -n "$fwid" ] ; then + wattr wh $fwid | { + read width height + if [ $width -gt $height ] ; then + echo "split_dir=east" + else + echo "split_dir=south" + fi +# echo "split_ratio=0.5" + } +fi +wmctrl -i -r "$wid" -b add,maximized_vert,maximized_horz &>/dev/null & +#window-placer $floats $wid diff --git a/scripts/.switchoutputs b/scripts/.switchoutputs new file mode 100755 index 0000000..b133135 --- /dev/null +++ b/scripts/.switchoutputs @@ -0,0 +1,63 @@ +#! /bin/sh +# A script that switches between external and internal monitor +# It is launched when AC power is connected + +export DISPLAY=:0 +export XAUTHORITY=/home/notthebee/.Xauthority + +# default monitor is LVDS1 +MONITOR=LVDS1 + +# functions to switch from HDMI to VGA and vice versa +connect() { + echo "Switching to HDMI2" + xrandr --output LVDS1 --off --output HDMI2 --auto --dpi 96 + /home/notthebee/.config/bspwm/bspwmrc + MONITOR=HDMI2 +} +disconnect() { + echo "Switching to LVDS1" + xrandr --output HDMI2 --off --output LVDS1 --auto --dpi 96 + /home/notthebee/.config/bspwm/bspwmrc + MONITOR=LVDS1 +} + + +# functions to check if HDMI2 is connected and in use + +active() { + [ $MONITOR = "HDMI2" ] +} + +connected() { + ! xrandr | grep "^HDMI2" | grep disconnected +} + +# switch to LVDS1 if HDMI2 is disconnected +if ! connected +then + disconnect +fi + +# switch between monitors, do it 15 times just to make sure. +# yes, i am serious. i've been trying to find a reliable way +# to do that for half a year, and nothing worked. apart from +# this. the absolute state of linux! + +for i in {1..15}; do + if ! active && connected + then + connect + fi + + if active && ! connected + then + disconnect + fi + sleep 0.5s +done + + +# set the xkb options. again. because they always reset +setxkbmap de,ru -option caps:escape -option grp:shifts_toggle +xset r rate 280 35