add case insensitivity and update lines/width config

This commit is contained in:
ksyasuda 2022-10-22 14:33:06 -07:00
parent f0bec148c3
commit d774766352

13
rofi.py
View File

@ -84,6 +84,8 @@ class Rofi(object):
rofi_args=None, rofi_args=None,
theme_str=None, theme_str=None,
config_file=None, config_file=None,
active=None,
insensitive=False,
): ):
""" """
Parameters Parameters
@ -125,12 +127,14 @@ class Rofi(object):
# Save parameters. # Save parameters.
self.theme_str = theme_str self.theme_str = theme_str
self.config_file = config_file self.config_file = config_file
self.insensitive = insensitive
self.lines = lines self.lines = lines
self.fixed_lines = fixed_lines self.fixed_lines = fixed_lines
self.width = width self.width = width
self.fullscreen = fullscreen self.fullscreen = fullscreen
self.location = location self.location = location
self.exit_hotkeys = exit_hotkeys self.exit_hotkeys = exit_hotkeys
self.active = active
self.rofi_args = rofi_args or [] self.rofi_args = rofi_args or []
# Don't want a window left on the screen if we exit unexpectedly # Don't want a window left on the screen if we exit unexpectedly
@ -282,10 +286,15 @@ class Rofi(object):
) )
args.extend(["-config", str(config_file.expanduser())]) args.extend(["-config", str(config_file.expanduser())])
# case insensitivity
insensitive = kwargs.get("insensitive", self.insensitive)
if insensitive:
args.append("-i")
# Number of lines. # Number of lines.
lines = kwargs.get("lines", self.lines) lines = kwargs.get("lines", self.lines)
if lines: if lines:
args.extend(["-lines", str(lines)]) args.extend(["-l", str(lines)])
fixed_lines = kwargs.get("fixed_lines", self.fixed_lines) fixed_lines = kwargs.get("fixed_lines", self.fixed_lines)
if fixed_lines: if fixed_lines:
args.extend(["-fixed-num-lines", str(fixed_lines)]) args.extend(["-fixed-num-lines", str(fixed_lines)])
@ -293,7 +302,7 @@ class Rofi(object):
# Width. # Width.
width = kwargs.get("width", self.width) width = kwargs.get("width", self.width)
if width is not None: if width is not None:
args.extend(["-width", str(width)]) args.extend(["-theme-str", f"window {{ width: {width}; }}"])
# Fullscreen mode? # Fullscreen mode?
fullscreen = kwargs.get("fullscreen", self.fullscreen) fullscreen = kwargs.get("fullscreen", self.fullscreen)