From 69de6d25c4d67499c170364bb583e995df61774f Mon Sep 17 00:00:00 2001 From: "committer@tuxwarrior" Date: Fri, 4 Apr 2025 04:58:01 -0500 Subject: [PATCH] / a bigger rewrite of the lock script automatically picks random image, and scales the overlay image to be 1/3 of the height of the monitor --- dots/bin/i3lock_fk.sh | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/dots/bin/i3lock_fk.sh b/dots/bin/i3lock_fk.sh index b523322..953af4b 100755 --- a/dots/bin/i3lock_fk.sh +++ b/dots/bin/i3lock_fk.sh @@ -1,19 +1,32 @@ #!/usr/bin/env bash +# originally got the idea from this script: # src:https://github.com/veltall/custom-i3lock -img_dir=/home/${USER}/.local/share/img -overlay_images=("abstractArtisticCrossIllustration.png" "abstractBirdRainbowColoredBird.png" "abstractCrossWithPaintSplatter.png" "abstractDuckColorfulPatternedDuckIllustration.png" "abstractFaceWithBirds.png" "abstractFemaleFaceInBrushStrokes.png" "abstractGirlFaceMadeOfAutumnLeaves.png" "abstractGirlNatureWomanWithForestProfile.png" "abstractGirlWomanWithButterfliesInHair.png" "abstractManAbstractWaterSplashOnFace.png" "abstractManColorfulFaceMadeOfBooks.png" "abstractManSurrealTreeManIllustration.png" "abstractManWithTree.png" "abstractSilhouetteArt.png" "abstractSneakerColorfulArtisticSneakerIllustration.png" "abstractTreeColorfulFantasyTreeWithSwirlingPatterns.png" "ajp.png" "amazonRainforestLushJungleSceneIllustration.png" "archLinux.png" "archLinuxLogo.png" "archLinuxLogoDesign.png" "archLinuxLogoPoweredByArchLinuxLogo.png" "archLogo.png" "artisticWomansFaceWithRedLips.png" "atat.png" "baseballCapFuturisticRoboticHelmetWithMechanicalDetails.png" "bibleIllustratedBibleWithGoldenCrossDesign.png" "birds.png" "boomboxColorfulRetroBoombox.png" "butterflies.png" "butterflyBlue.png" "butterflyColorfulFantasyButterflyIllustration.png" "cartoonRobotYellowRobotWithGears.png" "cartoonstyleAstronautHelmetWithStarryReflection.png" "christianFishSymbol.png" "circuitBoardFaceInNeonColors.png" "codeEditingCodingOnLaptop.png" "codeEditingLaptopWithCodingOnScreenIllustration.png" "coderWithHeadsetAndLaptop.png" "codingColorfulComputerWithCodeDisplay.png" "colorfulAbstractFaceArtwork.png" "colorfulAbstractSilhouetteOfWalkingPerson.png" "colorfulComputerWithCodeDisplay.png" "colourFaceColorfulAbstractFaceIllustration.png" "comicBooTextIllustration.png" "comicStyleExplosion.png" "comicStyleWhatTextWithRedExplosion.png" "commodoreLogoRetroCommodoreLogo.png" "computerStylizedRetroComputerIllustration.png" "coolWolfColorfulWolfArtworkInVibrantAbstractStyle.png" "cyberSecurityConceptIllustration.png" "cyberSecurityCybersecurityDigitalPadlockIllustration.png" "digitalArtworkColorfulArtisticFeather.png" "enigmaticCityNightCityscapeWithReflection.png" "faceSilhouetteDoubleExposureSilhouetteArt.png" "fierySilhouetteArt.png" "forestJungleBeautifulTropicalJungleIllustration.png" "futuristicCatNeonCyberCatWithGlowingPatterns.png" "futuristicCitySilhouetteInCyberpunkStyle.png" "futuristicCottageGardenModernHouseWithLushGarden.png" "futuristicCyberHead.png" "futuristicRobotWithDrink.png" "futuristicRocketLaunchIllustration.png" "gardenLandscapeLushTropicalGreeneryWithRocksAndVividColors.png" "glowingNeonFrameWithAbstractBackground.png" "greenFish.png" "headphonesColorfulHeadphonesIllustration.png" "indianElephantColorfulPsychedelicElephantArtwork.png" "jesusAbstractBlackDrippingFaceArtIllustration.png" "jesusAbstractFaceInBlackInk.png" "jesusChrist.png" "jesusSpiritualPortraitWithHaloAndBrightColors.png" "linuxLogoTuxPenguinLogoRepresentingLinuxCommunity.png" "linuxLogoTuxThePenguinLinuxLogo.png" "linuxPenguinNinjaLinuxPenguinCharacter.png" "linuxPenguinTuxLogoIllustration.png" "lionLogoArtisticLionIllustrationWithVibrantColors.png" "manHeadSilhouetteNatureTreeSilhouette.png" "manWorkingAtDeskIllustration.png" "mountainLakeMountainLandscapeWithStarrySky.png" "mountainMoonlitMountainAndLakeLandscape.png" "neon1.png" "neon2.png" "neonCatWithColorfulGlow.png" "neonGlowingMountain.png" "neonLineAbstractNeonPortraitOfADog.png" "nightSkyBeautifulNightSkyWithMoonAndStars.png" "nightSkyStarryNightSkyWithMoons.png" "oceanWavesStylizedOceanWavesArtisticIllustration.png" "panamaAqui.png" "panamaFlagCircularRepresentation.png" "panamaMapMapOfPanamaWithFlagColors.png" "peacockVibrantPeacockArtIllustration.png" "penguinArtworkPenguinWildlifeIllustrationInBlackAndWhite.png" "penguinColorfulCartoonPenguinIllustrationInFunStyle.png" "personCodingOnComputer.png" "popArtWolfVividAndColorfulWolfArtisticIllustration.png" "redKissGlossyRedLipsIllustration.png" "retroRocketBlackRocketIllustration.png" "retroSunsetWithGradientColors.png" "rickroll.png" "rocketColorfulRocketillustration.png" "rottweilerDogIllustration.png" "rottweilerDogSketch.png" "rottweilerGuardDogWarning.png" "rottweilerSilhouetteStanding.png" "roundMetalLock.png" "skyBackgroundColorfulSunsetPainting.png" "smokeAbstract.png" "jesusBeardedManWithOrangeBackground.png" "smokingCigarWithSmoke.png" "spaceAstronautAndPlanetsWatercolorArtwork.png" "steampunkCircularGearworkDesign.png" "steampunkGearMechanism.png" "steampunkHead.png" "steampunkOctopusWithMechanicalGears.png" "steampunkRoboticLizardDesign.png" "summerNightBeautifulNightSkyWithStarsAndCrescentMoon.png" "summerNightEtherealFairyInAMagicalSettingArtwork.png" "summerNightMoonlitIslandWithTreeAndStars.png" "sunSilhouetteSunsetOverWater.png" "thinkingManSilhouetteAbstractSilhouetteOfMan.png" "tronFuturisticNeonMotorcycleWithRider.png" "vaporwaveAstronautOnAlienPlanet.png" "vaporwaveCarRetroCarWithASunsetInVaporwaveStyle.png" "vaporwaveCarRetroCarWithNeonSunsetBackground.png" "vaporwaveCarRetroCarWithPalmTrees.png" "vaporwaveCatColorfulCatInArtisticStyle.png" "vaporwaveRabbitCoolRabbitWithSunglasses.png" "vaporwaveStarStarAndLandscapeWithMountainsAndSunset.png" "waterSplashBlueWaterSplashIllustration.png" "waterWave.png" "wowComicStyleTextWithPopArtDesign.png") -random_image_file=${overlay_images[ $RANDOM % ${#overlay_images[@]} ]} -random_image=${img_dir}/${random_image_file} +# get random image to use +# https://stackoverflow.com/questions/61290199/how-do-i-select-a-random-file-from-a-directory +random_image=$(ls -1 /home/${USER}/.local/share/img/*.png | shuf | head -1) +random_image_filname="$(basename -- $random_image)" -#gravity=("center" "northwest" "northeast" "southwest" "southeast") -gravity=("northeast" "southeast") +# get random gravity to use for the overlay image +gravity=("northeast" "southeast") # "center" "northwest" "northeast" "southwest" "southeast" random_gravity=${gravity[ $RANDOM % ${#gravity[@]} ]} -notify-send "${random_image_file} @ ${random_gravity}" +# send a notification to the user +notify-send "${random_image_filname} @ ${random_gravity}" +# take a screenshot of the entire screen, and blur this scrot --overwrite /tmp/currentworkspace.png convert /tmp/currentworkspace.png -blur 0x9 /tmp/currentworkspaceblur.png -composite -gravity ${random_gravity} ${random_image} /tmp/currentworkspaceblur.png /tmp/lockbackground.png + +# find height of background image, and set the overlay to be 1/3 of this +workspaceHeight=$(magick /tmp/currentworkspaceblur.png -print "%h" /dev/null) +overlayHeight=$((${workspaceHeight} / 3)) + +# resize the overlay image +cp ${random_image} /tmp/overlayimage.png +mogrify -resize x${overlayHeight} /tmp/overlayimage.png + +# create the final image to be used as the lock screen, and lock the system +composite -gravity ${random_gravity} /tmp/overlayimage.png /tmp/currentworkspaceblur.png /tmp/lockbackground.png i3lock --tiling -i /tmp/lockbackground.png