diff --git a/README.md b/README.md index e534d84..fd9fe34 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ My current setup is [Debian Bullseye](https://www.debian.org/releases/bullseye/) - thunderbird config (pretty hard to do, should just capture steps taken somewhere) - firefox config? extensions? host own synchronizer? - Smart script to manage screens: if external screen is connected, only show on that screen. Otherwise, show on laptop screen. -- drop-in includement of bashrc parts +- fix suspend +- Better randr profiles using autorandr: https://github.com/phillipberndt/autorandr #### Neovim diff --git a/roles/asdf/files/asdf.bashrc b/roles/asdf/files/asdf.bashrc new file mode 100644 index 0000000..8061740 --- /dev/null +++ b/roles/asdf/files/asdf.bashrc @@ -0,0 +1,2 @@ +[ -f ~/.asdf/asdf.sh ] && source ~/.asdf/asdf.sh +[ -f ~/.asdf/completions/asdf.bash ] && source ~/.asdf/completions/asdf.bash diff --git a/roles/asdf/meta/main.yml b/roles/asdf/meta/main.yml index 9711b33..b60b374 100644 --- a/roles/asdf/meta/main.yml +++ b/roles/asdf/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - role: common + - role: bash diff --git a/roles/asdf/tasks/main.yml b/roles/asdf/tasks/main.yml index af13150..3c2d222 100644 --- a/roles/asdf/tasks/main.yml +++ b/roles/asdf/tasks/main.yml @@ -32,3 +32,7 @@ shell: cmd: "~/.asdf/bin/asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git" creates: ~/.asdf/plugins/elixir +- name: Copy asdf.bashrc + copy: + src: "{{ role_path }}/files/asdf.bashrc" + dest: ~/.bashrc.d/asdf.bashrc diff --git a/roles/bash/files/bashrc b/roles/bash/files/bashrc new file mode 100644 index 0000000..97e4c22 --- /dev/null +++ b/roles/bash/files/bashrc @@ -0,0 +1 @@ +for f in ~/.bashrc.d/*; do source $f; done diff --git a/roles/bash/files/fzf.bash b/roles/bash/files/fzf.bashrc similarity index 100% rename from roles/bash/files/fzf.bash rename to roles/bash/files/fzf.bashrc diff --git a/roles/bash/tasks/main.yml b/roles/bash/tasks/main.yml index 5cad899..e5c0cda 100644 --- a/roles/bash/tasks/main.yml +++ b/roles/bash/tasks/main.yml @@ -6,10 +6,18 @@ - bat - fzf - name: Install .bashrc - template: - src: "{{ role_path }}/templates/bashrc.j2" - dest: ~/.bashrc -- name: Install .fzf.bash copy: - src: "{{ role_path }}/files/fzf.bash" - dest: ~/.fzf.bash + src: "{{ role_path }}/files/bashrc" + dest: ~/.bashrc +- name: Create bashrc config directory + file: + path: ~/.bashrc.d + state: directory +- name: Copy base.bashrc + template: + src: "{{ role_path }}/templates/base.bashrc.j2" + dest: ~/.bashrc.d/base.bashrc +- name: Copy fzf.bash + copy: + src: "{{ role_path }}/files/fzf.bashrc" + dest: ~/.bashrc.d/fzf.bashrc diff --git a/roles/bash/templates/bashrc.j2 b/roles/bash/templates/base.bashrc.j2 similarity index 92% rename from roles/bash/templates/bashrc.j2 rename to roles/bash/templates/base.bashrc.j2 index 91d73a2..2137151 100644 --- a/roles/bash/templates/bashrc.j2 +++ b/roles/bash/templates/base.bashrc.j2 @@ -90,18 +90,5 @@ alias gb='git branch' alias ga='git add' alias gl='git log' -# For neovim -PATH=$PATH:/usr/local -alias vi='nvim' -alias vim='nvim' - -[ -f ~/.fzf.bash ] && source ~/.fzf.bash - -# asdf -[ -f ~/.asdf/asdf.sh ] && source ~/.asdf/asdf.sh -[ -f ~/.asdf/completions/asdf.bash ] && source ~/.asdf/completions/asdf.bash - # pip scripts PATH=$PATH:~/.local/bin - -export SSH_AUTH_SOCK="{{ ssh_agent_socket }}" diff --git a/roles/i3/files/scripts/lock.sh b/roles/i3/files/scripts/lock.sh index dbf3d76..106691f 100755 --- a/roles/i3/files/scripts/lock.sh +++ b/roles/i3/files/scripts/lock.sh @@ -2,4 +2,4 @@ SCREEN_RESOLUTION="$(xdpyinfo | grep dimensions | cut -d' ' -f7)" BGCOLOR="000000" -convert "/home/pim/Pictures/wallpapers/orphans.png" -gravity Center -background \#$BGCOLOR -resize "$SCREEN_RESOLUTION" RGB:- | i3lock --raw "$SCREEN_RESOLUTION":rgb -c $BGCOLOR -i /dev/stdin --nofork +convert "/home/pim/Pictures/wallpapers/orphans.png" -gravity Center -background \#$BGCOLOR -resize "$SCREEN_RESOLUTION" RGB:- | i3lock --raw "$SCREEN_RESOLUTION":rgb -c $BGCOLOR -i /dev/stdin diff --git a/roles/i3/tasks/main.yml b/roles/i3/tasks/main.yml index 0fd30da..263bad5 100644 --- a/roles/i3/tasks/main.yml +++ b/roles/i3/tasks/main.yml @@ -8,6 +8,8 @@ - rofi - nitrogen - xss-lock + - arandr + - autorandr - name: Create i3 config directory file: path: ~/.config/i3 @@ -37,3 +39,11 @@ copy: src: "{{ role_path }}/files/bg-saved.cfg" dest: ~/.config/nitrogen/bg-saved.cfg +- name: Handle lid close + become: true + ini_file: + path: /etc/systemd/logind.conf + section: Login + option: HandleLidSwitch + value: suspend + no_extra_spaces: true diff --git a/roles/keepassxc/files/keepassxc.bashrc b/roles/keepassxc/files/keepassxc.bashrc new file mode 100644 index 0000000..90f0330 --- /dev/null +++ b/roles/keepassxc/files/keepassxc.bashrc @@ -0,0 +1 @@ +export SSH_AUTH_SOCK="/tmp/ssh-agent.socket" diff --git a/roles/keepassxc/meta/main.yml b/roles/keepassxc/meta/main.yml new file mode 100644 index 0000000..8c8ab6e --- /dev/null +++ b/roles/keepassxc/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - role: bash diff --git a/roles/keepassxc/tasks/main.yml b/roles/keepassxc/tasks/main.yml index 39ad275..9fa4cbf 100644 --- a/roles/keepassxc/tasks/main.yml +++ b/roles/keepassxc/tasks/main.yml @@ -29,3 +29,6 @@ option: AuthSockOverride value: "{{ ssh_agent_socket }}" no_extra_spaces: true +- name: Copy keepassxc.bashrc + copy: + src: "{{ role_path }}/files/keepassxc.bashrc" diff --git a/roles/neovim/files/neovim.bashrc b/roles/neovim/files/neovim.bashrc new file mode 100644 index 0000000..6e5534f --- /dev/null +++ b/roles/neovim/files/neovim.bashrc @@ -0,0 +1,3 @@ +PATH=$PATH:/usr/local +alias vi='nvim' +alias vim='nvim' diff --git a/roles/neovim/meta/main.yml b/roles/neovim/meta/main.yml index 9711b33..b60b374 100644 --- a/roles/neovim/meta/main.yml +++ b/roles/neovim/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - role: common + - role: bash diff --git a/roles/neovim/tasks/main.yml b/roles/neovim/tasks/main.yml index c66a63b..14d6f43 100644 --- a/roles/neovim/tasks/main.yml +++ b/roles/neovim/tasks/main.yml @@ -64,3 +64,7 @@ option: "{{ item }}" value: "nvim.desktop" loop: "{{ default_apps }}" +- name: Copy neovim.bashrc + copy: + src: "{{ role_path }}/files/neovim.bashrc" + dest: ~/.bashrc.d/neovim.bashrc