diff --git a/dotfiles/xkcd_wallpaper.sh b/dotfiles/xkcd_wallpaper.sh deleted file mode 100755 index 4826d13..0000000 --- a/dotfiles/xkcd_wallpaper.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -curl -s "$(curl -sL https://c.xkcd.com/random/comic | grep 'Image URL' | awk -F\" '{print $2}')" -o ~/Pictures/xkcd-wallpaper.png diff --git a/dotfiles/clitip_wallpaper.sh b/roles/i3/files/clitip_wallpaper.sh similarity index 90% rename from dotfiles/clitip_wallpaper.sh rename to roles/i3/files/clitip_wallpaper.sh index 407b589..b569ca5 100755 --- a/dotfiles/clitip_wallpaper.sh +++ b/roles/i3/files/clitip_wallpaper.sh @@ -9,4 +9,4 @@ clitip() { xmlstarlet unesc | fmt -80 | iconv -t US } -clitip | convert -background "#222222" -fill "#237856" -size 1980x1200 -pointsize 30 -gravity center -font JetBrains-Mono-Regular label:@- ~/Pictures/clitip-wallpaper.png +clitip | convert -background "#222222" -fill "#237856" -size 1980x1200 -pointsize 30 -gravity center -font JetBrains-Mono-Regular label:@- ~/Pictures/wallpapers/clitip-wallpaper.png diff --git a/roles/i3/files/xkcd_wallpaper.sh b/roles/i3/files/xkcd_wallpaper.sh new file mode 100755 index 0000000..3ea551f --- /dev/null +++ b/roles/i3/files/xkcd_wallpaper.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +curl -s "$(curl -sL https://c.xkcd.com/random/comic | grep 'Image URL' | awk -F\" '{print $2}')" -o ~/Pictures/wallpapers/xkcd-wallpaper.png diff --git a/roles/i3/tasks/main.yml b/roles/i3/tasks/main.yml index 361b485..6f15628 100644 --- a/roles/i3/tasks/main.yml +++ b/roles/i3/tasks/main.yml @@ -48,10 +48,15 @@ - { repo: 'https://github.com/addy-dclxvi/i3-starterpack.git', dest: '~/.git_clones/i3-starterpack' } - { repo: 'https://github.com/vivien/i3blocks-contrib.git', dest: '~/.git_clones/i3blocks-contrib' } +- name: Copy i3 config + template: + src: i3config.j2 + dest: ~/.config/i3/config + backup: true + - name: Copy files copy: src={{ item.src }} dest={{ item.dest }} backup=true with_items: - - { src: 'i3config', dest: '~/.config/i3/config' } - { src: 'i3blocksconfig', dest: '~/.config/i3blocks/config' } - { src: 'xinitrc', dest: '~/.xinitrc' } - { src: 'xserverrc', dest: '~/.xserverrc' } @@ -87,6 +92,8 @@ - { src: 'battery', dest: '~/.config/i3blocks/scripts/battery' } - { src: 'free_disk_space', dest: '~/.config/i3blocks/scripts/free_disk_space' } - { src: 'pub-ip', dest: '~/.config/i3blocks/scripts/pub-ip' } + - { src: 'clitip_wallpaper.sh', dest: '~/.local/bin/clitip_wallpaper.sh' } + - { src: 'xkcd_wallpaper.sh', dest: '~/.local/bin/xkcd_wallpaper.sh' } - name: Copy scripts (Archlinux) copy: src={{ item.src }} dest={{ item.dest }} mode=0755 backup=true @@ -114,3 +121,22 @@ become: true shell: cd {{ ansible_facts.user_dir }}/.git_clones/i3blocks && make install when: ansible_facts['distribution'] == 'Debian' + +- name: Uncomment wallpaper lines for clitip or xkcd + lineinfile: + path: ~/.config/i3/config + regexp: "{{ item }}" + line: '\1' + backrefs: true + with_items: + - '^#(exec .*wallpaper\.sh$)' + - '^#(exec .* hsetroot -center .*\.png$)' + when: wallpaper_type != 'fixed' + +- name: Uncomment wallpaper lines for fixed + lineinfile: + path: ~/.config/i3/config + regexp: '^#(exec .* hsetroot -cover .*current$)' + line: '\1' + backrefs: true + when: wallpaper_type == 'fixed' diff --git a/roles/i3/files/i3config b/roles/i3/templates/i3config.j2 similarity index 95% rename from roles/i3/files/i3config rename to roles/i3/templates/i3config.j2 index 050c55b..34cc163 100644 --- a/roles/i3/files/i3config +++ b/roles/i3/templates/i3config.j2 @@ -9,9 +9,9 @@ font pango: Noto Sans 9 floating_modifier $super #autostart -#exec --no-startup-id ~/setup-cockpit/dotfiles/xkcd_wallpaper.sh -#exec --no-startup-id hsetroot -center ~/Pictures/xkcd-wallpaper.png -exec --no-startup-id hsetroot -cover ~/Pictures/wallpapers/current +#exec --no-startup-id ~/.local/bin/{{ wallpaper_type }}_wallpaper.sh +#exec --no-startup-id hsetroot -center ~/Pictures/wallpapers/{{ wallpaper_type }}-wallpaper.png +#exec --no-startup-id hsetroot -cover ~/Pictures/wallpapers/current exec --no-startup-id xsettingsd & exec --no-startup-id picom -b --config ~/.config/picom.conf diff --git a/roles/i3/vars/main.yml b/roles/i3/vars/main.yml new file mode 100644 index 0000000..8f71d23 --- /dev/null +++ b/roles/i3/vars/main.yml @@ -0,0 +1,4 @@ +--- +# wallpaper_type: xkcd +# wallpaper_type: clitip +wallpaper_type: fixed