summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ec5cd2c8e45df79f901bde8761a866b42f5cf938 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Maintainer: Keep-Silence<keep_silence_96@163.com>

_pkgname=wechat-callout
pkgname="${_pkgname}-git"
pkgver=r4.94f9e6c
pkgrel=1
pkgdesc="微信窗口快捷键唤出/隐藏"
arch=('x86_64')
url="https://github.com/Keep-Silence/wechat-callout"
license=('MIT')
depends=('wmctrl' 'xdotool')
makedepends=('git' 'gendesk' 'go')
source=("$pkgname::git+https://github.com/Keep-Silence/wechat-callout")
sha256sums=('SKIP')
install="${pkgname}.install"

pkgver() {
  cd "$pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}

# Build function
build() {
  cd "$pkgname"

  # Set Go environment variables for the build
  export GOPROXY=https://goproxy.cn
  export GO111MODULE=on

  # Fetch dependencies
  go mod tidy

  # Build the project
  go build .
}

prepare() {
  cd "$pkgname"

  gendesk -q -f -n \
      --pkgname "${pkgname}" \
      --pkgdesc "${pkgdesc}" \
      --name "微信唤出" \
      --comment="${pkgdesc}" \
      --exec "/usr/share/${pkgname}/wechat-callout.sh" \
      --categories 'Utility;' \
      --custom StartupWMClass="${pkgname}"
}

# Package installation
package() {
  cd "$pkgname"

  # Install the main executable and other files
  install -Dm755 wechat-callout.sh -t "${pkgdir}/usr/share/${pkgname}"
  install -Dm755 wechat-callout -t "${pkgdir}/usr/share/${pkgname}"
  install -Dm644 wechat.png -t "${pkgdir}/usr/share/${pkgname}"
  install -Dm644 "${_pkgname}.desktop" -t "${pkgdir}/usr/share/applications"

}