Use find -files0-from in newmail
This commit is contained in:
parent
da469d255f
commit
c7c81a1074
9 changed files with 38 additions and 16 deletions
20
roles/i3/files/i3blocks/newmail_maildirs
Normal file
20
roles/i3/files/i3blocks/newmail_maildirs
Normal file
|
@ -0,0 +1,20 @@
|
|||
$ANSIBLE_VAULT;1.1;AES256
|
||||
35393636343537303461653037633231666239313034636430656537656331373930613530396566
|
||||
3135623435643836383238633638363338313337326433390a363635353364306337633762333762
|
||||
33663035626461333436373635326364646438373130396635663138303838636262396435366539
|
||||
3638346238323964300a643138636338346165616231613436343031646366366334663031353433
|
||||
33663930613361656166623131656438653865393136666163346365323230313235383934356636
|
||||
34346136656335356231326362633831643138353934386236373832653537323939386337383234
|
||||
38343637346362363262363265646562643162656630363962393335303962366361653234373265
|
||||
62633336643637633039383963333030313831623662663761653266633265613334323036643932
|
||||
37613635316530623934396562313533613063363738633663353738306231663765636265663666
|
||||
38643764336639393432323264353837376333306333366362643339633638356235393439396636
|
||||
36616162653138643437636637623961656663343764343731643932333336646639306563633236
|
||||
39333333633639663033313334326333363239616239663830373839363430663365646432356665
|
||||
63336330626431363537393362613262343964353863323763393633303437393465373730343137
|
||||
64623765306233613265353862663332386231656537313030323466363039366566366562323338
|
||||
31323839326530626131393936626439303966636535373032613034393538333834393236666537
|
||||
36313736363461343833366531373230343530313861353465666237303331366531366635653365
|
||||
61643264353538623336336335646236326635353330623434343432343861653465656436396464
|
||||
33303237363461396136613730633963343032346639623538353138363236333034313561313961
|
||||
346330646235643062623666633966663737
|
11
roles/i3/files/i3blocks/scripts/newmail
Executable file
11
roles/i3/files/i3blocks/scripts/newmail
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$LABEL" ]; then
|
||||
LABEL='New: '
|
||||
fi
|
||||
|
||||
nb_new=$(find -files0-from ~/.config/i3blocks/newmail_maildirs -type d -name new -not -empty -execdir ls '{}' \+ | wc -l)
|
||||
|
||||
if [ "$nb_new" -gt 0 ]; then
|
||||
echo "${LABEL}${nb_new}"
|
||||
fi
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$MAILBOX_DIR" ]; then
|
||||
MAILBOX_DIR=~/.local/share/mail/
|
||||
fi
|
||||
|
||||
if [ -z "$LABEL" ]; then
|
||||
LABEL='New: '
|
||||
fi
|
||||
|
||||
nb_new=$(find "${MAILBOX_DIR[@]}" -type d -name new -not -empty -execdir ls '{}' \+ | wc -l)
|
||||
|
||||
if [ "$nb_new" -gt 0 ]; then
|
||||
echo "${LABEL}${nb_new}"
|
||||
fi
|
|
@ -147,7 +147,13 @@
|
|||
dest: ~/.config/i3blocks/scripts/
|
||||
mode: 0755
|
||||
with_fileglob:
|
||||
- scripts/*
|
||||
- i3blocks/scripts/*
|
||||
|
||||
- name: Copy newmail_maildirs file
|
||||
ansible.builtin.copy:
|
||||
content: "{{ lookup('file', 'i3blocks/newmail_maildirs') | replace('~', ansible_facts.user_dir) | replace('\n', '\0') }}"
|
||||
dest: ~/.config/i3blocks/newmail_maildirs
|
||||
mode: 0644
|
||||
|
||||
- name: Update user dirs
|
||||
ansible.builtin.command: xdg-user-dirs-update
|
||||
|
|
Loading…
Add table
Reference in a new issue