Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lnotify.py 0.35: fix malformed ps call with py3 #335

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions python/lnotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,18 @@
#
# 0.3.3
# Fix undefined ignore_windows_list.
#
# 0.3.5
# Fix ps call generation in Python 3

from __future__ import unicode_literals

import weechat as weechat
import subprocess
from os import environ, path

lnotify_name = "lnotify"
lnotify_version = "0.3.4"
lnotify_version = "0.3.5"
lnotify_license = "GPL3"

# convenient table checking for bools
Expand Down Expand Up @@ -100,9 +105,9 @@ def handle_msg(data, pbuffer, date, tags, displayed, highlight, prefix, message)
# Check if active window is in the ignore_windows_list and skip notification
if (environ.get('DISPLAY') != None) and path.isfile("/bin/xdotool"):
cmd_pid="xdotool getactivewindow getwindowpid".split()
window_pid = subprocess.check_output(cmd_pid)
window_pid = subprocess.check_output(cmd_pid).decode("utf-8")
cmd_name=("ps -ho comm -p %s"%(window_pid)).split()
window_name = subprocess.check_output(cmd_name)
window_name = subprocess.check_output(cmd_name).decode("utf-8")
ignore_windows_list = ["tilda", "gnome-terminal", "xterm"]
if window_name in ignore_windows_list:
x_focus = True
Expand Down