mirror of
https://github.com/rwinkhart/artix-install-script.git
synced 2026-08-28 12:56:26 -04:00
Added xcaffeine.py (self-written script) for keeping the screen awake when certain applications are open
This commit is contained in:
+1
-1
@@ -103,7 +103,7 @@ chmod -R 700 /home
|
||||
|
||||
# installing desktop environment and addons + utilities
|
||||
if [ "$formfactor" -lt 4 ]; then
|
||||
pacman -S pipewire pipewire-pulse pipewire-jack pipewire-alsa plasma-desktop lightdm-openrc lightdm-gtk-greeter kscreen kdeplasma-addons spectacle gwenview plasma-nm plasma-pa breeze-gtk kde-gtk-config kio-extras khotkeys kwalletmanager pcmanfm-qt yakuake ark kate micro bluedevil bluez --needed --noconfirm
|
||||
pacman -S pipewire pipewire-pulse pipewire-jack pipewire-alsa libpulse plasma-desktop lightdm-openrc lightdm-gtk-greeter kscreen kdeplasma-addons spectacle gwenview plasma-nm plasma-pa breeze-gtk kde-gtk-config kio-extras khotkeys kwalletmanager pcmanfm-qt yakuake ark kate micro bluedevil bluez --needed --noconfirm
|
||||
rc-update add lightdm
|
||||
ln -s /usr/bin/micro /usr/bin/nano
|
||||
fi
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Exec=/usr/bin/xcaffeine.py
|
||||
Icon=
|
||||
Name=xcaffeine
|
||||
Path=
|
||||
Terminal=False
|
||||
Type=Application
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/python3
|
||||
|
||||
# external modules
|
||||
|
||||
from os import setuid, system
|
||||
from pwd import getpwnam
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
from time import sleep
|
||||
|
||||
# depends on X11, libpulse (compatible w/Pipewire&PulseAudio)
|
||||
|
||||
# START USER CHANGEABLE VARIABLES
|
||||
# list of pactl search terms
|
||||
pactl_search = ['jellyfinmediaplayer', 'rpcs3']
|
||||
# frequency to check for activity (in seconds)
|
||||
timeout = 290
|
||||
# FINISH USER CHANGEABLE VARIABLES
|
||||
|
||||
# ensure running as correct user
|
||||
setuid(1000)
|
||||
|
||||
while True:
|
||||
sleep(timeout)
|
||||
for search_term in pactl_search:
|
||||
command = f"pactl list | grep {search_term[:-1]}"
|
||||
output = Popen(command, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
||||
block = output.communicate()[0].strip() # blocks the program from proceeding until stdout is given
|
||||
if block.decode('utf-8').__contains__(search_term):
|
||||
print(f"Whitelisted content ({search_term}) is active, keeping screen alive...")
|
||||
system('xset s off -dpms')
|
||||
sleep(5)
|
||||
system('xset s on +dpms')
|
||||
Reference in New Issue
Block a user