лучше не лезьте

This commit is contained in:
2024-09-22 19:29:25 +04:00
parent 94e0023367
commit de3262e579
27 changed files with 1305 additions and 421 deletions

BIN
rofi/power/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

105
rofi/power/launch.sh Executable file
View File

@@ -0,0 +1,105 @@
#!/usr/bin/env bash
## Author : Aditya Shakya (adi1090x)
## Github : @adi1090x
#
## Rofi : Power Menu
#
## Available Styles
#
## style-1 style-2 style-3 style-4 style-5
# Current Theme
dir="$HOME/.config/rofi/power/power_menu.rasi"
# CMDs
uptime="`uptime -p | sed -e 's/up //g'`"
host=`hostname`
# Options
shutdown='⏻'
reboot=''
lock=''
suspend=''
logout=''
yes=''
no=''
# Rofi CMD
rofi_cmd() {
rofi -dmenu \
-mesg "󱑍 Uptime: $uptime" \
-theme ${dir}
}
# Confirmation CMD
confirm_cmd() {
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 240px;}' \
-theme-str 'listview {columns: 2; lines: 1;}' \
-theme-str 'element-text {horizontal-align: 0.48;}' \
-theme-str 'textbox {horizontal-align: 0.5;}' \
-dmenu \
-p 'Confirmation' \
-mesg 'Are you Sure?' \
-theme ${dir}
}
# Ask for confirmation
confirm_exit() {
echo -e "$yes\n$no" | confirm_cmd
}
# Pass variables to rofi dmenu
run_rofi() {
echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd
}
# Execute Command
run_cmd() {
selected="$(confirm_exit)"
if [[ "$selected" == "$yes" ]]; then
if [[ $1 == '--shutdown' ]]; then
loginctl poweroff
elif [[ $1 == '--reboot' ]]; then
loginctl reboot
elif [[ $1 == '--suspend' ]]; then
loginctl 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
;;
$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

138
rofi/power/power_menu.rasi Normal file
View File

@@ -0,0 +1,138 @@
/**
*
* Author : Aditya Shakya (adi1090x)
* Github : @adi1090x
*
* Rofi Theme File
* Rofi Version: 1.7.3
**/
/*****----- Configuration -----*****/
configuration {
show-icons: false;
}
/*
USE_BUTTONS=YES
*/
@import "../colors.rasi"
/*****----- Main Window -----*****/
window {
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 550px;
x-offset: 0px;
y-offset: 0px;
padding: 0px;
border: 0px solid;
border-radius: 20px;
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", "listview", "message" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 0px;
padding: 100px 80px;
background-color: transparent;
background-image: url("/home/doryan/.config/rofi/power/bg.png", width);
children: [ "textbox-prompt-colon", "dummy","prompt"];
}
dummy {
background-color: transparent;
}
textbox-prompt-colon {
enabled: false;
expand: false;
str: "󰐥 System";
padding: 12px;
border-radius: 100%;
background-color: @selected;
text-color: @foreground;
}
prompt {
enabled: false;
padding: 12px;
border-radius: 100%;
background-color: @active;
text-color: @foreground;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 5;
lines: 1;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: 15px;
margin: 15px;
background-color: transparent;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
padding: 23px 10px;
border-radius: 100%;
background-color: @background-alt;
text-color: @foreground;
cursor: pointer;
}
element-text {
font: "FiraCode Nerd Font Propo 28";
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
element selected.normal {
background-color: var(selected);
text-color: var(background);
}
/*****----- Message -----*****/
message {
enabled: true;
margin: 0px 15px 15px 15px;
padding: 15px;
border-radius: 100%;
background-color: @background-alt;
text-color: @foreground;
}
textbox {
background-color: inherit;
text-color: inherit;
vertical-align: 0.5;
horizontal-align: 0.48;
}