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
176e3b72
Unverified
Commit
176e3b72
authored
Aug 14, 2023
by
Jannis
Committed by
GitHub
Aug 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add show-per-app-label for volume (#301)
parent
e3cc05d6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
9 deletions
+60
-9
swaync.5.scd
man/swaync.5.scd
+10
-0
configSchema.json
src/configSchema.json
+10
-0
sinkInputRow.vala
src/controlCenter/widgets/volume/sinkInputRow.vala
+24
-6
volume.vala
src/controlCenter/widgets/volume/volume.vala
+16
-3
No files found.
man/swaync.5.scd
View file @
176e3b72
...
@@ -434,6 +434,16 @@ config file to be able to detect config errors
...
@@ -434,6 +434,16 @@ config file to be able to detect config errors
optional: true ++
optional: true ++
default: false ++
default: false ++
description: Show per app volume control ++
description: Show per app volume control ++
show-per-app-icon: ++
type: bool ++
optional: true ++
default: false ++
description: Show application icon in per app control ++
show-per-app-label: ++
type: bool ++
optional: true ++
default: false ++
description: Show application name in per app control ++
empty-list-label: ++
empty-list-label: ++
type: string ++
type: string ++
optional: true ++
optional: true ++
...
...
src/configSchema.json
View file @
176e3b72
...
@@ -498,6 +498,16 @@
...
@@ -498,6 +498,16 @@
"default"
:
false
,
"default"
:
false
,
"description"
:
"Show per app volume control"
"description"
:
"Show per app volume control"
},
},
"show-per-app-icon"
:
{
"type"
:
"boolean"
,
"default"
:
true
,
"description"
:
"Show application icon in per app control"
},
"show-per-app-label"
:
{
"type"
:
"boolean"
,
"default"
:
false
,
"description"
:
"Show application name in per app control"
},
"empty-list-label"
:
{
"empty-list-label"
:
{
"type"
:
"string"
,
"type"
:
"string"
,
"default"
:
"No active sink input"
,
"default"
:
"No active sink input"
,
...
...
src/controlCenter/widgets/volume/sinkInputRow.vala
View file @
176e3b72
...
@@ -3,14 +3,21 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -3,14 +3,21 @@ namespace SwayNotificationCenter.Widgets {
Gtk
.
Box
container
;
Gtk
.
Box
container
;
Gtk
.
Image
icon
=
new
Gtk
.
Image
();
Gtk
.
Image
icon
=
new
Gtk
.
Image
();
Gtk
.
Label
label
=
new
Gtk
.
Label
(
null
);
Gtk
.
Scale
scale
=
new
Gtk
.
Scale
.
with_range
(
Gtk
.
Orientation
.
HORIZONTAL
,
0
,
100
,
1
);
Gtk
.
Scale
scale
=
new
Gtk
.
Scale
.
with_range
(
Gtk
.
Orientation
.
HORIZONTAL
,
0
,
100
,
1
);
public
unowned
PulseSinkInput
sink_input
;
public
unowned
PulseSinkInput
sink_input
;
private
unowned
PulseDaemon
client
;
private
unowned
PulseDaemon
client
;
public
SinkInputRow
(
PulseSinkInput
sink_input
,
PulseDaemon
client
,
int
icon_size
)
{
private
bool
show_per_app_icon
;
private
bool
show_per_app_label
;
public
SinkInputRow
(
PulseSinkInput
sink_input
,
PulseDaemon
client
,
int
icon_size
,
bool
show_per_app_icon
,
bool
show_per_app_label
)
{
this
.
client
=
client
;
this
.
client
=
client
;
this
.
show_per_app_icon
=
show_per_app_icon
;
this
.
show_per_app_label
=
show_per_app_label
;
update
(
sink_input
);
update
(
sink_input
);
...
@@ -20,7 +27,12 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -20,7 +27,12 @@ namespace SwayNotificationCenter.Widgets {
container
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
HORIZONTAL
,
0
);
container
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
HORIZONTAL
,
0
);
container
.
add
(
icon
);
if
(
show_per_app_icon
)
{
container
.
add
(
icon
);
}
if
(
show_per_app_label
)
{
container
.
add
(
label
);
}
container
.
pack_start
(
scale
);
container
.
pack_start
(
scale
);
...
@@ -35,10 +47,16 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -35,10 +47,16 @@ namespace SwayNotificationCenter.Widgets {
public
void
update
(
PulseSinkInput
sink_input
)
{
public
void
update
(
PulseSinkInput
sink_input
)
{
this
.
sink_input
=
sink_input
;
this
.
sink_input
=
sink_input
;
icon
.
set_from_icon_name
(
if
(
show_per_app_icon
)
{
sink_input
.
application_icon_name
??
"application-x-executable"
,
icon
.
set_from_icon_name
(
Gtk
.
IconSize
.
DIALOG
sink_input
.
application_icon_name
??
"application-x-executable"
,
);
Gtk
.
IconSize
.
DIALOG
);
}
if
(
show_per_app_label
)
{
label
.
set_text
(
this
.
sink_input
.
name
);
}
scale
.
set_value
(
sink_input
.
volume
);
scale
.
set_value
(
sink_input
.
volume
);
scale
.
tooltip_text
=
((
int
)
scale
.
get_value
()).
to_string
();
scale
.
tooltip_text
=
((
int
)
scale
.
get_value
()).
to_string
();
...
...
src/controlCenter/widgets/volume/volume.vala
View file @
176e3b72
...
@@ -28,6 +28,8 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -28,6 +28,8 @@ namespace SwayNotificationCenter.Widgets {
private
PulseDaemon
client
=
new
PulseDaemon
();
private
PulseDaemon
client
=
new
PulseDaemon
();
private
bool
show_per_app
;
private
bool
show_per_app
;
private
bool
show_per_app_icon
=
true
;
private
bool
show_per_app_label
=
false
;
construct
{
construct
{
this
.
client
.
change_default_device
.
connect
(
default_device_changed
);
this
.
client
.
change_default_device
.
connect
(
default_device_changed
);
...
@@ -50,7 +52,17 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -50,7 +52,17 @@ namespace SwayNotificationCenter.Widgets {
string
?
label
=
get_prop
<
string
>
(
config
,
"label"
);
string
?
label
=
get_prop
<
string
>
(
config
,
"label"
);
label_widget
.
set_label
(
label
??
"Volume"
);
label_widget
.
set_label
(
label
??
"Volume"
);
show_per_app
=
get_prop
<
bool
>
(
config
,
"show-per-app"
)
?
true
:
false
;
bool
show_per_app_found
;
bool
?
show_per_app
=
get_prop
<
bool
>
(
config
,
"show-per-app"
,
out
show_per_app_found
);
if
(
show_per_app_found
)
this
.
show_per_app
=
show_per_app
;
bool
show_per_app_icon_found
;
bool
?
show_per_app_icon
=
get_prop
<
bool
>
(
config
,
"show-per-app-icon"
,
out
show_per_app_icon_found
);
if
(
show_per_app_icon_found
)
this
.
show_per_app_icon
=
show_per_app_icon
;
bool
show_per_app_label_found
;
bool
?
show_per_app_label
=
get_prop
<
bool
>
(
config
,
"show-per-app-label"
,
out
show_per_app_label_found
);
if
(
show_per_app_label_found
)
this
.
show_per_app_label
=
show_per_app_label
;
string
?
el
=
get_prop
<
string
>
(
config
,
"empty-list-label"
);
string
?
el
=
get_prop
<
string
>
(
config
,
"empty-list-label"
);
if
(
el
!=
null
)
empty_label
=
el
;
if
(
el
!=
null
)
empty_label
=
el
;
...
@@ -106,7 +118,8 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -106,7 +118,8 @@ namespace SwayNotificationCenter.Widgets {
}
}
foreach
(
var
item
in
this
.
client
.
active_sinks
.
values
)
{
foreach
(
var
item
in
this
.
client
.
active_sinks
.
values
)
{
levels_listbox
.
add
(
new
SinkInputRow
(
item
,
client
,
icon_size
));
levels_listbox
.
add
(
new
SinkInputRow
(
item
,
client
,
icon_size
,
show_per_app_icon
,
show_per_app_label
));
}
}
this
.
client
.
change_active_sink
.
connect
(
active_sink_change
);
this
.
client
.
change_active_sink
.
connect
(
active_sink_change
);
...
@@ -163,7 +176,7 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -163,7 +176,7 @@ namespace SwayNotificationCenter.Widgets {
var
label
=
levels_listbox
.
get_children
().
first
().
data
;
var
label
=
levels_listbox
.
get_children
().
first
().
data
;
levels_listbox
.
remove
((
Gtk
.
Widget
)
label
);
levels_listbox
.
remove
((
Gtk
.
Widget
)
label
);
}
}
levels_listbox
.
add
(
new
SinkInputRow
(
sink
,
client
,
icon_size
));
levels_listbox
.
add
(
new
SinkInputRow
(
sink
,
client
,
icon_size
,
show_per_app_icon
,
show_per_app_label
));
show_all
();
show_all
();
}
}
...
...
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