scripts: add missing scripts and some new ones

This commit is contained in:
lelgenio 2021-06-06 17:02:47 -03:00
parent a1cdace874
commit bb6ae22a0e
17 changed files with 151 additions and 19 deletions

View File

@ -255,7 +255,7 @@ actions:
pam_gpg: _pam-gpg-strap
make_theme: _make_theme
install_meta: install_meta
filter_backgrounds: _filter_backgrounds
filter_backgrounds: _backgrouds_filter
###############################################################
dotfiles: # Just a bunch of paths and action mappings

View File

@ -46,7 +46,7 @@ fileext = ".vcf"
type = "carddav"
url = "https://cloud.{{@@ mail.personal.mail @@}}/remote.php/dav/addressbooks/users/{{@@ mail.personal.user @@}}/contacts/"
username = "{{@@ mail.personal.user @@}}@{{@@ mail.personal.mail @@}}"
password.fetch = [ "command", "_get-pass", "{{@@ mail.personal.mail @@}}" ]
password.fetch = [ "command", "_pass_get", "{{@@ mail.personal.mail @@}}" ]
# CALDAV
[pair calendar]
@ -66,4 +66,4 @@ fileext = ".ics"
type = "caldav"
url = "https://cloud.{{@@ mail.personal.mail @@}}/remote.php/dav/calendars/{{@@ mail.personal.user @@}}/personal/"
username = "{{@@ mail.personal.user @@}}@{{@@ mail.personal.mail @@}}"
password.fetch = [ "command", "_get-pass", "{{@@ mail.personal.mail @@}}" ]
password.fetch = [ "command", "_pass_get", "{{@@ mail.personal.mail @@}}" ]

View File

@ -35,12 +35,12 @@ function esway
set -x XDG_CURRENT_DESKTOP sway
# this should not be necessary, but whatever
pidof sway || exec sway
pidof sway &> /dev/null || exec sway
end
if test "$XDG_VTNR" = 1
and test -z "$DISPLAY"
and test -z "$DISPLAY$WAYLAND_DISPLAY"
esway &| tee .swaylog
# ei3 &> .i3log

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Any Browser
Comment=A list of web browsers to try out
Icon=qutebrowser
Type=Application
Categories=Network;WebBrowser;
Exec=any-browser %u
Terminal=false
StartupNotify=true
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/qute;
Keywords=Browser

View File

@ -4,7 +4,7 @@ IMAPStore {{@@ name @@}}-remote
Host {{@@ info.mail @@}}
Port 993
User {{@@ info.user @@}}@{{@@ info.mail @@}}
PassCmd "_get-pass {{@@ info.mail @@}}"
PassCmd "_pass_get {{@@ info.mail @@}}"
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt

View File

@ -19,7 +19,7 @@ set ssl_force_tls = yes
{%@@ for name, info in mail.items() | reverse @@%}
set my_source_command = \
"_get-mutt-mail '{{@@ name @@}}' '{{@@ info.user @@}}' '{{@@ info.mail @@}}' |"
"_mutt_get-mail '{{@@ name @@}}' '{{@@ info.user @@}}' '{{@@ info.mail @@}}' |"
folder-hook "$my_mailroot/{{@@ name @@}}/" \
source "\"$my_source_command\""
@ -28,7 +28,7 @@ set my_source_command = \
{%@@ for name, info in mail.items() @@%}
set my_source_command = \
"_get-mutt-mail '{{@@ name @@}}' '{{@@ info.user @@}}' '{{@@ info.mail @@}}' |"
"_mutt_get-mail '{{@@ name @@}}' '{{@@ info.user @@}}' '{{@@ info.mail @@}}' |"
macro index,pager <f{{@@ loop.index @@}}> "<sync-mailbox><enter-command>source \"$my_source_command\"<enter><change-folder>!<enter>"
{%@@ endfor @@%}

View File

@ -3,7 +3,7 @@
my_path="$1"
my_user="$2"
my_host="$3"
my_pass=`_get-pass "$my_host"`
my_pass=`_pass_get "$my_host"`
cat <<EOF
set realname = "$my_user"

View File

