refactor: move notification icons to themes #236

Merged
Boria138 merged 1 commits from drop-img into main 2026-08-22 10:31:40 +00:00
11 changed files with 25 additions and 60 deletions

No files matched your search

-1
View File
@@ -120,7 +120,6 @@ install -Dpm 0644 ./completions/_portprotonqt -t %{buildroot}%{zsh_completions_d
%{_datadir}/mime/packages/ru.linux_gaming.PortProtonQt.xml
%{_datadir}/portproton/scripts/
%{_datadir}/portproton/conf/
%{_datadir}/portproton/img/
%{bash_completions_dir}/portprotonqt
%{fish_completions_dir}/portprotonqt.fish
%{zsh_completions_dir}/_portprotonqt
-1
View File
@@ -118,7 +118,6 @@ install -Dpm 0644 ./completions/_portprotonqt -t %{buildroot}%{zsh_completions_d
%{_datadir}/mime/packages/ru.linux_gaming.PortProtonQt.xml
%{_datadir}/portproton/scripts/
%{_datadir}/portproton/conf/
%{_datadir}/portproton/img/
%{bash_completions_dir}/portprotonqt
%{fish_completions_dir}/portprotonqt.fish
%{zsh_completions_dir}/_portprotonqt
Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

@@ -135,8 +135,10 @@ rm_from_array () {
}
fatal () {
#TODO
pw_notify_send -i error "$@"
if [[ -z "$*" ]] ; then
set -- "Fatal error"
fi
python_module dbus_tools notify -i error "$@" &>/dev/null
print_error "$@"
stop_portproton
exit 1
@@ -563,48 +565,6 @@ var_ld_library_path_update () {
fi
}
# GUI NOTIFY SEND
pw_notify_send () {
local icon title body app timeout OPTIND
app="ru.linux_gaming.PortProtonQt"
timeout="5000"
OPTIND="1"
while getopts a:i:t: opt ; do
case "$opt" in
a)
app=$OPTARG
;;
i)
case "$OPTARG" in
info) local OPTARG="${PORT_IMG_PATH}/notify/info.svg";;
warning) local OPTARG="${PORT_IMG_PATH}/notify/warning.svg";;
error) local OPTARG="${PORT_IMG_PATH}/notify/error.svg";;
esac
icon=$OPTARG
;;
t)
timeout=$OPTARG
;;
*)
echo "usage: $0
[-a] name application (PortProtonQt default)
[-i] info, warning, error (none default)
[-t] timeout in ms (5000 default)" >&2
return 1
;;
esac
done
shift $(( OPTIND - 1 ))
[[ "$1" == "--" ]] && shift
title="$1" ; shift
body="$*"
python_module dbus_tools notify \
-a "$app" -i "$icon" -t "$timeout" -- "$title" "$body" &>/dev/null
return 0
}
export -f pw_notify_send
check_gamescope_session () {
if [[ -n "$GAMESCOPE_IN_USE" ]]
then [[ "$GAMESCOPE_IN_USE" == 1 ]] && return 0 || return 1
@@ -2331,7 +2291,7 @@ pw_create_gui_png () {
pw_create_unique_exe () {
BASEDIR_GAME="$(dirname "$PW_EXE_FILE")"
if [[ -d "$BASEDIR_GAME" ]] ; then
pushd "$BASEDIR_GAME" || fatal
pushd "$BASEDIR_GAME" || fatal "Failed to enter game directory: $BASEDIR_GAME"
BASENAME_GAME_EXE="$(basename "$PW_EXE_FILE")"
if [[ -n "$1" ]] ; then
BASENAME_GAME="$(basename "$1" .exe).exe"
@@ -2344,7 +2304,7 @@ pw_create_unique_exe () {
print_warning "There are no arguments for creating a symbolic link! Skip it..."
fi
try_remove_file "${PW_EXE_FILE}.ppdb"
popd || fatal
popd || fatal "Failed to return from game directory: $BASEDIR_GAME"
fi
}
+6 -7
View File
@@ -19,7 +19,6 @@ else
PORT_SCRIPTS_PATH="$(dirname "$(realpath "$0")")"
fi
PORT_IMG_PATH="$(dirname "$PORT_SCRIPTS_PATH")/img"
PORT_CONF_PATH="$(dirname "$PORT_SCRIPTS_PATH")/conf"
if [[ -z "$PORT_DATA_PATH" ]] ; then
@@ -55,7 +54,7 @@ else
export PW_FIND_PPDB=1
fi
export PORT_SCRIPTS_PATH PORT_IMG_PATH PORT_DATA_PATH PORT_CONF_PATH
export PORT_SCRIPTS_PATH PORT_DATA_PATH PORT_CONF_PATH
export PW_LOG_FILE="${PORT_DATA_PATH}/PortProton.log"
# shellcheck source=/dev/null
@@ -148,7 +147,7 @@ create_new_dir "${PORT_DATA_PATH}/data/prefixes/DEFAULT"
create_new_dir "${PORT_DATA_PATH}/data/prefixes/DOTNET"
try_force_link_dir "${PORT_DATA_PATH}/data/prefixes" "${PORT_DATA_PATH}"
pushd "${PORT_DATA_PATH}/data/prefixes/" 1>/dev/null || fatal
pushd "${PORT_DATA_PATH}/data/prefixes/" 1>/dev/null || fatal "Failed to enter prefixes directory"
for pfx_dir in ./* ; do
[[ -d "$pfx_dir" ]] || continue
pfx_dir_new="${pfx_dir//[[:blank:]]/_}"
@@ -156,7 +155,7 @@ for pfx_dir in ./* ; do
mv -- "${PORT_DATA_PATH}/data/prefixes/$pfx_dir" "${PORT_DATA_PATH}/data/prefixes/${pfx_dir_new^^}"
fi
done
popd 1>/dev/null || fatal
popd 1>/dev/null || fatal "Failed to return from prefixes directory"
create_new_dir "${PORT_WINE_TMP_PATH}"/gecko
create_new_dir "${PORT_WINE_TMP_PATH}"/mono
@@ -164,12 +163,12 @@ create_new_dir "${PORT_WINE_TMP_PATH}"/mono
export PW_VULKAN_DIR="${PORT_WINE_TMP_PATH}/VULKAN"
create_new_dir "${PW_VULKAN_DIR}"
cd "${PORT_SCRIPTS_PATH}" || fatal
cd "${PORT_SCRIPTS_PATH}" || fatal "Scripts directory not found: ${PORT_SCRIPTS_PATH}"
# shellcheck source=/dev/null
source "${PORT_SCRIPTS_PATH}/var"
# HACK: Avoid inheriting a system scripts cwd in pressure-vessel.
cd "${XDG_DATA_HOME:-$HOME}" || fatal
cd "${XDG_DATA_HOME:-$HOME}" || fatal "Data directory not found: ${XDG_DATA_HOME:-$HOME}"
[[ ! -f "$VKBASALT_CONFIG_FILE" ]] && cp -f "${PORT_CONF_PATH}/vkBasalt.conf" "$VKBASALT_CONFIG_FILE"
[[ ! -f "$DXVK_CONFIG_FILE" ]] && cp -f "${PORT_CONF_PATH}/dxvk.conf" "$DXVK_CONFIG_FILE"
@@ -472,7 +471,7 @@ Usage examples:
--winecmd)
get_wine_and_pfx "$2" "$3"
start_portproton
cd "${PORT_DATA_PATH}/data/prefixes/${PW_PREFIX_NAME}/drive_c" || fatal
cd "${PORT_DATA_PATH}/data/prefixes/${PW_PREFIX_NAME}/drive_c" || fatal "Prefix drive_c directory not found"
PW_USE_TERMINAL=1 pw_run cmd
stop_portproton
;;
-5
View File
@@ -111,11 +111,6 @@ install_subdir(
install_dir: datadir / 'portproton',
)
install_subdir(
'build-aux/share/portproton/img',
install_dir: datadir / 'portproton',
)
install_subdir(
'build-aux/share/portproton/scripts/portwine_db',
install_dir: datadir / 'portproton' / 'scripts',
+13
View File
@@ -11,7 +11,9 @@ from typing import Any, cast
from dbus_fast import BusType, DBusError, Message, Variant
from dbus_fast.aio import MessageBus
from portprotonqt.config import ui_config
from portprotonqt.logger import get_logger
from portprotonqt.theme_manager import ThemeManager, load_theme
logger = get_logger(__name__)
@@ -347,6 +349,17 @@ async def _main() -> int:
args = parse_args()
try:
if args.command == "notify":
if args.icon in {"info", "warning", "error"}:
theme_name = ui_config.get_theme()
theme_manager = ThemeManager()
load_theme(theme_name)
icon_path = theme_manager.get_icon(
args.icon,
theme_name,
as_path=True,
)
if isinstance(icon_path, str):
args.icon = icon_path
request = NotificationRequest(
args.app,
args.icon,
File renamed without changes.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB