From 2f77c9e94e99b39d0fd0a26bba91923c7681d0e1 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Tue, 20 Feb 2024 11:03:06 +0100 Subject: [PATCH] More settings for i3 --- playbooks/apt_i3.yaml | 7 ++++--- playbooks/gpg.yaml | 20 ++++++++++++++++++++ playbooks/i3.yaml | 10 +++++++++- templates/gpg-agent.conf.j2 | 5 +++++ templates/i3_config.j2 | 10 +++++----- templates/monitors.sh.j2 | 17 +++++++++++++++++ templates/slack.desktop.j2 | 2 +- 7 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 playbooks/gpg.yaml create mode 100644 templates/gpg-agent.conf.j2 create mode 100755 templates/monitors.sh.j2 diff --git a/playbooks/apt_i3.yaml b/playbooks/apt_i3.yaml index 6320e31..016e8f2 100644 --- a/playbooks/apt_i3.yaml +++ b/playbooks/apt_i3.yaml @@ -23,9 +23,9 @@ - dia - evince - fcitx5 + - feh - file-roller - firmware-linux - - flameshot - git - hiera-eyaml - i3 @@ -61,12 +61,13 @@ - puppet-lint - python3-deepdiff - python3-openstackclient - - python3-yamlfix +# - python3-yamlfix - python3-xdg - qt5ct - rsync - rofi - scdaemon + - seahorse - shfmt - simple-scan - thunar @@ -75,7 +76,7 @@ - unzip - waypipe - wget - - x11-server-utils +# - x11-server-utils - xclip - xdg-desktop-portal - xdg-desktop-portal-gtk diff --git a/playbooks/gpg.yaml b/playbooks/gpg.yaml new file mode 100644 index 0000000..ecc18e8 --- /dev/null +++ b/playbooks/gpg.yaml @@ -0,0 +1,20 @@ +--- +- name: Set up gpg + hosts: localhost + connection: local + vars: + uid: "{{ lookup('env', 'USER') }}" + cert_test: "{{ lookup('ansible.builtin.pipe', 'pass show kube1.drive.test.sunet.se/cert') }}" + token_test: "{{ lookup('ansible.builtin.pipe', 'pass show kube1.drive.test.sunet.se/token') }}" + cert_prod: "{{ lookup('ansible.builtin.pipe', 'pass show kube1.drive.sunet.se/cert') }}" + token_prod: "{{ lookup('ansible.builtin.pipe', 'pass show kube1.drive.sunet.se/token') }}" + become: false + tasks: + - name: Add gnupg conf dir + ansible.builtin.file: + dest: /home/{{ uid }}/.gnupg + state: directory + - name: Add kube.conf + ansible.builtin.template: + src: ../templates/gpg-agent.conf.j2 + dest: /home/{{ uid }}/.gnupg/gpg-agent.conf diff --git a/playbooks/i3.yaml b/playbooks/i3.yaml index 2faf37b..b2b11a8 100644 --- a/playbooks/i3.yaml +++ b/playbooks/i3.yaml @@ -33,7 +33,15 @@ dest: '{{ wallpaper_path }}' src: ../data/debian.jpg notify: Reload i3 + - name: Install monitor script + ansible.builtin.template: + src: ../templates/monitors.sh.j2 + dest: /home/{{ uid }}/.local/bin/monitors.sh + owner: '{{ uid }}' + group: '{{ uid }}' + mode: '0750' + notify: Reload i3 handlers: - name: Reload i3 ansible.builtin.command: - cmd: i3msg reload + cmd: i3-msg reload diff --git a/templates/gpg-agent.conf.j2 b/templates/gpg-agent.conf.j2 new file mode 100644 index 0000000..3c8b30f --- /dev/null +++ b/templates/gpg-agent.conf.j2 @@ -0,0 +1,5 @@ +scdaemon-program /usr/lib/gnupg/scdaemon +enable-ssh-support +# Enable debug logging if needed +#debug guru +#log-file /dev/shm/gpg-agent.log diff --git a/templates/i3_config.j2 b/templates/i3_config.j2 index 654dacd..7da4b4b 100644 --- a/templates/i3_config.j2 +++ b/templates/i3_config.j2 @@ -22,12 +22,12 @@ font pango:monospace 8 # Start XDG autostart .desktop files using dex. See also # https://wiki.archlinux.org/index.php/XDG_Autostart exec --no-startup-id dex --autostart --environment i3 +exec --no-startup-id setxkbmap -layout se -variant us # Other autostart exec --no-startup-id autotiling exec --no-startup-id picom -b -exec --no-startup-id xrandr --output DP-1 --auto --left-of eDP-1 -exec --no-startup-id nitrogen --restore +exec --no-startup-id ${HOME}/.local/bin/monitors.sh # The combination of xss-lock, nm-applet and pactl is a popular choice, so # they are included here as an example. Modify as you see fit. @@ -198,7 +198,7 @@ mode $power_mode { bindsym p exec systemctl poweroff bindsym r exec systemctl reboot bindsym l exec i3lock -c 000000, mode "default" - bindsym q exec --no-startup-id swaymsg exit, mode "default" + bindsym q exec --no-startup-id i3-msg exit, mode "default" bindsym h exec systemctl hibernate bindsym s exec pm-suspend @@ -210,6 +210,6 @@ mode $power_mode { # finds out, if available) bar { position top - tray_output eDP-1 - status_command i3status + tray_output primary + status_command i3status } diff --git a/templates/monitors.sh.j2 b/templates/monitors.sh.j2 new file mode 100755 index 0000000..ee011b8 --- /dev/null +++ b/templates/monitors.sh.j2 @@ -0,0 +1,17 @@ +#!/bin/bash + +monitors="$(xrandr | awk '/ connected/ {print $1}')" +num_monitors="$(echo "${monitors}" | wc -l)" + +if [[ $num_monitors -ge 3 ]]; then + xrandr --output eDP-1 --off --output DP-4 --left-of DP-3 --primary --output DP-3 --auto +else + primary="$(echo "${monitors}" | head -n 1)" + output="$(echo "${monitors}" | tail -n 1)" + command="xrandr --output --output ${primary} --primary" + if [[ ${output} != ${primary} ]]; then + command="${command} --right-of ${output} --output ${output} --auto" + fi + ${command} +fi +feh --bg-scale {{ wallpaper_path }} diff --git a/templates/slack.desktop.j2 b/templates/slack.desktop.j2 index 11a5d8b..ec8d121 100644 --- a/templates/slack.desktop.j2 +++ b/templates/slack.desktop.j2 @@ -3,7 +3,7 @@ Name=Slack StartupWMClass=Slack Comment=Slack Desktop GenericName=Slack Client for Linux -Exec=/usr/bin/slack --ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer %U +Exec=/usr/bin/slack %U Icon=/usr/share/pixmaps/slack.png Type=Application StartupNotify=true