1
0
Fork 0

try to fix screensaver

This commit is contained in:
Luca Bilke 2023-01-26 17:52:24 +01:00
parent 79e80918f8
commit fce4969a6a
2 changed files with 183 additions and 260 deletions

View file

@ -27,273 +27,13 @@ dpmsOff: 4:00:00
grabDesktopImages: True
grabVideoFrames: False
chooseRandomImages: False
imageDirectory:
mode: one
selected: 184
textMode: url
textLiteral: XScreenSaver
textFile:
textProgram: fortune
textURL: https://en.wikipedia.org/w/index.php?title=Special:NewPages&feed=rss
dialogTheme: default
programs: \
maze -root \n\
GL: superquadrics -root \n\
attraction -root \n\
blitspin -root \n\
greynetic -root \n\
helix -root \n\
hopalong -root \n\
imsmap -root \n\
- noseguy -root \n\
- pyro -root \n\
qix -root \n\
- rocks -root \n\
rorschach -root \n\
decayscreen -root \n\
flame -root \n\
halo -root \n\
slidescreen -root \n\
pedal -root \n\
bouboule -root \n\
- braid -root \n\
coral -root \n\
deco -root \n\
drift -root \n\
- fadeplot -root -count 30 -cycles 2519 \n\
galaxy -root \n\
goop -root \n\
grav -root \n\
ifs -root \n\
GL: jigsaw -root \n\
julia -root \n\
- kaleidescope -root \n\
GL: moebius -root \n\
moire -root \n\
GL: morph3d -root \n\
mountain -root \n\
munch -root \n\
penrose -root \n\
GL: pipes -root \n\
rdbomb -root \n\
GL: rubik -root \n\
- sierpinski -root \n\
slip -root \n\
GL: sproingies -root \n\
starfish -root \n\
strange -root \n\
swirl -root \n\
triangle -root \n\
xjack -root \n\
xlyap -root \n\
GL: atlantis -root \n\
bsod -root \n\
GL: bubble3d -root \n\
GL: cage -root \n\
- crystal -root \n\
cynosure -root \n\
discrete -root \n\
distort -root \n\
epicycle -root \n\
flow -root -delay 25191 -cycles 800000 \
-size -6 -no-rotate -no-ride -no-box \n\
GL: glplanet -root \n\
interference -root \n\
kumppa -root \n\
GL: lament -root \n\
moire2 -root \n\
GL: sonar -root \n\
GL: stairs -root \n\
truchet -root \n\
- vidwhacker -root \n\
blaster -root \n\
bumps -root \n\
ccurve -root \n\
compass -root \n\
deluxe -root \n\
- demon -root \n\
- GL: extrusion -root \n\
- loop -root \n\
penetrate -root \n\
petri -root \n\
phosphor -root \n\
GL: pulsar -root \n\
ripples -root \n\
shadebobs -root \n\
GL: sierpinski3d -root \n\
spotlight -root \n\
squiral -root \n\
wander -root \n\
- webcollage -root \n\
xflame -root \n\
xmatrix -root -insert top -delay 19084 \
-density 49 \n\
GL: gflux -root \n\
- nerverot -root \n\
xrayswarm -root \n\
xspirograph -root \n\
GL: circuit -root \n\
GL: dangerball -root \n\
- GL: dnalogo -root \n\
GL: engine -root \n\
GL: flipscreen3d -root \n\
GL: gltext -root \n\
GL: menger -root \n\
GL: molecule -root \n\
rotzoomer -root \n\
scooter -root \n\
speedmine -root \n\
GL: starwars -root \n\
GL: stonerview -root \n\
vermiculate -root \n\
whirlwindwarp -root \n\
zoom -root \n\
anemone -root \n\
apollonian -root \n\
GL: boxed -root \n\
GL: cubenetic -root \n\
GL: endgame -root \n\
euler2d -root \n\
fluidballs -root \n\
GL: flurry -root \n\
- GL: glblur -root \n\
GL: glsnake -root \n\
halftone -root \n\
GL: juggler3d -root \n\
GL: lavalite -root \n\
- polyominoes -root \n\
GL: queens -root \n\
- GL: sballs -root \n\
GL: spheremonics -root \n\
- thornbird -root \n\
twang -root \n\
- GL: antspotlight -root \n\
apple2 -root \n\
GL: atunnel -root \n\
barcode -root \n\
GL: blinkbox -root \n\
GL: blocktube -root \n\
GL: bouncingcow -root -delay 0 -speed 0.326 \n\
cloudlife -root \n\
GL: cubestorm -root \n\
eruption -root \n\
GL: flipflop -root \n\
GL: flyingtoasters -root \n\
fontglide -root \n\
GL: gleidescope -root \n\
GL: glknots -root \n\
GL: glmatrix -root \n\
- GL: glslideshow -root \n\
GL: hypertorus -root \n\
- GL: jigglypuff -root \n\
metaballs -root \n\
GL: mirrorblob -root \n\
piecewise -root \n\
GL: polytopes -root \n\
pong -root \n\
popsquares -root \n\
GL: surfaces -root \n\
xanalogtv -root \n\
abstractile -root \n\
anemotaxis -root \n\
- GL: antinspect -root \n\
fireworkx -root \n\
fuzzyflakes -root \n\
interaggregate -root \n\
intermomentary -root \n\
memscroller -root \n\
GL: noof -root \n\
pacman -root \n\
GL: pinion -root \n\
GL: polyhedra -root \n\
- GL: providence -root \n\
substrate -root \n\
wormhole -root \n\
- GL: antmaze -root \n\
GL: boing -root \n\
boxfit -root \n\
GL: carousel -root \n\
celtic -root \n\
GL: crackberg -root \n\
GL: cube21 -root \n\
fiberlamp -root \n\
GL: fliptext -root \n\
GL: glhanoi -root \n\
GL: tangram -root \n\
GL: timetunnel -root \n\
GL: glschool -root \n\
GL: topblock -root \n\
GL: cubicgrid -root -delay 0 -speed 0.676 \
-zoom 34 \n\
cwaves -root \n\
GL: gears -root \n\
GL: glcells -root \n\
GL: lockward -root \n\
m6502 -root \n\
GL: moebiusgears -root \n\
GL: voronoi -root \n\
GL: hypnowheel -root \n\
GL: klein -root \n\
- lcdscrub -root \n\
GL: photopile -root \n\
GL: skytentacles -root \n\
GL: rubikblocks -root \n\
GL: companioncube -root \n\
GL: hilbert -root \n\
GL: tronbit -root \n\
GL: geodesic -root \n\
hexadrop -root \n\
GL: kaleidocycle -root \n\
GL: quasicrystal -root \n\
GL: unknownpleasures -root -resolution 104 \n\
binaryring -root \n\
GL: cityflow -root \n\
GL: geodesicgears -root \n\
GL: projectiveplane -root \n\
GL: romanboy -root \n\
tessellimage -root \n\
GL: winduprobot -root \n\
GL: splitflap -root \n\
GL: cubestack -root \n\
GL: cubetwist -root \n\
GL: discoball -root \n\
GL: dymaxionmap -root \n\
GL: energystream -root \n\
GL: hexstrut -root \n\
GL: hydrostat -root \n\
GL: raverhoop -root \n\
GL: splodesic -root \n\
GL: unicrud -root \n\
GL: esper -root \n\
GL: vigilance -root \n\
GL: crumbler -root \n\
filmleader -root \n\
glitchpeg -root \n\
GL: handsy -root \n\
GL: maze3d -root \n\
GL: peepers -root \n\
GL: razzledazzle -root \n\
vfeedback -root \n\
GL: deepstars -root \n\
GL: gravitywell -root -grid-size 1.641 -count \
31 \n\
GL: beats -root \n\
GL: covid19 -root \n\
GL: etruscanvenus -root \n\
GL: gibson -root \n\
GL: headroom -root \n\
GL: sphereeversion -root \n\
binaryhorizon -root \n\
marbling -root \n\
GL: chompytower -root \n\
GL: mapscroller -root \n\
GL: nakagin -root \n\
GL: squirtorus -root \n\
pointerHysteresis: 10
authWarningSlack: 20

183
.local/bin/screensaver Executable file
View file

@ -0,0 +1,183 @@
#!/bin/sh
#
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
: ${XSECURELOCK_XSCREENSAVER_PATH:=/usr/share/xscreensaver/}
TAB=' '
# Note: the following logic is somewhat derived from parse_screenhack in
# XScreenSaver.
convert_xscreensaver_programs() {
i=0
while IFS= read -r line; do
skipwhite() {
while :; do
case "$line" in
$TAB*) line=${line#$TAB} ;;
\ *) line=${line# } ;;
*) break ;;
esac
done
}
skipwhite
# Read disabled field.
case "$line" in
-*) enabled=false; line=${line#-}; skipwhite ;;
*) enabled=true ;;
esac
# Strip visual name (VISUAL:, where VISUAL can't contain " or whitespace).
case "${line%%[\" $TAB]*}" in
*:*) line=${line#*:}; skipwhite ;;
esac
# Strip textual description ("description").
case "$line" in
'"'*) line=${line#\"*\"}; skipwhite ;;
esac
# What's remaining is the program name with its options.
echo "$i $enabled $line"
i=$((i+1))
done
}
convert_program_list() {
i=0
while IFS= read -r line; do
echo "$i true $line -root"
i=$((i+1))
done
}
list_savers() {
want_all=$1
if [ -f ~/.xscreensaver ]; then
printf "%b" "$(
xrdb -n ~/.config/xscreensaver 2>/dev/null |\
grep ^programs: |\
cut -d : -f 2-
)" | convert_xscreensaver_programs
else
ls "$XSECURELOCK_XSCREENSAVER_PATH" | convert_program_list
fi | while read -r number enabled saver flags; do
$want_all || $enabled || continue
[ -x "$XSECURELOCK_XSCREENSAVER_PATH/$saver" ] || continue
printf '%d\t%s/%s\n' "$number" "$XSECURELOCK_XSCREENSAVER_PATH" "$saver $flags"
done
}
mode=
# Debug mode to list all savers.
case "$1" in
--list_savers)
list_savers false
exit 0
;;
--list_all_savers)
list_savers true
exit 0
;;
--internal-override-mode=*)
mode=${1#*=}
;;
esac
if [ -z "$mode" ]; then
mode=$(
xrdb -n ~/.config/xscreensaver 2>/dev/null |\
grep ^mode: |\
cut -f 2
)
fi
selected=
case "$mode" in
one)
selected=$(
xrdb -n ~/.config/xscreensaver 2>/dev/null |\
grep ^selected: |\
cut -f 2
)
;;
random) # NOT random-same.
# Try bash's $RANDOM, but if it's not there, just use the PID.
selected=${RANDOM:-$$}
;;
esac
if [ -z "$selected" ]; then # Note: random-same hits this.
# We're using the parent process ID here, which may be a saver_multiplex
# instance. This ensures that multiple instances of this always spawn the same
# saver on each screen.
selected=$PPID
fi
# Prepare the saver list so we only parse once.
case "$mode" in
one)
savers=$(list_savers true)
count=$(printf '%s\n' "$savers" | wc -l)
;;
*)
savers=$(list_savers false)
count=$(printf '%s\n' "$savers" | wc -l)
;;
esac
select_saver() {
case "$mode" in
one)
printf '%s\n' "$savers" | grep "^$selected$(printf '\t')"
;;
*)
printf '%s\n' "$savers" | tail -n +$((selected % count + 1))
;;
esac | head -n 1 | cut -f 2-
}
# On SIGUSR1, we exit the saver and retry the selection.
sigusr1_caught=false
trap 'sigusr1_caught=true' USR1
while :; do
saver=$(select_saver)
if [ -z "$saver" ]; then
echo >&2 "xsecurelock: No saver selected. Giving up."
exec ./saver_blank
fi
sigusr1_caught=false
eval $saver
status=$?
if [ $status -eq 0 ] || $sigusr1_caught; then
# Immediately try the next saver.
case "$mode" in
one)
;;
*)
selected=$((selected + 1))
;;
esac
else
# Saver failed entirely. Just give up.
echo >&2 "xsecurelock: Screen saver failed with status $status: $saver."
sleep 2 # Anti-spam delay.
if [ x"$mode" != x"random" ]; then
# As a fallback, when the saver failed, try random.
exec "$0" --internal-override-mode=random
fi
exit $status
fi
done