forked from yktoo/indicator-sound-switcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindicator-sound-switcher
executable file
·56 lines (44 loc) · 1.6 KB
/
indicator-sound-switcher
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
#!/usr/bin/env python3
"""
Copyright (C) 2012-2018 Dmitry Kann, http://yktoo.com
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3, as published
by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranties of
MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------
Note for developers: some PEP8 rules are deliberately neglected here, namely:
- E211
- E221
- E241
- E272
- E402
"""
import sys
import logging
import gettext
from indicator_sound_switcher.indicator import SoundSwitcherIndicator, APP_ID
def _parse_cmd_line():
"""Parse command line arguments. Currently only sets up logging."""
# Check command line arguments
lvl = logging.WARNING
for arg in sys.argv:
if arg == '-v':
lvl = logging.INFO
break
elif arg == '-vv':
lvl = logging.DEBUG
break
# Set up logging options
logging.basicConfig(level=lvl, format='%(levelname).3s %(message)s')
if __name__ == "__main__":
# Set up the gettext localisation engine
gettext.install(APP_ID)
# Parse the command line
_parse_cmd_line()
# Instantiate and run the indicator
SoundSwitcherIndicator().run()