From 82d96c264804a840a20b7e899b21a1a409bb423c Mon Sep 17 00:00:00 2001 From: xSmurf Date: Mon, 29 Jun 2015 21:20:49 +0000 Subject: [PATCH] Changed audio profile setting to more selective audio_mode --- profile.go | 23 +++++++++++++++-------- profiles/evince.json | 1 - profiles/gajim.json | 1 - profiles/icedove.json | 1 - profiles/libreoffice.json | 2 -- profiles/pond.json | 1 - profiles/torbrowser-launcher.json | 1 - profiles/xchat.json | 1 - xpra/xpra.go | 7 +++++-- 9 files changed, 20 insertions(+), 18 deletions(-) diff --git a/profile.go b/profile.go index 855ce58..175ca93 100644 --- a/profile.go +++ b/profile.go @@ -44,15 +44,22 @@ type Profile struct { Networking NetworkProfile } +type AudioMode string +const ( + PROFILE_AUDIO_NONE AudioMode = "none" + PROFILE_AUDIO_SPEAKER AudioMode = "speaker" + PROFILE_AUDIO_FULL AudioMode = "full" +) + type XServerConf struct { Enabled bool - TrayIcon string `json:"tray_icon"` - WindowIcon string `json:"window_icon"` - EnableTray bool `json:"enable_tray"` - UseDBUS bool `json:"use_dbus"` - UsePulseAudio bool `json:"use_pulse_audio"` - DisableClipboard bool `json:"disable_clipboard"` - DisableAudio bool `json:"disable_audio"` + TrayIcon string `json:"tray_icon"` + WindowIcon string `json:"window_icon"` + EnableTray bool `json:"enable_tray"` + UseDBUS bool `json:"use_dbus"` + UsePulseAudio bool `json:"use_pulse_audio"` + DisableClipboard bool `json:"disable_clipboard"` + AudioMode AudioMode `json:"audio_mode"` } type WhitelistItem struct { @@ -97,7 +104,7 @@ func NewDefaultProfile() *Profile { EnableTray: false, UseDBUS: false, UsePulseAudio: false, - DisableAudio: true, + AudioMode: PROFILE_AUDIO_NONE, }, } } diff --git a/profiles/evince.json b/profiles/evince.json index b858d8f..f12df60 100644 --- a/profiles/evince.json +++ b/profiles/evince.json @@ -10,7 +10,6 @@ "enabled": true , "enable_tray": true , "tray_icon":"/usr/share/icons/hicolor/48x48/apps/evince.png" - , "disable_audio": true , "use_pulse_audio": false } , "networking":{ diff --git a/profiles/gajim.json b/profiles/gajim.json index 8fd36b6..b41e658 100644 --- a/profiles/gajim.json +++ b/profiles/gajim.json @@ -9,7 +9,6 @@ "enabled": true , "enable_tray": true , "tray_icon":"/usr/share/icons/gnome-colors-common/scalable/apps/gajim.svg" - , "disable_audio":true } , "networking":{ "type":"empty" diff --git a/profiles/icedove.json b/profiles/icedove.json index 8699973..b10cfd6 100644 --- a/profiles/icedove.json +++ b/profiles/icedove.json @@ -4,7 +4,6 @@ "enabled": true , "enable_tray": true , "tray_icon": "/usr/share/icons/hicolor/scalable/apps/icedove.svg" - , "disable_audio": true } , "networking":{ "type":"bridge" diff --git a/profiles/libreoffice.json b/profiles/libreoffice.json index cb5cec6..22f5ef7 100644 --- a/profiles/libreoffice.json +++ b/profiles/libreoffice.json @@ -22,8 +22,6 @@ , "enable_tray": true , "tray_icon":"/usr/share/icons/gnome/scalable/apps/libreoffice-startcenter.svg" , "window_icon":"/usr/share/icons/gnome/scalable/apps/libreoffice-startcenter.svg" - , "disable_audio": true - , "use_pulse_audio": false } , "networking":{ "type":"empty" diff --git a/profiles/pond.json b/profiles/pond.json index 9d3d4a7..7785be5 100644 --- a/profiles/pond.json +++ b/profiles/pond.json @@ -5,7 +5,6 @@ , "enable_tray": true , "tray_icon":"/usr/share/icons/gnome-colors-common/scalable/apps/office-mail.svg" , "window_icon":"/usr/share/icons/gnome-colors-common/scalable/apps/office-mail.svg" - , "disable_audio": true , "use_pulse_audio": false } , "networking":{ diff --git a/profiles/torbrowser-launcher.json b/profiles/torbrowser-launcher.json index bc6dc7a..8be9f3e 100644 --- a/profiles/torbrowser-launcher.json +++ b/profiles/torbrowser-launcher.json @@ -4,7 +4,6 @@ , "xserver": { "enabled": true , "enable_tray": true - , "disable_audio": true , "disable_clipboard": false , "tray_icon":"/usr/share/pixmaps/torbrowser80.xpm" } diff --git a/profiles/xchat.json b/profiles/xchat.json index a32ec2a..c69cce9 100644 --- a/profiles/xchat.json +++ b/profiles/xchat.json @@ -4,7 +4,6 @@ "enabled": true , "enable_tray": true , "tray_icon": "/usr/share/icons/gnome-colors-common/scalable/apps/xchat.svg" - , "disable_audio": true } , "networking":{ "type":"empty" diff --git a/xpra/xpra.go b/xpra/xpra.go index ecceb18..8189f5b 100644 --- a/xpra/xpra.go +++ b/xpra/xpra.go @@ -51,9 +51,12 @@ func getDefaultArgs(config *oz.XServerConf) []string { args = append(args, "--clipboard") } - if config.DisableAudio { + switch config.AudioMode { + case oz.PROFILE_AUDIO_NONE, "": args = append(args, "--no-microphone", "--no-speaker") - } else { + case oz.PROFILE_AUDIO_SPEAKER: + args = append(args, "--no-microphone", "--speaker") + case oz.PROFILE_AUDIO_FULL: args = append(args, "--microphone", "--speaker") }