-
Notifications
You must be signed in to change notification settings - Fork 79
command chaining functionality in config #89
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
c1aeaaf
f4064c3
8d0d0e9
76e97dc
cdf7ea0
f4894f2
7d4400a
f90de3d
4d47975
418185a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,7 +167,8 @@ def decorate(func): | |
return func | ||
return decorate | ||
|
||
def checkCommand(self, command,winman,*args,**kwargs): | ||
def check_command(self, command, winman, *args, **kwargs): | ||
""" check if the command is valid and execute it""" | ||
# type: (str, WindowManager, *Any, **Any) -> bool | ||
cmd = self.commands.get(command, None) | ||
|
||
|
@@ -190,11 +191,11 @@ def call(self, command, winman, *args, **kwargs): | |
if ',' in command: | ||
cmds = [i.strip() for i in command.split(',')] | ||
for cmd in cmds: | ||
success = self.checkCommand(cmd, winman, *args, **kwargs) | ||
success = self.check_command(cmd, winman, *args, **kwargs) | ||
else: | ||
return self.checkCommand(command,winman,*args,**kwargs) | ||
return self.check_command(command, winman, *args, **kwargs) | ||
|
||
return success | ||
return success | ||
|
||
|
||
#: The instance of L{CommandRegistry} to be used in 99.9% of use cases. | ||
|
@@ -354,26 +355,17 @@ def move_to_position(winman, # type: WindowManager | |
winman.reposition(win, result, use_rect, gravity=gravity, | ||
geometry_mask=gravity_mask) | ||
|
||
@commands.add('WithBorder') | ||
def add_decoration(winman, win, state): # pylint: disable=unused-argument | ||
# type: (WindowManager, wnck.Window, Any) -> None | ||
"""Add window decoration on the active window.""" | ||
win = gtk.gdk.window_foreign_new(win.get_xid()) | ||
win.set_decorations(True) | ||
|
||
@commands.add('borderless') | ||
def remove_decoration(winman, win, state): # pylint: disable=unused-argument | ||
# type: (WindowManager, wnck.Window, Any) -> None | ||
"""Remove window decoration on the active window.""" | ||
win = gtk.gdk.window_foreign_new(win.get_xid()) | ||
win.set_decorations(False) | ||
|
||
@commands.add('WithBorder', True) | ||
@commands.add('borderless', False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of capitals rather than dashes to indicate word boundaries in Also, using Please change these to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. I wasn't sure about how to name it considering some options were capitalized while some were not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There shouldn't be any. I certainly don't see any capitals in the output of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mmm not the actions. But some of the [general ] config are capitalized while some are not. Since I was considering adding "boderless" as a general state, I guess it kind of bled through on my end. |
||
@commands.add('bordered') | ||
def toggle_decorated(winman, win, state): # pylint: disable=unused-argument | ||
def toggle_decorated(winman, win, state, decoration=None): # pylint: disable=unused-argument | ||
# type: (WindowManager, wnck.Window, Any) -> None | ||
"""Toggle window decoration state on the active window.""" | ||
win = gtk.gdk.window_foreign_new(win.get_xid()) | ||
win.set_decorations(not win.get_decorations()) | ||
if decoration is not None: | ||
win.set_decorations(decoration) | ||
else: | ||
win.set_decorations(not win.get_decorations()) | ||
|
||
@commands.add('show-desktop', windowless=True) | ||
def toggle_desktop(winman, win, state): # pylint: disable=unused-argument | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name
check_command
implies that it won't execute the command if it does exist. (A view supported by the docstring saying "check ... and execute it".)Please either leave this as
call
or rename it totry_call
.