mirror of
https://github.com/rwinkhart/artix-install-script.git
synced 2026-08-27 20:36:26 -04:00
Ported xcaffeine to bash, removed Python version
This commit is contained in:
@@ -9,7 +9,7 @@ Some major/noteworthy differences from common configurations:
|
||||
- EXT4 fast_commit mode is enabled by default
|
||||
- makepkg is configured for better than stock performance
|
||||
- a custom .bashrc with useful power management aliases is included
|
||||
- a custom script (xcaffeine.py) is included to keep the screen awake during the use of whitelisted applications
|
||||
- a custom script (xcaffeine.sh) is included to keep the screen awake during the use of whitelisted applications
|
||||
- ...all of this and more on KDE Plasma X11
|
||||
|
||||
# Usage
|
||||
|
||||
+2
-2
@@ -115,12 +115,12 @@ if [ "$formfactor" -lt 4 ]; then
|
||||
pacman -S xorg pipewire pipewire-pulse pipewire-jack pipewire-alsa wireplumber 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-openrc --needed --noconfirm
|
||||
rc-update add lightdm
|
||||
curl https://raw.githubusercontent.com/rwinkhart/artix-install-script/main/programs/powerset/powerset.sh -o /usr/local/bin/powerset.sh
|
||||
curl https://raw.githubusercontent.com/rwinkhart/artix-install-script/main/programs/xcaffeine/xcaffeine.py -o /usr/local/bin/xcaffeine.py
|
||||
curl https://raw.githubusercontent.com/rwinkhart/artix-install-script/main/programs/xcaffeine/xcaffeine.sh -o /usr/local/bin/xcaffeine.sh
|
||||
mkdir -p /home/"$username"/.config/autostart/
|
||||
curl https://raw.githubusercontent.com/rwinkhart/artix-install-script/main/programs/xcaffeine/xcaffeine.desktop -o /home/"$username"/.config/autostart/xcaffeine.desktop
|
||||
curl https://raw.githubusercontent.com/rwinkhart/artix-install-script/main/config-files/pipewire-start.sh -o /usr/local/bin/pipewire-start.sh
|
||||
curl https://raw.githubusercontent.com/rwinkhart/artix-install-script/main/config-files/pipewire.desktop -o /home/"$username"/.config/autostart/pipewire.desktop
|
||||
chmod 755 /usr/local/bin/powerset.sh /usr/local/bin/xcaffeine.py /usr/local/bin/pipewire-start.sh
|
||||
chmod 755 /usr/local/bin/powerset.sh /usr/local/bin/xcaffeine.sh /usr/local/bin/pipewire-start.sh
|
||||
chown -R root /usr/local/bin
|
||||
fi
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
loadkeys us
|
||||
echo ----------------------------------------------------------------------------------------------
|
||||
echo rwinkhart\'s artix install script
|
||||
echo last updated september 20, 2022
|
||||
echo last updated september 21, 2022
|
||||
echo ----------------------------------------------------------------------------------------------
|
||||
echo You will be asked some questions before installation.
|
||||
echo -e "----------------------------------------------------------------------------------------------\n"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[Desktop Entry]
|
||||
Exec=/usr/local/bin/xcaffeine.py
|
||||
Exec=/usr/local/bin/xcaffeine.sh
|
||||
Icon=
|
||||
Name=xcaffeine
|
||||
Path=
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env 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')
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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
|
||||
|
||||
while [ True ]; do
|
||||
sleep $timeout
|
||||
for term in ${pactl_search[@]}; do
|
||||
search_result=$(pactl list | grep $term)
|
||||
if [ ! -z "$search_result" ]; then
|
||||
echo "Whitelisted content ($term) is active, keeping screen alive..."
|
||||
xset s off -dpms
|
||||
sleep 5
|
||||
xset s on +dpms
|
||||
fi
|
||||
done
|
||||
done
|
||||
Reference in New Issue
Block a user