94 lines
2.8 KiB
Bash
Executable File
94 lines
2.8 KiB
Bash
Executable File
#!/bin/zsh
|
|
if [ "$1" = "lock" ];then
|
|
#!/bin/bash
|
|
|
|
declare -i ID
|
|
ID=`xinput list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
|
|
declare -i STATE
|
|
STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
|
|
if [ $STATE -eq 1 ];then
|
|
xinput disable $ID
|
|
echo "Touchpad disabled."
|
|
else
|
|
xinput enable $ID
|
|
echo "Touchpad enabled."
|
|
fi
|
|
fi
|
|
if [ "$1" = "pass" ];then
|
|
pass -c $(ls ~/.password-store/*/*|cut -b-37 --complement|rofi -dmenu|sed -e 's/\.gpg//')
|
|
fi
|
|
if [ "$1" = "screensaver" ];then
|
|
cat /tmp/noss||i3lock -di `shuf -n1 -e ~/.i3/wall/*`
|
|
fi
|
|
if [ "$1" = "wall" ];then
|
|
#if [[ -d ~/.i3/wallOM ]];then feh --bg-scale "`shuf -n1 -e ~/.i3/wallOM/*`";else feh --bg-scale "`shuf -n1 -e ~/.i3/wall/*`";fi;
|
|
#feh --bg-scale "$(shuf -n1 -e ~/.i3/wallOM/*)"
|
|
#feh --bg-scale ~/.i3/image.png
|
|
feh --bg-scale $(shuf -n1 <(realpath /home/stonewareslord/sync/wallpaper/$(hostname)))
|
|
fi
|
|
if [ "$1" = "swap" ];then
|
|
python << EOF
|
|
import i3
|
|
swap = [output for output in i3.get_outputs() if output['active']]
|
|
if len(swap) == 2:
|
|
for output in swap:
|
|
i3.workspace(output['current_workspace'])
|
|
i3.command('move', 'workspace to output right')
|
|
EOF
|
|
fi
|
|
if [ "$1" = "boot" ];then
|
|
test -f ~/.screenlayout/default.sh && ~/.screenlayout/default.sh
|
|
/usr/bin/xset -b
|
|
/usr/bin/xset +fp /usr/share/fonts/X11/misc
|
|
/usr/bin/xset +fp /usr/share/fonts/X11/Type1
|
|
/usr/bin/xset +fp built-ins
|
|
/usr/bin/xset s off
|
|
/usr/bin/xset -dpms
|
|
# This will segfault and ruin your day
|
|
#/usr/bin/urxvtd -q -f -o
|
|
if [ "$(hostname)" = "MMLin" ]; then
|
|
xrandr --output HDMI1 --primary
|
|
xmodmap <(echo pointer = 3 2 1)
|
|
elif [ "$(hostname)" = "G2" ]; then
|
|
#TODO: Figure out what the display is called
|
|
xrandr --output eDP1 --primary
|
|
xmodmap <(echo pointer = 1 2 3)
|
|
fi
|
|
feh --bg-scale $(shuf -n1 <(realpath /home/stonewareslord/owncloud/wallpaper/$(hostname)))
|
|
xinput --set-prop 'Logitech USB Optical Mouse' 'Device Accel Constant Deceleration' 3
|
|
$(which ck-launch-session 2>/dev/null) $(which i3)
|
|
fi
|
|
if [ "$1" = "screen-lock" ];then
|
|
revert(){
|
|
xset dpms 0 0 0
|
|
}
|
|
trap revert SIGHUP SIGINT SIGTERM
|
|
xset +dpms dpms 5 5 5
|
|
slock
|
|
revert
|
|
fi
|
|
if [ "$1" = "paste" ]; then
|
|
DISPLAY=:0.0 xdotool type --clearmodifiers --file <(xsel)
|
|
fi
|
|
if [ "$1" = "ip" ]; then
|
|
shift
|
|
local RET=0
|
|
if [ "$(hostname)" = "MMLin" ]; then
|
|
if grep -q "$1" < <(ifconfig enp2s0f0); then
|
|
RET=1
|
|
fi
|
|
elif [ "$(hostname)" = "G2" ]; then
|
|
if grep -q "$1" < <(ifconfig enp1s0;ifconfig wlp2s0); then
|
|
RET=1
|
|
fi
|
|
elif [ "$(hostname)" = "SGen" ]; then
|
|
if grep -q "$1" < <(ifconfig enp0s25); then
|
|
RET=1
|
|
fi
|
|
fi
|
|
echo $RET
|
|
fi
|
|
if [ "$1" = "copy" ]; then
|
|
(printf '-chegg ';xsel | perl -pe 's/[^a-zA-Z ]//g;chomp()') | xsel && notify-send "Copied" || notify-send "Error"
|
|
fi
|