Class: Hiraishin

Inherits:
Object
  • Object
show all
Defined in:
lib/hiraishin.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#current_shortcutsObject (readonly)

Returns the value of attribute current_shortcuts.



3
4
5
# File 'lib/hiraishin.rb', line 3

def current_shortcuts
  @current_shortcuts
end

Class Method Details

.add_shortcut_to_cinnamon(name, command, *keys) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/hiraishin.rb', line 5

def self.add_shortcut_to_cinnamon(name, command, *keys)
  `gsettings set org.cinnamon.desktop.keybindings custom-list "[#{current_shortcuts.join(', ')}, 'custom#{last_shortcode_number}']"`
  `gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom#{last_shortcode_number}/ name "#{name}"`
  `gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom#{last_shortcode_number}/ command "#{command}"`
  `gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom#{last_shortcode_number}/ binding "['<Primary>#{format_keys(keys)}']"`
  
  p "Shortcut #{format_keys(keys)} ('#{name}') created for #{command}"

  true
end