First Commit

This is a first dotfiles config. I think I have a lot more to add tho...
This commit is contained in:
2023-10-24 23:28:14 +02:00
commit 9eede5ef5f
51 changed files with 4974 additions and 0 deletions

5
bin/.bin/WindowMinimiser Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
hiddens=$(bspc query --nodes --node .hidden | nl -w1 -s' ')
window_choice=$(echo "$hiddens" | cut -d ' ' -f 2 | xargs -L 1 bspc query -T -n | jq -r .client.className | nl -w1 -s' ' | dmenu -l 10 -i | cut -d ' ' -f 1)
echo "${hiddens}" | awk 'NR == n {print $2}' n=$window_choice | xargs -I{} bspc node {} --flag hidden

17
bin/.bin/WindowSelector Executable file
View File

@ -0,0 +1,17 @@
#!/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)
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 -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

26
bin/.bin/avol Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
#
# Manage ALSA Master channel
test "$1" = "-h" && echo "usage `basename $0` [up|down|mute]" && exit 0
level() {
amixer get Master | sed -n 's/^.*\[\([0-9]\+%\).*$/\1/p' | uniq
}
state() {
amixer get Master | sed -n 's/^.*\[\(o[nf]\+\)]$/\1/p' | uniq
}
test $# -eq 0 && echo "`level` `state`" && exit 0
case $1 in
up) amixer set Master ${2:-5}%+ >/dev/null ||autoalsaconfamixer;;
down) amixer set Master ${2:-5}%- >/dev/null ||autoalsaconf;;
mute) amixer set Master toggle >/dev/null ||autoalsaconf;;
state|level) $1 ||autoalsaconf;;
set) amixer set Master $2% >/dev/null ||autoalsaconf;;
*) amixer set Master $1% >/dev/null ||autoalsaconf;;
esac

13
bin/.bin/bspwm_rename_desktop Executable file
View 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/.bin/bspwm_resize.sh Executable file
View 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/.bin/colorshow Executable file
View 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 ""

22
bin/.bin/emoji Executable file
View 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/.bin/euclid_balancer Executable file
View 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/.bin/euclid_mode Executable file
View 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/.bin/euclid_mover Executable file
View 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/.bin/focusmover Executable file
View 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/.bin/linkhandler Executable file
View 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

4
bin/.bin/maildecrypt Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
gpg --output /tmp/decrypt.html --decrypt "$@"
firefox /tmp/decrypt.html

5
bin/.bin/md2pdf Executable file
View 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"

4
bin/.bin/quickssh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
sshchoice=$(grep -Eo '^[^, ]+' $HOME/.ssh/known_hosts | dmenu)
$TERMINAL -e ssh $sshchoice

7
bin/.bin/resetnotify Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
pidof dunst && killall dunst
dunst &
notify-send "Hello, World!" &
notify-send "Hello, World!2" --urgency=critical &

5
bin/.bin/scrot_copy Executable file
View 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/.bin/search Executable file
View 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/.bin/search_open Executable file
View 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

1
bin/.bin/steamlaunch Executable file
View File

@ -0,0 +1 @@
steam steam://runappid/$1

17
bin/.bin/switchkblayout Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
key=`setxkbmap -query | grep "layout\|variant" | awk '{print $2}' | xargs`
if [[ $key = "fr" ]]; then
setxkbmap us
elif [[ $key = "us" ]]; then
setxkbmap us -variant dvorak
elif [[ $key = "us dvorak" ]]; then
setxkbmap fr
else
setxkbmap fr
fi
key=`setxkbmap -query | grep "layout\|variant" | awk '{print $2}' | xargs`
notify-send "Keyboard Layout: $key"

3
bin/.bin/tordone Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
notify-send "✔ Transmission-daemon" "$TR_TORRENT_NAME has completely downloaded."

6
bin/.bin/transadd Executable file
View 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."

8
bin/.bin/volume Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if [ $(pgrep pulseaudio >/dev/null) ]; then
volume_command=pulseaudio-ctl
else
volume_command=avol
fi
$volume_command $@

View 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/.bin/windowgrabber Executable file
View 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/.bin/windowpromoter Executable file
View 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

View 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