crate pulseaudio autostart file while opening user session on default_policy module

This commit is contained in:
Tuncay ÇOLAK 2021-09-13 16:30:40 +03:00
parent 5f092a86d7
commit 423faea01a
4 changed files with 27 additions and 2 deletions

View file

@ -142,6 +142,7 @@ class CommandRunner(object):
self.logger.info("Applying default policies for user {0}".format(Util.get_username())) self.logger.info("Applying default policies for user {0}".format(Util.get_username()))
self.default_policy.default_firefox_policy(Util.get_username()) self.default_policy.default_firefox_policy(Util.get_username())
self.default_policy.disable_update_package_notify(Util.get_username()) self.default_policy.disable_update_package_notify(Util.get_username())
self.default_policy.create_pulseaudio_autostart()
# Default policy for users --->> STOP # Default policy for users --->> STOP
get_policy_message = self.message_manager.policy_request_msg(username) get_policy_message = self.message_manager.policy_request_msg(username)

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Name=sesbaslat
Comment=Start the PulseAudio Sound System
Exec=sh -c 'killall pulseaudio; sleep 3; pulseaudio --start'
Terminal=false
Type=Application
Categories=
GenericName=
X-GNOME-Autostart-Phase=Initialization
X-KDE-autostart-phase=1

View file

@ -134,4 +134,18 @@ class DefaultPolicy:
new_element.attrib["value"] = app_name_for_blocking new_element.attrib["value"] = app_name_for_blocking
tree.write(fileName) tree.write(fileName)
else: else:
self.logger.info("'" + app_name_for_blocking + "' is already added to muted_applications tag.") self.logger.info("'" + app_name_for_blocking + "' is already added to muted_applications tag.")
# create pulseaudio autostart file while user opening session
def create_pulseaudio_autostart(self):
pulseaudio_des_path = "/etc/xdg/autostart/ahenk.pulseaudio.start.desktop"
pulseaudio_src_path = "/usr/share/ahenk/base/default_policy/config-files/ahenk.pulseaudio.start.desktop"
pulseaudio_old_file = "/etc/xdg/autostart/ahenk.pulseaudio.desktop"
if Util.is_exist(pulseaudio_old_file):
Util.delete_file(pulseaudio_old_file)
if not Util.is_exist(pulseaudio_des_path):
Util.copy_file(pulseaudio_src_path, pulseaudio_des_path)
self.logger.info("Copy pulseaudio autostart file")
else:
self.logger.info("Pulseaudio autostart file already exist")

View file

@ -151,7 +151,7 @@ class Registration:
self.install_and_config_ad(reg_reply) self.install_and_config_ad(reg_reply)
self.change_permissions_for_local_users() self.change_permissions_for_local_users()
self.create_ahenk_pulseaudio_desktop_file() # self.create_ahenk_pulseaudio_desktop_file()
except Exception as e: except Exception as e:
self.logger.error('Registration error. Error Message: {0}.'.format(str(e))) self.logger.error('Registration error. Error Message: {0}.'.format(str(e)))