You are not logged in.
Pages: 1
I find that the default setup for bl-hotcorners isn't configurable regarding the polling interval for the mouse position, the delay in a corner until it triggers, and the bounce distance for the cursor away from a corner. I prefer a longer interval and a bigger bounce, and previously I edited the python script values manually.
These tweaks add more options to the bl-hotcornersrc config file, which makes personalizing the values easier:
[Hot Corners]
top_left_corner_command = gmrun
top_right_corner_command =
bottom_left_corner_command =
bottom_right_corner_command =
polling_interval = 0.2
corner_delay = 0.2
bounce_distance = 40
#!/usr/bin/env python2.7
#
# bl-hotcorners: a script for adding hot corners to Openbox.
# Copyright (C) 2012 Philip Newborough <corenominal@corenominal.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY 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/>.
#
# Renamed for BunsenLabs, more config options added by damo
from Xlib import display
from Xlib.ext.xtest import fake_input
from Xlib import X
from subprocess import Popen, PIPE, STDOUT
import sys, time, os, ConfigParser, re
import argparse
ap = argparse.ArgumentParser(description="Hotcorners")
ap.add_argument("-k", "--kill", help="attempt to kill any running instances",
action="store_true")
ap.add_argument("-d", "--daemon", help="run daemon and listen for cursor triggers",
action="store_true")
opts = ap.parse_args(sys.argv[1:])
p = Popen(['xdotool','getdisplaygeometry'], stdout=PIPE, stderr=STDOUT)
Dimensions = p.communicate()
Dimensions = Dimensions[0].replace('\n', '')
Dimensions = Dimensions.split(' ')
width = int(Dimensions[0])
height = int(Dimensions[1])
hw = width / 2
rt = width - 1
bt = height - 1
if opts.kill:
print "Attempting to kill any running instances..."
os.system('pkill -9 -f bl-hotcorners')
exit()
elif opts.daemon:
Config = ConfigParser.ConfigParser()
cfgdir = os.getenv("HOME")+"/.config/bl-hotcorners"
rcfile = cfgdir+"/bl-hotcornersrc"
bounce = 100
disp = display.Display()
root=display.Display().screen().root
def mousepos():
data = root.query_pointer()._data
return data["root_x"], data["root_y"], data["mask"]
def mousemove(x, y):
fake_input(disp, X.MotionNotify, x=x, y=y)
disp.sync()
try:
cfgfile = open(rcfile)
except IOError as e:
if not os.path.exists(cfgdir):
os.makedirs(cfgdir)
cfgfile = open(rcfile,'w')
Config.add_section('Hot Corners')
Config.set('Hot Corners','top_left_corner_command', 'gmrun')
Config.set('Hot Corners','top_right_corner_command', '')
Config.set('Hot Corners','bottom_left_corner_command', '')
Config.set('Hot Corners','bottom_right_corner_command', '')
Config.set('Hot Corners','polling_interval', '0.2')
Config.set('Hot Corners','corner_delay', '0.2')
Config.set('Hot Corners','bounce_distance', '40')
Config.write(cfgfile)
cfgfile.close()
while True:
Config.read(rcfile)
if Config.get('Hot Corners','polling_interval') != '':
check_intervall = Config.getfloat('Hot Corners','polling_interval')
if Config.get('Hot Corners','bounce_distance') != '':
bounce = Config.getint('Hot Corners','bounce_distance')
if Config.get('Hot Corners','corner_delay') != '':
delay = Config.getfloat('Hot Corners','corner_delay')
time.sleep(check_intervall)
pos = mousepos()
if pos[0] == 0 and pos[1] == 0:
if Config.get('Hot Corners','top_left_corner_command') != '':
time.sleep(delay)
pos = mousepos()
if pos[0] == 0 and pos[1] == 0:
mousemove(pos[0] + bounce, pos[1] + bounce)
os.system('(' + Config.get('Hot Corners','top_left_corner_command') + ') &')
mousemove(pos[0] + bounce, pos[1] + bounce)
time.sleep(2)
elif pos[0] == rt and pos[1] == 0:
if Config.get('Hot Corners','top_right_corner_command') != '':
time.sleep(delay)
pos = mousepos()
if pos[0] == rt and pos[1] == 0 :
mousemove(pos[0] - bounce, pos[1] + bounce)
os.system('(' + Config.get('Hot Corners','top_right_corner_command') + ') &')
mousemove(pos[0] - bounce, pos[1] + bounce)
time.sleep(2)
elif pos[0] == 0 and pos[1] == bt:
if Config.get('Hot Corners','bottom_left_corner_command') != '':
time.sleep(delay)
pos = mousepos()
if pos[0] == 0 and pos[1] == bt:
mousemove(pos[0] + bounce, pos[1] - bounce)
os.system('(' + Config.get('Hot Corners','bottom_left_corner_command') + ') &')
mousemove(pos[0] + bounce, pos[1] - bounce)
time.sleep(2)
elif pos[0] == rt and pos[1] == bt:
if Config.get('Hot Corners','bottom_right_corner_command') != '':
time.sleep(delay)
pos = mousepos()
if pos[0] == rt and pos[1] == bt:
mousemove(pos[0] - bounce, pos[1] - bounce)
os.system('(' + Config.get('Hot Corners','bottom_right_corner_command') + ') &')
mousemove(pos[0] - bounce, pos[1] - bounce)
time.sleep(2)
Now we just need someone to convert the script to be used by Python 3x!
EDIT: Did it myself (I think!) bl-hotcorners-python3
NB it needs
pip3 install python-xlib
Last edited by damo (2020-02-07 23:51:38)
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
Thanks for this. I also found the delay too long and Mr Google sent me here.
Also thanks to the bunsenlabs distro for making me aware of this script
which I use in Xubuntu.
Offline
Pages: 1