feat(tray-icons): add Breeze-style Ngó Sen icons
This commit is contained in:
1 parent
6f4c331dd4
commit
6423eaa29d
13 files changed
+155
No files matched your search
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# Copy the Breeze-style icons over Ngó Sen's monochrome tray icons.
|
||||
# Runs as root; the pacman hook re-runs it after every fcitx5-ngosen install/upgrade.
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
ROOT=${ROOT:-} # for dry-run testing only
|
||||
|
||||
# Ngó Sen points at hicolor, but Plasma looks the icon up by name in breeze/breeze-dark
|
||||
dirs=(usr/share/icons/hicolor/scalable/{apps,status}
|
||||
usr/share/icons/breeze{,-dark}/status/{22,24})
|
||||
mtree=$(zcat "$ROOT"/var/lib/pacman/local/fcitx5-ngosen-*/mtree 2>/dev/null || true)
|
||||
|
||||
for d in "${dirs[@]}"; do
|
||||
for f in "$here"/icons/*.svg; do
|
||||
n=$(basename "$f"); t=$ROOT/$d/$n
|
||||
[[ -f $t ]] || continue
|
||||
# Still the file the package installed: keep it as the original for restore.sh
|
||||
sum=$(grep -F "./$d/$n " <<<"$mtree" | grep -o 'sha256digest=[0-9a-f]*' | cut -d= -f2 || true)
|
||||
if [[ -n $sum && $(sha256sum <"$t" | cut -d' ' -f1) == "$sum" ]]; then
|
||||
install -Dm644 "$t" "$here/orig/$d/$n"
|
||||
fi
|
||||
install -m644 "$f" "$t"
|
||||
done
|
||||
done
|
||||
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="22" height="22">
|
||||
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #232629; }</style>
|
||||
<g class="ColorScheme-Text" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3">
|
||||
<rect x="3.5" y="3.5" width="15" height="15" rx="2.5" stroke-width="1"/><path d="M8.3 7.5 11 14.5l2.7-7"/>
|
||||
</g></svg>
|
||||
|
After Width: | Height: | Size: 426 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="22" height="22">
|
||||
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #fcfcfc; }</style>
|
||||
<g class="ColorScheme-Text" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3">
|
||||
<rect x="3.5" y="3.5" width="15" height="15" rx="2.5" stroke-width="1"/><path d="M8.3 7.5 11 14.5l2.7-7"/>
|
||||
</g></svg>
|
||||
|
After Width: | Height: | Size: 426 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="22" height="22">
|
||||
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #232629; }</style>
|
||||
<g class="ColorScheme-Text" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1">
|
||||
<circle cx="11" cy="11" r="7.5"/><path d="M7.8 12.6q3.2 3.2 6.4 0"/><path d="M8.6 8.6v.6M13.4 8.6v.6" stroke-width="1.6"/>
|
||||
</g></svg>
|
||||
|
After Width: | Height: | Size: 440 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="22" height="22">
|
||||
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #fcfcfc; }</style>
|
||||
<g class="ColorScheme-Text" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1">
|
||||
<circle cx="11" cy="11" r="7.5"/><path d="M7.8 12.6q3.2 3.2 6.4 0"/><path d="M8.6 8.6v.6M13.4 8.6v.6" stroke-width="1.6"/>
|
||||
</g></svg>
|
||||
|
After Width: | Height: | Size: 440 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="22" height="22">
|
||||
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #232629; }</style>
|
||||
<g class="ColorScheme-Text" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3">
|
||||
<rect x="3.5" y="3.5" width="15" height="15" rx="2.5" stroke-width="1"/><path d="M13.3 7.5H8.8v7h4.5M8.8 11h3.7"/>
|
||||
</g></svg>
|
||||
|
After Width: | Height: | Size: 434 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="22" height="22">
|
||||
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #fcfcfc; }</style>
|
||||
<g class="ColorScheme-Text" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3">
|
||||
<rect x="3.5" y="3.5" width="15" height="15" rx="2.5" stroke-width="1"/><path d="M13.3 7.5H8.8v7h4.5M8.8 11h3.7"/>
|
||||
</g></svg>
|
||||
|
After Width: | Height: | Size: 434 B |
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Install Breeze-style tray icons for Ngó Sen. Usage: sudo ./install.sh
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
ROOT=${ROOT:-} # for dry-run testing only
|
||||
[[ $EUID -eq 0 || -n $ROOT ]] || { echo "Must be run with sudo"; exit 1; }
|
||||
owner=${SUDO_USER:-$(id -un "${PKEXEC_UID:-0}")}
|
||||
dest=$ROOT/usr/local/share/ngosen-breeze-icons
|
||||
|
||||
install -d "$dest/icons"
|
||||
install -m644 "$here"/icons/*.svg "$dest/icons/"
|
||||
install -m755 "$here/apply.sh" "$dest/apply.sh"
|
||||
install -Dm644 "$here/ngosen-breeze-icons.hook" "$ROOT/etc/pacman.d/hooks/ngosen-breeze-icons.hook"
|
||||
# Older versions used NoUpgrade in pacman.conf; the hook replaces it
|
||||
sed -i '/^# ngosen-breeze-icons$/,+1d' "$ROOT/etc/pacman.conf"
|
||||
ROOT=$ROOT "$dest/apply.sh"
|
||||
|
||||
# Ngó Sen: use the monochrome icons (not the lotus ones), white for a dark panel
|
||||
conf=$ROOT$(getent passwd "$owner" | cut -d: -f6)/.config/fcitx5/conf/ngosen.conf
|
||||
as_owner() { if [[ -n $ROOT ]]; then "$@"; else runuser -u "$owner" -- "$@"; fi; }
|
||||
if [[ -f $conf ]]; then
|
||||
for kv in UseLotusIcons=False IconTheme=Dark; do
|
||||
k=${kv%%=*}
|
||||
if grep -q "^$k=" "$conf"; then as_owner sed -i "s/^$k=.*/$kv/" "$conf"
|
||||
elif grep -q "^# $k=" "$conf"; then as_owner sed -i "s/^# $k=.*/$kv/" "$conf"
|
||||
else as_owner sh -c "echo '$kv' >> '$conf'"; fi
|
||||
done
|
||||
else
|
||||
as_owner install -Dm600 /dev/stdin "$conf" <<<$'UseLotusIcons=False\nIconTheme=Dark'
|
||||
fi
|
||||
|
||||
echo "Done. Restart fcitx5 and plasmashell (without sudo):"
|
||||
echo " $here/restart-fcitx5.sh; systemctl --user restart plasma-plasmashell"
|
||||
@@ -0,0 +1,10 @@
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = fcitx5-ngosen
|
||||
|
||||
[Action]
|
||||
Description = Applying Breeze-style tray icons for Ngó Sen...
|
||||
When = PostTransaction
|
||||
Exec = /usr/local/share/ngosen-breeze-icons/apply.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Restart fcitx5 through KWin (KDE Wayland) so it keeps the Wayland input method frontend.
|
||||
L=$(kreadconfig6 --file kwinrc --group Wayland --key InputMethod)
|
||||
[[ -n $L ]] || L=/usr/share/applications/fcitx5-wayland-launcher.desktop
|
||||
pkill -x fcitx5; sleep 1
|
||||
kwriteconfig6 --notify --file kwinrc --group Wayland --key InputMethod --delete; sleep 1
|
||||
kwriteconfig6 --notify --file kwinrc --group Wayland --key InputMethod "$L"
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Put Ngó Sen's original icons back and remove the hook. Usage: sudo ./restore.sh
|
||||
set -euo pipefail
|
||||
ROOT=${ROOT:-} # for dry-run testing only
|
||||
[[ $EUID -eq 0 || -n $ROOT ]] || { echo "Must be run with sudo"; exit 1; }
|
||||
dest=$ROOT/usr/local/share/ngosen-breeze-icons
|
||||
[[ -d $dest/orig/usr ]] || { echo "No original icons in $dest/orig"; exit 1; }
|
||||
(cd "$dest/orig" && find usr -name '*.svg' -print0) | while IFS= read -r -d '' f; do
|
||||
install -m644 "$dest/orig/$f" "$ROOT/$f"
|
||||
done
|
||||
rm -f "$ROOT/etc/pacman.d/hooks/ngosen-breeze-icons.hook"
|
||||
rm -rf "$dest"
|
||||
echo "Restored. To get the lotus icons back, turn them on in Ngó Sen Settings."
|
||||
echo "Restart plasmashell (without sudo): systemctl --user restart plasma-plasmashell"
|
||||
Reference in new issue
Block a user