From 67cd4de70766f9e616eec4ef4fc0bcaec7c3b8f8 Mon Sep 17 00:00:00 2001 From: gabo Date: Sat, 20 May 2023 18:55:38 -0300 Subject: [PATCH 1/8] added draft script --- tmenu.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 tmenu.sh diff --git a/tmenu.sh b/tmenu.sh new file mode 100755 index 0000000..314a157 --- /dev/null +++ b/tmenu.sh @@ -0,0 +1,23 @@ +#!/bin/bash +read -r -d '' list + +menu="dmenu" +args="" + +while getopts dfrp: option +do + case "${option}" in + d) menu="dmenu";; + f) menu="fzf";; + r) menu="rofi -dmenu";; + # couldn't make it possible to pass as just a string ($2?), had to pass as a parameter + p) args="${OPTARG}";; + *) echo "menu not available"; exit 1 ;; + esac +done + +# currently not removing single quotes from parameters +# demo of behaviour: tmenu.sh -d -p "-p 'a prompt'" +menu_command="$menu $args" + +printf '%b\n' "$list" | $menu_command \ No newline at end of file From 0dacc60f7bde6310ef231d017dc55b812c6788ab Mon Sep 17 00:00:00 2001 From: gabo Date: Sat, 20 May 2023 20:11:06 -0300 Subject: [PATCH 2/8] renamed script --- tmenu.sh => tmenu | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tmenu.sh => tmenu (100%) diff --git a/tmenu.sh b/tmenu similarity index 100% rename from tmenu.sh rename to tmenu From c5277152722e6bb990a2856792ae8d1daa989685 Mon Sep 17 00:00:00 2001 From: gabo Date: Sat, 20 May 2023 20:13:05 -0300 Subject: [PATCH 3/8] added Makefile --- Makefile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..39230c9 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +.POSIX: + +prefix = /usr/local + +all: + @echo "all target" + +install: + @echo "Installing tmenu..." + install -m 555 tmenu $(DESTDIR)/$(prefix)/bin/tmenu + @echo "done!" + +clean: + @echo "Cleaning tmenu" + +distclean: clean + +uninstall: + @echo "Uninstall tmenu" + rm -f $(DESTDIR)/$(prefix)/bin/tmenu + @echo "done!" + +.PHONY: all install clean distclean uninstall From 7420d3ed67b69dbee2efc82a25ad4a777567f48e Mon Sep 17 00:00:00 2001 From: gabo Date: Sat, 20 May 2023 20:16:09 -0300 Subject: [PATCH 4/8] fzf handles non matching input like dmenu --- tmenu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmenu b/tmenu index 314a157..73ab1e0 100755 --- a/tmenu +++ b/tmenu @@ -8,7 +8,7 @@ while getopts dfrp: option do case "${option}" in d) menu="dmenu";; - f) menu="fzf";; + f) menu="fzf --bind=enter:replace-query+print-query ";; r) menu="rofi -dmenu";; # couldn't make it possible to pass as just a string ($2?), had to pass as a parameter p) args="${OPTARG}";; @@ -17,7 +17,7 @@ do done # currently not removing single quotes from parameters -# demo of behaviour: tmenu.sh -d -p "-p 'a prompt'" +# demo of behaviour: tmenu -d -p "-p 'a prompt'" menu_command="$menu $args" printf '%b\n' "$list" | $menu_command \ No newline at end of file From aeaf1aca3b0d420ecbe335ef7d2db6597b406507 Mon Sep 17 00:00:00 2001 From: gabo Date: Sat, 20 May 2023 20:16:09 -0300 Subject: [PATCH 5/8] fzf handles non matching input like dmenu --- README.md | 1 + tmenu | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 83877ee..5959e18 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,4 @@ Any argument you want to pass to the menu utility can be declared in double quot ```bash ls . | tmenu -d "-l 8 -p 'Files'" ``` + diff --git a/tmenu b/tmenu index 73ab1e0..b30773f 100755 --- a/tmenu +++ b/tmenu @@ -1,17 +1,27 @@ -#!/bin/bash -read -r -d '' list +#!/bin/sh + +# There should be another way to do this +read_from_pipe() +{ + list="" + while read -r item; do + list="$list$item\n" + done + echo "$list" +} menu="dmenu" args="" -while getopts dfrp: option +while getopts dxfra: option do case "${option}" in d) menu="dmenu";; - f) menu="fzf --bind=enter:replace-query+print-query ";; + f) menu="fzf --bind=enter:replace-query+print-query";; r) menu="rofi -dmenu";; + x) menu="xmenu";; # couldn't make it possible to pass as just a string ($2?), had to pass as a parameter - p) args="${OPTARG}";; + a) args="${OPTARG}";; *) echo "menu not available"; exit 1 ;; esac done @@ -20,4 +30,4 @@ done # demo of behaviour: tmenu -d -p "-p 'a prompt'" menu_command="$menu $args" -printf '%b\n' "$list" | $menu_command \ No newline at end of file +printf '%b\n' "$(read_from_pipe)" | $menu_command From d73c9f78a9de5ffd43164bb027fc0a736233863d Mon Sep 17 00:00:00 2001 From: Calebe94 Date: Wed, 10 Jan 2024 18:26:01 -0300 Subject: [PATCH 6/8] Updated the arguments handle --- tmenu | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tmenu b/tmenu index b30773f..b636f6b 100755 --- a/tmenu +++ b/tmenu @@ -21,13 +21,18 @@ do r) menu="rofi -dmenu";; x) menu="xmenu";; # couldn't make it possible to pass as just a string ($2?), had to pass as a parameter - a) args="${OPTARG}";; + a) + args="${OPTARG}" + if [ "$menu" = "fzf --bind=enter:replace-query+print-query" ]; then + args=$(echo "$args" | sed 's/-p/--prompt/g') + fi + ;; *) echo "menu not available"; exit 1 ;; esac done # currently not removing single quotes from parameters -# demo of behaviour: tmenu -d -p "-p 'a prompt'" +# demo of behaviour: tmenu -d -a "-p 'a prompt'" menu_command="$menu $args" printf '%b\n' "$(read_from_pipe)" | $menu_command From 84a91de36257279a27af6b1a3829e177a8af98e8 Mon Sep 17 00:00:00 2001 From: Calebe94 Date: Wed, 10 Jan 2024 18:29:09 -0300 Subject: [PATCH 7/8] Added templates to repository --- .github/CODE_OF_CONDUCT.md | 134 ++++++++++++++++++++ .github/CONTRIBUTING.md | 9 ++ .github/ISSUE_TEMPLATE/1_Bug_report.md | 36 ++++++ .github/ISSUE_TEMPLATE/2_Feature_request.md | 21 +++ .github/ISSUE_TEMPLATE/config.yml | 5 + .github/pull_request_template.md | 34 +++++ 6 files changed, 239 insertions(+) create mode 100644 .github/CODE_OF_CONDUCT.md create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE/1_Bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/2_Feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/pull_request_template.md diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..ebbb6f3 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,134 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at [calebe94@disroot.org](mailto:calebe94@disroot.org); + +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available +at [https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations + diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..498c31f --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,9 @@ +- **IMPORTANT**: Bandwidth for pull request review is currently quite limited. If you +want to contribute where it's most needed, please consider reviewing or testing +open pull requests. + +- Before you start to work on something, please leave a comment on the relevant + issue (or open one). This makes sure there is no duplicate work done. + +- If you are stuck somewhere or have questions, [please ask](https://github.com/TinyToolSH/tmenu/discussions)! + diff --git a/.github/ISSUE_TEMPLATE/1_Bug_report.md b/.github/ISSUE_TEMPLATE/1_Bug_report.md new file mode 100644 index 0000000..98807d4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_Bug_report.md @@ -0,0 +1,36 @@ +--- +name: 🐛 Bug Report +about: Report errors and problems + +--- + + + +## Expected Behavior + + +## Current Behavior + + +## Possible Solution + + +## Steps to Reproduce + + +1. +2. +3. +4. + +## Context (Environment) + + + + + +## Detailed Description + + +## Possible Implementation + diff --git a/.github/ISSUE_TEMPLATE/2_Feature_request.md b/.github/ISSUE_TEMPLATE/2_Feature_request.md new file mode 100644 index 0000000..c96eaa0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2_Feature_request.md @@ -0,0 +1,21 @@ +--- +name: 🚀 Feature Request +about: Ideas for new features and improvements + +--- + + +## Expected Behavior + + +## Context (Environment) + + + + + +## Detailed Description + + +## Possible Implementation + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..1478e79 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: ❓ Support Question + url: https://github.com/TinyToolSH/tmenu/discussions + about: Use GitHub's new discussions feature for questions diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..3971171 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,34 @@ + + + +## Description + + +## Related Issue + + + + + +## Motivation and Context + + +## How Has This Been Tested? + + + + +## Screenshots (if appropriate): + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist: + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. From 7eeb593a2a0719b3d9fffcfb9dffd8cb38746bc8 Mon Sep 17 00:00:00 2001 From: Calebe94 Date: Wed, 10 Jan 2024 18:32:58 -0300 Subject: [PATCH 8/8] Updated readme --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5959e18..2a92bbb 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,8 @@ ls . | tmenu -r ls . | tmenu -x ``` -Any argument you want to pass to the menu utility can be declared in double quotes +Any argument you want to pass to the menu utility can be declared by calling `-a` and passing the arguments in double quotes: ```bash -ls . | tmenu -d "-l 8 -p 'Files'" +ls . | tmenu -d -a "-l 8 -p 'Files'" ``` -