Class: YakuakeController::DBusClient
- Inherits:
-
Object
- Object
- YakuakeController::DBusClient
- Defined in:
- lib/yakuake_controller/dbus_client.rb
Instance Method Summary collapse
- #add_tabs_if_needed(count:) ⇒ Object
-
#initialize(dbus: YakuakeController::YakuakeDBus.new) ⇒ DBusClient
constructor
A new instance of DBusClient.
- #remove_tab(tab_index:) ⇒ Object
- #remove_terminal(terminal_id:) ⇒ Object
- #run_command_in_tab(tab_index:, command_text:) ⇒ Object
- #run_command_in_terminal(terminal_id:, command_text:) ⇒ Object
- #set_tab_title(tab_index:, new_title:) ⇒ Object
- #tab_title(tab_index:) ⇒ Object
- #terminal_ids_for_tab(tab_index:) ⇒ Object
Constructor Details
#initialize(dbus: YakuakeController::YakuakeDBus.new) ⇒ DBusClient
Returns a new instance of DBusClient.
6 7 8 |
# File 'lib/yakuake_controller/dbus_client.rb', line 6 def initialize(dbus: YakuakeController::YakuakeDBus.new) @dbus = dbus end |
Instance Method Details
#add_tabs_if_needed(count:) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/yakuake_controller/dbus_client.rb', line 33 def add_tabs_if_needed count: if count > sessions_ids.length active_session = @dbus.sessions_interface.activeSessionId.first.to_i (count - sessions_ids.length).times do @dbus.sessions_interface.addSession end @dbus.sessions_interface.raiseSession active_session end end |
#remove_tab(tab_index:) ⇒ Object
43 44 45 |
# File 'lib/yakuake_controller/dbus_client.rb', line 43 def remove_tab tab_index: @dbus.sessions_interface.removeSession session_id(tab_index: tab_index).to_i end |
#remove_terminal(terminal_id:) ⇒ Object
47 48 49 |
# File 'lib/yakuake_controller/dbus_client.rb', line 47 def remove_terminal terminal_id: @dbus.sessions_interface.removeTerminal terminal_id.to_i end |
#run_command_in_tab(tab_index:, command_text:) ⇒ Object
23 24 25 26 27 |
# File 'lib/yakuake_controller/dbus_client.rb', line 23 def run_command_in_tab tab_index:, command_text: terminal_id = terminal_ids_for_tab(tab_index: tab_index).first run_command_in_terminal terminal_id: terminal_id, command_text: command_text end |
#run_command_in_terminal(terminal_id:, command_text:) ⇒ Object
29 30 31 |
# File 'lib/yakuake_controller/dbus_client.rb', line 29 def run_command_in_terminal terminal_id:, command_text: @dbus.sessions_interface.runCommandInTerminal terminal_id.to_i, command_text end |
#set_tab_title(tab_index:, new_title:) ⇒ Object
18 19 20 21 |
# File 'lib/yakuake_controller/dbus_client.rb', line 18 def set_tab_title tab_index:, new_title: @dbus.tabs_interface.setTabTitle session_id(tab_index: tab_index).to_i, new_title end |
#tab_title(tab_index:) ⇒ Object
14 15 16 |
# File 'lib/yakuake_controller/dbus_client.rb', line 14 def tab_title tab_index: @dbus.tabs_interface.tabTitle(session_id tab_index: tab_index).first end |
#terminal_ids_for_tab(tab_index:) ⇒ Object
10 11 12 |
# File 'lib/yakuake_controller/dbus_client.rb', line 10 def terminal_ids_for_tab tab_index: terminal_ids_for_session session_id: session_id(tab_index: tab_index) end |