From 381aaffe4ed3caa0f1356b720f6d4fc0de5b1f8f Mon Sep 17 00:00:00 2001 From: davidovski Date: Mon, 16 May 2022 00:48:34 +0100 Subject: removed bash and added mkshrc --- scripts/bg.sh | 3 ++- scripts/cinema.sh | 2 +- scripts/fzf-bash-completion.sh | 4 ++-- scripts/gamma.sh | 2 +- scripts/links-launcher | 10 ++++++++++ scripts/lock | 3 ++- scripts/powermenu | 1 + scripts/record_window.sh | 19 +++++++++++++++++++ scripts/screenshot | 2 +- scripts/tablet | 4 ++-- scripts/websearch | 17 ++++++++++------- 11 files changed, 51 insertions(+), 16 deletions(-) create mode 100755 scripts/links-launcher create mode 100755 scripts/record_window.sh (limited to 'scripts') diff --git a/scripts/bg.sh b/scripts/bg.sh index 747aa20..decf4f1 100755 --- a/scripts/bg.sh +++ b/scripts/bg.sh @@ -1,2 +1,3 @@ #!/bin/sh -feh --force-aliasing --bg-fill ~/.config/bg +feh --force-aliasing --bg-tile ~/.config/dither.png +#feh --force-aliasing --bg-fill ~/.config/bg diff --git a/scripts/cinema.sh b/scripts/cinema.sh index c453260..46c7082 100755 --- a/scripts/cinema.sh +++ b/scripts/cinema.sh @@ -1,3 +1,3 @@ #!/bin/sh -MAIN_DP=DP-2; +MAIN_DP=DP-0; v=$(xrandr --current --verbose | grep "Brightness" | cut -f2 -d " " | tr '\n' '*' | rev | cut -c 2- | rev | sed -e "s/$/==1/" | bc -l | grep -q 0 && echo 1 || echo 0); xrandr | grep " connected" | cut -f1 -d " " | while read -r line; do echo $line | grep -q $MAIN_DP && : || xrandr --output $line --brightness $v; done diff --git a/scripts/fzf-bash-completion.sh b/scripts/fzf-bash-completion.sh index 9a63e15..337e908 100644 --- a/scripts/fzf-bash-completion.sh +++ b/scripts/fzf-bash-completion.sh @@ -42,9 +42,9 @@ _fzf_bash_completion_flatten_subshells() { printf '%s\n' "$line$buffer" buffer= fi - done < <(tac) + done < <(cat) printf '%s\n' "$buffer" - ) | tac + ) | cat } _fzf_bash_completion_find_matching_bracket() { diff --git a/scripts/gamma.sh b/scripts/gamma.sh index 0117dd5..cd9433f 100755 --- a/scripts/gamma.sh +++ b/scripts/gamma.sh @@ -1,5 +1,5 @@ #!/bin/bash -MAIN_DP=DP-2; +MAIN_DP=DP-0; v=$1 diff --git a/scripts/links-launcher b/scripts/links-launcher new file mode 100755 index 0000000..eef2a2f --- /dev/null +++ b/scripts/links-launcher @@ -0,0 +1,10 @@ +#!/bin/sh + +startpage=${1:-https://search.davidovski.xyz/} + +bin="$(which links || which xlinks)" + +[ "${#DISPLAY}" = "0" ] || opts="-g -html-g-text-color 0xf58f44 -html-g-background-color 0x191919 -font /home/david/.fonts/ttf-mononoki/mononoki-Regular.ttf" + +$bin $opts $startpage + diff --git a/scripts/lock b/scripts/lock index 01820fb..d0b8d36 100755 --- a/scripts/lock +++ b/scripts/lock @@ -1,2 +1,3 @@ #!/bin/sh -i3lock-fancy -p -t '' +#i3lock-fancy -p -t '' +slock diff --git a/scripts/powermenu b/scripts/powermenu index 49b8f3e..a1ac5f4 100755 --- a/scripts/powermenu +++ b/scripts/powermenu @@ -1,2 +1,3 @@ #!/bin/sh + printf "suspend\nreboot\npoweroff\nhibernate" | rofi -dmenu -p "systemctl" | xargs -r systemctl diff --git a/scripts/record_window.sh b/scripts/record_window.sh new file mode 100755 index 0000000..841b756 --- /dev/null +++ b/scripts/record_window.sh @@ -0,0 +1,19 @@ +#!/bin/sh +info=/tmp/wminfo + +xwininfo > /tmp/wminfo + +geom=$(cat $info | grep "geometry" | cut -d' ' -f4) + +width=$(cat $info | grep Width | cut -d' ' -f4) +height=$(cat $info | grep Height | cut -d' ' -f4) + +size="${width}x${height}" +position=+$(echo $geom | cut -d'+' -f2- | sed "s/+/,/g") + +filename=$(date +"$HOME/pics/screenshot/%F_%T.mp4") + +echo $size and $position +ffmpeg -y -f x11grab -video_size $size -i $position $filename + +rm $info diff --git a/scripts/screenshot b/scripts/screenshot index 626671c..d0df6a8 100755 --- a/scripts/screenshot +++ b/scripts/screenshot @@ -1,2 +1,2 @@ #!/bin/bash -maim -su /dev/stdout | tee >(xclip -selection clipboard -t image/png) > $(date +"$HOME/pics/screenshot/%F_%T.png") +maim -su /dev/stdout | tee $(date +"$HOME/pics/screenshot/%F_%T.png") | xclip -selection clipboard -t image/png diff --git a/scripts/tablet b/scripts/tablet index 3b49064..ec3eefa 100755 --- a/scripts/tablet +++ b/scripts/tablet @@ -9,10 +9,10 @@ tablet_ratio = (lambda s: float(s[0]) / float(s[1]))(sys.argv[4].split(":")) if #Layout of screens: (x, y, w, h) screens = [ - (3840, 0, 1080, 1920), + (0, 0, 1280, 1024), (1280, 0, 2560, 1440), + (3840, 0, 1080, 1920), (4920, 0, 1080, 1920), - (0, 0, 1280, 1024), ] #TODO find this with xrandr diff --git a/scripts/websearch b/scripts/websearch index 996ddc3..32d8773 100755 --- a/scripts/websearch +++ b/scripts/websearch @@ -1,14 +1,17 @@ #!/bin/sh - -SEARCH_ENGINE="https://search.brave.com/search?q=" -SEARCH_HISTORY=/tmp/.search_history +browser="links-launcher" +SEARCH_ENGINE="https://librex.beparanoid.de/search.php?q=" +SEARCH_HISTORY=$HOME/.local/share/search_history SEARCH=$(cat $SEARCH_HISTORY | dmenu -p "search") -touch $SEARCH_HISTORY +echo "$SEARCH" >> $SEARCH_HISTORY -cat <<< "$SEARCH -$(cat $SEARCH_HISTORY)" > $SEARCH_HISTORY +query=$(echo $SEARCH | sed 's/ /+/g') -brave "$SEARCH_ENGINE$SEARCH" +echo $query | grep -q '(?=^.{5,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)' && { + links-launcher "$query" +} || { + links-launcher "$SEARCH_ENGINE$query" +} -- cgit v1.2.1