make python config variables very visible by making them all capitals. cleaner nicer documentation in the py modules. make public functions more visible.
This commit is contained in:
parent
7e3a0b227c
commit
220b5c40f9
11 changed files with 170 additions and 167 deletions
|
@ -6,8 +6,14 @@ import ob
|
||||||
import otk
|
import otk
|
||||||
|
|
||||||
StateRemove = 0
|
StateRemove = 0
|
||||||
|
"""For the state_* callbacks. Indicates the state should be removed from the
|
||||||
|
window."""
|
||||||
StateAdd = 1
|
StateAdd = 1
|
||||||
|
"""For the state_* callbacks. Indicates the state should be add to the
|
||||||
|
window."""
|
||||||
StateToggle = 2
|
StateToggle = 2
|
||||||
|
"""For the state_* callbacks. Indicates the state should be toggled on the
|
||||||
|
window."""
|
||||||
|
|
||||||
def state_above(data, add=StateAdd):
|
def state_above(data, add=StateAdd):
|
||||||
"""Toggles, adds or removes the 'above' state on a window.
|
"""Toggles, adds or removes the 'above' state on a window.
|
||||||
|
|
|
@ -1,34 +1,36 @@
|
||||||
#############################################################################
|
#############################################################################
|
||||||
### Options that can be defined on startup that affect the behavior of ###
|
### Options that can be changed to adjust the behavior of Openbox. ###
|
||||||
### openbox. ###
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
# theme - the theme used to decorate everything.
|
THEME = "/usr/local/share/openbox/styles/fieron2"
|
||||||
theme = "/usr/local/share/openbox/styles/fieron2"
|
"""The theme used to decorate everything."""
|
||||||
|
|
||||||
# titlebar_layout - the layout of the buttons/label on client titlebars, can be
|
TITLEBAR_LAYOUT = "DILMC"
|
||||||
# made up of the following:
|
"""The layout of the buttons/label on client titlebars, can be made up of the
|
||||||
# I - iconify button, L - text label, M - maximize button,
|
following:
|
||||||
# D - all-desktops button, C - close button
|
I - iconify button
|
||||||
# If no 'L' is included in the string, one will be added to
|
L - text label
|
||||||
# the end by Openbox.
|
M - maximize button,
|
||||||
titlebar_layout = "DILMC"
|
D - all-desktops button
|
||||||
|
C - close button
|
||||||
|
If no 'L' is included in the string, one will be added to the end by
|
||||||
|
Openbox."""
|
||||||
|
|
||||||
# double_click_delay - the number of milliseconds in which 2 clicks are
|
DOUBLE_CLICK_DELAY = 300
|
||||||
# perceived as a double-click.
|
"""The number of milliseconds in which 2 clicks are perceived as a
|
||||||
double_click_delay = 300
|
double-click."""
|
||||||
|
|
||||||
# drag_threshold - the amount of pixels that you have to drag the mouse before
|
DRAG_THRESHOLD = 3
|
||||||
# motion events will start occuring.
|
"""The amount of pixels that you have to drag the mouse before motion events
|
||||||
drag_threshold = 3
|
will start occuring."""
|
||||||
|
|
||||||
# desktop_names - the name of each desktop
|
DESKTOP_NAMES = ["one", "two", "three", "four", "five", "six", "seven", \
|
||||||
desktop_names = ["one", "two", "three", "four", "five", "six", "seven", \
|
|
||||||
"eight", "nine", "ten", "eleven", "twelve"]
|
"eight", "nine", "ten", "eleven", "twelve"]
|
||||||
|
"""The name of each desktop."""
|
||||||
|
|
||||||
# number_of_desktops - the number of desktops/workspaces which can be scrolled
|
NUMBER_OF_DESKTOPS = 4
|
||||||
# between.
|
"""The number of desktops/workspaces which can be scrolled between."""
|
||||||
number_of_desktops = 4
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
print "Loaded config.py"
|
print "Loaded config.py"
|
||||||
|
|
|
@ -6,7 +6,7 @@ import windowplacement # use a routine in here to place windows
|
||||||
import historyplacement # history window placement
|
import historyplacement # history window placement
|
||||||
|
|
||||||
# try focus something when nothing is focused
|
# try focus something when nothing is focused
|
||||||
focus.fallback = 1
|
focus.FALLBACK = 1
|
||||||
|
|
||||||
# choose a default focus model
|
# choose a default focus model
|
||||||
focusmodel.setup_click_focus() # use focusmodel.setup_sloppy_focus() instead to
|
focusmodel.setup_click_focus() # use focusmodel.setup_sloppy_focus() instead to
|
||||||
|
@ -23,7 +23,7 @@ ob.ebind(ob.EventAction.PlaceWindow, historyplacement.place)
|
||||||
def histplace(data):
|
def histplace(data):
|
||||||
if data.client.appClass() == "XTerm": return 0
|
if data.client.appClass() == "XTerm": return 0
|
||||||
return 1
|
return 1
|
||||||
historyplacement.confirm_callback = histplace
|
historyplacement.CONFIRM_CALLBACK = histplace
|
||||||
|
|
||||||
|
|
||||||
# run xterm from root clicks
|
# run xterm from root clicks
|
||||||
|
@ -40,7 +40,7 @@ ob.kbind(["A-S-Tab"], ob.KeyContext.All, stackedcycle.previous
|
||||||
# if you want linear cycling instead of stacked cycling, comment out the focus
|
# if you want linear cycling instead of stacked cycling, comment out the focus
|
||||||
# bindings above, and use these instead.
|
# bindings above, and use these instead.
|
||||||
#import focuscycle
|
#import focuscycle
|
||||||
#focuscycle.raise_window = 0 # don't raise windows when they're activated
|
#focuscycle.RAISE_WINDOW = 0 # don't raise windows when they're activated
|
||||||
#ob.kbind(["A-Tab"], ob.KeyContext.All, focuscycle.next)
|
#ob.kbind(["A-Tab"], ob.KeyContext.All, focuscycle.next)
|
||||||
#ob.kbind(["A-S-Tab"], ob.KeyContext.All, focuscycle.previous)
|
#ob.kbind(["A-S-Tab"], ob.KeyContext.All, focuscycle.previous)
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
###########################################################################
|
###########################################################################
|
||||||
### Options that affect the behavior of the focus module. ###
|
### Options that affect the behavior of the focus module. ###
|
||||||
###########################################################################
|
###########################################################################
|
||||||
avoid_skip_taskbar = 1
|
AVOID_SKIP_TASKBAR = 1
|
||||||
"""Don't focus windows which have requested to not be displayed in taskbars.
|
"""Don't focus windows which have requested to not be displayed in taskbars.
|
||||||
You will still be able to focus the windows, but not through cycling, and
|
You will still be able to focus the windows, but not through cycling, and
|
||||||
they won't be focused as a fallback if 'fallback' is enabled."""
|
they won't be focused as a fallback if 'fallback' is enabled."""
|
||||||
fallback = 0
|
FALLBACK = 0
|
||||||
"""Send focus somewhere when nothing is left with the focus, if possible."""
|
"""Send focus somewhere when nothing is left with the focus, if possible."""
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ _disable = 0
|
||||||
def _focusable(client, desktop):
|
def _focusable(client, desktop):
|
||||||
if not client.normal(): return 0
|
if not client.normal(): return 0
|
||||||
if not (client.canFocus() or client.focusNotify()): return 0
|
if not (client.canFocus() or client.focusNotify()): return 0
|
||||||
if avoid_skip_taskbar and client.skipTaskbar(): return 0
|
if AVOID_SKIP_TASKBAR and client.skipTaskbar(): return 0
|
||||||
|
|
||||||
desk = client.desktop()
|
desk = client.desktop()
|
||||||
if not (desk == 0xffffffff or desk == desktop): return 0
|
if not (desk == 0xffffffff or desk == desktop): return 0
|
||||||
|
@ -46,7 +46,7 @@ def _focused(data):
|
||||||
# move it to the top
|
# move it to the top
|
||||||
_clients.remove(win)
|
_clients.remove(win)
|
||||||
_clients.insert(0, win)
|
_clients.insert(0, win)
|
||||||
elif fallback:
|
elif FALLBACK:
|
||||||
# pass around focus
|
# pass around focus
|
||||||
desktop = ob.openbox.screen(data.screen).desktop()
|
desktop = ob.openbox.screen(data.screen).desktop()
|
||||||
for w in _clients:
|
for w in _clients:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
###########################################################################
|
###########################################################################
|
||||||
### Options that affect the behavior of the focuscycle module. ###
|
### Options that affect the behavior of the focuscycle module. ###
|
||||||
###########################################################################
|
###########################################################################
|
||||||
raise_window = 1
|
RAISE_WINDOW = 1
|
||||||
"""When cycling focus, raise the window chosen as well as focusing it. This
|
"""When cycling focus, raise the window chosen as well as focusing it. This
|
||||||
does not affect fallback focusing behavior."""
|
does not affect fallback focusing behavior."""
|
||||||
# See focus.avoid_skip_taskbar
|
# See focus.avoid_skip_taskbar
|
||||||
|
@ -58,7 +58,7 @@ def _cycle(data, num, forward):
|
||||||
while 1:
|
while 1:
|
||||||
client = screen.client(t)
|
client = screen.client(t)
|
||||||
if client and focus._focusable(client, desktop) and client.focus():
|
if client and focus._focusable(client, desktop) and client.focus():
|
||||||
if raise_window:
|
if RAISE_WINDOW:
|
||||||
screen.raiseWindow(client)
|
screen.raiseWindow(client)
|
||||||
return
|
return
|
||||||
if forward:
|
if forward:
|
||||||
|
|
|
@ -7,32 +7,35 @@ import windowplacement # fallback routines
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
### Options for the historyplacement module (Options in the ###
|
### Options for the historyplacement module (Options in the ###
|
||||||
### windowplacement module also apply!): ###
|
### windowplacement module also apply!) ###
|
||||||
### ###
|
|
||||||
# ignore_requested_positions - When true, the placement algorithm will ###
|
|
||||||
### attempt to place windows even when they ###
|
|
||||||
### request a position (like XMMS). ###
|
|
||||||
### Note this only applies to normal windows, ###
|
|
||||||
### not to special cases like desktops and ###
|
|
||||||
### docks. ###
|
|
||||||
ignore_requested_positions = 0 ###
|
|
||||||
### ###
|
|
||||||
# fallback - The window placement algorithm that will be used when history ###
|
|
||||||
### placement does not have a place for the window. ###
|
|
||||||
fallback = windowplacement.random ###
|
|
||||||
### ###
|
|
||||||
# confirm_callback - set this to a function to have the function called ###
|
|
||||||
### before attempting to place a window via history. If ###
|
|
||||||
### the function returns 'true' then an attempt will be ###
|
|
||||||
### made to place the window. If it returns 'false', the ###
|
|
||||||
### fallback method will be directly applied instead. ###
|
|
||||||
confirm_callback = 0 ###
|
|
||||||
### ###
|
|
||||||
# filename - The name of the file where history data will be stored. The ###
|
|
||||||
### number of the screen is appended onto this filename. ###
|
|
||||||
filename = 'historydb' ###
|
|
||||||
### ###
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
IGNORE_REQUESTED_POSITIONS = 0
|
||||||
|
"""When true, the placement algorithm will attempt to place windows even
|
||||||
|
when they request a position (like XMMS). Note this only applies to
|
||||||
|
normal windows, not to special cases like desktops and docks."""
|
||||||
|
FALLBACK = windowplacement.random
|
||||||
|
"""The window placement algorithm that will be used when history placement
|
||||||
|
does not have a place for the window."""
|
||||||
|
CONFIRM_CALLBACK = 0
|
||||||
|
"""Set this to a function to have the function called before attempting to
|
||||||
|
place a window via history. If the function returns a non-zero, then an
|
||||||
|
attempt will be made to place the window. If it returns zero, the
|
||||||
|
fallback method will be directly applied instead."""
|
||||||
|
FILENAME = 'historydb'
|
||||||
|
"""The name of the file where history data will be stored. The number of
|
||||||
|
the screen is appended onto this filename."""
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
def place(data):
|
||||||
|
"""Place a window usingthe history placement algorithm."""
|
||||||
|
_place(data)
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
### Internal stuff, should not be accessed outside the module. ###
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
import otk
|
import otk
|
||||||
import ob
|
import ob
|
||||||
|
@ -57,7 +60,7 @@ class _state:
|
||||||
|
|
||||||
def _load(data):
|
def _load(data):
|
||||||
global _data
|
global _data
|
||||||
file = open(os.environ['HOME']+'/.openbox/'+filename+"."+str(data.screen),
|
file = open(os.environ['HOME']+'/.openbox/'+FILENAME+"."+str(data.screen),
|
||||||
'r')
|
'r')
|
||||||
if file:
|
if file:
|
||||||
# read data
|
# read data
|
||||||
|
@ -80,7 +83,7 @@ def _load(data):
|
||||||
|
|
||||||
def _save(data):
|
def _save(data):
|
||||||
global _data
|
global _data
|
||||||
file = open(os.environ['HOME']+'/.openbox/'+filename+"."+str(data.screen),
|
file = open(os.environ['HOME']+'/.openbox/'+FILENAME+"."+str(data.screen),
|
||||||
'w')
|
'w')
|
||||||
if file:
|
if file:
|
||||||
while len(_data)-1 < data.screen:
|
while len(_data)-1 < data.screen:
|
||||||
|
@ -110,14 +113,14 @@ def _find(screen, state):
|
||||||
_data.append([])
|
_data.append([])
|
||||||
return _find(screen, state) # try again
|
return _find(screen, state) # try again
|
||||||
|
|
||||||
def place(data):
|
def _place(data):
|
||||||
global _data
|
global _data
|
||||||
if data.client:
|
if data.client:
|
||||||
if not (ignore_requested_positions and data.client.normal()):
|
if not (IGNORE_REQUESTED_POSITIONS and data.client.normal()):
|
||||||
if data.client.positionRequested(): return
|
if data.client.positionRequested(): return
|
||||||
state = _create_state(data)
|
state = _create_state(data)
|
||||||
try:
|
try:
|
||||||
if not confirm_callback or confirm_callback(data):
|
if not CONFIRM_CALLBACK or CONFIRM_CALLBACK(data):
|
||||||
print "looking for : " + state.appname + " : " + \
|
print "looking for : " + state.appname + " : " + \
|
||||||
state.appclass + " : " + state.role
|
state.appclass + " : " + state.role
|
||||||
|
|
||||||
|
@ -132,7 +135,7 @@ def place(data):
|
||||||
print "No match in history"
|
print "No match in history"
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
if fallback: fallback(data)
|
if FALLBACK: FALLBACK(data)
|
||||||
|
|
||||||
def _save_window(data):
|
def _save_window(data):
|
||||||
global _data
|
global _data
|
||||||
|
|
|
@ -5,49 +5,53 @@
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
### Options that can be modified to change the functions' behaviors. ###
|
### Options that can be modified to change the functions' behaviors. ###
|
||||||
### ###
|
|
||||||
# edge_resistance - the amount of resistance to provide to moving a ###
|
|
||||||
### window past a screen boundary. Specify a value of 0 ###
|
|
||||||
### to disable edge resistance. ###
|
|
||||||
edge_resistance = 10 ###
|
|
||||||
### ###
|
|
||||||
# move_popup - display a coordinates popup when moving windows. ###
|
|
||||||
move_popup = 1 ###
|
|
||||||
### ###
|
|
||||||
# NOT IMPLEMENTED (yet?) ###
|
|
||||||
# move_rubberband - display an outline while moving instead of moving the ###
|
|
||||||
### actual window, until the move is completed. Good for ###
|
|
||||||
### slower systems. ###
|
|
||||||
move_rubberband = 0 ###
|
|
||||||
### ###
|
|
||||||
# resize_popup - display a size popup when resizing windows. ###
|
|
||||||
resize_popup = 1 ###
|
|
||||||
### ###
|
|
||||||
# NOT IMPLEMENTED (yet?) ###
|
|
||||||
# resize_rubberband - display an outline while resizing instead of ###
|
|
||||||
### resizing the actual window, until the resize is ###
|
|
||||||
### completed. Good for slower systems. ###
|
|
||||||
resize_rubberband = 0 ###
|
|
||||||
### ###
|
|
||||||
# resize_nearest - 1 to resize from the corner nearest where the mouse ###
|
|
||||||
### is, 0 to resize always from the bottom right corner. ###
|
|
||||||
resize_nearest = 1 ###
|
|
||||||
### ###
|
|
||||||
### ###
|
|
||||||
# Provides: ###
|
|
||||||
# def move(data): ###
|
|
||||||
# """Moves the window interactively. This should only be used with ###
|
|
||||||
# MouseMotion events. If move_popup or move_rubberband is enabled, ###
|
|
||||||
# then the end_move function needs to be bound as well.""" ###
|
|
||||||
# def end_move(data): ###
|
|
||||||
# """Complete the interactive move of a window.""" ###
|
|
||||||
# def resize(data): ###
|
|
||||||
# """Resizes the window interactively. This should only be used with ###
|
|
||||||
# MouseMotion events""" ###
|
|
||||||
# def end_resize(data): ###
|
|
||||||
# """Complete the interactive resize of a window.""" ###
|
|
||||||
### ###
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
EDGE_RESISTANCE = 10
|
||||||
|
"""The amount of resistance to provide to moving a window past a screen
|
||||||
|
boundary. Specify a value of 0 to disable edge resistance."""
|
||||||
|
MOVE_POPUP = 1
|
||||||
|
"""Display a coordinates popup when moving windows."
|
||||||
|
MOVE_RUBBERBAND = 0
|
||||||
|
"""NOT IMPLEMENTED (yet?)
|
||||||
|
Display an outline while moving instead of moving the actual window,
|
||||||
|
until the move is completed. Good for slower systems."""
|
||||||
|
RESIZE_POPUP = 1
|
||||||
|
"""Display a size popup when resizing windows."""
|
||||||
|
RESIZE_RUBBERBAND = 0
|
||||||
|
"""NOT IMPLEMENTED (yet?)
|
||||||
|
Display an outline while resizing instead of resizing the actual
|
||||||
|
window, until the resize is completed. Good for slower systems."""
|
||||||
|
RESIZE_NEAREST = 1
|
||||||
|
"""Non-zero to resize from the corner nearest where the mouse is, 0 to
|
||||||
|
resize always from the bottom right corner."""
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
def move(data):
|
||||||
|
"""Moves the window interactively. This should only be used with
|
||||||
|
MouseAction.Motion events. If MOVE_POPUP or MOVE_RUBBERBAND is enabled,
|
||||||
|
then the end_move function needs to be bound as well."""
|
||||||
|
_move(data)
|
||||||
|
|
||||||
|
def end_move(data):
|
||||||
|
"""Complete the interactive move of a window."""
|
||||||
|
_end_move(data)
|
||||||
|
|
||||||
|
def resize(data):
|
||||||
|
"""Resizes the window interactively. This should only be used with
|
||||||
|
MouseMotion events. If RESIZE_POPUP or RESIZE_RUBBERBAND is enabled,
|
||||||
|
then the end_resize function needs to be bound as well."""
|
||||||
|
_resize(data)
|
||||||
|
|
||||||
|
def end_resize(data):
|
||||||
|
"""Complete the interactive resize of a window."""
|
||||||
|
_end_resize(data)
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
### Internal stuff, should not be accessed outside the module. ###
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
import ob
|
import ob
|
||||||
import otk
|
import otk
|
||||||
|
@ -80,9 +84,9 @@ def _motion_grab(data):
|
||||||
# have all the modifiers this started with been released?
|
# have all the modifiers this started with been released?
|
||||||
if not _motion_mask & data.state:
|
if not _motion_mask & data.state:
|
||||||
if _inmove:
|
if _inmove:
|
||||||
end_move(data)
|
_end_move(data)
|
||||||
elif _inresize:
|
elif _inresize:
|
||||||
end_resize(data)
|
_end_resize(data)
|
||||||
else:
|
else:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
@ -96,9 +100,8 @@ def _do_move():
|
||||||
x = _cx + _dx + _client.frame.rect().x() - _client.area().x()
|
x = _cx + _dx + _client.frame.rect().x() - _client.area().x()
|
||||||
y = _cy + _dy + _client.frame.rect().y() - _client.area().y()
|
y = _cy + _dy + _client.frame.rect().y() - _client.area().y()
|
||||||
|
|
||||||
global edge_resistance
|
|
||||||
global _last_x, _last_y
|
global _last_x, _last_y
|
||||||
if edge_resistance:
|
if EDGE_RESISTANCE:
|
||||||
fs = _client.frame.size()
|
fs = _client.frame.size()
|
||||||
w = _client.area().width() + fs.left + fs.right
|
w = _client.area().width() + fs.left + fs.right
|
||||||
h = _client.area().height() + fs.top + fs.bottom
|
h = _client.area().height() + fs.top + fs.bottom
|
||||||
|
@ -109,16 +112,16 @@ def _do_move():
|
||||||
t = area.top()
|
t = area.top()
|
||||||
b = area.bottom() - h + 1
|
b = area.bottom() - h + 1
|
||||||
# left screen edge
|
# left screen edge
|
||||||
if _last_x > x and x < l and x >= l - edge_resistance:
|
if _last_x > x and x < l and x >= l - EDGE_RESISTANCE:
|
||||||
x = l
|
x = l
|
||||||
# right screen edge
|
# right screen edge
|
||||||
if _last_x < x and x > r and x <= r + edge_resistance:
|
if _last_x < x and x > r and x <= r + EDGE_RESISTANCE:
|
||||||
x = r
|
x = r
|
||||||
# top screen edge
|
# top screen edge
|
||||||
if _last_y > y and y < t and y >= t - edge_resistance:
|
if _last_y > y and y < t and y >= t - EDGE_RESISTANCE:
|
||||||
y = t
|
y = t
|
||||||
# right screen edge
|
# right screen edge
|
||||||
if _last_y < y and y > b and y <= b + edge_resistance:
|
if _last_y < y and y > b and y <= b + EDGE_RESISTANCE:
|
||||||
y = b
|
y = b
|
||||||
|
|
||||||
global _inmove
|
global _inmove
|
||||||
|
@ -129,15 +132,13 @@ def _do_move():
|
||||||
_last_x = x
|
_last_x = x
|
||||||
_last_y = y
|
_last_y = y
|
||||||
|
|
||||||
global move_rubberband
|
if MOVE_RUBBERBAND:
|
||||||
if move_rubberband:
|
|
||||||
# draw the outline ...
|
# draw the outline ...
|
||||||
f=0
|
f=0
|
||||||
else:
|
else:
|
||||||
_client.move(x, y)
|
_client.move(x, y)
|
||||||
|
|
||||||
global move_popup
|
if MOVE_POPUP:
|
||||||
if move_popup:
|
|
||||||
global _popwidget, _poplabel
|
global _popwidget, _poplabel
|
||||||
style = ob.openbox.screen(_screen).style()
|
style = ob.openbox.screen(_screen).style()
|
||||||
font = style.labelFont()
|
font = style.labelFont()
|
||||||
|
@ -160,10 +161,7 @@ def _do_move():
|
||||||
_popwidget.height()) / 2)
|
_popwidget.height()) / 2)
|
||||||
_popwidget.show(1)
|
_popwidget.show(1)
|
||||||
|
|
||||||
def move(data):
|
def _move(data):
|
||||||
"""Moves the window interactively. This should only be used with
|
|
||||||
MouseMotion events. If move_popup or move_rubberband is enabled, then
|
|
||||||
the end_move function needs to be bound as well."""
|
|
||||||
if not data.client: return
|
if not data.client: return
|
||||||
|
|
||||||
# not-normal windows dont get moved
|
# not-normal windows dont get moved
|
||||||
|
@ -182,15 +180,14 @@ def move(data):
|
||||||
ob.kgrab(_screen, _motion_grab)
|
ob.kgrab(_screen, _motion_grab)
|
||||||
_inmove = 1
|
_inmove = 1
|
||||||
|
|
||||||
def end_move(data):
|
def _end_move(data):
|
||||||
"""Complete the interactive move of a window."""
|
global MOVE_RUBBERBAND
|
||||||
global move_rubberband, _inmove
|
global _inmove, _popwidget, _poplabel
|
||||||
global _popwidget, _poplabel
|
|
||||||
if _inmove:
|
if _inmove:
|
||||||
r = move_rubberband
|
r = MOVE_RUBBERBAND
|
||||||
move_rubberband = 0
|
MOVE_RUBBERBAND = 0
|
||||||
_do_move()
|
_do_move()
|
||||||
move_rubberband = r
|
MOVE_RUBBERBAND = r
|
||||||
_inmove = 0
|
_inmove = 0
|
||||||
_poplabel = 0
|
_poplabel = 0
|
||||||
_popwidget = 0
|
_popwidget = 0
|
||||||
|
@ -203,7 +200,7 @@ def _do_resize():
|
||||||
dy = _dy
|
dy = _dy
|
||||||
|
|
||||||
# pick a corner to anchor
|
# pick a corner to anchor
|
||||||
if not (resize_nearest or _context == ob.MouseContext.Grip):
|
if not (RESIZE_NEAREST or _context == ob.MouseContext.Grip):
|
||||||
corner = ob.Client.TopLeft
|
corner = ob.Client.TopLeft
|
||||||
else:
|
else:
|
||||||
x = _px - _cx
|
x = _px - _cx
|
||||||
|
@ -225,15 +222,13 @@ def _do_resize():
|
||||||
w = _cw + dx
|
w = _cw + dx
|
||||||
h = _ch + dy
|
h = _ch + dy
|
||||||
|
|
||||||
global resize_popup
|
if RESIZE_RUBBERBAND:
|
||||||
if resize_rubberband:
|
|
||||||
# draw the outline ...
|
# draw the outline ...
|
||||||
f=0
|
f=0
|
||||||
else:
|
else:
|
||||||
_client.resize(corner, w, h)
|
_client.resize(corner, w, h)
|
||||||
|
|
||||||
global resize_popup
|
if RESIZE_POPUP:
|
||||||
if resize_popup:
|
|
||||||
global _popwidget, _poplabel
|
global _popwidget, _poplabel
|
||||||
style = ob.openbox.screen(_screen).style()
|
style = ob.openbox.screen(_screen).style()
|
||||||
ls = _client.logicalSize()
|
ls = _client.logicalSize()
|
||||||
|
@ -255,9 +250,7 @@ def _do_resize():
|
||||||
_popwidget.height()) / 2)
|
_popwidget.height()) / 2)
|
||||||
_popwidget.show(1)
|
_popwidget.show(1)
|
||||||
|
|
||||||
def resize(data):
|
def _resize(data):
|
||||||
"""Resizes the window interactively. This should only be used with
|
|
||||||
MouseMotion events"""
|
|
||||||
if not data.client: return
|
if not data.client: return
|
||||||
|
|
||||||
# not-normal windows dont get resized
|
# not-normal windows dont get resized
|
||||||
|
@ -280,15 +273,14 @@ def resize(data):
|
||||||
ob.kgrab(_screen, _motion_grab)
|
ob.kgrab(_screen, _motion_grab)
|
||||||
_inresize = 1
|
_inresize = 1
|
||||||
|
|
||||||
def end_resize(data):
|
def _end_resize(data):
|
||||||
"""Complete the interactive resize of a window."""
|
global RESIZE_RUBBERBAND, _inresize
|
||||||
global resize_rubberband, _inresize
|
|
||||||
global _popwidget, _poplabel
|
global _popwidget, _poplabel
|
||||||
if _inresize:
|
if _inresize:
|
||||||
r = resize_rubberband
|
r = RESIZE_RUBBERBAND
|
||||||
resize_rubberband = 0
|
RESIZE_RUBBERBAND = 0
|
||||||
_do_resize()
|
_do_resize()
|
||||||
resize_rubberband = r
|
RESIZE_RUBBERBAND = r
|
||||||
_inresize = 0
|
_inresize = 0
|
||||||
_poplabel = 0
|
_poplabel = 0
|
||||||
_popwidget = 0
|
_popwidget = 0
|
||||||
|
|
|
@ -5,24 +5,24 @@
|
||||||
###########################################################################
|
###########################################################################
|
||||||
### Options that affect the behavior of the stackedcycle module. ###
|
### Options that affect the behavior of the stackedcycle module. ###
|
||||||
###########################################################################
|
###########################################################################
|
||||||
include_all_desktops = 0
|
INCLUDE_ALL_DESKTOPS = 0
|
||||||
"""If this is non-zero then windows from all desktops will be included in
|
"""If this is non-zero then windows from all desktops will be included in
|
||||||
the stacking list."""
|
the stacking list."""
|
||||||
include_icons = 1
|
INCLUDE_ICONS = 1
|
||||||
"""If this is non-zero then windows which are iconified will be included
|
"""If this is non-zero then windows which are iconified will be included
|
||||||
in the stacking list."""
|
in the stacking list."""
|
||||||
include_omnipresent = 1
|
INCLUDE_OMNIPRESENT = 1
|
||||||
"""If this is non-zero then windows which are on all-desktops at once will
|
"""If this is non-zero then windows which are on all-desktops at once will
|
||||||
be included."""
|
be included."""
|
||||||
title_size_limit = 80
|
TITLE_SIZE_LIMIT = 80
|
||||||
"""This specifies a rough limit of characters for the cycling list titles.
|
"""This specifies a rough limit of characters for the cycling list titles.
|
||||||
Titles which are larger will be chopped with an elipsis in their
|
Titles which are larger will be chopped with an elipsis in their
|
||||||
center."""
|
center."""
|
||||||
activate_while_cycling = 1
|
ACTIVATE_WHILE_CYCLING = 1
|
||||||
"""If this is non-zero then windows will be activated as they are
|
"""If this is non-zero then windows will be activated as they are
|
||||||
highlighted in the cycling list (except iconified windows)."""
|
highlighted in the cycling list (except iconified windows)."""
|
||||||
# See focus.avoid_skip_taskbar
|
# See focus.AVOID_SKIP_TASKBAR
|
||||||
# See focuscycle.raise_window
|
# See focuscycle.RAISE_WINDOW
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
def next(data):
|
def next(data):
|
||||||
|
@ -51,7 +51,7 @@ import ob
|
||||||
import focus
|
import focus
|
||||||
import focuscycle
|
import focuscycle
|
||||||
|
|
||||||
class cycledata:
|
class _cycledata:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.cycling = 0
|
self.cycling = 0
|
||||||
|
|
||||||
|
@ -72,11 +72,11 @@ class cycledata:
|
||||||
|
|
||||||
if not client.normal(): return 0
|
if not client.normal(): return 0
|
||||||
if not (client.canFocus() or client.focusNotify()): return 0
|
if not (client.canFocus() or client.focusNotify()): return 0
|
||||||
if focus.avoid_skip_taskbar and client.skipTaskbar(): return 0
|
if focus.AVOID_SKIP_TASKBAR and client.skipTaskbar(): return 0
|
||||||
|
|
||||||
if include_icons and client.iconic(): return 1
|
if INCLUDE_ICONS and client.iconic(): return 1
|
||||||
if include_omnipresent and desk == 0xffffffff: return 1
|
if INCLUDE_OMNIPRESENT and desk == 0xffffffff: return 1
|
||||||
if include_all_desktops: return 1
|
if INCLUDE_ALL_DESKTOPS: return 1
|
||||||
if desk == curdesk: return 1
|
if desk == curdesk: return 1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@ -127,9 +127,9 @@ class cycledata:
|
||||||
|
|
||||||
if c.iconic(): t = c.iconTitle()
|
if c.iconic(): t = c.iconTitle()
|
||||||
else: t = c.title()
|
else: t = c.title()
|
||||||
if len(t) > title_size_limit: # limit the length of titles
|
if len(t) > TITLE_SIZE_LIMIT: # limit the length of titles
|
||||||
t = t[:title_size_limit / 2 - 2] + "..." + \
|
t = t[:TITLE_SIZE_LIMIT / 2 - 2] + "..." + \
|
||||||
t[0 - title_size_limit / 2 - 2:]
|
t[0 - TITLE_SIZE_LIMIT / 2 - 2:]
|
||||||
length = font.measureString(t)
|
length = font.measureString(t)
|
||||||
if length > longest: longest = length
|
if length > longest: longest = length
|
||||||
w.setText(t)
|
w.setText(t)
|
||||||
|
@ -172,7 +172,7 @@ class cycledata:
|
||||||
|
|
||||||
# send a net_active_window message for the target
|
# send a net_active_window message for the target
|
||||||
if final or not client.iconic():
|
if final or not client.iconic():
|
||||||
if final: r = focuscycle.raise_window
|
if final: r = focuscycle.RAISE_WINDOW
|
||||||
else: r = 0
|
else: r = 0
|
||||||
ob.send_client_msg(self.screeninfo.rootWindow(),
|
ob.send_client_msg(self.screeninfo.rootWindow(),
|
||||||
otk.Property_atoms().openbox_active_window,
|
otk.Property_atoms().openbox_active_window,
|
||||||
|
@ -207,7 +207,7 @@ class cycledata:
|
||||||
if self.menupos < 0: self.menupos = len(self.clients) - 1
|
if self.menupos < 0: self.menupos = len(self.clients) - 1
|
||||||
elif self.menupos >= len(self.clients): self.menupos = 0
|
elif self.menupos >= len(self.clients): self.menupos = 0
|
||||||
self.menuwidgets[self.menupos].focus()
|
self.menuwidgets[self.menupos].focus()
|
||||||
if activate_while_cycling:
|
if ACTIVATE_WHILE_CYCLING:
|
||||||
self.activatetarget(0) # activate, but dont deiconify/unshade/raise
|
self.activatetarget(0) # activate, but dont deiconify/unshade/raise
|
||||||
|
|
||||||
def grabfunc(self, data):
|
def grabfunc(self, data):
|
||||||
|
@ -245,6 +245,6 @@ def _grabfunc(data):
|
||||||
ob.ebind(ob.EventAction.NewWindow, _newwindow)
|
ob.ebind(ob.EventAction.NewWindow, _newwindow)
|
||||||
ob.ebind(ob.EventAction.CloseWindow, _closewindow)
|
ob.ebind(ob.EventAction.CloseWindow, _closewindow)
|
||||||
|
|
||||||
_o = cycledata()
|
_o = _cycledata()
|
||||||
|
|
||||||
print "Loaded stackedcycle.py"
|
print "Loaded stackedcycle.py"
|
||||||
|
|
|
@ -153,7 +153,7 @@ void Actions::buttonReleaseHandler(const XButtonEvent &e)
|
||||||
|
|
||||||
// XXX: dont load this every time!!@*
|
// XXX: dont load this every time!!@*
|
||||||
long dblclick;
|
long dblclick;
|
||||||
if (!python_get_long("double_click_delay", &dblclick))
|
if (!python_get_long("DOUBLE_CLICK_DELAY", &dblclick))
|
||||||
dblclick = 300;
|
dblclick = 300;
|
||||||
|
|
||||||
if (e.time - _release.time < (unsigned)dblclick &&
|
if (e.time - _release.time < (unsigned)dblclick &&
|
||||||
|
@ -283,7 +283,7 @@ void Actions::motionHandler(const XMotionEvent &e)
|
||||||
int dx = x_root - _posqueue[0]->pos.x();
|
int dx = x_root - _posqueue[0]->pos.x();
|
||||||
int dy = y_root - _posqueue[0]->pos.y();
|
int dy = y_root - _posqueue[0]->pos.y();
|
||||||
// XXX: dont get this from python every time!
|
// XXX: dont get this from python every time!
|
||||||
if (!python_get_long("drag_threshold", &threshold))
|
if (!python_get_long("DRAG_THRESHOLD", &threshold))
|
||||||
threshold = 0;
|
threshold = 0;
|
||||||
if (!(std::abs(dx) >= threshold || std::abs(dy) >= threshold))
|
if (!(std::abs(dx) >= threshold || std::abs(dy) >= threshold))
|
||||||
return; // not at the threshold yet
|
return; // not at the threshold yet
|
||||||
|
|
|
@ -173,7 +173,7 @@ void Frame::adjustSize()
|
||||||
const int sep = bevel + 1;
|
const int sep = bevel + 1;
|
||||||
|
|
||||||
otk::ustring layout;
|
otk::ustring layout;
|
||||||
if (!python_get_string("titlebar_layout", &layout))
|
if (!python_get_string("TITLEBAR_LAYOUT", &layout))
|
||||||
layout = "ILMC";
|
layout = "ILMC";
|
||||||
|
|
||||||
// this code ensures that the string only has one of each possible
|
// this code ensures that the string only has one of each possible
|
||||||
|
|
|
@ -77,7 +77,7 @@ Screen::Screen(int screen)
|
||||||
// XXX: initialize the screen's style
|
// XXX: initialize the screen's style
|
||||||
/*
|
/*
|
||||||
otk::ustring stylepath;
|
otk::ustring stylepath;
|
||||||
python_get_string("theme", &stylepath);
|
python_get_string("THEME", &stylepath);
|
||||||
otk::Configuration sconfig(false);
|
otk::Configuration sconfig(false);
|
||||||
sconfig.setFile(otk::expandTilde(stylepath.c_str()));
|
sconfig.setFile(otk::expandTilde(stylepath.c_str()));
|
||||||
if (!sconfig.load()) {
|
if (!sconfig.load()) {
|
||||||
|
@ -103,7 +103,7 @@ Screen::Screen(int screen)
|
||||||
|
|
||||||
// Set the net_desktop_names property
|
// Set the net_desktop_names property
|
||||||
std::vector<otk::ustring> names;
|
std::vector<otk::ustring> names;
|
||||||
python_get_stringlist("desktop_names", &names);
|
python_get_stringlist("DESKTOP_NAMES", &names);
|
||||||
otk::Property::set(_info->rootWindow(),
|
otk::Property::set(_info->rootWindow(),
|
||||||
otk::Property::atoms.net_desktop_names,
|
otk::Property::atoms.net_desktop_names,
|
||||||
otk::Property::utf8, names);
|
otk::Property::utf8, names);
|
||||||
|
@ -112,7 +112,7 @@ Screen::Screen(int screen)
|
||||||
|
|
||||||
_desktop = 0;
|
_desktop = 0;
|
||||||
|
|
||||||
if (!python_get_long("number_of_desktops", &_num_desktops))
|
if (!python_get_long("NUMBER_OF_DESKTOPS", &_num_desktops))
|
||||||
_num_desktops = 1;
|
_num_desktops = 1;
|
||||||
changeNumDesktops(_num_desktops); // set the hint
|
changeNumDesktops(_num_desktops); // set the hint
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue