Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanCarloMachado committed Oct 16, 2024
1 parent c3ac114 commit 8f057fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 6 additions & 3 deletions python_search/search/search_ui/kitty.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,14 @@ def launch(self) -> None:
self._logger.debug(f"Launching kitty with cmd: {cmd}")
result = os.system(cmd)
if result != 0:
raise Exception("Failed: " + str(result), cmd)
raise Exception("Failed: " + str(result))

def get_kitty_complete_cmd(self) -> str:
terminal = KittyTerminal()
from python_search.theme import get_current_theme
theme = get_current_theme()
return f"""{self.get_kitty_cmd()} \
--title {self._title} \
--listen-on unix:/tmp/mykitty \
-o allow_remote_control=yes \
-o draw_minimal_borders=no \
-o window_padding_width=0 \
-o placement_strategy=center \
Expand Down Expand Up @@ -115,6 +113,11 @@ def main():

fire.Fire(KittySearch)

def get_kitty_cmd() -> str:
if is_mac():
return SystemPaths.KITTY_BINNARY
return "kitty"


if __name__ == "__main__":
main()
10 changes: 6 additions & 4 deletions python_search/search/search_ui/search_actions.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
from subprocess import Popen

from python_search.host_system.system_paths import SystemPaths


class Actions:
def search_in_google(self, query):
Popen(
f'clipboard set_content "{query}" && run_key "search in google using clipboard content" &>/dev/null',
f'{SystemPaths.BINARIES_PATH}/clipboard set_content "{query}" && {SystemPaths.BINARIES_PATH}/run_key "search in google using clipboard content" &>/dev/null',
stdout=None,
stderr=None,
shell=True,
)

def copy_entry_value_to_clipboard(self, entry_key):
Popen(
f'share_entry share_only_value "{entry_key}" &>/dev/null',
f'{SystemPaths.BINARIES_PATH}/share_entry share_only_value "{entry_key}" &>/dev/null',
stdout=None,
stderr=None,
shell=True,
)

def edit_key(self, key):
Popen(
f'/Users/jean.machado/miniconda3/envs/python312/bin/entries_editor edit_key "{key}" &>/dev/null',
f'{SystemPaths.BINARIES_PATH}/entries_editor edit_key "{key}" &>/dev/null',
stdout=None,
stderr=None,
shell=True,
)

def run_key(self, key: str) -> None:
command = f'run_key "{key}" &>/dev/null'
command = f'{SystemPaths.BINARIES_PATH}/run_key "{key}" &>/dev/null'
Popen(command, stdout=None, stderr=None, shell=True)

0 comments on commit 8f057fb

Please sign in to comment.