move some files around
This commit is contained in:
parent
df402becef
commit
5bc1b7fc2b
29 changed files with 197 additions and 247 deletions
35
other/scripts/desktop/desktopctl.nix
Normal file
35
other/scripts/desktop/desktopctl.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ pkgs, ... }:
|
||||
pkgs.writeShellScriptBin "desktopctl" ''
|
||||
case $@ in
|
||||
"Lock Screen")
|
||||
nohup sh -c "i3lock-fancy" > /dev/null &
|
||||
exit 0
|
||||
;;
|
||||
"Log Out")
|
||||
pkill i3
|
||||
exit 0
|
||||
;;
|
||||
"Shut Down")
|
||||
shutdown now
|
||||
exit 0
|
||||
;;
|
||||
"Reboot")
|
||||
systemctl reboot
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# resizes grid
|
||||
echo -en "\0theme\x1flistview,inputbar,message{columns:4;lines:1;}\n"
|
||||
# resizes window, moves it to top of screen, adjusts rounded corners
|
||||
echo -en "\0theme\x1fwindow{width:800px;location:north;y-offset:24px;border-radius:0 0 12px 12px;}\n"
|
||||
# swaps grid and input bar
|
||||
echo -en "\0theme\x1fmainbox{children:[listview,inputbar];}\n"
|
||||
# fixes brown line below input bar
|
||||
echo -en "\0theme\x1finputbar{margin:0;}\n"
|
||||
|
||||
echo -en "Lock Screen\0icon\x1f${../../../other/assets/desktopctl/lock-screen.svg}\n"
|
||||
echo -en "Log Out\0icon\x1f${../../../other/assets/desktopctl/logout.svg}\n"
|
||||
echo -en "Shut Down\0icon\x1f${../../../other/assets/desktopctl/shutdown.svg}\n"
|
||||
echo -en "Reboot\0icon\x1f${../../../other/assets/desktopctl/reboot.svg}\n"
|
||||
''
|
9
other/scripts/desktop/macros/play-loop.sh
Normal file
9
other/scripts/desktop/macros/play-loop.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
mkdir -p $HOME/xmacros
|
||||
|
||||
register=$(ls $HOME/xmacros | rofi -dmenu)
|
||||
count=$(echo "2;5;10;20;50;100" | rofi -dmenu -sep ";" -l 5)
|
||||
|
||||
for i in $(seq $count); do
|
||||
echo $i
|
||||
xmacroplay "$DISPLAY" < $HOME/xmacros/$register
|
||||
done
|
5
other/scripts/desktop/macros/play.sh
Normal file
5
other/scripts/desktop/macros/play.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
mkdir -p $HOME/xmacros
|
||||
|
||||
register=$(ls $HOME/xmacros | rofi -dmenu)
|
||||
|
||||
xmacroplay "$DISPLAY" < $HOME/xmacros/$register
|
5
other/scripts/desktop/macros/record.sh
Normal file
5
other/scripts/desktop/macros/record.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
mkdir -p $HOME/xmacros
|
||||
|
||||
register=$(ls $HOME/xmacros | rofi -dmenu)
|
||||
|
||||
xmacrorec2 > $HOME/xmacros/$register
|
87
other/scripts/desktop/menu-qalc.sh
Normal file
87
other/scripts/desktop/menu-qalc.sh
Normal file
|
@ -0,0 +1,87 @@
|
|||
# Copy-pasted from https://raw.githubusercontent.com/BarbUk/menu-qalc/master/%3D
|
||||
# I hope this is even legal but OH WELL
|
||||
|
||||
# https://github.com/onespaceman/menu-calc
|
||||
# Calculator for use with rofi/dmenu(2)
|
||||
# Copying to the clipboard requires xclip
|
||||
|
||||
usage() {
|
||||
echo "$(tput bold)menu-calc$(tput sgr0)"
|
||||
echo "A calculator for Rofi/dmenu(2)"
|
||||
echo
|
||||
echo "$(tput bold)Usage:$(tput sgr0)"
|
||||
echo " = 4+2"
|
||||
echo " = (4+2)/(4+3)"
|
||||
echo " = 4^2"
|
||||
echo " = sqrt(4)"
|
||||
echo " = c(2)"
|
||||
echo
|
||||
echo "$(tput bold)Force Rofi/dmenu(2):$(tput sgr0)"
|
||||
echo "By default, if rofi exists, it will be used. To force menu-calc to"
|
||||
echo "use one or the other, use the --dmenu argument"
|
||||
echo
|
||||
echo " = --dmenu=<dmenu_executable>"
|
||||
echo
|
||||
echo "$(tput bold)Passing arguments to Rofi/dmenu(2):$(tput sgr0)"
|
||||
echo "Any parameters after ' -- ' will be passed to Rofi/dmenu(2)."
|
||||
echo
|
||||
echo " = -- <Rofi/dmenu(2) args>"
|
||||
echo
|
||||
echo "The answer can be copied to the clipboard and used for further calculations inside (or outside) Rofi/dmenu."
|
||||
echo
|
||||
echo "If launched outside of Rofi/dmenu the expression may need quotation marks."
|
||||
exit
|
||||
}
|
||||
|
||||
# Process CLI parameters
|
||||
for var in "$@"
|
||||
do
|
||||
case $var in
|
||||
-h|--help) usage ;;
|
||||
-d=*|--dmenu=*)
|
||||
menu=$(echo $var | cut -d'=' -f 2);
|
||||
;;
|
||||
--) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Grab the answer
|
||||
if [ -n "$1" ]; then
|
||||
answer=$(echo "$1" | qalc +u8 -color=never -terse | awk '!/^>/ && !/^$/ {gsub(/^[ \t]+|[ \t]+$/, "", $0); print}')
|
||||
fi
|
||||
|
||||
# Path to menu application
|
||||
if [ -z "${menu+1}" ]; then
|
||||
if [[ -n $(command -v rofi) ]]; then
|
||||
menu="$(command -v rofi)"
|
||||
elif [[ -n $(command -v dmenu) ]]; then
|
||||
menu=$(command -v dmenu)
|
||||
else
|
||||
>&2 echo "Rofi or dmenu not found"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# If using rofi, add the necessary parameters
|
||||
if [[ $menu == "rofi" || $menu == $(command -v rofi) ]]; then
|
||||
menu="$menu -dmenu -lines 3"
|
||||
elif [[ $menu == "dmenu" || $menu == $(command -v dmenu) ]]; then
|
||||
menu="$menu ""$DMENU_OPTIONS"
|
||||
fi
|
||||
|
||||
# Determine args to pass to dmenu/rofi
|
||||
while [[ $# -gt 0 && $1 != "--" ]]; do
|
||||
shift
|
||||
done
|
||||
[[ $1 == "--" ]] && shift
|
||||
|
||||
action=$(echo -e "Copy to clipboard\nClear\nClose" | $menu "$@" -p "= $answer")
|
||||
|
||||
case $action in
|
||||
"Clear") $0 ;;
|
||||
"Copy to clipboard") echo -n "$answer" | xclip -selection clipboard ;;
|
||||
"Close") ;;
|
||||
"") ;;
|
||||
*) $0 "$answer $action" "--dmenu=$menu" "--" "$@" ;;
|
||||
esac
|
||||
|
26
other/scripts/desktop/ocr-screenshot.sh
Normal file
26
other/scripts/desktop/ocr-screenshot.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
langs="eng deu spa osd"
|
||||
langs=$(tesseract --list-langs | tail +2)
|
||||
first_menu="$langs exit"
|
||||
selection_menu1=$(echo $first_menu | rofi -sep " " -dmenu)
|
||||
|
||||
tmp_img=`mktemp`
|
||||
trap "rm $tmp_img*" EXIT
|
||||
|
||||
|
||||
echo $selection_menu1
|
||||
|
||||
case $selection_menu1 in
|
||||
"eng"|"deu"|"spa"|"osd"|"fra")
|
||||
tesseract_lang=$selection_menu1
|
||||
flameshot gui -p $tmp_img.png -d 100
|
||||
mogrify -modulate 100,0 -resize 400% $tmp_img.png
|
||||
;;
|
||||
"exit")
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
tesseract $tmp_img.png $tmp_img &> /dev/null
|
||||
xclip -i $tmp_img.txt -selection clipboard
|
||||
exit
|
||||
|
15
other/scripts/desktop/permaclip/pc-get.sh
Normal file
15
other/scripts/desktop/permaclip/pc-get.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
# create ~/permaclip if it doesnt exist already
|
||||
mkdir -p $HOME/permaclip
|
||||
|
||||
tr_name=$(echo ${@% (*} | xargs)
|
||||
if [ x"$tr_name" != x"" ]; then
|
||||
nohup bash -c "xclip -selection c -i $HOME/permaclip/${tr_name% (*}" > /dev/null
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "\0markup-rows\x1ftrue"
|
||||
|
||||
for reg in $(ls ~/permaclip); do
|
||||
content=$(cat ~/permaclip/$reg)
|
||||
echo -e "$reg (<i>${content:0:50}...</i>)"
|
||||
done
|
16
other/scripts/desktop/permaclip/pc-set.sh
Normal file
16
other/scripts/desktop/permaclip/pc-set.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
# create ~/permaclip if it doesnt exist already
|
||||
mkdir -p $HOME/permaclip
|
||||
|
||||
tr_name=$(echo $@ | xargs)
|
||||
if [ x"$tr_name" != x"" ]; then
|
||||
tr_name="${tr_name% (*}"
|
||||
clipdata=$(xclip -selection c -o)
|
||||
echo "$clipdata" > $HOME/permaclip/$tr_name
|
||||
fi
|
||||
|
||||
echo -e "\0markup-rows\x1ftrue"
|
||||
|
||||
for reg in $(ls ~/permaclip); do
|
||||
content=$(cat ~/permaclip/$reg)
|
||||
echo -e "$reg (<i>${content:0:30}</i>)"
|
||||
done
|
2
other/scripts/desktop/searchwolf.nix
Normal file
2
other/scripts/desktop/searchwolf.nix
Normal file
|
@ -0,0 +1,2 @@
|
|||
{ pkgs, ... }:
|
||||
pkgs.writeShellScriptBin "searchwolf" (builtins.readFile ./searchwolf.sh)
|
25
other/scripts/desktop/searchwolf.sh
Executable file
25
other/scripts/desktop/searchwolf.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
if [ x"$@" = x"exit" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case $ROFI_RETV in
|
||||
0)
|
||||
;;
|
||||
1)
|
||||
val=${@%%.*}
|
||||
res=$(echo $ROFI_DATA | jq -r ".[$val]" )
|
||||
coproc ( librewolf --new-tab $res > /dev/null 2>&1 )
|
||||
exit 0
|
||||
;;
|
||||
2)
|
||||
ddgrout=$(ddgr --json --num=25 "$@")
|
||||
|
||||
for i in $(echo $ddgrout | jq -r 'keys | @sh'); do
|
||||
title=$(echo $ddgrout | jq -r .[$i].title)
|
||||
url=$(echo $ddgrout | jq -r .[$i].url)
|
||||
echo "$i. $title ($url)"
|
||||
done
|
||||
|
||||
echo -e "\0data\x1f$(echo $ddgrout | jq -r .[].url | jq -sRc '. | split("\n") | [ .[] | select(length > 0) ]')"
|
||||
;;
|
||||
esac
|
8
other/scripts/desktop/window-screenshot.sh
Normal file
8
other/scripts/desktop/window-screenshot.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
unset x y w h
|
||||
eval $(xwininfo -id $(xdotool getactivewindow) |
|
||||
sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
|
||||
-e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
|
||||
-e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
|
||||
-e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
|
||||
echo -n "$x $y $w $h"
|
||||
flameshot gui --region "${w}x${h}+${x}+${y}" -c -p ~/Pictures/screenshots/
|
Loading…
Add table
Add a link
Reference in a new issue