Sha256: 1fdd900cf58a27e6f06a7622df9d11bee9f95f03c8004afb08495686ec7a703a

Contents?: true

Size: 840 Bytes

Versions: 2

Compression:

Stored size: 840 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require File.expand_path('../../lib/volay', __FILE__)

# Module volay
module Volay
  # Main class to display app or control volume
  class Main
    def initialize
      cli = Volay::CLI.new
      cli.parse_options
      Volay::Config.set(:log_level, cli.config[:log_level])
      Volay::Config.init_config
      if %i[up down mute].any? { |k| cli.config.key?(k) }
        sound(cli.config)
      else
        app
      end
    end

    def sound(config)
      Volay::Config.mixer.up(config[:up]) unless config[:up].nil?
      Volay::Config.mixer.down(config[:down]) unless config[:down].nil?
      Volay::Config.mixer.toggle if config[:mute]
    end

    def app
      Volay::App.new(File.expand_path('../../glade/volay.glade', __FILE__))
      Gtk.main
    end
  end
end

Volay::Main.new

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
volay-2.0.0 bin/volay
volay-1.2.0 bin/volay