summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDX372017-01-26 13:44:05 +0700
committerDX372017-01-26 13:44:05 +0700
commit38b64efb32ea160ee92701058d16462309d94dba (patch)
tree83e74d79d0bb76e9b5b06aefa6e9861baac386da
parenta3a0df7c1fd0613945a9ef3ddfc27ae0dd78a3d4 (diff)
downloadaur-38b64efb32ea160ee92701058d16462309d94dba.tar.gz
Make config regen more quick
-rw-r--r--.SRCINFO12
-rw-r--r--PKGBUILD18
-rw-r--r--xlunch-conf-gen.hook (renamed from xlunch-conf-regen.hook)4
-rw-r--r--xlunch-conf-install.hook11
-rw-r--r--xlunch-conf-remove.hook10
-rw-r--r--xlunch-create-entry23
6 files changed, 68 insertions, 10 deletions
diff --git a/.SRCINFO b/.SRCINFO
index ae57d6c4c853..52e3a6c7420c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = xlunch-git
pkgdesc = Graphical app launcher for X with little dependencies
pkgver = 2.4.r0.g514bcd6
- pkgrel = 1
+ pkgrel = 2
url = http://xlunch.org/
arch = i686
arch = x86_64
@@ -12,9 +12,15 @@ pkgbase = xlunch-git
provides = xlunch
conflicts = xlunch
source = git+https://github.com/Tomas-M/xlunch.git
- source = xlunch-conf-regen.hook
+ source = xlunch-create-entry
+ source = xlunch-conf-gen.hook
+ source = xlunch-conf-install.hook
+ source = xlunch-conf-remove.hook
md5sums = SKIP
- md5sums = 4d3835da25e59f2497ab2975cafc2ac8
+ md5sums = 914c8dbbf6fdf4925de0ebe1d4cc8ea7
+ md5sums = 5cedcafe1ba39961a84f1634958ca478
+ md5sums = b3e91a3ded90c24d56a42df84124df29
+ md5sums = aa9654e2adae39523d5d56abd4cbca92
pkgname = xlunch-git
diff --git a/PKGBUILD b/PKGBUILD
index f10828c18a78..eb3b11f446a5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
_pkgname=xlunch
pkgname=xlunch-git
pkgver=2.4.r0.g514bcd6
-pkgrel=1
+pkgrel=2
pkgdesc="Graphical app launcher for X with little dependencies"
arch=('i686' 'x86_64')
url="http://xlunch.org/"
@@ -15,9 +15,15 @@ optdepends=()
provides=('xlunch')
conflicts=('xlunch')
source=('git+https://github.com/Tomas-M/xlunch.git'
- 'xlunch-conf-regen.hook')
+ 'xlunch-create-entry'
+ 'xlunch-conf-gen.hook'
+ 'xlunch-conf-install.hook'
+ 'xlunch-conf-remove.hook')
md5sums=('SKIP'
- '4d3835da25e59f2497ab2975cafc2ac8')
+ '914c8dbbf6fdf4925de0ebe1d4cc8ea7'
+ '5cedcafe1ba39961a84f1634958ca478'
+ 'b3e91a3ded90c24d56a42df84124df29'
+ 'aa9654e2adae39523d5d56abd4cbca92')
pkgver() {
cd "$_pkgname"
@@ -33,5 +39,9 @@ package() {
cd "$srcdir/$_pkgname"
install -Dm755 xlunch "$pkgdir"/usr/bin/xlunch
install -Dm755 extra/genconf "$pkgdir"/usr/bin/xlunch-genconf
- install -Dm644 ../xlunch-conf-regen.hook "$pkgdir"/usr/share/libalpm/hooks/xlunch-conf-regen.hook
+ install -Dm755 extra/sample_config.cfg "$pkgdir"/etc/xlunch/icons.conf
+ install -Dm755 ../xlunch-create-entry "$pkgdir"/usr/bin/xlunch-create-entry
+ install -Dm644 ../xlunch-conf-gen.hook "$pkgdir"/usr/share/libalpm/hooks/xlunch-conf-gen.hook
+ install -Dm644 ../xlunch-conf-install.hook "$pkgdir"/usr/share/libalpm/hooks/xlunch-conf-install.hook
+ install -Dm644 ../xlunch-conf-remove.hook "$pkgdir"/usr/share/libalpm/hooks/xlunch-conf-remove.hook
}
diff --git a/xlunch-conf-regen.hook b/xlunch-conf-gen.hook
index 8e0d6c7084b0..bb9f5b9b63ca 100644
--- a/xlunch-conf-regen.hook
+++ b/xlunch-conf-gen.hook
@@ -1,12 +1,10 @@
[Trigger]
Operation = Install
-Operation = Remove
Operation = Upgrade
Type = File
Target = usr/bin/xlunch
-Target = usr/share/applications/*
[Action]
-Description = Generating xlunch icons.conf
+Description = Generating new xlunch icons.conf
Exec = bin/sh -c 'xlunch-genconf > /etc/xlunch/icons.conf'
When = PostTransaction
diff --git a/xlunch-conf-install.hook b/xlunch-conf-install.hook
new file mode 100644
index 000000000000..9645d9e465fc
--- /dev/null
+++ b/xlunch-conf-install.hook
@@ -0,0 +1,11 @@
+[Trigger]
+Operation = Install
+Operation = Upgrade
+Type = File
+Target = usr/share/applications/*
+
+[Action]
+Description = Updating xlunch icons.conf...
+Exec = bin/sh -c 'while read -r f; do xlunch-create-entry "$f" >> /etc/xlunch/icons.conf; cat /etc/xlunch/icons.conf | sort | uniq > /etc/xlunch/icons-new.conf; mv /etc/xlunch/icons-new.conf /etc/xlunch/icons.conf; done'
+When = PostTransaction
+NeedsTargets
diff --git a/xlunch-conf-remove.hook b/xlunch-conf-remove.hook
new file mode 100644
index 000000000000..e364174ae357
--- /dev/null
+++ b/xlunch-conf-remove.hook
@@ -0,0 +1,10 @@
+[Trigger]
+Operation = Remove
+Type = File
+Target = usr/share/applications/*
+
+[Action]
+Description = Updating xlunch icons.conf...
+Exec = bin/sh -c 'while read -r f; do if [ '$f' != "/usr/share/applications" -a -n '$f' ]; then grep -v "$(xlunch-create-entry '$f')" /etc/xlunch/icons.conf > /etc/xlunch/icons-new.conf; fi; if [ -n "$(cat /etc/xlunch/icons-new.conf)" ]; then mv /etc/xlunch/icons-new.conf /etc/xlunch/icons.conf; fi; done'
+When = PreTransaction
+NeedsTargets
diff --git a/xlunch-create-entry b/xlunch-create-entry
new file mode 100644
index 000000000000..0a5810444848
--- /dev/null
+++ b/xlunch-create-entry
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+APPS=/usr/share/applications
+ICONS=/usr/share/icons/hicolor
+SIZE=48
+
+echo $1 | fgrep .desktop | while read DESKTOPFILE; do
+ NAME="$(cat $DESKTOPFILE | egrep -i "^Name=" | head -n 1 | cut -d "=" -f 2)"
+ EXEC="$(cat $DESKTOPFILE | egrep -i "^Exec=" | head -n 1 | cut -d "=" -f 2)"
+ ICON="$(cat $DESKTOPFILE | egrep -i "^Icon=" | head -n 1 | cut -d "=" -f 2)"
+ TERM="$(cat $DESKTOPFILE | egrep -i "^Terminal=" | head -n 1 | cut -d "=" -f 2)"
+
+ if [ "$TERM" = "true" ]; then
+ EXEC="xterm -e ""$EXEC"
+ fi
+
+ if [ "$ICON" != "" ]; then
+ ICON=$(find "$ICONS" | grep $SIZE"x"$SIZE | grep $ICON"[.]png" | head -n 1)
+ if [ "$ICON" != "" -a "$EXEC" != "" -a "$NAME" != "" ]; then
+ echo "$NAME;$ICON;$EXEC"
+ fi
+ fi
+done | sort | uniq