Move 'Fix primary screen' task to role
This commit is contained in:
parent
ce40cb885f
commit
3615ef241c
6 changed files with 585 additions and 524 deletions
|
@ -4,3 +4,5 @@ misc_pwroff: true
|
|||
misc_pwroff_idle: true
|
||||
misc_pxe_first: false
|
||||
misc_reporter: false
|
||||
misc_clonescreen: false
|
||||
misc_clonescreen_mode: "1920x1080@60"
|
||||
|
|
|
@ -182,3 +182,35 @@
|
|||
name: reporter.timer
|
||||
enabled: true
|
||||
when: misc_reporter
|
||||
|
||||
# Prepare CloneScreen on Presenter PCs
|
||||
|
||||
- name: Fix primary screen for class room PCs with projector
|
||||
when: misc_clonescreen
|
||||
block:
|
||||
- name: Set primary screen for login
|
||||
ansible.builtin.blockinfile:
|
||||
path: /usr/share/sddm/scripts/Xsetup
|
||||
block: |
|
||||
xrandr --output {{ dual_screen[0] }} --primary
|
||||
when: dual_screen is defined
|
||||
- name: Reset primary screen for login
|
||||
ansible.builtin.blockinfile:
|
||||
path: /usr/share/sddm/scripts/Xsetup
|
||||
state: absent
|
||||
when: dual_screen is not defined
|
||||
- name: Deploy fix-screen script
|
||||
ansible.builtin.template:
|
||||
src: lmn-fix-screen.j2
|
||||
dest: /usr/local/bin/lmn-fix-screen
|
||||
mode: '0755'
|
||||
- name: Deploy fix-screen autostarter
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/xdg/autostart/lmn-fix-screen.desktop
|
||||
mode: '0644'
|
||||
content: |
|
||||
[Desktop Entry]
|
||||
Name=fix-screen
|
||||
Exec=lmn-fix-screen
|
||||
Type=Application
|
||||
NoDisplay=true
|
||||
|
|
29
roles/lmn_misc/templates/lmn-fix-screen.j2
Normal file
29
roles/lmn_misc/templates/lmn-fix-screen.j2
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# Set the primary screen after login
|
||||
# Clone screen on all displays
|
||||
# Set audio-default-sink
|
||||
#
|
||||
set -eu
|
||||
|
||||
if [[ "$XDG_SESSION_TYPE" = wayland ]] ; then
|
||||
while ! kscreen-doctor -o; do
|
||||
sleep 1
|
||||
done
|
||||
sleep 2
|
||||
{% if dual_screen is defined %}
|
||||
kscreen-doctor output.{{ dual_screen[1] }}.priority.1
|
||||
{% endif %}
|
||||
for N in $(kscreen-doctor -j | jq -r .outputs[].name) ; do
|
||||
kscreen-doctor output.$N.mode.{{ misc_clonescreen_mode }} output.$N.position.0,0 output.$N.scale.$(kscreen-doctor -j | jq .outputs[].scale | sort | head -1);
|
||||
done
|
||||
fi
|
||||
{% if audio_output is defined %}
|
||||
pactl set-card-profile alsa_card.{{ audio_output[0] }} output:{{ audio_output[1] }}
|
||||
pactl set-default-sink alsa_output.{{ audio_output[0] }}.{{ audio_output[1] }}
|
||||
{% else %}
|
||||
if pactl list cards | grep output:hdmi-stereo: | grep verfügbar:\ ja; then
|
||||
pactl set-card-profile $(pactl list short cards | grep -m1 pci | head -1 | cut -f2) output:hdmi-stereo
|
||||
pactl set-default-sink $(pactl list short cards | grep -m1 pci | head -1 | cut -f2 | sed s/card/output/g).output:hdmi-stereo
|
||||
fi
|
||||
{% endif %}
|
Loading…
Add table
Add a link
Reference in a new issue