-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch-ubuntu
More file actions
executable file
·94 lines (87 loc) · 3.21 KB
/
launch-ubuntu
File metadata and controls
executable file
·94 lines (87 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Jared Daniel Carbonell Recomendable.
import sys
import subprocess
def run(flag):
'''Carry out the process of launching the requested application. This is the
first function called when the program is run in the terminal.'''
insertion = {
0 : 'google-chrome --incognito',
1 : 'firefox --private-window',
2 : 'nautilus ~/Apps/',
3 : 'nautilus ~/Dropbox/',
4 : 'nautilus ~/.local/bin/',
5 : 'x-terminal-emulator -e "cd ~ && sudo ./Apps/arduino-1.8.5/arduino"',
6 : 'cd ~ && ./Apps/eagle-9.1.0/eagle',
7 : 'cd ~ && ./Apps/etcher-electron-1.4.4-x86_64/etcher-electron-1.4.4-x86_64.AppImage',
8 : 'cd ~ && ./Apps/fritzing-0.9.3b.linux.AMD64/Fritzing',
9 : 'cd ~ && ./Apps/peazip_portable-6.6.0.LINUX.x86_64.GTK2/peazip',
10: 'cd ~/Apps/tor-browser_en-US/ && ./start-tor-browser.desktop',
11: 'cd ~ && ./Apps/coursemology-linux-x64/coursemology',
12: 'thunderbird',
13: 'x-terminal-emulator -e "jupyter-notebook --no-browser"',
14: 'cd ~ && ./Apps/freemind-bin-1.0.1/freemind.sh',
15: 'cd ~ && ./Apps/whats-app-web-linux-x64/whats-app-web',
16: 'x-terminal-emulator -e "sudo mu-editor"',
17: 'anki',
18: 'nautilus ~/Music/'
}
try:
to_run = insertion[flag]
subprocess.run(['bash', '-c', to_run])
except KeyError:
show_help()
def show_help():
'''Show the help documentation for the program.'''
help_doc = '''Usage: launch [options]
Options:
anki launch Anki
apps launch Nautilus with ~/Apps/ open
arduino launch Arduino
chrome launch Chrome in incognito mode
coursemology launch YIJC Coursemology
dropbox launch Nautilus with Dropbox root directory open
eagle launch Autodesk Eagle
etcher launch Etcher
firefox launch Firefox in a Private Window
fritzing launch Fritzing
jupyter launch Jupyter Notebook without launching a browser
local-bin launch Nautilus with ~/.local/bin/ open
mail launch Thunderbird
mindmap launch FreeMind (mind-mapping software)
mu launch Mu Editor
music launch Nautilus with Music directory open
peazip launch Peazip
tor launch Tor
whatsapp launch WhatsApp (desktop program)'''
print(help_doc)
if __name__ == '__main__':
if len(sys.argv) == 2:
options = {
'chrome' : 0,
'firefox' : 1,
'apps' : 2,
'dropbox' : 3,
'local-bin' : 4,
'arduino' : 5,
'eagle' : 6,
'etcher' : 7,
'fritzing' : 8,
'peazip' : 9,
'tor' : 10,
'coursemology': 11,
'mail' : 12,
'jupyter' : 13,
'mindmap' : 14,
'whatsapp' : 15,
'mu' : 16,
'anki' : 17,
'music' : 18
}
try:
run(options[sys.argv[1]])
except KeyError:
show_help()
else:
show_help()