def run(self): if os.path.exists(self.test_file): os.remove(self.test_file) # add a new custom launcher at the beginning of the dock conf_file = self.d.Add({'type':'Launcher', 'name':'xxx', 'command':'echo -n 321 > '+self.test_file, 'icon':'gtk-home.png', 'position':1}) if conf_file == None or conf_file == "" or not os.path.exists(conf_file): self.print_error ("Failed to add the launcher") return # reload set_param (conf_file, "Desktop Entry", "Name", "Test launcher") set_param (conf_file, "Desktop Entry", "Exec", "echo -n 123 > \/tmp\/cairo-dock-test") self.d.Reload('config-file='+conf_file) # left-click on it key ("super+Return") key("2") # 'position' starts from 0, but numbers on the icons start from 1 try: f = open('/tmp/cairo-dock-test', 'r') result = f.read() if result != "123": self.print_error ("Failed to reload the launcher") except: self.print_error ("Failed to activate the launcher") # remove it self.d.Remove('config-file='+conf_file); if os.path.exists(conf_file): self.print_error ("Failed to remove the launcher") self.end()
def run(self): os.system('killall -q '+self.exe) sleep(1) self.d.Remove('type=Launcher & class='+self.wmclass) # add a new launcher conf_file = self.d.Add({'type':'Launcher', 'position':1, 'config-file':'application://'+self.desktop_file}) if conf_file == None or conf_file == "" or not os.path.exists(conf_file): self.print_error ("Failed to add the launcher") # activate the launcher and check that it launches the program key ("super+Return") key("2") # 'position' starts from 0, but numbers on the icons start from 1 os.system('pgrep -f '+self.exe) # remove the launcher self.d.Remove('config-file='+conf_file) if len (self.d.GetProperties('config-file='+conf_file)) != 0: # check that it has been deleted self.print_error ("Failed to remove the launcher") if os.path.exists(conf_file): # check that it has been removed from the theme self.print_error ("Failed to remove the launcher from the theme") self.end()
def run(self): if os.path.exists(self.test_file): os.remove(self.test_file) # add a new custom launcher at the beginning of the dock conf_file = self.d.Add({ 'type': 'Launcher', 'name': 'xxx', 'command': 'echo -n 321 > ' + self.test_file, 'icon': 'gtk-home.png', 'position': 1 }) if conf_file == None or conf_file == "" or not os.path.exists( conf_file): self.print_error("Failed to add the launcher") return # reload set_param(conf_file, "Desktop Entry", "Name", "Test launcher") set_param(conf_file, "Desktop Entry", "Exec", "echo -n 123 > \/tmp\/cairo-dock-test") self.d.Reload('config-file=' + conf_file) # left-click on it key("super+Return") key( "2" ) # 'position' starts from 0, but numbers on the icons start from 1 try: f = open('/tmp/cairo-dock-test', 'r') result = f.read() if result != "123": self.print_error("Failed to reload the launcher") except: self.print_error("Failed to activate the launcher") # remove it self.d.Remove('config-file=' + conf_file) if os.path.exists(conf_file): self.print_error("Failed to remove the launcher") self.end()
def run(self): os.system('killall -q ' + self.exe) sleep(1) self.d.Remove('type=Launcher & class=' + self.wmclass) # add a new launcher conf_file = self.d.Add({ 'type': 'Launcher', 'position': 1, 'config-file': 'application://' + self.desktop_file }) if conf_file == None or conf_file == "" or not os.path.exists( conf_file): self.print_error("Failed to add the launcher") # activate the launcher and check that it launches the program key("super+Return") key( "2" ) # 'position' starts from 0, but numbers on the icons start from 1 os.system('pgrep -f ' + self.exe) # remove the launcher self.d.Remove('config-file=' + conf_file) if len(self.d.GetProperties('config-file=' + conf_file) ) != 0: # check that it has been deleted self.print_error("Failed to remove the launcher") if os.path.exists( conf_file): # check that it has been removed from the theme self.print_error("Failed to remove the launcher from the theme") self.end()