@ -2,7 +2,7 @@
gpg --list-secret-keys --with-keygrip \
"{{@@ username @@}}@{{@@ mail @@}}" |
"{{@@ username @@}}@{{@@ mail.personal.mail @@}}" |
awk '
/^ssb/ {
ssb=1

10
dotfiles/scripts/any-browser Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
{
if pidof firefox
then
firefox $@
else
qutebrowser $@
fi
} &> /dev/null < /dev/null & disown

5
dotfiles/scripts/cdexec Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
cd "$1"
shift
exec $@

View File

@ -10,7 +10,7 @@ owm(){
REGI=$(echo $INFO | jq -r '.region')
COUN=$(echo $INFO | jq -r '.country')
QUERY="$CITY, $REGI, $COUN"
APPID=`_get-pass OpenWeatherMapAPPID`
APPID=`_pass_get OpenWeatherMapAPPID`
#{%@@ if False @@%}#
notify-send "Get a free appid"
xdg-open openweathermap.org &

16
dotfiles/scripts/imgrs Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
set -x
FILE="$1"
SCALE="$2"
test -z "$SCALE" &&
SCALE=`echo | wdmenu -p 'Scale'`
OUTPUT="$3"
test -z "$OUTPUT" &&
OUTPUT="${FILE}.resized.png"
magick convert "$FILE" -scale "${SCALE}%" "$OUTPUT"

88
dotfiles/scripts/memegen Executable file
View File

@ -0,0 +1,88 @@
#!/bin/fish
set fish_trace 1
set progname (status basename)
function warning
set_color yellow
echo "[$progname]" $argv >&2
set_color --default
end
function error
set_color brred
echo "[$progname]" $argv >&2
set_color --default
exit 1
end
argparse --name="$progname" \
'i/input=' \
'o/output=' \
't/top=' \
'b/bottom=' \
's/scale=' \
'open' \
'f/force' \
-- $argv
set input "$_flag_input"
set output "$_flag_output"
set top "$_flag_top"
set bottom "$_flag_bottom"
set scale "$_flag_scale"
set force "$_flag_force"
test -f "$input"
or error "No input file provided"
if test -z "$top""$bottom"
warning "No top or bottom text provided"
test -n "$top"
or set top (echo | wdmenu -p 'Top text: ')
test -n "$bottom"
or set bottom (echo | wdmenu -p 'Bottom text: ')
end
set original_name (basename "$input" |
string replace -r '\.\w+$' '')
set meme_text (string join - $top $bottom)
test -n "$output"
or set output "$meme_text-$original_name.png"
if test -f "$output"
and not set -q force
error "Output file exists"
end
if set -q scale
set resized (mktemp -t memegen-XXXXX.png)
command magick convert "$input" -resize "$scale""%" "$resized"
else
set resized "$input"
end
set size (magick identify -format "%[fx:w]x%[fx:h]" "$resized")
command magick convert "$resized" \
-gravity north \
\( -size "$size" xc:none -font Impact -pointsize 50 -stroke black -strokewidth 7 -annotate 0 "$top" -blur 0x1 \) -composite \
-font Impact -pointsize 50 -fill white -stroke none -annotate 0 "$top" \
-gravity south \
\( -size "$size" xc:none -font Impact -pointsize 50 -stroke black -strokewidth 7 -annotate 0 "$bottom" -blur 0x1 \) \
-font Impact -pointsize 50 -fill white -stroke none -annotate 0 "$bottom" -composite \
$argv "$output"
if test "$input" != "$resized"
command rm "$resized"
end
if set -q _flag_open
command xdg-open "$output"
end
# vim: ft=fish

View File

@ -1,3 +1,3 @@
#!/bin/sh
mpv av://v4l2:/dev/video0 --profile=low-latency --untimed &
mpv av://v4l2:/dev/video0 --profile=low-latency --untimed $@ &

View File

@ -80,14 +80,16 @@ gaps inner 5px
# Themes
###############################################################
set $gnome-schema org.gnome.desktop.interface
set $gnome_schema org.gnome.desktop.interface
set $no_desplay env DISPLAY="" WAYLAND_DISPLAY=""
exec_always {
# In case of errors, kvantummanager opens a window
# this is retarded
kvantummanager --set '{{@@ kvantum_theme @@}}'
gsettings set $gnome-schema gtk-theme '{{@@ gtk_theme @@}}'
gsettings set $gnome-schema icon-theme '{{@@ icon_theme @@}}'
gsettings set $gnome-schema cursor-theme '{{@@ cursor_theme @@}}'
$no_desplay kvantummanager --set '{{@@ kvantum_theme @@}}'
gsettings set $gnome_schema gtk-theme '{{@@ gtk_theme @@}}'
gsettings set $gnome_schema icon-theme '{{@@ icon_theme @@}}'
gsettings set $gnome_schema cursor-theme '{{@@ cursor_theme @@}}'
}
seat * xcursor_theme "{{@@ cursor_theme @@}}" "{{@@ cursor_size @@}}"

View File

@ -174,7 +174,7 @@
"tooltip":false
},
"custom/layout":{
"exec":"_get-sway-layout",
"exec":"_sway_get-layout",
"interval": 1,
"tooltip":false
},

View File

@ -21,7 +21,7 @@ def rclone_obscure(pass_name):
def sh(*args):
return check_output(args).decode().strip()
return sh("rclone", "obscure", sh("_get-pass", pass_name))
return sh("rclone", "obscure", sh("_pass_get", pass_name))
####################################################################