mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
allow setting desktop / capture display separately.
This commit is contained in:
parent
dbf9fc6ebc
commit
03733a9cd3
@ -75,6 +75,11 @@ func (Capture) Init(cmd *cobra.Command) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// videos
|
// videos
|
||||||
|
cmd.PersistentFlags().String("capture.video.display", "", "X display to capture")
|
||||||
|
if err := viper.BindPFlag("capture.video.display", cmd.PersistentFlags().Lookup("capture.video.display")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
cmd.PersistentFlags().String("capture.video.codec", "vp8", "video codec to be used")
|
cmd.PersistentFlags().String("capture.video.codec", "vp8", "video codec to be used")
|
||||||
if err := viper.BindPFlag("capture.video.codec", cmd.PersistentFlags().Lookup("capture.video.codec")); err != nil {
|
if err := viper.BindPFlag("capture.video.codec", cmd.PersistentFlags().Lookup("capture.video.codec")); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -309,8 +314,12 @@ func (Capture) InitV2(cmd *cobra.Command) error {
|
|||||||
func (s *Capture) Set() {
|
func (s *Capture) Set() {
|
||||||
var ok bool
|
var ok bool
|
||||||
|
|
||||||
// Display is provided by env variable
|
s.Display = viper.GetString("capture.video.display")
|
||||||
s.Display = os.Getenv("DISPLAY")
|
|
||||||
|
// Display is provided by env variable unless explicitly set
|
||||||
|
if s.Display == "" {
|
||||||
|
s.Display = os.Getenv("DISPLAY")
|
||||||
|
}
|
||||||
|
|
||||||
// video
|
// video
|
||||||
videoCodec := viper.GetString("capture.video.codec")
|
videoCodec := viper.GetString("capture.video.codec")
|
||||||
@ -400,7 +409,7 @@ func (s *Capture) SetV2() {
|
|||||||
|
|
||||||
if display := viper.GetString("display"); display != "" {
|
if display := viper.GetString("display"); display != "" {
|
||||||
s.Display = display
|
s.Display = display
|
||||||
log.Warn().Msg("you are using v2 configuration 'NEKO_DISPLAY' which is deprecated, please use 'DISPLAY' instead")
|
log.Warn().Msg("you are using v2 configuration 'NEKO_DISPLAY' which is deprecated, please use 'NEKO_CAPTURE_VIDEO_DISPLAY' and/or 'NEKO_DESKTOP_DISPLAY' instead, also consider using 'DISPLAY' env variable if both should be the same")
|
||||||
}
|
}
|
||||||
|
|
||||||
if videoCodec := viper.GetString("video_codec"); videoCodec != "" {
|
if videoCodec := viper.GetString("video_codec"); videoCodec != "" {
|
||||||
|
@ -26,6 +26,11 @@ type Desktop struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (Desktop) Init(cmd *cobra.Command) error {
|
func (Desktop) Init(cmd *cobra.Command) error {
|
||||||
|
cmd.PersistentFlags().String("desktop.display", "", "X display to use for desktop sharing")
|
||||||
|
if err := viper.BindPFlag("desktop.display", cmd.PersistentFlags().Lookup("desktop.display")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
cmd.PersistentFlags().String("desktop.screen", "1280x720@30", "default screen size and framerate")
|
cmd.PersistentFlags().String("desktop.screen", "1280x720@30", "default screen size and framerate")
|
||||||
if err := viper.BindPFlag("desktop.screen", cmd.PersistentFlags().Lookup("desktop.screen")); err != nil {
|
if err := viper.BindPFlag("desktop.screen", cmd.PersistentFlags().Lookup("desktop.screen")); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -69,8 +74,12 @@ func (Desktop) InitV2(cmd *cobra.Command) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Desktop) Set() {
|
func (s *Desktop) Set() {
|
||||||
// Display is provided by env variable
|
s.Display = viper.GetString("desktop.display")
|
||||||
s.Display = os.Getenv("DISPLAY")
|
|
||||||
|
// Display is provided by env variable unless explicitly set
|
||||||
|
if s.Display == "" {
|
||||||
|
s.Display = os.Getenv("DISPLAY")
|
||||||
|
}
|
||||||
|
|
||||||
s.ScreenSize = types.ScreenSize{
|
s.ScreenSize = types.ScreenSize{
|
||||||
Width: 1280,
|
Width: 1280,
|
||||||
|
Loading…
Reference in New Issue
Block a user