commit c8f2b3ef39775f1854e5a039b534730dbc26ca23 Author: Yorick Barbanneau Date: Tue Nov 29 00:42:29 2022 +0100 First commit diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7dcadbc --- /dev/null +++ b/Makefile @@ -0,0 +1,60 @@ +# Ansible options +ansible_user ?= ephase +ansible_roles := deps +ansible_options ?= --diff +ansible_playbook ?= playbook.yml +ansible_req ?= requirements.yml +# venv options +venv_source ?= .venv +venv_cmd := . $(venv_source)/bin/activate + +#Python +python_bin ?= python +pip_req ?= requirements.txt + +.PHONY: inventory +inventory: + ansible-inventory --graph -i inventory.ini + +$(ansible_req): + +deps: $(ansible_req) + $(shell mkdir -p $(ansible_roles)) +ifeq ($(wildcard $(ansible_req)),) + $(error there is not requirements.yml file in $(ansible_data)!) +endif + $(venv_cmd) && ansible-galaxy install \ + --ignore-errors \ + --roles-path="$(ansible_roles)" \ + --role-file="$(ansible_req)" + +.PHONY: check-syntax +check-syntax: ## check-syntax #Check playbook syntax + $(venv_cmd) && ansible-playbook -i inventory.ini \ + --syntax-check $(ansible_playbook) + +.PHONY: dry-run +dry-run: ## dry-run #run playbook in check mode + $(venv_cmd) && ansible-playbook -i inventory.ini \ + --check $(ansible_options) $(ansible_playbook) \ + -u $(ansible_user) + +.PHONY: dry-run +run: ## dry-run #run playbook in check mode + $(venv_cmd) && ansible-playbook -i inventory.ini \ + $(ansible_options) $(ansible_playbook) \ + -u $(ansible_user) + +# venv management +$(venv_source): + $(python_bin) -m venv $(venv_source) + +$(pip_req): + +$(venv_source)/dep: $(venv_source) $(pip_req) + touch $(venv_source)/dep + $(venv_cmd) && pip install -r $(pip_req) + +.PHONY: clean-venv +clean-venv: + [ -d $(venv_source) ] && rm -rf $(venv_source) diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..49e13ac --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,3 @@ +[defaults] +roles_path = deps +stdout_callback = yaml diff --git a/group_vars/all/input.yml b/group_vars/all/input.yml new file mode 100644 index 0000000..1ba7b32 --- /dev/null +++ b/group_vars/all/input.yml @@ -0,0 +1,22 @@ +--- +sway_inputs: + - name: '1:1:AT_Translated_Set_2_keyboard' + options: + - option: 'xkb_layout' + value: 'gpdwinmax' + - name: '1003:8258:MNT_Reform_Keyboard' + options: + - option: 'xkb_layout' + value: 'us' + - option: 'xkb_variant' + value: 'altgr-intl' + - name: '2362:597:HTIX5288:00_093A:0255_Touchpad' + options: + - option: 'tap' + value: 'enabled' + - option: 'pointer_accel' + value: 0.3 + - name: '1046:928:Goodix_Capacitive_TouchScreen' + options: + - option: 'map_to_output' + value: 'eDP-1' diff --git a/group_vars/all/kanshi.yml b/group_vars/all/kanshi.yml new file mode 100644 index 0000000..abe8c2d --- /dev/null +++ b/group_vars/all/kanshi.yml @@ -0,0 +1,19 @@ +--- +kanshi_profiles: + - profile: 'home' + screens: + - id: 'eDP-1' + status: enable + + - profile: 'home' + screens: + - id: 'eDP-1' + status: 'disable' + - id: 'iiyama_27_4k' + position: '0,0' + - id: 'iiyama_23_fhd' + position: '1920,0' + mode: '1920x1080' + transform: 90 + commands: + - swaymsg 'workspace $ws1, move workspace to +iiyama_23_fhd+' diff --git a/group_vars/all/keybindings.yml b/group_vars/all/keybindings.yml new file mode 100644 index 0000000..39e0ba5 --- /dev/null +++ b/group_vars/all/keybindings.yml @@ -0,0 +1,105 @@ +--- +sway_keybindings: + - mode: 'normal' + bindings: + - bindsym: '$mod+Return' + action: 'exec $term' + - bindsym: '$mod+Shift+q' + action: 'kill' + - bindsym: '$mod+d' + action: 'exec $menu' + - bindsym: '$mod+Shift+c' + action: 'reload' + - bindsym: '$mod+Shift+e' + action: >- + exec swaynag -t warning -m "You pressed the exit shortcut. \ + Do you really want to exit sway? \ + This will end your Wayland session." \ + -B "Yes, exit sway" "swaymsg exit" + + # Focus + - bindsym: '$mod+$left' + action: 'focus left' + - bindsym: '$mod+$down' + action: 'focus down' + - bindsym: '$mod+$up' + action: 'focus up' + - bindsym: '$mod+$right' + action: 'focus right' + + # Use regular direction bindsym + - bindsym: '$mod+Left' + action: 'focus left' + - bindsym: '$mod+Down' + action: 'focus down' + - bindsym: '$mod+Up' + action: 'focus up' + - bindsym: '$mod+Right' + action: 'focus right' + + # move the focused window with the same, but add Shift + - bindsym: '$mod+Shift+$left' + action: 'move left' + - bindsym: '$mod+Shift+$down' + action: 'move down' + - bindsym: '$mod+Shift+$up' + action: 'move up' + - bindsym: '$mod+Shift+$right' + action: 'move right' + + - bindsym: '$mod+Shift+Left' + action: 'move left' + - bindsym: '$mod+Shift+Down' + action: 'move down' + - bindsym: '$mod+Shift+Up' + action: 'move up' + - bindsym: '$mod+Shift+Right' + action: 'move right' + + # split + - bindsym: '$mod+b' + action: 'splith' + - bindsym: '$mod+v' + action: 'splitv' + + # layout + - bindsym: '$mod+s' + action: 'layout stacking' + - bindsym: '$mod+w' + action: 'layout tabbed' + - bindsym: '$mod+e' + action: layout toggle split + + # Fullscreen + - bindsym: '$mod+f' + action: 'fullscreen' + + # Toggle floating mode + - bindsym: '$mod+Shift+space' + action: 'floating toggle' + # Swap focus between the tiling area and the floating area + - bindsym: '$mod+space' + action: 'focus mode_toggle' + # move focus to the parent container + - bindsym: '$mod+a' + action: 'focus parent' + + # Scratchpad + - bindsym: '$mod+Shift+p' + action: 'move scratchpad' + - bindsym: '$mod+p' + action: 'scratchpad show' + - mode: 'resize' + bindings: + - bindsym: '$left' + action: 'resize shrink width 10 px or 10 ppt' + - bindsym: '$down' + action: 'resize grow height 10 px or 10 ppt' + - bindsym: '$up' + action: 'resize shrink height 10 px or 10 ppt' + - bindsym: '$right' + action: 'resize grow width 10 px or 10 ppt' + - bindsym: 'Return' + action: 'mode "default"' + - bindsym: Escape + action: 'mode "default"' diff --git a/group_vars/all/output.yml b/group_vars/all/output.yml new file mode 100644 index 0000000..bba1de9 --- /dev/null +++ b/group_vars/all/output.yml @@ -0,0 +1,18 @@ +--- +sway_outputs: + - id: 'bg' + name: '*' + options: + bg: '/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill' + - id: 'eDP-1' + name: 'eDP-1' + options: + transform: 90 + - id: 'iiyama_27_4k' + name: 'Iiyama North America PL2792UH 1166310803122' + status: absent + options: + scale: 2 + - id: 'iiyama_23_fhd' + name: 'Iiyama North America PLX2380H 11177G3400889' + status: absent diff --git a/group_vars/all/packages.yml b/group_vars/all/packages.yml new file mode 100644 index 0000000..d303a82 --- /dev/null +++ b/group_vars/all/packages.yml @@ -0,0 +1,6 @@ +--- +sway_packages: + - sway + - swaybg + - swayidle + - swaylock diff --git a/group_vars/all/theme.yml b/group_vars/all/theme.yml new file mode 100644 index 0000000..98a6df0 --- /dev/null +++ b/group_vars/all/theme.yml @@ -0,0 +1,47 @@ +--- +sway_theme_parameters: + default_orientation: 'auto' + workspace_layout: 'default' + gaps: 'inner 3' + smart_gaps: 'on' + smart_borders: 'on' + font: 'pango:FuraCode Nerd Font Mono 10' + default_border: 'pixel 2' + default_floating_border: 'pixel 2' + title_align: 'center' + + # client.focused #f268b3 #a82d70 #ffffff #f268b3 #ffffff + # client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a + # client.focused_tab_title #2f343a 5f676a #ffffff + # client.unfocused #000000 #4d3d46 #cccccc #000000 #000000 + # client.urgent #2f343a #900000 #cccccc #900000 #900000 + +sway_theme_colors: + focused: + border: '#f268b3' + backgound: '#a82d70' + text: '#ffffff' + indicator: '#f268b3' + child_border: '#f268b3' + focused_inactive: + border: '#333333' + backgound: '#5f676a' + text: '#ffffff' + indicator: '#484e50' + child_border: '#5f676a' + focused_tab_title: + border: '#2f343a' + backgound: '5f676a' + text: '#ffffff' + unfocused: + border: '#000000' + backgound: '#4d3d46' + text: '#cccccc' + indicator: '#000000' + child_border: '#000000' + urgent: + border: '#2f343a' + backgound: '#900000' + text: '#cccccc' + indicator: '#900000' + child_border: '#900000' diff --git a/group_vars/all/variables.yml b/group_vars/all/variables.yml new file mode 100644 index 0000000..eda3ba4 --- /dev/null +++ b/group_vars/all/variables.yml @@ -0,0 +1,14 @@ +--- +sway_variables: + - name: '$left' + value: 'h' + - name: '$down' + value: 'j' + - name: '$up' + value: 'k' + - name: '$right' + value: 'l' + - name: '$term' + value: 'foot' + - name: '$menu' + value: 'exec $term --app-id=launcher --title=launcher ~/.local/bin/launcher.sh' diff --git a/group_vars/all/workspaces.yml b/group_vars/all/workspaces.yml new file mode 100644 index 0000000..9b42370 --- /dev/null +++ b/group_vars/all/workspaces.yml @@ -0,0 +1,56 @@ +--- +sway_workspaces: + 1: '1: ' + 2: '2: ' + 3: '3: ' + 4: '4: ' + 5: '5: ' + 6: '6: ' + 7: '7: ' + 8: '8' + 9: '9' + 0: '10' + +sway_rules: + - verb: 'assign' + query: '[app_id="^firefox$"]' + action: 3 + - verb: 'assign' + query: '[app_id="KeePassXC$"]' + action: 3 + - verb: 'assign' + query: '[app_id="org.qutebrowser.qutebrowser"]' + action: 3 + - verb: 'assign' + query: '[app_id="org.remmina.*"]' + action: 5 + - verb: 'assign' + query: '[app_id="homebank"]' + action: 6 + - verb: 'assign' + query: '[app_id="org.inkscape.Inkscape"]' + action: 7 + - verb: 'assign' + query: '[app_id="^libreoffice-*"]' + action: 6 + - verb: 'assign' + query: '[class="Gimp"]' + action: 7 + - verb: 'for_window' + query: '[app_id="imv"]' + action: 'floating enable' + - verb: 'for_window' + query: '[app_id="org.pwmt.zathura"]' + action: 'floating enable' + - verb: 'for_window' + query: '[app_id="^launcher$"]' + action: 'floating enable, resize set 800px 400px' + - verb: 'for_window' + query: '[title="Remmina Remote Desktop Client"]' + action: 'floating enable' + - verb: 'for_window' + query: '[app_id="pavucontrol"]' + action: 'floating enable, resize set 600px 400px' + - verb: 'for_window' + query: '[title="^Open .*$"]' + action: 'floating enable, resize set 900px 700px' diff --git a/inventory.ini b/inventory.ini new file mode 100644 index 0000000..df8b5f6 --- /dev/null +++ b/inventory.ini @@ -0,0 +1,2 @@ +[all] +localhost ansible_connection=local diff --git a/playbook.yml b/playbook.yml new file mode 100644 index 0000000..bfc6742 --- /dev/null +++ b/playbook.yml @@ -0,0 +1,6 @@ +--- +- hosts: all + roles: + #- ansible-sshagentd + #- ansible-sway + - ansible-mako diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..12649ee --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +ansible == 6.4.0 diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..ba89b0e --- /dev/null +++ b/requirements.yml @@ -0,0 +1,13 @@ +--- +- src: https://git.epha.se/ephase/ansible-sway + scm: git + version: main +- src: https://git.epha.se/ephase/ansible-mako + scm: git + version: main +- src: https://git.epha.se/ephase/ansible-kanshi + scm: git + version: main +- src: https://git.epha.se/ephase/ansible-sshagentd + scm: git + version: main