Compare commits
No commits in common. "d68a0d42c326ce5b2a67738a5e31ecd55777dc26" and "63130529bb20d9d7fd47611a802add171a795208" have entirely different histories.
d68a0d42c3
...
63130529bb
34
.SRCINFO
34
.SRCINFO
|
|
@ -1,27 +1,25 @@
|
||||||
pkgbase = hardcode-tray-git
|
pkgbase = hardcode-tray-git
|
||||||
pkgdesc = Fixes hardcoded tray icons
|
pkgdesc = Fixes Hardcoded Tray Icons
|
||||||
pkgver = 4.3.r224.ga91b4b7
|
pkgver = 3.6.5
|
||||||
pkgrel = 2
|
pkgrel = 1
|
||||||
url = https://github.com/bil-elmoussaoui/Hardcode-Tray
|
url = https://github.com/bil-elmoussaoui/Hardcode-Tray
|
||||||
|
arch = i686
|
||||||
arch = x86_64
|
arch = x86_64
|
||||||
license = GPL3
|
license = GPL
|
||||||
makedepends = git
|
makedepends = git
|
||||||
makedepends = gobject-introspection
|
depends = python
|
||||||
makedepends = meson
|
|
||||||
depends = gtk3
|
|
||||||
depends = librsvg
|
|
||||||
depends = python-cairosvg
|
|
||||||
depends = python-gobject
|
depends = python-gobject
|
||||||
optdepends = nodejs-svgexport: option to convert svg to png
|
depends = python-cairosvg
|
||||||
optdepends = imagemagick: option to convert svg to png
|
depends = librsvg
|
||||||
optdepends = inkscape: option to convert svg to png
|
depends = gtk3
|
||||||
provides = hardcode-tray
|
optdepends = sni-qt-patched-git: patched qt4 sni plugin to enable icon modification
|
||||||
|
optdepends = inkscape: to convert svg to png with inkscape
|
||||||
|
optdepends = lib32-sni-qt-patched-git: 32-bit patched qt4 sni plugin to enable icon modification
|
||||||
|
provides = hardcode-tray-git
|
||||||
|
conflicts = hardcode-tray-fixer-git
|
||||||
conflicts = hardcode-tray
|
conflicts = hardcode-tray
|
||||||
source = hardcode-tray::git+https://github.com/bil-elmoussaoui/Hardcode-Tray.git
|
source = git://github.com/bil-elmoussaoui/Hardcode-Tray
|
||||||
source = 90-hardcode-tray.hook
|
|
||||||
source = hook.py
|
|
||||||
sha256sums = SKIP
|
sha256sums = SKIP
|
||||||
sha256sums = c16ba6a82d4fe523cb91bf472b44296db82ff301866e3bce18bb4149d0aae5ea
|
|
||||||
sha256sums = 64a9907f74c5c04fb9f32b2b0684a3ce040d3bc2baacabb3ca1e914d70f24c81
|
|
||||||
|
|
||||||
pkgname = hardcode-tray-git
|
pkgname = hardcode-tray-git
|
||||||
|
|
||||||
|
|
|
||||||
10
.gitignore
vendored
10
.gitignore
vendored
|
|
@ -1,10 +0,0 @@
|
||||||
# Ignore everything
|
|
||||||
*
|
|
||||||
|
|
||||||
# But not these files...
|
|
||||||
!.gitignore
|
|
||||||
!PKGBUILD
|
|
||||||
!.SRCINFO
|
|
||||||
!90-hardcode-tray.hook
|
|
||||||
!hook.py
|
|
||||||
!doasuser.patch
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
[Trigger]
|
|
||||||
Operation = Install
|
|
||||||
Operation = Upgrade
|
|
||||||
Type = Package
|
|
||||||
Target = *
|
|
||||||
|
|
||||||
[Action]
|
|
||||||
Description = Updating tray icons...
|
|
||||||
Depends = hardcode-tray-git
|
|
||||||
When = PostTransaction
|
|
||||||
Exec = /usr/bin/python /usr/share/hardcode-tray/hook.py
|
|
||||||
NeedsTargets
|
|
||||||
80
PKGBUILD
80
PKGBUILD
|
|
@ -1,60 +1,36 @@
|
||||||
# Maintainer: Mark Wagie <mark dot wagie at tutanota dot com>
|
|
||||||
# Contributor: Yuanji <self@gimo.me>
|
# Maintainer: Bilal Elmoussaoui <bil.elmoussaoui@gmail.com>
|
||||||
# Contributor: Bilal Elmoussaoui <bil.elmoussaoui@gmail.com>
|
|
||||||
pkgname=hardcode-tray-git
|
_pkgbase=hardcode-tray-git
|
||||||
pkgver=4.3.r246.g1d52b2c
|
_gitname=Hardcode-Tray
|
||||||
|
pkgname=$_pkgbase
|
||||||
|
pkgver=3.6.5
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Fixes hardcoded tray icons"
|
pkgdesc="Fixes Hardcoded Tray Icons"
|
||||||
arch=('x86_64')
|
arch=('i686' 'x86_64')
|
||||||
url="https://github.com/bil-elmoussaoui/Hardcode-Tray"
|
url="https://github.com/bil-elmoussaoui/Hardcode-Tray"
|
||||||
license=('GPL3')
|
license=('GPL')
|
||||||
depends=('gtk3' 'librsvg' 'python-cairosvg' 'python-gobject')
|
provides=("$_pkgbase")
|
||||||
makedepends=('git' 'gobject-introspection' 'meson')
|
makedepends=("git")
|
||||||
optdepends=('nodejs-svgexport: option to convert svg to png'
|
conflicts=("hardcode-tray-fixer-git" "hardcode-tray")
|
||||||
'imagemagick: option to convert svg to png'
|
depends=('python' 'python-gobject' 'python-cairosvg' 'librsvg' 'gtk3')
|
||||||
'inkscape: option to convert svg to png')
|
optdepends=('sni-qt-patched-git: patched qt4 sni plugin to enable icon modification' 'inkscape: to convert svg to png with inkscape')
|
||||||
provides=("${pkgname%-git}")
|
optdepends_x86_64=('lib32-sni-qt-patched-git: 32-bit patched qt4 sni plugin to enable icon modification')
|
||||||
conflicts=("${pkgname%-git}")
|
source=("git://github.com/bil-elmoussaoui/Hardcode-Tray")
|
||||||
source=("${pkgname%-git}::git+https://github.com/bil-elmoussaoui/Hardcode-Tray.git"
|
sha256sums=('SKIP')
|
||||||
"90-${pkgname%-git}.hook"
|
|
||||||
"hook.py"
|
|
||||||
"doasuser.patch")
|
|
||||||
sha256sums=('SKIP'
|
|
||||||
'c16ba6a82d4fe523cb91bf472b44296db82ff301866e3bce18bb4149d0aae5ea'
|
|
||||||
'64a9907f74c5c04fb9f32b2b0684a3ce040d3bc2baacabb3ca1e914d70f24c81'
|
|
||||||
'8f567656707f3e1bc534f2b30b0f87a1b9df9372be27788b61044a54fec90045')
|
|
||||||
|
|
||||||
pkgver() {
|
pkgver() {
|
||||||
cd "$srcdir/${pkgname%-git}"
|
cd "$srcdir/$_gitname"
|
||||||
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
( set -o pipefail
|
||||||
}
|
git describe --long 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' ||
|
||||||
|
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||||||
prepare() {
|
)
|
||||||
cd "$srcdir/${pkgname%-git}"
|
|
||||||
|
|
||||||
# Correct app.asar path for community bitwarden package
|
|
||||||
sed -i 's|/usr/lib/bitwarden/resources/|/usr/lib/bitwarden/|g' \
|
|
||||||
data/database/bitwarden.electron.json
|
|
||||||
|
|
||||||
# Add doas support
|
|
||||||
patch --forward --strip=1 --input="${srcdir}/doasuser.patch"
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
|
||||||
arch-meson "${pkgname%-git}" build
|
|
||||||
meson compile -C build
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
meson install -C build --destdir "$pkgdir"
|
install -Dm755 "$srcdir/$_gitname/script.py" "$pkgdir/opt/$_gitname/script.py"
|
||||||
|
install -Dm755 "$srcdir/$_gitname/hardcode-tray" "$pkgdir/usr/bin/hardcode-tray"
|
||||||
# Compile Python bytecode:
|
install -d "$pkgdir/opt/$_gitname"
|
||||||
local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
|
cp -r -f "$srcdir/$_gitname/database" "$pkgdir/opt/$_gitname"
|
||||||
python -m compileall -d "$site_packages" "$pkgdir$site_packages"
|
cp -r -f "$srcdir/$_gitname/modules" "$pkgdir/opt/$_gitname"
|
||||||
python -O -m compileall -d "$site_packages" "$pkgdir$site_packages"
|
|
||||||
|
|
||||||
# Add pacman hook
|
|
||||||
# https://github.com/bilelmoussaoui/Hardcode-Tray/issues/454
|
|
||||||
install -Dm644 "$srcdir/90-${pkgname%-git}.hook" -t "$pkgdir/etc/pacman.d/hooks"
|
|
||||||
install -Dm644 "$srcdir/hook.py" -t "$pkgdir/usr/share/${pkgname%-git}"
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
diff --unified --recursive --text --color hardcode-tray.orig/const.py.in hardcode-tray.new/const.py.in
|
|
||||||
--- hardcode-tray.orig/const.py.in 2023-05-04 15:16:47.519709571 -0500
|
|
||||||
+++ hardcode-tray.new/const.py.in 2023-05-04 15:19:08.596711509 -0500
|
|
||||||
@@ -24,7 +24,7 @@
|
|
||||||
from HardcodeTray.tools import detect_de, get_themes
|
|
||||||
|
|
||||||
DB_FOLDER = path.join("@DATA_DIR@", "database", "")
|
|
||||||
-USERNAME = getenv("SUDO_USER") or getenv("USER")
|
|
||||||
+USERNAME = getenv("SUDO_USER") or getenv("DOAS_USER") or getenv("USER")
|
|
||||||
USERHOME = path.expanduser("~" + USERNAME)
|
|
||||||
BACKUP_FOLDER = path.join(USERHOME, ".config", "Hardcode-Tray", "")
|
|
||||||
CONFIG_FILE = path.join(USERHOME, ".config", "hardcode-tray.json")
|
|
||||||
135
hook.py
135
hook.py
|
|
@ -1,135 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import json
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from subprocess import run, PIPE
|
|
||||||
from glob import glob
|
|
||||||
from os import path
|
|
||||||
|
|
||||||
from HardcodeTray.const import DB_FOLDER, USERHOME
|
|
||||||
|
|
||||||
HARDCORE_TRAY_PACKAGES = ['hardcode-tray-git', 'hardcode-tray']
|
|
||||||
BLACKLIST = ['mullvad'] # Added cause got /usr/bin in it paths
|
|
||||||
|
|
||||||
CONVERSION_TOOL = 'RSVGConvert' # None if not needed
|
|
||||||
THEME = 'Papirus-Dark' # None if not needed
|
|
||||||
|
|
||||||
|
|
||||||
class Hook:
|
|
||||||
userhome_re = r"{userhome}"
|
|
||||||
|
|
||||||
def __init__(self, packages):
|
|
||||||
self.__packages = packages
|
|
||||||
self.__db = self.read_db_files()
|
|
||||||
|
|
||||||
|
|
||||||
def read_db_files(self):
|
|
||||||
""" Reading all package paths """
|
|
||||||
|
|
||||||
files = glob("{0}*.json".format(path.join(DB_FOLDER, "")))
|
|
||||||
db = {}
|
|
||||||
|
|
||||||
for db_file in files:
|
|
||||||
script_name = path.splitext(path.basename(db_file))[0]
|
|
||||||
|
|
||||||
if script_name in BLACKLIST:
|
|
||||||
continue
|
|
||||||
|
|
||||||
with open(db_file, 'r') as db_file:
|
|
||||||
app_path = json.load(db_file)['app_path']
|
|
||||||
db[script_name] = [re.sub(Hook.userhome_re, USERHOME, sctipt_path) for sctipt_path in app_path]
|
|
||||||
|
|
||||||
return db
|
|
||||||
|
|
||||||
def get_package_paths(self, package):
|
|
||||||
""" Reading all package paths from pacman """
|
|
||||||
|
|
||||||
regex = r"^%s\s+" % re.escape(package)
|
|
||||||
proc = run(
|
|
||||||
[
|
|
||||||
"pacman", "-Ql",
|
|
||||||
package
|
|
||||||
],
|
|
||||||
stdout=PIPE,
|
|
||||||
stderr=PIPE,
|
|
||||||
)
|
|
||||||
|
|
||||||
if proc.returncode == 0:
|
|
||||||
output = str(proc.stdout, "utf-8").split('\n')
|
|
||||||
return [re.sub(regex, '',line) for line in output if re.match(regex, line)]
|
|
||||||
else:
|
|
||||||
return []
|
|
||||||
|
|
||||||
def get_supported_scripts(self):
|
|
||||||
""" Finding supported scripts """
|
|
||||||
|
|
||||||
supported_scripts = [];
|
|
||||||
|
|
||||||
for package in self.__packages:
|
|
||||||
package_paths = self.get_package_paths(package)
|
|
||||||
for path in package_paths:
|
|
||||||
for script_name, script_paths in self.__db.items():
|
|
||||||
if path in script_paths:
|
|
||||||
supported_scripts.append(script_name)
|
|
||||||
|
|
||||||
return set(supported_scripts)
|
|
||||||
|
|
||||||
def run_hadcode_tray(self, packages = None):
|
|
||||||
""" Hardcode tray bit execution """
|
|
||||||
|
|
||||||
args = ["hardcode-tray"]
|
|
||||||
|
|
||||||
if CONVERSION_TOOL != None:
|
|
||||||
args += ["--conversion-tool", CONVERSION_TOOL]
|
|
||||||
|
|
||||||
if THEME != None:
|
|
||||||
args += ["--theme", THEME]
|
|
||||||
|
|
||||||
if packages != None:
|
|
||||||
args += ["--only", ','.join(packages)]
|
|
||||||
|
|
||||||
args.append("--apply")
|
|
||||||
|
|
||||||
proc = run(
|
|
||||||
args,
|
|
||||||
stdout=PIPE,
|
|
||||||
stderr=PIPE,
|
|
||||||
)
|
|
||||||
|
|
||||||
return (proc.returncode == 0)
|
|
||||||
|
|
||||||
def execute(self):
|
|
||||||
""" Execution method running hardcode-tray for supported apps"""
|
|
||||||
|
|
||||||
for package in self.__packages:
|
|
||||||
if package in HARDCORE_TRAY_PACKAGES:
|
|
||||||
if self.run_hadcode_tray():
|
|
||||||
print("All packages are updated.")
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
print("Packages update failed.")
|
|
||||||
return False
|
|
||||||
|
|
||||||
packages_for_update = self.get_supported_scripts()
|
|
||||||
|
|
||||||
if len(packages_for_update) == 0:
|
|
||||||
print("No packages for update has been found.")
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
if self.run_hadcode_tray(packages_for_update):
|
|
||||||
print("Packages: %s - updated." % ', '.join(packages_for_update))
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
print("Packages: %s - failed." % ', '.join(packages_for_update))
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
input_str = sys.stdin.read()
|
|
||||||
packages = [x for x in input_str.split('\n') if x]
|
|
||||||
hook = Hook(packages)
|
|
||||||
|
|
||||||
if not hook.execute():
|
|
||||||
sys.exit('Hook failed')
|
|
||||||
Loading…
Reference in a new issue