Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] common/environment/setup/install.sh: add vicons
@ 2023-06-29 16:22 Bnyro
  2023-06-29 18:15 ` [PR REVIEW] " classabbyamp
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Bnyro @ 2023-06-29 16:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1084 bytes --]

There is a new pull request by Bnyro against master on the void-packages repository

https://github.com/Bnyro/void-packages vicons
https://github.com/void-linux/void-packages/pull/44722

common/environment/setup/install.sh: add vicons
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **NO**

A lot of scripts, for example https://github.com/void-linux/void-packages/blob/d2a5b2d23b30e115335ffe5c3cb50ccc2b945131/srcpkgs/goxel/template#L36-L39 iterate over different resolutions of icons in order to install all of them to `usr/share/icons` which is quite some boilerplate code. In my eyes it would be very handy to have an inbuilt function that automatically iterates over all possible resolutions and installs the icons to `usr/share/icons`. If that would be generally accepted, I'd change existing templates to use that function too.

I'm very interested on thoughts about that :)
Cheers


A patch file from https://github.com/void-linux/void-packages/pull/44722.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-vicons-44722.patch --]
[-- Type: text/x-diff, Size: 2216 bytes --]

From 14665f3e9a5a753a6dde390bd202ce2cc5b5846e Mon Sep 17 00:00:00 2001
From: Bnyro <bnyro@tutanota.com>
Date: Thu, 29 Jun 2023 18:17:14 +0200
Subject: [PATCH] common/environment/setup/install.sh: add vicons

---
 Manual.md                           |  8 ++++++++
 common/environment/setup/install.sh | 17 ++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/Manual.md b/Manual.md
index 1670863cbe54..58c3613093a5 100644
--- a/Manual.md
+++ b/Manual.md
@@ -335,6 +335,14 @@ The following functions are defined by `xbps-src` and can be used on any templat
 	it will default to `pkgname`. The `shell` argument can be one of `bash`,
 	`fish` or `zsh`.
 
+- *vicons()* `<icon_name_scheme> [<name>]`
+
+	Installs icons of all supported resolutions (e.g. 512px) in the correct
+	location and skips the ones that don't exist for the provided pattern.
+	Therefore it replaces all occurences of `%` in `icon_name_scheme` with the
+	resolution of the current iteration, for example `512`. By default icons are
+	stored by their package name with png as extension if no `name` is provided.
+
 > Shell wildcards must be properly quoted, Example: `vmove "usr/lib/*.a"`.
 
 <a id="global_vars"></a>
diff --git a/common/environment/setup/install.sh b/common/environment/setup/install.sh
index ba0845bba5d1..20394b042ea8 100644
--- a/common/environment/setup/install.sh
+++ b/common/environment/setup/install.sh
@@ -13,7 +13,7 @@ _noglob_helper() {
 }
 
 # Apply _noglob to v* commands
-for cmd in vinstall vcopy vcompletion vmove vmkdir vbin vman vdoc vconf vsconf vlicense vsv; do
+for cmd in vinstall vcopy vcompletion vmove vmkdir vbin vman vdoc vconf vsconf vlicense vsv vicons; do
        alias ${cmd}="set -f; _noglob_helper _${cmd}"
 done
 
@@ -274,3 +274,18 @@ _vcompletion() {
 			;;
 	esac
 }
+
+_vicons() {
+	local icon_name_scheme="$1" name="$2"
+
+	if [ -z "$icon_name_scheme" ]; then
+		msg_red "$pkgver: vicons: 1 argument expected: <icon_name_scheme>\n"
+		return 1
+	fi
+
+	_name="${name:-${pkgname}.png}"
+	for x in 16 32 64 128 256 512 1024; do
+		_file="${icon_name_scheme/\%/$x}"
+		[ -f "$_file" ] && vinstall "$_file" 644 "usr/share/icons/hicolor/${x}x${x}/apps/$_name"
+	done
+}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PR REVIEW] common/environment/setup/install.sh: add vicons
  2023-06-29 16:22 [PR PATCH] common/environment/setup/install.sh: add vicons Bnyro
@ 2023-06-29 18:15 ` classabbyamp
  2023-06-29 19:05 ` Bnyro
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: classabbyamp @ 2023-06-29 18:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

New review comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/44722#discussion_r1246957244

Comment:
no comment on whether I'd want to merge this, but don't hardcode the sizes, not all pkgs that do this use all these sizes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PR REVIEW] common/environment/setup/install.sh: add vicons
  2023-06-29 16:22 [PR PATCH] common/environment/setup/install.sh: add vicons Bnyro
  2023-06-29 18:15 ` [PR REVIEW] " classabbyamp
