Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #50 from nwg-piotr/pipemenus
Browse files Browse the repository at this point in the history
nwg-menu and nwg-dmenu creation from stdin content #49
  • Loading branch information
nwg-piotr authored Jun 24, 2020
2 parents 12f8917 + 04fa140 commit 702fc94
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def read(f_name):

setup(
name='sgtk-menu',
version='1.4.1',
version='1.4.0',
description='GTK menu for sway, i3 and some other WMs',
packages=find_packages(),
include_package_data=True,
Expand Down
16 changes: 14 additions & 2 deletions sgtk_menu/dmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from sgtk_menu.tools import (config_dirs, load_json, create_default_configs, check_wm, display_geometry, path_dirs)

wm = check_wm()
pipe_menu = None

# This will apply to the overlay window, as setting the window type POPUP does not impress sway :)
if wm == "sway":
Expand Down Expand Up @@ -74,6 +75,14 @@ def main():
sys.exit(2)

global build_from_file

if not sys.stdin.isatty():
global pipe_menu
pipe_menu = []
for line in sys.stdin:
pipe_menu.append(line.rstrip())
print(pipe_menu)

parser = argparse.ArgumentParser(description="GTK dmenu for sway, i3 and some other WMs")
placement = parser.add_mutually_exclusive_group()
placement.add_argument("-b", "--bottom", action="store_true", help="display menu at the bottom")
Expand Down Expand Up @@ -139,8 +148,11 @@ def main():
)

global all_commands_list
all_commands_list = list_commands()
all_commands_list.sort()
if not pipe_menu:
all_commands_list = list_commands()
all_commands_list.sort()
else:
all_commands_list = pipe_menu

# Overlay window
global win
Expand Down

0 comments on commit 702fc94

Please sign in to comment.