summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 78565da6a44bc7d12fab0b65f851cba3af6cacf9 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Maintainer: Victor Coscrato <vcoscrato@users.noreply.github.com>

pkgname=quickdash-git
pkgver=r14.g046e7dc
pkgrel=1
pkgdesc="Configurable Hyprland dashboard and launcher built with Quickshell"
arch=('any')
url="https://github.com/vcoscrato/quickdash"
license=('MIT')
depends=(
  'bash'
  'bluez-utils'
  'coreutils'
  'hyprland'
  'libnotify'
  'networkmanager'
  'pipewire'
  'procps-ng'
  'quickshell>=0.3.0'
  'systemd'
  'which'
  'wireplumber'
)
makedepends=('git')
optdepends=(
  'curl: weather lookup'
  'brightnessctl: brightness controls'
  'cliphist: clipboard history'
  'hyprsunset: night-light controls'
  'wl-clipboard: restoring clipboard history entries'
  'xdg-utils: opening the config when VISUAL and EDITOR are unset'
)
provides=('quickdash')
conflicts=('quickdash')
source=("quickdash::git+${url}.git")
sha256sums=('SKIP')

pkgver() {
  if [ -d quickdash ]; then
    cd quickdash
  fi
  printf 'r%s.g%s' \
    "$(git rev-list --count HEAD)" \
    "$(git rev-parse --short=7 HEAD)"
}

package() {
  cd quickdash

  install -d "$pkgdir/usr/share/quickdash"
  install -m644 shell.qml config.example.jsonc "$pkgdir/usr/share/quickdash/"
  cp -r components core services theme widgets "$pkgdir/usr/share/quickdash/"

  install -Dm644 README.md "$pkgdir/usr/share/doc/quickdash/README.md"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  install -Dm755 /dev/stdin "$pkgdir/usr/bin/quickdash" <<'EOF'
#!/usr/bin/env bash
set -euo pipefail

readonly app_dir="${QUICKDASH_QML_DIR:-/usr/share/quickdash}"
readonly config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/quickdash"
readonly data_dir="${XDG_DATA_HOME:-$HOME/.local/share}/quickdash"
readonly config_file="$config_dir/config.jsonc"

if [[ ! -r "$app_dir/shell.qml" ]]; then
  printf 'quickdash: shell.qml not found in %s\n' "$app_dir" >&2
  exit 1
fi

install -d -m755 "$config_dir" "$data_dir"

if [[ ! -e "$config_file" && ! -L "$config_file" ]]; then
  install -m644 "$app_dir/config.example.jsonc" "$config_file"
fi

if [[ "${1:-}" == "launcher" ]]; then
  shift
  action="${1:-open}"
  case "$action" in
    open|close|toggle) ;;
    *)
      printf 'quickdash: unknown launcher action: %s\n' "$action" >&2
      printf 'usage: quickdash launcher [open|close|toggle]\n' >&2
      exit 2
      ;;
  esac

  if /usr/bin/quickshell ipc --any-display -p "$app_dir" call launcher "$action" >/dev/null 2>&1; then
    exit 0
  fi

  /usr/bin/quickshell -p "$app_dir" --no-duplicate --daemonize

  for _ in $(seq 1 30); do
    if /usr/bin/quickshell ipc --any-display -p "$app_dir" call launcher "$action" >/dev/null 2>&1; then
      exit 0
    fi
    sleep 0.05
  done

  printf 'quickdash: failed to contact launcher IPC target\n' >&2
  exit 1
fi

exec /usr/bin/quickshell -p "$app_dir" "$@"
EOF

  install -Dm644 /dev/stdin \
    "$pkgdir/usr/share/applications/quickdash.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=QuickDash
Comment=Configurable Wayland dashboard
Exec=quickdash --no-duplicate
TryExec=quickdash
Icon=quickdash
Terminal=false
Categories=Utility;
Keywords=dashboard;launcher;wayland;hyprland;quickshell;system;
StartupNotify=false
EOF

  install -Dm644 /dev/stdin \
    "$pkgdir/usr/share/icons/hicolor/scalable/apps/quickdash.svg" <<'EOF'
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
  <defs>
    <linearGradient id="bg" x1="8" y1="4" x2="56" y2="60" gradientUnits="userSpaceOnUse">
      <stop stop-color="#323d43"/>
      <stop offset="1" stop-color="#1e2326"/>
    </linearGradient>
  </defs>
  <rect x="4" y="4" width="56" height="56" rx="14" fill="url(#bg)"/>
  <rect x="12" y="12" width="10" height="40" rx="5" fill="#a7c080"/>
  <rect x="28" y="12" width="24" height="17" rx="5" fill="#4f585e"/>
  <rect x="28" y="35" width="24" height="17" rx="5" fill="#3a454a"/>
  <circle cx="40" cy="20.5" r="4" fill="#dbbc7f"/>
  <path d="M35 44h10" stroke="#83c092" stroke-width="4" stroke-linecap="round"/>
</svg>
EOF
}