Class: Lek::Context
- Inherits:
-
Object
- Object
- Lek::Context
- Defined in:
- lib/lek.rb,
lib/lek/editors.rb,
lib/lek/browsers.rb,
lib/lek/terminals.rb,
lib/lek/workspaces.rb
Instance Method Summary collapse
- #create_new_workspace ⇒ Object
-
#initialize ⇒ Context
constructor
A new instance of Context.
- #open_browsers(url_list) ⇒ Object
- #open_editor(editors_list) ⇒ Object
- #open_terminals(terminals_list) ⇒ Object
Constructor Details
#initialize ⇒ Context
Returns a new instance of Context.
11 12 |
# File 'lib/lek.rb', line 11 def initialize end |
Instance Method Details
#create_new_workspace ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/lek/workspaces.rb', line 5 def create_new_workspace wm = WMCtrl.instance puts "there are #{wm.desktops.last[:id] + 1} desktops" # create a new desktop/workspace wm.change_number_of_desktops(wm.desktops.last[:id] + 2) # refresh the wm object wm = WMCtrl.instance puts "created new desktop with id #{wm.desktops.last[:id]}" # switch to new workspace wm.switch_desktop(wm.desktops.last[:id]) puts "switched to desktop id #{wm.desktops.last[:id]}" end |
#open_browsers(url_list) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/lek/browsers.rb', line 7 def open_browsers(url_list) # opens new window with empty tab for searches system 'google-chrome --new-window' # open list of tabs as per url-list url_list.each do |url| # puts url system "google-chrome #{url}" end end |
#open_editor(editors_list) ⇒ Object
5 6 7 |
# File 'lib/lek/editors.rb', line 5 def open_editor(editors_list) system "subl #{editors_list.join(" ")}" end |
#open_terminals(terminals_list) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lek/terminals.rb', line 6 def open_terminals(terminals_list) concatenated_command = '' # open a terminal for each location/command terminals_list.each do |tab| concatenated_command += "--tab --working-directory=#{tab["path"]} " if tab["command"] then concatenated_command += "-e #{tab["command"]} " end end # puts command system "gnome-terminal #{concatenated_command}" end |