Add rofi
This commit is contained in:
parent
b8de2e70f8
commit
d1bbbcbb15
16 changed files with 1538 additions and 3 deletions
BIN
rofi/powermenu/background.png
Normal file
BIN
rofi/powermenu/background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
104
rofi/powermenu/confirmation.rasi
Normal file
104
rofi/powermenu/confirmation.rasi
Normal file
|
@ -0,0 +1,104 @@
|
|||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
* {
|
||||
font: "JetBrainsMono Nerd Font Mono Bold 12";
|
||||
background: #11111b;
|
||||
selected: #cba6f7;
|
||||
active: #716251;
|
||||
urgent: #934A1C;
|
||||
}
|
||||
|
||||
/*
|
||||
USE_BUTTONS=YES
|
||||
*/
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 350px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 8px;
|
||||
border-color: @selected;
|
||||
cursor: "default";
|
||||
background-color: @background;
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
children: [ "message", "listview" ];
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 2;
|
||||
lines: 1;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
spacing: 16px;
|
||||
padding: 32px;
|
||||
margin: 0px;
|
||||
background-color: transparent;
|
||||
cursor: "default";
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
padding: 17px;
|
||||
border-radius: 16px;
|
||||
background-color: #585b70;
|
||||
text-color: #eff1f5;
|
||||
cursor: pointer;
|
||||
}
|
||||
element-text {
|
||||
font: "Font Awesome 5 Free Bold 24";
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: #8839ef;
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px 25px;
|
||||
padding: 10px 20px;
|
||||
border-radius: 0% 0% 100% 100%;
|
||||
background-color: #f5c2e7;
|
||||
}
|
||||
textbox {
|
||||
background-color: transparent;
|
||||
text-color: #313244;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
}
|
102
rofi/powermenu/powermenu.sh
Executable file
102
rofi/powermenu/powermenu.sh
Executable file
|
@ -0,0 +1,102 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Current Theme
|
||||
dir="$HOME/.config/rofi/powermenu/"
|
||||
theme='style'
|
||||
|
||||
# CMDs
|
||||
uptime="`uptime -p | sed -e 's/up //g' | sed -e 's/hour/hr/g' | sed -e 's/minute/min/g'`"
|
||||
|
||||
# Options
|
||||
hibernate=''
|
||||
shutdown=''
|
||||
reboot=''
|
||||
lock=''
|
||||
suspend=''
|
||||
logout=''
|
||||
yes=''
|
||||
no=''
|
||||
|
||||
# Rofi CMD
|
||||
rofi_cmd() {
|
||||
rofi -dmenu \
|
||||
-p " $USER" \
|
||||
-mesg " Uptime: $uptime" \
|
||||
-theme ${dir}/${theme}.rasi
|
||||
}
|
||||
|
||||
# Confirmation CMD
|
||||
confirm_cmd() {
|
||||
rofi -markup-rows -dmenu \
|
||||
-p 'Confirmation' \
|
||||
-mesg 'Are you Sure?' \
|
||||
-theme ${dir}/confirmation.rasi
|
||||
}
|
||||
|
||||
# Ask for confirmation
|
||||
confirm_exit() {
|
||||
echo -e "<span foreground='#a6e3a1'>$yes</span>\n<span foreground='#f38ba8'>$no</span>" | confirm_cmd
|
||||
}
|
||||
|
||||
# Pass variables to rofi dmenu
|
||||
run_rofi() {
|
||||
echo -e "$shutdown\n$reboot\n$lock\n$suspend\n$hibernate\n$logout" | rofi_cmd
|
||||
}
|
||||
|
||||
# Execute Command
|
||||
run_cmd() {
|
||||
selected="$(confirm_exit)"
|
||||
echo "$selected"
|
||||
if [[ "$selected" =~ "$yes" ]]; then
|
||||
if [[ $1 == '--shutdown' ]]; then
|
||||
systemctl poweroff
|
||||
elif [[ $1 == '--reboot' ]]; then
|
||||
systemctl reboot
|
||||
elif [[ $1 == '--hibernate' ]]; then
|
||||
systemctl hibernate
|
||||
elif [[ $1 == '--suspend' ]]; then
|
||||
mpc -q pause
|
||||
amixer set Master mute
|
||||
systemctl suspend
|
||||
elif [[ $1 == '--logout' ]]; then
|
||||
if [[ "$DESKTOP_SESSION" == 'openbox' ]]; then
|
||||
openbox --exit
|
||||
elif [[ "$DESKTOP_SESSION" == 'bspwm' ]]; then
|
||||
bspc quit
|
||||
elif [[ "$DESKTOP_SESSION" == 'i3' ]]; then
|
||||
i3-msg exit
|
||||
elif [[ "$DESKTOP_SESSION" == 'plasma' ]]; then
|
||||
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
|
||||
fi
|
||||
fi
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Actions
|
||||
chosen="$(run_rofi)"
|
||||
case ${chosen} in
|
||||
$shutdown)
|
||||
run_cmd --shutdown
|
||||
;;
|
||||
$reboot)
|
||||
run_cmd --reboot
|
||||
;;
|
||||
$hibernate)
|
||||
run_cmd --hibernate
|
||||
;;
|
||||
$lock)
|
||||
if [[ -x '/usr/bin/betterlockscreen' ]]; then
|
||||
betterlockscreen -l
|
||||
elif [[ -x '/usr/bin/i3lock' ]]; then
|
||||
i3lock
|
||||
fi
|
||||
;;
|
||||
$suspend)
|
||||
run_cmd --suspend
|
||||
;;
|
||||
$logout)
|
||||
run_cmd --logout
|
||||
;;
|
||||
esac
|
130
rofi/powermenu/style.rasi
Normal file
130
rofi/powermenu/style.rasi
Normal file
|
@ -0,0 +1,130 @@
|
|||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
* {
|
||||
font: "JetBrainsMono Nerd Font Mono Bold 12";
|
||||
background: #11111b;
|
||||
background-alt: #f2cdcd;
|
||||
foreground: #FFFFFF;
|
||||
selected: #cba6f7;
|
||||
active: #716251;
|
||||
urgent: #934A1C;
|
||||
}
|
||||
|
||||
/*
|
||||
USE_BUTTONS=YES
|
||||
*/
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 600px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 8px;
|
||||
border-color: @selected;
|
||||
cursor: "default";
|
||||
background-color: @background;
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
children: [ "inputbar", "message", "listview" ];
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
padding: 102px 32px 80px 32px;
|
||||
border-radius: 0%;
|
||||
background-color: transparent;
|
||||
background-image: url("~/Downloads/wallpaper/Anime.png",width);
|
||||
children: ["dummy", "prompt"];
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
padding: 8px;
|
||||
border-radius: 8px;
|
||||
background-color: #a6e3a1;
|
||||
text-color: #313244;
|
||||
}
|
||||
|
||||
dummy {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 6;
|
||||
lines: 1;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
spacing: 16px;
|
||||
padding: 32px;
|
||||
margin: 0px;
|
||||
background-color: transparent;
|
||||
cursor: "default";
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
padding: 17px;
|
||||
border-radius: 16px;
|
||||
background-color: #585b70;
|
||||
text-color: #eff1f5;
|
||||
cursor: pointer;
|
||||
}
|
||||
element-text {
|
||||
font: "Font Awesome 5 Free Bold 24";
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: #cba6f7;
|
||||
text-color: #313244;
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 20px 150px 0px 150px;
|
||||
padding: 10px 20px;
|
||||
border-radius: 100%;
|
||||
background-color: #f5c2e7;
|
||||
}
|
||||
textbox {
|
||||
background-color: transparent;
|
||||
text-color: #313244;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue