1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-22 23:12:32 +01:00

configure displays in host_vars

This commit is contained in:
eoli3n 2023-06-10 13:49:04 +02:00
parent 38c2f4cd2e
commit 95c18e8550
13 changed files with 80 additions and 187 deletions

18
host_vars/osz.yml Normal file

@ -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

20
host_vars/work.yml Normal file

@ -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

@ -2,12 +2,6 @@
- ``cli`` dir is the basedir and will be sync on all hosts - ``cli`` dir is the basedir and will be sync on all hosts
- ``desktop`` dir will be sync only on desktop 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 fish

@ -19,26 +19,26 @@
src: Trolltech.conf src: Trolltech.conf
dest: ~/.config/ dest: ~/.config/
- name: Link Xdefaults #- name: Link Xdefaults
file: # file:
src: ~/.Xresources # src: ~/.Xresources
dest: ~/.Xdefaults # dest: ~/.Xdefaults
state: link # state: link
force: yes # force: yes
#
- name: Create .Xresources.d dir #- name: Create .Xresources.d dir
file: # file:
path: ~/.Xresources.d # path: ~/.Xresources.d
state: directory # state: directory
#
- name: Configure Cursors #- name: Configure Cursors
copy: # copy:
src: cursor # src: cursor
dest: ~/.Xresources.d/ # dest: ~/.Xresources.d/
#
- name: Init Cursors in .Xresources #- name: Init Cursors in .Xresources
lineinfile: # lineinfile:
path: ~/.Xresources # path: ~/.Xresources
create: yes # create: yes
state: present # state: present
line: '#include ".Xresources.d/cursor"' # line: '#include ".Xresources.d/cursor"'

@ -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
}

@ -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
}

@ -31,10 +31,10 @@
path: ~/.config/kanshi path: ~/.config/kanshi
state: directory state: directory
- name: copy kanshi config file - name: template kanshi config file
copy: template:
src: "kanshi/by_host/{{ ansible_hostname }}/config" src: "kanshi.config.j2"
dest: ~/.config/kanshi/ dest: ~/.config/kanshi/config
failed_when: false failed_when: false
- name: fish swaylock-fancy - name: fish swaylock-fancy

@ -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####################################################

@ -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####################################################

@ -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####################################################

@ -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####################################################

@ -192,7 +192,7 @@ for_window [title="Firefox - Indicateur de partage"] floating enable
bindsym $mod+Prior move workspace to output left bindsym $mod+Prior move workspace to output left
bindsym $mod+Next move workspace to output right 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 # exec background apps

@ -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 }}
}