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
| | Fix Debian-specific check for dmenu.
See <https://github.com/proxypoke/quickswitch-for-i3/pull/28>.
--- quickswitch-for-i3-2.2/quickswitch.py 2016-09-18 19:59:10.257765542 +0200
+++ quickswitch-for-i3-2.2/quickswitch.py 2016-09-19 11:00:51.147101323 +0200
@@ -37,11 +37,14 @@
def check_dmenu():
'''Check if dmenu is available.'''
- devnull = open(os.devnull)
- retcode = subprocess.call(["which", "dmenu"],
- stdout=devnull,
- stderr=devnull)
- return True if retcode == 0 else False
+ with open(os.devnull, 'w') as devnull:
+ try:
+ retcode = subprocess.call(["dmenu", "-v"],
+ stdout=devnull,
+ stderr=devnull)
+ return retcode == 0
+ except OSError:
+ return False
def dmenu(options, dmenu):
|