Skip to content

Commit

Permalink
Merge pull request #2 from ekaunt/master
Browse files Browse the repository at this point in the history
Better promptmenu
  • Loading branch information
owl4ce committed Aug 17, 2020
2 parents 5855875 + 65f7042 commit d589227
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .config/rofi/scripts/powermenu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
chosen="$(echo -e "$options" | $rofi_command -dmenu -selected-row 2)"
case $chosen in
$shutdown)
~/.config/rofi/scripts/promptmenu.sh --yes-command "poweroff" --query "Are you sure want to Poweroff?"
~/.config/rofi/scripts/promptmenu.sh --yes-command "poweroff" --query "Poweroff?"
;;
$reboot)
~/.config/rofi/scripts/promptmenu.sh --yes-command "reboot" --query "Are you sure want to Reboot?"
~/.config/rofi/scripts/promptmenu.sh --yes-command "reboot" --query "Reboot?"
;;
$lock)
~/.scripts/lockscreen
Expand Down
6 changes: 3 additions & 3 deletions .config/rofi/scripts/promptmenu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
rofi_command="rofi -theme themes/promptmenu.rasi"

# Options
yes_text="• Confirm"
no_text="• Cancel"
yes_text=""
no_text=""
query="Are you sure?"
# Parse the args
if [[ $# -eq 0 ]]; then
Expand Down Expand Up @@ -46,7 +46,7 @@ fi
# Variable passed to rofi
options="$yes_text\n$no_text"

chosen="$(echo -e "$options" | $rofi_command -p "$query" -dmenu -a 0 -u 1 -selected-row 1)"
chosen="$(echo -e "$options" | $rofi_command -p "$query" -dmenu -selected-row 1)"
case $chosen in
$yes_text)
eval "$yes_command"
Expand Down
115 changes: 89 additions & 26 deletions .config/rofi/themes/promptmenu.rasi
Original file line number Diff line number Diff line change
@@ -1,43 +1,106 @@
/**
* This theme is intended for a 2 items option menu with a headerbar.
*/

@import "shared/option-menu.rasi"
@import "sidebar/colors.rasi"

* {
font: @prompt-menu-font;
/* General */
text-font: "Comfortaa 15";
icon-font: "feather 30";

option-6-listview-spacing: 30px;

// top right bottom left
menu-window-padding: 6px 6px 6px 60px;
menu-prompt-padding: 10px 20px 15px 20px;
menu-prompt-margin: 0px;
menu-element-border: 0px 10px 0px 10px;
menu-element-padding: 15px 15px 0px -50px;
}

/* ########### */

#window {
height: @confirm-window-height;
width: 20%;
width: 18%;
height: 15%;
location: center;
border: 0px;
}

/* ########### */

* {
background-color: @background;
text-color: @foreground;
font: @icon-font;
}

#horibox {
children: [ listview ];
}
#listview {
layout: horizontal;
}
#element {
border: 0px;
padding: @option-element-padding;
background-color: @background-light;
}
#element.selected {
background-color: @accent;
text-color: @background;
}

/* ########### */

* {
font: @text-font;
}
#window {
padding: @menu-window-padding;
children: [ inputbar, horibox ];
border: @confirm-window-border;
padding: 2%;
border-color: @accent;
}
#inputbar {
children: [ prompt ];
}
#prompt {
padding: @confirm-prompt-padding;
margin: @confirm-prompt-margin;
text-color: @foreground;
margin: @menu-inputbar-margin;
}
#listview {
padding: 1%;
spacing: 1%;
layout: vertical;
spacing: @option-6-listview-spacing;
lines: 2;
}
prompt {
padding: @menu-prompt-padding;
}
#prompt {
margin: @menu-prompt-margin;
background-color: @background-light;
text-color: @accent;
}

#element {
font: @confirm-text-font;
padding: @confirm-element-padding;
background-color: @background;
font: @icon-font;
border: @menu-element-border;
padding: @menu-element-padding;
border-color: @background-light;
}

#element.selected {
border-color: @accent;
}

element.active,
element.selected.urgent {
background-color: @background;
text-color: @accent;
background-color: @on;
text-color: @background;
border-color: @on;
}
element.selected.urgent {
border-color: @accent;
}
element.urgent,
element.selected.active {
background-color: @background;
text-color: @accent;
background-color: @off;
text-color: @background;
border-color: @off;
}
element.selected.active {
border-color: @accent;
}

0 comments on commit d589227

Please sign in to comment.