Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-shell-notification-center
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-shell-notification-center
Commits
35d3a14f
Unverified
Commit
35d3a14f
authored
Mar 02, 2025
by
Erik Reider
Committed by
GitHub
Mar 02, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed image-path not being considered as theme icon (#515)
parent
01eb2221
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
functions.vala
src/functions.vala
+6
-6
notification.vala
src/notification/notification.vala
+15
-4
No files found.
src/functions.vala
View file @
35d3a14f
...
@@ -18,15 +18,15 @@ namespace SwayNotificationCenter {
...
@@ -18,15 +18,15 @@ namespace SwayNotificationCenter {
Gtk
.
Image
img
,
Gtk
.
Image
img
,
int
icon_size
,
int
icon_size
,
int
radius
,
int
radius
,
bool
file_exists
)
{
bool
file_exists
,
bool
is_theme_icon
=
false
)
{
const
string
URI_PREFIX
=
"file://"
;
const
string
URI_PREFIX
=
"file://"
;
const
uint
PREFIX_SIZE
=
7
;
bool
is_uri
=
(
uri
.
length
>=
URI_PREFIX
.
length
bool
is_uri
=
(
uri
.
length
>=
PREFIX_SIZE
&&
uri
.
slice
(
0
,
URI_PREFIX
.
length
)
==
URI_PREFIX
);
&&
uri
.
slice
(
0
,
PREFIX_SIZE
)
==
URI_PREFIX
);
if
(!
is_theme_icon
&&
(
is_uri
||
file_exists
))
{
if
(
is_uri
||
file_exists
)
{
// Try as a URI (file:// is the only URI schema supported right now)
// Try as a URI (file:// is the only URI schema supported right now)
try
{
try
{
if
(
is_uri
)
uri
=
uri
.
slice
(
PREFIX_SIZE
,
uri
.
length
);
if
(
is_uri
)
uri
=
uri
.
slice
(
URI_PREFIX
.
length
,
uri
.
length
);
var
pixbuf
=
new
Gdk
.
Pixbuf
.
from_file_at_scale
(
var
pixbuf
=
new
Gdk
.
Pixbuf
.
from_file_at_scale
(
uri
,
uri
,
...
...
src/notification/notification.vala
View file @
35d3a14f
...
@@ -690,15 +690,25 @@ namespace SwayNotificationCenter {
...
@@ -690,15 +690,25 @@ namespace SwayNotificationCenter {
int
app_icon_size
=
notification_icon_size
/
3
;
int
app_icon_size
=
notification_icon_size
/
3
;
img_app_icon
.
set_pixel_size
(
app_icon_size
);
img_app_icon
.
set_pixel_size
(
app_icon_size
);
var
img_path_exists
=
File
.
new_for_uri
(
bool
img_path_is_theme_icon
=
false
;
bool
img_path_exists
=
File
.
new_for_uri
(
param
.
image_path
??
""
).
query_exists
();
param
.
image_path
??
""
).
query_exists
();
if
(
param
.
image_path
!=
null
&&
!
img_path_exists
)
{
if
(
param
.
image_path
!=
null
&&
!
img_path_exists
)
{
// Check if it's not a URI
// Check if it's not a URI
img_path_exists
=
File
.
new_for_path
(
img_path_exists
=
File
.
new_for_path
(
param
.
image_path
??
""
).
query_exists
();
param
.
image_path
??
""
).
query_exists
();
// Check if it's a freedesktop.org-compliant icon
if
(!
img_path_exists
)
{
unowned
Gtk
.
IconTheme
icon_theme
=
Gtk
.
IconTheme
.
get_default
();
Gtk
.
IconInfo
?
info
=
icon_theme
.
lookup_icon
(
param
.
image_path
,
notification_icon_size
,
Gtk
.
IconLookupFlags
.
USE_BUILTIN
);
img_path_exists
=
info
!=
null
;
img_path_is_theme_icon
=
img_path_exists
;
}
}
var
app_icon_exists
=
File
.
new_for_uri
(
}
app_icon_uri
??
""
).
query_exists
();
var
app_icon_exists
=
File
.
new_for_uri
(
app_icon_uri
??
""
).
query_exists
();
if
(
app_icon_uri
!=
null
&&
!
img_path_exists
)
{
if
(
app_icon_uri
!=
null
&&
!
img_path_exists
)
{
// Check if it's not a URI
// Check if it's not a URI
app_icon_exists
=
File
.
new_for_path
(
app_icon_exists
=
File
.
new_for_path
(
...
@@ -724,7 +734,8 @@ namespace SwayNotificationCenter {
...
@@ -724,7 +734,8 @@ namespace SwayNotificationCenter {
Functions
.
set_image_uri
(
param
.
image_path
,
img
,
Functions
.
set_image_uri
(
param
.
image_path
,
img
,
notification_icon_size
,
notification_icon_size
,
radius
,
radius
,
img_path_exists
);
img_path_exists
,
img_path_is_theme_icon
);
}
else
if
(
param
.
icon_data
.
is_initialized
)
{
}
else
if
(
param
.
icon_data
.
is_initialized
)
{
Functions
.
set_image_data
(
param
.
icon_data
,
img
,
Functions
.
set_image_data
(
param
.
icon_data
,
img
,
notification_icon_size
,
radius
);
notification_icon_size
,
radius
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment