diff --git a/host_vars/osz.yml b/host_vars/osz.yml new file mode 100644 index 0000000..d0c4c11 --- /dev/null +++ b/host_vars/osz.yml @@ -0,0 +1,18 @@ +--- +displays: + - name: laptop + id: eDP-1 + x: 548 + y: 1388 + mode: 1920x1080 + scale: 1.4 + - name: screen1 + id: DP-3 + x: 1920 + y: 1080 + mode: 1920x1080 + scale: 1 + - name: screen2 + id: ONKYO Corporation Sound System Unknown + mode: 1920x1080 + scale: 1 diff --git a/host_vars/work.yml b/host_vars/work.yml new file mode 100644 index 0000000..2b3477c --- /dev/null +++ b/host_vars/work.yml @@ -0,0 +1,20 @@ +--- +displays: + - name: laptop + id: eDP-1 + x: 0 + y: 920 + mode: 1920x1080 + scale: 1.4 + - name: screen1 + id: DP-3 + x: 1280 + y: 0 + mode: 1920x1080 + scale: 1 + - name: screen2 + id: DP-4 + mode: 1920x1080 + x: 3200 + y: 0 + scale: 1 diff --git a/roles/fish/README.md b/roles/fish/README.md index 0438434..2e1d905 100644 --- a/roles/fish/README.md +++ b/roles/fish/README.md @@ -2,12 +2,6 @@ - ``cli`` dir is the basedir and will be sync on all hosts - ``desktop`` dir will be sync only on desktop hosts. -- If you want to configure something for a specific host, use this snippets in *fish* script: -``` -if test "$hostname" = "host1" - set -x key "value" -end -``` ``` fish diff --git a/roles/gtk/tasks/main.yml b/roles/gtk/tasks/main.yml index cd65610..39c43f0 100644 --- a/roles/gtk/tasks/main.yml +++ b/roles/gtk/tasks/main.yml @@ -19,26 +19,26 @@ src: Trolltech.conf dest: ~/.config/ -- name: Link Xdefaults - file: - src: ~/.Xresources - dest: ~/.Xdefaults - state: link - force: yes - -- name: Create .Xresources.d dir - file: - path: ~/.Xresources.d - state: directory - -- name: Configure Cursors - copy: - src: cursor - dest: ~/.Xresources.d/ - -- name: Init Cursors in .Xresources - lineinfile: - path: ~/.Xresources - create: yes - state: present - line: '#include ".Xresources.d/cursor"' +#- name: Link Xdefaults +# file: +# src: ~/.Xresources +# dest: ~/.Xdefaults +# state: link +# force: yes +# +#- name: Create .Xresources.d dir +# file: +# path: ~/.Xresources.d +# state: directory +# +#- name: Configure Cursors +# copy: +# src: cursor +# dest: ~/.Xresources.d/ +# +#- name: Init Cursors in .Xresources +# lineinfile: +# path: ~/.Xresources +# create: yes +# state: present +# line: '#include ".Xresources.d/cursor"' diff --git a/roles/sway/files/kanshi/by_host/osz/config b/roles/sway/files/kanshi/by_host/osz/config deleted file mode 100644 index 8a83070..0000000 --- a/roles/sway/files/kanshi/by_host/osz/config +++ /dev/null @@ -1,14 +0,0 @@ -profile { - output "ONKYO Corporation Sound System Unknown" disable - output "DP-3" position 1920,1080 mode 1920x1080 - output "eDP-1" position 548,1388 mode 1920x1080 scale 1.4 -} - -profile { - output "DP-3" position 1920,1080 mode 1920x1080 - output "eDP-1" position 548,1388 mode 1920x1080 scale 1.4 -} - -profile { - output "eDP-1" position 0,0 mode 1920x1080 scale 1.4 -} diff --git a/roles/sway/files/kanshi/by_host/work/config b/roles/sway/files/kanshi/by_host/work/config deleted file mode 100644 index db8731a..0000000 --- a/roles/sway/files/kanshi/by_host/work/config +++ /dev/null @@ -1,10 +0,0 @@ -profile { - output "eDP-1" position 0,920 mode 1920x1080 scale 1.5 - output "DP-3" position 1280,0 mode 1920x1200 - output "DP-4" position 3200,0 mode 1920x1200 -} - -profile { - output "eDP-1" position 0,0 mode 1920x1080 scale 1 -} - diff --git a/roles/sway/tasks/main.yml b/roles/sway/tasks/main.yml index 1fc8d20..114573e 100644 --- a/roles/sway/tasks/main.yml +++ b/roles/sway/tasks/main.yml @@ -31,10 +31,10 @@ path: ~/.config/kanshi state: directory -- name: copy kanshi config file - copy: - src: "kanshi/by_host/{{ ansible_hostname }}/config" - dest: ~/.config/kanshi/ +- name: template kanshi config file + template: + src: "kanshi.config.j2" + dest: ~/.config/kanshi/config failed_when: false - name: fish swaylock-fancy diff --git a/roles/sway/templates/by_host/arch-test/config.j2 b/roles/sway/templates/by_host/arch-test/config.j2 deleted file mode 100644 index 06a03b4..0000000 --- a/roles/sway/templates/by_host/arch-test/config.j2 +++ /dev/null @@ -1,21 +0,0 @@ -#INCLUDE#################################################### -# output configuration -set $laptop "eDP-1" -output $laptop pos 1920 0 res 1920x1080 -output $laptop scale 1 - -# lid -bindswitch --reload lid:on output $laptop disable -bindswitch --reload lid:off output $laptop enable - -# dpms -output * dpms on - -# exec startup apps -#exec --no-startup-id swaymsg 'exec xbindkeys &' -#exec --no-startup-id swaymsg 'exec variety &' -exec --no-startup-id swaymsg 'exec firefox' -#exec --no-startup-id swaymsg 'exec firefox -private -kiosk "www.gmail.com"' -exec --no-startup-id swaymsg 'workspace $tag4; exec alacritty -e "screen -rd weechat &"' -exec --no-startup-id swaymsg 'workspace $tag2; exec alacritty -e "ssh-add" && termite' -#INCLUDE#################################################### diff --git a/roles/sway/templates/by_host/nixtest/config.j2 b/roles/sway/templates/by_host/nixtest/config.j2 deleted file mode 100644 index 375dae4..0000000 --- a/roles/sway/templates/by_host/nixtest/config.j2 +++ /dev/null @@ -1,21 +0,0 @@ -#INCLUDE#################################################### -# output configuration -set $laptop "eDP-1" -output $laptop pos 1920 0 res 1920x1080 -output $laptop scale 1 - -# lid -bindswitch --reload lid:on output $laptop disable -bindswitch --reload lid:off output $laptop enable - -# dpms -output * dpms on - -# exec startup apps -exec --no-startup-id swaymsg 'exec xbindkeys &' -exec --no-startup-id swaymsg 'exec variety &' -exec --no-startup-id swaymsg 'exec firefox' -#exec --no-startup-id swaymsg 'exec firefox -private -kiosk "www.gmail.com"' -exec --no-startup-id swaymsg 'workspace $tag4; exec termite -e "screen -rd weechat &"' -exec --no-startup-id swaymsg 'workspace $tag2; exec termite -e "ssh-add" && termite' -#INCLUDE#################################################### diff --git a/roles/sway/templates/by_host/osz/config.j2 b/roles/sway/templates/by_host/osz/config.j2 deleted file mode 100644 index f79dd00..0000000 --- a/roles/sway/templates/by_host/osz/config.j2 +++ /dev/null @@ -1,56 +0,0 @@ -#INCLUDE#################################################### -# output configuration -set $laptop "eDP-1" -set $screen "DP-3" -#set $proj "ONKYO Corporation Sound System 0x00000000" - -#output $proj pos 0 0 res 1920x1080 -#output $screen pos 0 1080 res 1920x1080 -#output $laptop pos 1920 1560 res 1920x1080 scale 1.8 - -# toggle proj -bindsym --no-repeat $mod+p output $proj toggle -bindsym --no-repeat $mod+Shift+p output $screen toggle; output $laptop toggle - -# start kanshi -exec_always "pkill kanshi; kanshi" - -# dpms -output * dpms on - -# turn of screen when laptop closed -bindswitch --reload lid:on output $laptop disable -bindswitch --reload lid:off output $laptop enable - -# assign workspace to screens -workspace $tag1 output $screen -workspace $tag2 output $screen -workspace $tag3 output $screen -workspace $tag4 output $laptop -workspace $tag5 output $screen -workspace $tag6 output $laptop -workspace $tag7 output $laptop -workspace $tag8 output $laptop -workspace $tag9 output $laptop -workspace $tag10 output $laptop - -# laptop bindsyms -bindsym XF86AudioRaiseVolume exec pamixer -ui 5 && \ - pamixer --get-volume > $SWAYSOCK.wob -bindsym XF86AudioLowerVolume exec pamixer -ud 5 && \ - pamixer --get-volume > $SWAYSOCK.wob -bindsym XF86AudioMute exec pamixer --toggle-mute && \ - ( pamixer --get-mute && echo 0 > $SWAYSOCK.wob ) || \ - pamixer --get-volume > $SWAYSOCK.wob -bindsym XF86AudioMicMute exec amixer set Capture toggle -bindsym XF86MonBrightnessUp exec brightnessctl set +10% && \ - brightnessctl -m | cut -d',' -f4 | tr -d '%' > $SWAYSOCK.wob -bindsym XF86MonBrightnessDown exec brightnessctl set 10%- && \ - brightnessctl -m | cut -d',' -f4 | tr -d '%' > $SWAYSOCK.wob - -# autostart per host -# syncthing -exec_always bash -c "pgrep -x syncthing || syncthing" -# pipewire -exec_always bash -c "pgrep -x pipewire || pipewire" -#INCLUDE#################################################### diff --git a/roles/sway/templates/by_host/work/config.j2 b/roles/sway/templates/by_host/work/config.j2 deleted file mode 100644 index e855d4a..0000000 --- a/roles/sway/templates/by_host/work/config.j2 +++ /dev/null @@ -1,31 +0,0 @@ -#INCLUDE#################################################### -# output configuration -set $left "eDP-1" -set $center "DP-3" -set $right "DP-4" -output $left pos 0 920 res 1920x1080 scale 1.5 -output $center pos 1280 0 res 1920x1200 -output $right pos 3200 0 res 1920x1200 - -# dpms -output * dpms on - -# turn of screen when laptop closed -bindswitch --reload lid:on output $laptop disable -bindswitch --reload lid:off output $laptop enable - -# assign workspace to screens -workspace $tag1 output $center -workspace $tag2 output $center -workspace $tag3 output $right -workspace $tag4 output $left -workspace $tag5 output $right -workspace $tag6 output $right -workspace $tag7 output $center -workspace $tag8 output $center -workspace $tag9 output $left -workspace $tag10 output $left - -# syncthing -exec_always bash -c "pgrep -x syncthing || syncthing" -#INCLUDE#################################################### diff --git a/roles/sway/templates/config.j2 b/roles/sway/templates/config.j2 index 24e94e8..4db758b 100644 --- a/roles/sway/templates/config.j2 +++ b/roles/sway/templates/config.j2 @@ -192,7 +192,7 @@ for_window [title="Firefox - Indicateur de partage"] floating enable bindsym $mod+Prior move workspace to output left bindsym $mod+Next move workspace to output right -{% include 'by_host/' + ansible_hostname + '/config.j2' ignore missing %} +{% include 'hosts/sway/' + ansible_hostname + '/config.j2' ignore missing %} # exec background apps diff --git a/roles/sway/templates/kanshi.config.j2 b/roles/sway/templates/kanshi.config.j2 new file mode 100644 index 0000000..604c65d --- /dev/null +++ b/roles/sway/templates/kanshi.config.j2 @@ -0,0 +1,14 @@ +profile { + output "{{ (displays | selectattr('name', 'eq', 'screen2')).0.id }}" disable + output "{{ (displays | selectattr('name', 'eq', 'screen1')).0.id }}" position {{ (displays | selectattr('name', 'eq', 'screen1')).0.x }},{{ (displays | selectattr('name', 'eq', 'screen1')).0.y }} mode {{ (displays | selectattr('name', 'eq', 'screen1')).0.mode }} scale {{ (displays | selectattr('name', 'eq', 'screen1')).0.scale }} + output "{{ (displays | selectattr('name', 'eq', 'laptop')).0.id }}" position {{ (displays | selectattr('name', 'eq', 'laptop')).0.x }},{{ (displays | selectattr('name', 'eq', 'laptop')).0.y }} mode {{ (displays | selectattr('name', 'eq', 'laptop')).0.mode }} scale {{ (displays | selectattr('name', 'eq', 'laptop')).0.scale }} +} + +profile { + output "{{ (displays | selectattr('name', 'eq', 'screen1')).0.id }}" position {{ (displays | selectattr('name', 'eq', 'screen1')).0.x }},{{ (displays | selectattr('name', 'eq', 'screen1')).0.y }} mode {{ (displays | selectattr('name', 'eq', 'screen1')).0.mode }} scale {{ (displays | selectattr('name', 'eq', 'screen1')).0.scale }} + output "{{ (displays | selectattr('name', 'eq', 'laptop')).0.id }}" position {{ (displays | selectattr('name', 'eq', 'laptop')).0.x }},{{ (displays | selectattr('name', 'eq', 'laptop')).0.y }} mode {{ (displays | selectattr('name', 'eq', 'laptop')).0.mode }} scale {{ (displays | selectattr('name', 'eq', 'laptop')).0.scale }} +} + +profile { + output "{{ (displays | selectattr('name', 'eq', 'laptop')).0.id }}" position 0,0 mode {{ (displays | selectattr('name', 'eq', 'laptop')).0.mode }} scale {{ (displays | selectattr('name', 'eq', 'laptop')).0.scale }} +}