Class: Uh::WM::Env

Inherits:
Baf::Env
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/uh/wm/env.rb

Constant Summary collapse

RC_PATH =
'~/.uhwmrc.rb'.freeze
MODIFIER =
:mod1
KEYBINDS =
{
  [:q, :shift] => proc { quit }
}.freeze
WORKER =
:block
LOGGER_LEVEL =
Logger::WARN
LOGGER_LEVEL_VERBOSE =
Logger::INFO
LOGGER_LEVEL_DEBUG =
Logger::DEBUG
LOGGER_LEVEL_STRINGS =
%w[DEBUG INFO WARN ERROR FATAL UNKNOWN].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**_) ⇒ Env

Returns a new instance of Env.



27
28
29
30
31
32
33
34
35
36
# File 'lib/uh/wm/env.rb', line 27

def initialize **_
  super
  @rc_path          = RC_PATH
  @modifier         = MODIFIER
  @modifier_ignore  = []
  @keybinds         = KEYBINDS.dup
  @layout_options   = {}
  @worker           = WORKER
  @rules            = {}
end

Instance Attribute Details

#keybindsObject (readonly)

Returns the value of attribute keybinds.



23
24
25
# File 'lib/uh/wm/env.rb', line 23

def keybinds
  @keybinds
end

#launchObject

Returns the value of attribute launch.



24
25
26
# File 'lib/uh/wm/env.rb', line 24

def launch
  @launch
end

#layoutObject

Returns the value of attribute layout.



24
25
26
# File 'lib/uh/wm/env.rb', line 24

def layout
  @layout
end

#layout_classObject

Returns the value of attribute layout_class.



24
25
26
# File 'lib/uh/wm/env.rb', line 24

def layout_class
  @layout_class
end

#layout_optionsObject

Returns the value of attribute layout_options.



24
25
26
# File 'lib/uh/wm/env.rb', line 24

def layout_options
  @layout_options
end

#modifierObject

Returns the value of attribute modifier.



24
25
26
# File 'lib/uh/wm/env.rb', line 24

def modifier
  @modifier
end

#modifier_ignoreObject

Returns the value of attribute modifier_ignore.



24
25
26
# File 'lib/uh/wm/env.rb', line 24

def modifier_ignore
  @modifier_ignore
end

#rc_pathObject

Returns the value of attribute rc_path.



24
25
26
# File 'lib/uh/wm/env.rb', line 24

def rc_path
  @rc_path
end

#rulesObject

Returns the value of attribute rules.



24
25
26
# File 'lib/uh/wm/env.rb', line 24

def rules
  @rules
end

#workerObject

Returns the value of attribute worker.



24
25
26
# File 'lib/uh/wm/env.rb', line 24

def worker
  @worker
end

Instance Method Details

#log_logger_levelObject



56
57
58
# File 'lib/uh/wm/env.rb', line 56

def log_logger_level
  log "Logging at #{LOGGER_LEVEL_STRINGS[logger.level]} level"
end

#loggerObject



47
48
49
50
51
52
53
54
# File 'lib/uh/wm/env.rb', line 47

def logger
  @logger ||= Logger.new(@output).tap do |o|
    o.level = debug? ? LOGGER_LEVEL_DEBUG :
      verbose? ? LOGGER_LEVEL_VERBOSE :
      LOGGER_LEVEL
    o.formatter = LoggerFormatter.new
  end
end