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
cf7fcaee
Unverified
Commit
cf7fcaee
authored
Jul 10, 2025
by
Gabriele Musco
Committed by
GitHub
Jul 10, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: new buttons-per-row property for buttons-grid widget (#576)
Co-authored-by:
Gabriele Musco
<
gabmus@disroot.org
>
parent
a831118a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
0 deletions
+14
-0
swaync.5.scd
man/swaync.5.scd
+2
-0
config.json.in
src/config.json.in
+1
-0
configSchema.json
src/configSchema.json
+4
-0
buttonsGrid.vala
src/controlCenter/widgets/buttonsGrid/buttonsGrid.vala
+7
-0
No files found.
man/swaync.5.scd
View file @
cf7fcaee
...
@@ -471,6 +471,8 @@ config file to be able to detect config errors
...
@@ -471,6 +471,8 @@ config file to be able to detect config errors
type: object ++
type: object ++
css class: widget-buttons (access buttons with >flowbox>flowboxchild>button) ++
css class: widget-buttons (access buttons with >flowbox>flowboxchild>button) ++
properties: ++
properties: ++
buttons-per-row: ++
type: number ++
actions: ++
actions: ++
type: array ++
type: array ++
Default values: [] ++
Default values: [] ++
...
...
src/config.json.in
View file @
cf7fcaee
...
@@ -79,6 +79,7 @@
...
@@ -79,6 +79,7 @@
"loop-carousel": false
"loop-carousel": false
},
},
"buttons-grid": {
"buttons-grid": {
"buttons-per-row": 7,
"actions": [
"actions": [
{
{
"label": "直",
"label": "直",
...
...
src/configSchema.json
View file @
cf7fcaee
...
@@ -434,6 +434,10 @@
...
@@ -434,6 +434,10 @@
"description"
:
"A widget to add a grid of buttons that execute shell commands"
,
"description"
:
"A widget to add a grid of buttons that execute shell commands"
,
"additionalProperties"
:
false
,
"additionalProperties"
:
false
,
"properties"
:
{
"properties"
:
{
"buttons-per-row"
:
{
"type"
:
"number"
,
"description"
:
"How many buttons should be shown in a buttons-grid row"
},
"actions"
:
{
"actions"
:
{
"type"
:
"array"
,
"type"
:
"array"
,
"description"
:
"A list of actions containing a label and a command"
,
"description"
:
"A list of actions containing a label and a command"
,
...
...
src/controlCenter/widgets/buttonsGrid/buttonsGrid.vala
View file @
cf7fcaee
...
@@ -10,6 +10,8 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -10,6 +10,8 @@ namespace SwayNotificationCenter.Widgets {
}
}
Action
[]
actions
;
Action
[]
actions
;
// 7 is the default Gtk.FlowBox.max_children_per_line
int
buttons_per_row
=
7
;
List
<
ToggleButton
>
toggle_buttons
;
List
<
ToggleButton
>
toggle_buttons
;
public
ButtonsGrid
(
string
suffix
,
SwayncDaemon
swaync_daemon
,
NotiDaemon
noti_daemon
)
{
public
ButtonsGrid
(
string
suffix
,
SwayncDaemon
swaync_daemon
,
NotiDaemon
noti_daemon
)
{
...
@@ -19,9 +21,14 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -19,9 +21,14 @@ namespace SwayNotificationCenter.Widgets {
if
(
config
!=
null
)
{
if
(
config
!=
null
)
{
Json
.
Array
a
=
get_prop_array
(
config
,
"actions"
);
Json
.
Array
a
=
get_prop_array
(
config
,
"actions"
);
if
(
a
!=
null
)
actions
=
parse_actions
(
a
);
if
(
a
!=
null
)
actions
=
parse_actions
(
a
);
bool
bpr_found
=
false
;
int
bpr
=
get_prop
<
int
>
(
config
,
"buttons-per-row"
,
out
bpr_found
);
if
(
bpr_found
)
buttons_per_row
=
bpr
;
}
}
Gtk
.
FlowBox
container
=
new
Gtk
.
FlowBox
();
Gtk
.
FlowBox
container
=
new
Gtk
.
FlowBox
();
container
.
set_max_children_per_line
(
buttons_per_row
);
container
.
set_selection_mode
(
Gtk
.
SelectionMode
.
NONE
);
container
.
set_selection_mode
(
Gtk
.
SelectionMode
.
NONE
);
container
.
set_hexpand
(
true
);
container
.
set_hexpand
(
true
);
append
(
container
);
append
(
container
);
...
...
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