this is a lot of hoopla

This commit is contained in:
Chris Cochrun 2022-03-24 13:53:59 -05:00
parent 9a0fdfefa8
commit a8ee3f5c13
13 changed files with 151 additions and 42 deletions

View file

@ -0,0 +1,83 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Diese Skript importiert ein Bild und setzt es auf die akutelle Seite.
Der Bildrahmen wird dem Bild angepasst und in den nicht-proportionalen Modus
gesetzt, das heisst, beliebige Verzerrungen sind moeglich.
Um das Bild proportional zu vergroessern, die STRG-Taste beim Bearbeiten druecken.
Tested with scribus 1.3.3.3
Author: Konrad Stania
LICENSE:
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
name
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""
import sys
try:
from scribus import *
except ImportError:
print("This script only runs from within Scribus.")
sys.exit(1)
def main():
#setRedraw(False)
pageX,pageY = getPageSize()
ImageFileName = fileDialog("Image Import", "*","" ,True, False)
Breite = pageX*0.8
Hoehe = Breite
if pageX >= pageY:
Breite = pageY*0.8
Hoehe = Breite
ImageFrame = createImage(pageX/2 - Breite/2, pageY/2 - Hoehe/2, Breite, Hoehe)
loadImage(ImageFileName, ImageFrame)
setScaleImageToFrame(True, False,ImageFrame)
setFillColor("None", ImageFrame)
setLineColor("None", ImageFrame)
scaleX,scaleY = getImageScale(ImageFrame)
if scaleX > scaleY:
Breite = Breite * scaleY / scaleX
sizeObject(Breite, Hoehe, ImageFrame)
setScaleImageToFrame(True, False,ImageFrame)
if scaleX < scaleY:
Hoehe = Hoehe * scaleX / scaleY
setScaleImageToFrame(True, False,ImageFrame)
sizeObject(Breite, Hoehe, ImageFrame)
#setRedraw(True)
if __name__ == '__main__':
if haveDoc():
main()
else:
messageBox("Image Import", "You need to have a document open <i>before</i> you can run this script succesfully.", ICON_INFORMATION)

View file

@ -5,7 +5,7 @@ if [ $(pgrep -c emacsclient) -gt 0 ]; then
if [ $XDG_SESSION_TYPE = "x11" ]; then
#X11
emacsrg=$(wmctrl -lx | rg emacs | rg -v org-agenda | awk '{print $1}')
emacsrg=$(wmctrl -lx | rg emacs.Emacs | rg -v org-agenda | awk '{print $1}')
# echo $emacsrg
if [ -z $emacsrg ]; then

View file

@ -28,14 +28,18 @@ list_passwords() {
passwords=$(rbw list)
prompt='search for passwords...'
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done
)
if [ $XDG_SESSION_TYPE = "x11" ]; then
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done
)
else
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi)
fi
# Ask whether pass, user or both are required
options=("Password" \
@ -44,35 +48,40 @@ options=("Password" \
"QR-Code" \
"OTP")
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -p="..." -theme ~/.config/rofi/launchers-git/$style.rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done
)
if [ $XDG_SESSION_TYPE = "x11" ]; then
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -p="..." -theme ~/.config/rofi/launchers-git/$style.rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done
)
else
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -p="..." -theme ~/.config/rofi/launchers-git/$style.rasi)
fi
# echo $option
case ${option} in
Password )
# echo "${SECRET}"
ydotool type --next-delay 500 $(rbw get "${SECRET}")
echo "${SECRET}"
xdotool type $(rbw get "${SECRET}")
;;
User )
ydotool type --next-delay 500 "$(rbw get --full "${SECRET}" | rg Username: | awk '{print $2}')"
echo "$(rbw get --full "${SECRET}" | rg Username: | awk '{print $2}')"
xdotool type "$(rbw get --full "${SECRET}" | rg Username: | awk '{print $2}')"
;;
"User and password" )
ydotool type --next-delay 500 $(rbw get --full "${SECRET}" | rg Username: | awk '{print $2}')
ydotool key TAB
ydotool type --next-delay 500 $(rbw get "${SECRET}")
xdotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{print $2}')
xdotool key Tab
xdotool type $(rbw get "${SECRET}")
;;
"QR-Code" )
if [[ $SECRET =~ wifi$ ]]; then
# Produce a valid wifi QR-code
WIFISSID=$(pass get_user ${SECRET})
WIFIPASS=$(pass get_pass ${SECRET})
WIFISSID=$(pass get_user "${SECRET}")
WIFIPASS=$(pass get_pass "${SECRET}")
WIFIQR="WIFI:T:WPA;S:${WIFISSID};P:${WIFIPASS};;"
qrencode -s 8 -o - $WIFIQR | feh --title "pass: QR-WIFI" -
else
@ -80,8 +89,8 @@ case ${option} in
pass show -q1 ${SECRET}
fi
;;
"OTP" )
ydotool type --next-delay 300 $(rbw code ${SECRET})
OTP )
xdotool type $(rbw code "${SECRET}")
;;
esac

View file

@ -37,7 +37,8 @@ else
echo not running
machine=$(hostname)
if [ $machine = "syl" ]; then
env GDK_DPI_SCALE=0.5 GDK_SCALE=2 nyxt
# env GDK_DPI_SCALE=0.5 GDK_SCALE=2 nyxt
nyxt
else
nyxt
fi