У меня есть hotcorner в верхнем левом, для показа всех окон, и в нижней правой части для показа рабочих областей. Это является раздражающим, когда они продолжают активироваться, играя в игру. Там должен так или иначе установить Compiz для игнорирования горячих углов, когда существует полноэкранное окно?
Ниже двух опций; один сценарий для отключения всего hotcorners (временно), если активное окно максимизируется, и одно, чтобы только отключить определенный hotcorners и действия, Вы упоминаете в вопросе.
Оба сценария являются чрезвычайно легким весом и не добавляют значимой нагрузки для Вашей системы вообще.
Фоновый патч ниже отключит весь hotcorners, если (и пока) активное окно будет максимизироваться (полный экран).
#!/usr/bin/env python3
import subprocess
import time
import ast
import os
edgedata = os.path.join(os.environ["HOME"], ".stored_edges")
key = "/org/compiz/profiles/unity/plugins/"
corners = [
"|TopRight", "|TopLeft", "|BottomLeft", "|Right",
"|Left", "|Top", "|Bottom", "|BottomRight",
]
def get(cmd):
# just a helper function
try:
return subprocess.check_output(cmd).decode("utf-8").strip()
except subprocess.CalledProcessError:
pass
def setval(cmd):
# just another helper function
subprocess.Popen(cmd)
def check_win():
# see if the active window is maximized
# get the active window, convert the id to wmctrl format
windata = get(["wmctrl", "-lG"])
if windata:
w = hex(int(get(["xdotool", "getactivewindow"])))
front = w[:2]+((10-len(w))*"0")+w[2:]
# look up the window size
match = [l for l in windata.splitlines() if front in l][0].split()[4:6]
# and compare them, if equal -> window is maximized
return match == res
def get_res():
# look up screen resolution
scrdata = get("xrandr").split(); resindex = scrdata.index("connected")+2
return [n for n in scrdata[resindex].split("+")[0].split("x")]
def get_edges():
# get data from dump, remember
data = get(["dconf", "dump", key]).split()
for s in data:
if s.startswith("["):
k = s.replace("[", "").replace("]", "/")
elif any([[c in s][0] for c in corners]):
currval = s.split("=")
stored = ["dconf", "write", key+k+currval[0], currval[1]]
tempval = ["dconf", "write", key+k+currval[0], "''"]
open(edgedata, "a+").write(str(stored)+"\n")
setval(tempval)
def set_stored():
# set the stored values
try:
prev = open(edgedata).readlines()
except FileNotFoundError:
pass
else:
for l in [l.strip() for l in open(edgedata).readlines()]:
toset = ast.literal_eval(l)
setval(toset)
os.remove(edgedata)
res = get_res()
state1 = None
while True:
time.sleep(1)
state2 = check_win()
if state2 != None:
if state2 != state1:
get_edges() if state2 else set_stored()
state1 = state2
Для сценария нужны оба xdotool
и wmctrl
:
sudo apt-get install wmctrl xdotool
disable_corners.py
Тестовый прогон сценарий от терминала с командой:
python3 /path/to/disable_corners.py
Если все хорошо работает, добавьте его для Запущения Приложений: Тире> Приложения Запуска> Добавляет. Добавьте команду:
/bin/bash -c "sleep 10 && python3 /path/to/disable_corners.py"
(Фон) сценарий ниже отключит оба угловых действия, которые Вы упоминаете, максимизируется ли активное окно.
#!/usr/bin/env python3
import subprocess
import time
key = "/org/compiz/profiles/unity/plugins"
active1 = "'|BottomRight'"; active2 = "'|TopLeft'"
def get(cmd):
# just a helper function
try:
return subprocess.check_output(cmd).decode("utf-8")
except subprocess.CalledProcessError:
pass
def setval(cmd):
# just another helper function
subprocess.Popen(cmd)
def check_win():
# see if the active window is maximized
# get the active window, convert the id to wmctrl format
windata = get(["wmctrl", "-lG"])
if windata:
w = hex(int(get(["xdotool", "getactivewindow"])))
front = w[:2]+((10-len(w))*"0")+w[2:]
# look up the window size
match = [l for l in windata.splitlines() if front in l][0].split()[4:6]
# and compare them, if equal -> window is maximized
return match == res
def get_res():
# look up screen resolution
scrdata = get("xrandr").split(); resindex = scrdata.index("connected")+2
return [n for n in scrdata[resindex].split("+")[0].split("x")]
res = get_res()
state1 = None
while True:
time.sleep(1)
state2 = check_win()
if state2 != None:
if state2 != state1:
newws = "''" if state2 else active1
# below the specific edges to take care of
setval(["dconf", "write", key+"/expo/expo-edge", newws])
newspread = "''" if state2 else active2
setval(["dconf", "write", key+"/scale/initiate-edge", newspread])
state1 = state2
Использование и настроенный является точно тем же как опцией 1.
Если существует изменение в ситуации (максимизировал/не максимизировал), сценарий устанавливает/сбрасывает Ваш набор hotcorners использование команд:
dconf write /org/compiz/profiles/unity/plugins/expo/expo-edge "''"
dconf write /org/compiz/profiles/unity/plugins/scale/initiate-edge "''"
отключить, или
dconf write /org/compiz/profiles/unity/plugins "'|BottomRight'"
dconf write /org/compiz/profiles/unity/plugins "'|TopLeft'"
включить.