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
a91a1f6d
Unverified
Commit
a91a1f6d
authored
Feb 13, 2023
by
Erik Reider
Committed by
GitHub
Feb 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ControlCenter positioning config option (#213)
parent
83a9f210
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
24 deletions
+31
-24
configModel.vala
src/configModel/configModel.vala
+11
-22
configSchema.json
src/configSchema.json
+12
-0
controlCenter.vala
src/controlCenter/controlCenter.vala
+8
-2
No files found.
src/configModel/configModel.vala
View file @
a91a1f6d
namespace
SwayNotificationCenter
{
namespace
SwayNotificationCenter
{
public
enum
PositionX
{
public
enum
PositionX
{
RIGHT
,
LEFT
,
CENTER
;
RIGHT
,
LEFT
,
CENTER
,
NONE
;
public
string
parse
()
{
switch
(
this
)
{
default
:
return
"right"
;
case
LEFT
:
return
"left"
;
case
CENTER
:
return
"center"
;
}
}
}
}
public
enum
PositionY
{
public
enum
PositionY
{
TOP
,
BOTTOM
;
TOP
,
BOTTOM
,
NONE
;
public
string
parse
()
{
switch
(
this
)
{
default
:
return
"top"
;
case
BOTTOM
:
return
"bottom"
;
}
}
}
}
public
enum
ImageVisibility
{
public
enum
ImageVisibility
{
...
@@ -432,6 +412,15 @@ namespace SwayNotificationCenter {
...
@@ -432,6 +412,15 @@ namespace SwayNotificationCenter {
/** Hides the control center when clicking on notification action */
/** Hides the control center when clicking on notification action */
public
bool
hide_on_action
{
get
;
set
;
default
=
true
;
}
public
bool
hide_on_action
{
get
;
set
;
default
=
true
;
}
/** The controlcenters horizontal alignment. Supersedes `positionX` if not `NONE` */
public
PositionX
control_center_positionX
{
// vala-lint=naming-convention
get
;
set
;
default
=
PositionX
.
NONE
;
}
/** The controlcenters vertical alignment. Supersedes `positionY` if not `NONE` */
public
PositionY
control_center_positionY
{
// vala-lint=naming-convention
get
;
set
;
default
=
PositionY
.
NONE
;
}
/** GtkLayerShell margins around the notification center */
/** GtkLayerShell margins around the notification center */
private
int
control_center_margin_top_
=
0
;
private
int
control_center_margin_top_
=
0
;
public
int
control_center_margin_top
{
public
int
control_center_margin_top
{
...
...
src/configSchema.json
View file @
a91a1f6d
...
@@ -32,6 +32,18 @@
...
@@ -32,6 +32,18 @@
"default"
:
"top"
,
"default"
:
"top"
,
"enum"
:
[
"top"
,
"bottom"
]
"enum"
:
[
"top"
,
"bottom"
]
},
},
"control-center-positionX"
:
{
"type"
:
"string"
,
"description"
:
"Optional: Horizontal position of the control center. Supersedes positionX if not set to `none`"
,
"default"
:
"none"
,
"enum"
:
[
"right"
,
"left"
,
"center"
,
"none"
]
},
"control-center-positionY"
:
{
"type"
:
"string"
,
"description"
:
"Optional: Vertical position of the control center. Supersedes positionY if not set to `none`"
,
"default"
:
"none"
,
"enum"
:
[
"top"
,
"bottom"
,
"none"
]
},
"control-center-margin-top"
:
{
"control-center-margin-top"
:
{
"type"
:
"integer"
,
"type"
:
"integer"
,
"description"
:
"The margin (in pixels) at the top of the notification center. 0 to disable"
,
"description"
:
"The margin (in pixels) at the top of the notification center. 0 to disable"
,
...
...
src/controlCenter/controlCenter.vala
View file @
a91a1f6d
...
@@ -254,19 +254,25 @@ namespace SwayNotificationCenter {
...
@@ -254,19 +254,25 @@ namespace SwayNotificationCenter {
// Anchor box to north/south edges as needed
// Anchor box to north/south edges as needed
Gtk
.
Align
align_x
=
Gtk
.
Align
.
END
;
Gtk
.
Align
align_x
=
Gtk
.
Align
.
END
;
switch
(
ConfigModel
.
instance
.
positionX
)
{
PositionX
pos_x
=
ConfigModel
.
instance
.
control_center_positionX
;
if
(
pos_x
==
PositionX
.
NONE
)
pos_x
=
ConfigModel
.
instance
.
positionX
;
switch
(
pos_x
)
{
case
PositionX
.
LEFT
:
case
PositionX
.
LEFT
:
align_x
=
Gtk
.
Align
.
START
;
align_x
=
Gtk
.
Align
.
START
;
break
;
break
;
case
PositionX
.
CENTER
:
case
PositionX
.
CENTER
:
align_x
=
Gtk
.
Align
.
CENTER
;
align_x
=
Gtk
.
Align
.
CENTER
;
break
;
break
;
default
:
case
PositionX
.
RIGHT
:
case
PositionX
.
RIGHT
:
align_x
=
Gtk
.
Align
.
END
;
align_x
=
Gtk
.
Align
.
END
;
break
;
break
;
}
}
Gtk
.
Align
align_y
=
Gtk
.
Align
.
START
;
Gtk
.
Align
align_y
=
Gtk
.
Align
.
START
;
switch
(
ConfigModel
.
instance
.
positionY
)
{
PositionY
pos_y
=
ConfigModel
.
instance
.
control_center_positionY
;
if
(
pos_y
==
PositionY
.
NONE
)
pos_y
=
ConfigModel
.
instance
.
positionY
;
switch
(
pos_y
)
{
default
:
case
PositionY
.
TOP
:
case
PositionY
.
TOP
:
align_y
=
Gtk
.
Align
.
START
;
align_y
=
Gtk
.
Align
.
START
;
// Set cc widget position
// Set cc widget position
...
...
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