@ 2023-06-29 19:05 ` Bnyro
  2023-07-01 20:57 ` Chocimier
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Bnyro @ 2023-06-29 19:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

New review comment by Bnyro on void-packages repository

https://github.com/void-linux/void-packages/pull/44722#discussion_r1247003179

Comment:
Yes, that's why we're checking if the file exists. But you're right, it would look way cleaner (and better for the performance) if the resolutions can be passed as a requires argument.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PR REVIEW] common/environment/setup/install.sh: add vicons
  2023-06-29 16:22 [PR PATCH] common/environment/setup/install.sh: add vicons Bnyro
  2023-06-29 18:15 ` [PR REVIEW] " classabbyamp
  2023-06-29 19:05 ` Bnyro
@ 2023-07-01 20:57 ` Chocimier
  2023-07-26  8:31 ` Bnyro
  2023-07-26  8:31 ` [PR PATCH] [Closed]: " Bnyro
  4 siblings, 0 replies; 6+ messages in thread
From: Chocimier @ 2023-07-01 20:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

New review comment by Chocimier on void-packages repository

https://github.com/void-linux/void-packages/pull/44722#discussion_r1248974474

Comment:
Iterating available sizes makes function more useful. For now this is missing some popular sizes and scalables.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: common/environment/setup/install.sh: add vicons
  2023-06-29 16:22 [PR PATCH] common/environment/setup/install.sh: add vicons Bnyro
                   ` (2 preceding siblings ...)
  2023-07-01 20:57 ` Chocimier
@ 2023-07-26  8:31 ` Bnyro
  2023-07-26  8:31 ` [PR PATCH] [Closed]: " Bnyro
  4 siblings, 0 replies; 6+ messages in thread
From: Bnyro @ 2023-07-26  8:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

New comment by Bnyro on void-packages repository

https://github.com/void-linux/void-packages/pull/44722#issuecomment-1651225410

Comment:
Closing due to a lack of interest in continuing this from my side.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PR PATCH] [Closed]: common/environment/setup/install.sh: add vicons
  2023-06-29 16:22 [PR PATCH] common/environment/setup/install.sh: add vicons Bnyro
                   ` (3 preceding siblings ...)
  2023-07-26  8:31 ` Bnyro
@ 2023-07-26  8:31 ` Bnyro
  4 siblings, 0 replies; 6+ messages in thread
From: Bnyro @ 2023-07-26  8:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 783 bytes --]

There's a closed pull request on the void-packages repository

common/environment/setup/install.sh: add vicons
https://github.com/void-linux/void-packages/pull/44722

Description:
A lot of scripts, for example https://github.com/void-linux/void-packages/blob/d2a5b2d23b30e115335ffe5c3cb50ccc2b945131/srcpkgs/goxel/template#L36-L39 iterate over different resolutions of icons in order to install all of them to `usr/share/icons` which is quite some boilerplate code. In my eyes it would be very handy to have an inbuilt function that automatically iterates over all possible resolutions and installs the icons to `usr/share/icons`. If that would be generally accepted, I'd change existing templates to use that function too.

I'm very interested on thoughts about that :)
Cheers


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-26  8:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 16:22 [PR PATCH] common/environment/setup/install.sh: add vicons Bnyro
2023-06-29 18:15 ` [PR REVIEW] " classabbyamp
2023-06-29 19:05 ` Bnyro
2023-07-01 20:57 ` Chocimier
2023-07-26  8:31 ` Bnyro
2023-07-26  8:31 ` [PR PATCH] [Closed]: " Bnyro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).