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
f765d2d4
Unverified
Commit
f765d2d4
authored
Oct 28, 2022
by
Erik Reider
Committed by
GitHub
Oct 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cssPriority to config (#176)
* Added cssPriority to config * Fixed linting issues
parent
69375cc7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
4 deletions
+44
-4
swaync.5.scd
man/swaync.5.scd
+7
-0
config.json.in
src/config.json.in
+1
-0
configModel.vala
src/configModel/configModel.vala
+19
-0
configSchema.json
src/configSchema.json
+6
-0
functions.vala
src/functions.vala
+10
-3
main.vala
src/main.vala
+1
-1
No files found.
man/swaync.5.scd
View file @
f765d2d4
...
@@ -27,6 +27,13 @@ config file to be able to detect config errors
...
@@ -27,6 +27,13 @@ config file to be able to detect config errors
values: background, bottom, top, overlay ++
values: background, bottom, top, overlay ++
description: Layer of control center window relative to normal windows. background is below all windows, overlay is above all windows.
description: Layer of control center window relative to normal windows. background is below all windows, overlay is above all windows.
*cssPriority* ++
type: string ++
default: application ++
values: application, user ++
description: Which GTK priority to use when loading the default and user ++
CSS files. Pick "user" to override *XDG_CONFIG_HOME/gtk-3.0/gtk.css*
*control-center-margin-top* ++
*control-center-margin-top* ++
type: integer ++
type: integer ++
default: 0 ++
default: 0 ++
...
...
src/config.json.in
View file @
f765d2d4
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
"positionX": "right",
"positionX": "right",
"positionY": "top",
"positionY": "top",
"layer": "top",
"layer": "top",
"cssPriority": "application",
"control-center-margin-top": 0,
"control-center-margin-top": 0,
"control-center-margin-bottom": 0,
"control-center-margin-bottom": 0,
"control-center-margin-right": 0,
"control-center-margin-right": 0,
...
...
src/configModel/configModel.vala
View file @
f765d2d4
...
@@ -61,6 +61,20 @@ namespace SwayNotificationCenter {
...
@@ -61,6 +61,20 @@ namespace SwayNotificationCenter {
}
}
}
}
public
enum
CssPriority
{
APPLICATION
,
USER
;
public
int
get_priority
()
{
switch
(
this
)
{
case
APPLICATION
:
default
:
return
Gtk
.
STYLE_PROVIDER_PRIORITY_APPLICATION
;
case
USER
:
return
Gtk
.
STYLE_PROVIDER_PRIORITY_USER
;
}
}
}
public
class
Category
:
Object
{
public
class
Category
:
Object
{
public
string
?
sound
{
get
;
set
;
default
=
null
;
}
public
string
?
sound
{
get
;
set
;
default
=
null
;
}
public
string
?
icon
{
get
;
set
;
default
=
null
;
}
public
string
?
icon
{
get
;
set
;
default
=
null
;
}
...
@@ -308,6 +322,11 @@ namespace SwayNotificationCenter {
...
@@ -308,6 +322,11 @@ namespace SwayNotificationCenter {
get
;
set
;
default
=
Layer
.
TOP
;
get
;
set
;
default
=
Layer
.
TOP
;
}
}
/** The CSS loading priority */
public
CssPriority
cssPriority
{
// vala-lint=naming-convention
get
;
set
;
default
=
CssPriority
.
APPLICATION
;
}
/** The timeout for notifications with NORMAL priority */
/** The timeout for notifications with NORMAL priority */
private
const
int
TIMEOUT_DEFAULT
=
10
;
private
const
int
TIMEOUT_DEFAULT
=
10
;
private
int
_timeout
=
TIMEOUT_DEFAULT
;
private
int
_timeout
=
TIMEOUT_DEFAULT
;
...
...
src/configSchema.json
View file @
f765d2d4
...
@@ -20,6 +20,12 @@
...
@@ -20,6 +20,12 @@
"default"
:
"top"
,
"default"
:
"top"
,
"enum"
:
[
"background"
,
"bottom"
,
"top"
,
"overlay"
]
"enum"
:
[
"background"
,
"bottom"
,
"top"
,
"overlay"
]
},
},
"cssPriority"
:
{
"type"
:
"string"
,
"description"
:
"Which GTK priority to use when loading the default and user CSS files. Pick
\"
user
\"
to override XDG_CONFIG_HOME/gtk-3.0/gtk.css"
,
"default"
:
"application"
,
"enum"
:
[
"application"
,
"user"
]
},
"positionY"
:
{
"positionY"
:
{
"type"
:
"string"
,
"type"
:
"string"
,
"description"
:
"Vertical position of control center and notification window"
,
"description"
:
"Vertical position of control center and notification window"
,
...
...
src/functions.vala
View file @
f765d2d4
...
@@ -70,6 +70,8 @@ namespace SwayNotificationCenter {
...
@@ -70,6 +70,8 @@ namespace SwayNotificationCenter {
* with default GTK style properties
* with default GTK style properties
*/
*/
public
static
bool
load_css
(
string
?
style_path
)
{
public
static
bool
load_css
(
string
?
style_path
)
{
int
css_priority
=
ConfigModel
.
instance
.
cssPriority
.
get_priority
();
try
{
try
{
// Load packaged CSS as backup
// Load packaged CSS as backup
string
system_css
=
get_style_path
(
null
,
true
);
string
system_css
=
get_style_path
(
null
,
true
);
...
@@ -77,18 +79,23 @@ namespace SwayNotificationCenter {
...
@@ -77,18 +79,23 @@ namespace SwayNotificationCenter {
Gtk
.
StyleContext
.
add_provider_for_screen
(
Gtk
.
StyleContext
.
add_provider_for_screen
(
Gdk
.
Screen
.
get_default
(),
Gdk
.
Screen
.
get_default
(),
system_css_provider
,
system_css_provider
,
Gtk
.
STYLE_PROVIDER_PRIORITY_APPLICATION
);
css_priority
);
}
catch
(
Error
e
)
{
print
(
"Load packaged CSS Error: %s\n"
,
e
.
message
);
return
false
;
}
try
{
// Load user CSS
// Load user CSS
string
user_css
=
get_style_path
(
style_path
);
string
user_css
=
get_style_path
(
style_path
);
user_css_provider
.
load_from_path
(
user_css
);
user_css_provider
.
load_from_path
(
user_css
);
Gtk
.
StyleContext
.
add_provider_for_screen
(
Gtk
.
StyleContext
.
add_provider_for_screen
(
Gdk
.
Screen
.
get_default
(),
Gdk
.
Screen
.
get_default
(),
user_css_provider
,
user_css_provider
,
Gtk
.
STYLE_PROVIDER_PRIORITY_APPLICATION
);
css_priority
);
return
true
;
return
true
;
}
catch
(
Error
e
)
{
}
catch
(
Error
e
)
{
print
(
"Load CSS Error: %s\n"
,
e
.
message
);
print
(
"Load
user
CSS Error: %s\n"
,
e
.
message
);
return
false
;
return
false
;
}
}
}
}
...
...
src/main.vala
View file @
f765d2d4
...
@@ -37,8 +37,8 @@ namespace SwayNotificationCenter {
...
@@ -37,8 +37,8 @@ namespace SwayNotificationCenter {
}
}
}
}
Functions
.
load_css
(
style_path
);
ConfigModel
.
init
(
config_path
);
ConfigModel
.
init
(
config_path
);
Functions
.
load_css
(
style_path
);
swaync_daemon
=
new
SwayncDaemon
();
swaync_daemon
=
new
SwayncDaemon
();
Bus
.
own_name
(
BusType
.
SESSION
,
"org.erikreider.swaync.cc"
,
Bus
.
own_name
(
BusType
.
SESSION
,
"org.erikreider.swaync.cc"
,
...
...
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