From 0e7456052566b8fe3abc8bacab7a91b6d3db612b Mon Sep 17 00:00:00 2001 From: bill-auger Date: Sun, 22 Apr 2018 23:40:06 -0400 Subject: news from /usr/share/parabola-laf/news --- PKGBUILD | 10 ++++-- skel/.config/autostart/autostart-lxde.sh | 4 --- skel/.config/autostart/autostart.sh | 59 +++++++++++++++++++++++++++----- skel/.config/libfm/libfm.conf | 2 +- 4 files changed, 59 insertions(+), 16 deletions(-) delete mode 100755 skel/.config/autostart/autostart-lxde.sh diff --git a/PKGBUILD b/PKGBUILD index 9b7756c..2f196fa 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -12,9 +12,10 @@ url="https://parabola.nu/" depends=() makedepends=() -source=("https://notabug.org/bill-auger/${pkgname}/archive/v${pkgver}.tar.gz") -sha256sums=('e70c80459f00456209bf3b2a4fedc5406071985691d7760cafd9d6e3ca59358a') - +source=("https://notabug.org/bill-auger/${pkgname}/archive/v${pkgver}.tar.gz" + news) +sha256sums=('e70c80459f00456209bf3b2a4fedc5406071985691d7760cafd9d6e3ca59358a' + 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') package() { mkdir -p $pkgdir/usr/share/backgrounds @@ -28,4 +29,7 @@ package() { cp -r ${srcdir}/${pkgname}/grub-theme $pkgdir/boot/grub/themes/${pkgname} cp -rT ${srcdir}/${pkgname}/skel $pkgdir/etc/skel cp -rT ${srcdir}/${pkgname}/bin $pkgdir/usr/bin + + mkdir -p ${pkgdir}/usr/share/${pkgname}/news + cp ${srcdir}/news ${pkgdir}/usr/share/${pkgname}/news/news-${pkgver}-${pkgrel} } diff --git a/skel/.config/autostart/autostart-lxde.sh b/skel/.config/autostart/autostart-lxde.sh deleted file mode 100755 index a65c467..0000000 --- a/skel/.config/autostart/autostart-lxde.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - - -which octopi-notifier && sleep 10 && octopi-notifier & diff --git a/skel/.config/autostart/autostart.sh b/skel/.config/autostart/autostart.sh index 3ac5a24..91be332 100755 --- a/skel/.config/autostart/autostart.sh +++ b/skel/.config/autostart/autostart.sh @@ -1,13 +1,56 @@ #!/bin/bash +readonly NEWS_DIR=/usr/share/parabola-laf/news +readonly NEWS_STAMP=~/.local/share/parabola-laf/last_news +readonly CLEANUP_MSG="These old news files are no longer needed. It is safe to delete them." +readonly ROOT_WIN_ID=$(xprop -notype -root | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') +readonly WM_NAME=$( xprop -notype -id $ROOT_WIN_ID | awk '$1=="_NET_WM_NAME"{print $3}') -for notice in ~/welcome.txt ~/news.txt -do [ -f $notice ] && gxmessage -title "_EDITION_TITLE_" \ - -file $notice \ - -buttons "OK:1,Don't show this again:0" \ - -default "OK" \ - -geometry 620x460 \ - -center -wrap -ontop -sticky && rm $notice & + +DisplayNotice() +{ + gxmessage -title "_EDITION_TITLE_" \ + -file $notice \ + -buttons "OK:1,Don't show this again:0" \ + -default "OK" \ + -geometry 620x460 \ + -center -wrap -ontop -sticky +} + +Cleanup() +{ + return # TODO: + + current_news="news-$(pacman -Si parabola-laf | awk '$1=="Version"{print $3}').txt" + declare -a read_notices=( $(grep -v $current_news $NEWS_STAMP) ) + (( ${#read_notices[*]} > 10 )) || return + + gxmessage -title "Delete read news items ?" \ + -buttons "Keep them:1,Delete them:0" \ + -default "Keep them" \ + -geometry 620x460 \ + -center -wrap -ontop -sticky \ + "$CLEANUP_MSG$(printf "\n\t%s" "${read_notices[*]}")" && \ + echo $current_news > $NEWS_STAMP && \ + chroot $NEWS_DIR "pkexec rm ${read_notices[*]}" +} + + +# display unread news items +mkdir -p $(dirname $NEWS_STAMP) ; touch $NEWS_STAMP ; +cd $NEWS_DIR +for notice in news-* # e.g. news-${pkgver}-${pkgrel} +do [ -f $notice ] && notice_exists=1 || notice_exists=0 + [ -z "$(grep $notice $NEWS_STAMP)" ] && is_unread=1 || is_unread=0 + [ -z "$(echo $(cat $notice))" ] && is_blank=1 || is_blank=0 + + (( $notice_exists && $is_unread )) || continue + + ( (( $is_blank )) || DisplayNotice ) && echo "$notice" >> $NEWS_STAMP && Cleanup & done -~/.config/autostart/autostart-lxde.sh & +# WM-specific startup tasks +case "$WM_NAME" in + '"LXDE"') which octopi-notifier && sleep 10 && octopi-notifier & ;; + '"MATE"') ;; +esac diff --git a/skel/.config/libfm/libfm.conf b/skel/.config/libfm/libfm.conf index 68b8dc8..e29ec33 100644 --- a/skel/.config/libfm/libfm.conf +++ b/skel/.config/libfm/libfm.conf @@ -19,7 +19,7 @@ template_type_once=0 auto_selection_delay=600 drop_default_action=auto defer_content_test=0 -quick_exec=0 +quick_exec=1 archiver=xarchiver thumbnail_local=1 thumbnail_max=2048 -- cgit v1.2.2