From 0ff957f9a3ed8fc97a8826d864eef5f7fdd56141 Mon Sep 17 00:00:00 2001 From: Sravan Balaji Date: Wed, 28 Feb 2024 17:32:24 -0500 Subject: [PATCH] Fix Autorandr/Lock Screen Bug - Had a bug where autorandr would run after waking up from sleep which ran the postswitch script which would restart the window manager session, thus displaying the windows ON TOP of the lock screen - Added a simple check to only restart session if i3lock (what betterlockscreen uses) is not running --- .config/autorandr/postswitch | 20 ++++++++++++++++---- README.org | 20 ++++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.config/autorandr/postswitch b/.config/autorandr/postswitch index d296280..ddf268a 100755 --- a/.config/autorandr/postswitch +++ b/.config/autorandr/postswitch @@ -1,5 +1,17 @@ #!/bin/bash -/home/sravan/.scripts/session.sh --restart & # Restart dwm -/usr/bin/nvidia-force-comp-pipeline & # NVIDIA Force Composition Pipeline -/usr/bin/nitrogen --restore & # Restore wallpaper -/usr/bin/betterlockscreen -u /home/sravan/Documents/Wallpapers/Desktop/Solar_System.png & # Update lock screen wallpaper +# Check if screen is not currently locked +if ! pgrep -x "i3lock" > /dev/null +then + # Restart session + /home/sravan/.scripts/session.sh --restart & +fi + +# NVIDIA Force Composition Pipeline +/usr/bin/nvidia-force-comp-pipeline & + +# Restore wallpaper +/usr/bin/nitrogen --restore & + +# Update lock screen wallpaper +/usr/bin/betterlockscreen -u \ + /home/sravan/Documents/Wallpapers/Desktop/Solar_System.png & diff --git a/README.org b/README.org index 38724b3..10e0e16 100644 --- a/README.org +++ b/README.org @@ -3069,10 +3069,22 @@ See [[https://github.com/phillipberndt/autorandr#hook-scripts][autorandr hook sc *** Post Switch #+BEGIN_SRC shell :shebang #!/bin/bash :tangle .config/autorandr/postswitch -/home/sravan/.scripts/session.sh --restart & # Restart dwm -/usr/bin/nvidia-force-comp-pipeline & # NVIDIA Force Composition Pipeline -/usr/bin/nitrogen --restore & # Restore wallpaper -/usr/bin/betterlockscreen -u /home/sravan/Documents/Wallpapers/Desktop/Solar_System.png & # Update lock screen wallpaper +# Check if screen is not currently locked +if ! pgrep -x "i3lock" > /dev/null +then + # Restart session + /home/sravan/.scripts/session.sh --restart & +fi + +# NVIDIA Force Composition Pipeline +/usr/bin/nvidia-force-comp-pipeline & + +# Restore wallpaper +/usr/bin/nitrogen --restore & + +# Update lock screen wallpaper +/usr/bin/betterlockscreen -u \ + /home/sravan/Documents/Wallpapers/Desktop/Solar_System.png & #+END_SRC ** Compositor