mirror of
https://github.com/GRFreire/scripts.git
synced 2026-01-10 04:59:38 +00:00
add compatibility with dmenu
This commit is contained in:
parent
cff4456d98
commit
516cb35fc6
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## Installing shell-color-scripts
|
## Installing shell-color-scripts
|
||||||
|
|
||||||
> Requires [rofi](https://github.com/davatorium/rofi)
|
> Requires [rofi](https://github.com/davatorium/rofi) or [dmenu](https://tools.suckless.org/dmenu/)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/GRFreire/simple-power-menu $HOME/.local/share/simple-power-menu
|
git clone https://github.com/GRFreire/simple-power-menu $HOME/.local/share/simple-power-menu
|
||||||
|
|||||||
@ -1,5 +1,14 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ $(command -v rofi) ]]; then
|
||||||
|
CMD='rofi -dmenu';
|
||||||
|
elif [[ $(command -v dmenu) ]]; then
|
||||||
|
CMD='dmenu';
|
||||||
|
else
|
||||||
|
echo 'Could not find either dmenu or rofi, exiting'
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
fn_logout() {
|
fn_logout() {
|
||||||
if [[ $DESKTOP_SESSION =~ ^.*openbox$ ]]; then
|
if [[ $DESKTOP_SESSION =~ ^.*openbox$ ]]; then
|
||||||
openbox --exit
|
openbox --exit
|
||||||
@ -35,7 +44,7 @@ PROMPT="${PROMPT%??}"
|
|||||||
|
|
||||||
PROMPT_LENGHT="${#OPTIONS[@]}"
|
PROMPT_LENGHT="${#OPTIONS[@]}"
|
||||||
|
|
||||||
CHOICE=$(echo -e $PROMPT | rofi -dmenu -l $PROMPT_LENGHT -width 20 -p "Power Menu")
|
CHOICE=$(echo -e $PROMPT | $CMD -l $PROMPT_LENGHT -p "Power Menu")
|
||||||
|
|
||||||
if [[ -z $CHOICE ]]; then
|
if [[ -z $CHOICE ]]; then
|
||||||
exit 0;
|
exit 0;
|
||||||
@ -53,7 +62,7 @@ if [ $CAN_PROCEDE -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
CONFIRMATION_CHOICES="no\nyes"
|
CONFIRMATION_CHOICES="no\nyes"
|
||||||
CONFIRMATION=$(echo -e $CONFIRMATION_CHOICES | rofi -dmenu -l 2 -width 20 -p "Do you want to $CHOICE")
|
CONFIRMATION=$(echo -e $CONFIRMATION_CHOICES | $CMD -l 2 -p "Do you want to $CHOICE")
|
||||||
|
|
||||||
if [ -z $CONFIRMATION ]; then
|
if [ -z $CONFIRMATION ]; then
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user