Class: Fusuma::Plugin::Executors::WmctrlExecutor::Workspace

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/plugin/executors/wmctrl_executor.rb

Overview

Manage workspace

Class Method Summary collapse

Class Method Details

.current_workspace_numInteger

get workspace number

Returns:

  • (Integer)


82
83
84
85
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 82

def current_workspace_num
  text = `wmctrl -d`.split("\n").grep(/\*/).first
  text.chars.first.to_i
end

.move_command(direction:) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 87

def move_command(direction:)
  workspace_num = case direction
                  when 'next'
                    current_workspace_num + 1
                  when 'prev'
                    current_workspace_num - 1
                  else
                    raise "#{direction} is invalid key"
                  end
  "wmctrl -s #{workspace_num}"
end