Skip to content

Commit 4cf9131

Browse files
committedApr 25, 2020
Use rofi-script-to-dmenu to run in dmenu mode
1 parent efd8124 commit 4cf9131

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed
 

‎README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ There's a stand-alone script `dmenu-power-menu` that can be used to run the
178178
power menu with dmenu (or rofi in dmenu mode if dmenu isn't found). That script
179179
takes the same command-line arguments as listed above for the main script
180180
`rofi-power-menu`. The stand-alone script might be easier to use but you cannot
181-
pass arguments to dmenu/rofi so their configuration is hardcoded.
181+
pass arguments to dmenu/rofi so their configuration is hardcoded. Also, you need
182+
to install
183+
[rofi-script-to-dmenu](https://github.com/jluttine/rofi-script-to-dmenu).
182184

183185

184186
## Copyright

‎dmenu-power-menu

+5-20
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,10 @@
33
# Simple stand-alone wrapper for rofi-power-menu.
44
#
55
# This script takes the same CLI arguments as rofi-power-menu.
6+
#
7+
# rofi-script-to-dmenu needs to be installed
68

7-
# Use rofi if dmenu isn't found
8-
command -v dmenu >/dev/null
9-
dmenu_exists=$?
10-
if [ $dmenu_exists -eq 0 ]
11-
then
12-
dmenu="dmenu"
13-
else
14-
dmenu="rofi -dmenu"
15-
fi
16-
9+
# Use local rofi-power-menu if present. This makes developing easier.
1710
command -v ./rofi-power-menu >/dev/null
1811
powermenu_exists=$?
1912
if [ $powermenu_exists -eq 0 ]
@@ -23,13 +16,5 @@ else
2316
powermenu="rofi-power-menu"
2417
fi
2518

26-
options=$($powermenu $@ | xxd)
27-
while [ -n "$options" ]
28-
do
29-
choice=$(echo "$options" | xxd -r | $dmenu -p "Power menu" -i -show-icons)
30-
if [ $? -ne 0 ]
31-
then
32-
break
33-
fi
34-
options=$($powermenu $@ "$choice" | xxd)
35-
done
19+
cmd="$powermenu $@"
20+
rofi-script-to-dmenu "$cmd"

0 commit comments

Comments
 (0)
Please sign in to comment.