added packages

This commit is contained in:
2023-04-29 00:31:15 +05:30
parent 6c0edc5379
commit cb7808a9bd
78 changed files with 5393 additions and 0 deletions

View File

@ -0,0 +1,101 @@
#!/usr/bin/env bash
# Current Theme
dir="$HOME/.config/bspwm/"
theme='powermenu'
# 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 \
-p "Uptime: $uptime" \
-mesg "Uptime: $uptime" \
-theme ${dir}/${theme}.rasi
}
# Confirmation CMD
confirm_cmd() {
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 350px;}' \
-theme-str 'mainbox {children: [ "message", "listview" ];}' \
-theme-str 'listview {columns: 2; lines: 1;}' \
-theme-str 'element-text {horizontal-align: 0.5;}' \
-theme-str 'textbox {horizontal-align: 0.5;}' \
-dmenu \
-p 'Confirmation' \
-mesg 'Are you Sure?' \
-theme ${dir}/${theme}.rasi
}
# 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
systemctl poweroff
elif [[ $1 == '--reboot' ]]; then
systemctl reboot
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
;;
$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

View File

@ -0,0 +1,36 @@
get_total_updates() {
local total_updates=$(($(checkupdates 2> /dev/null | wc -l || echo 0) + $(paru -Qua 2> /dev/null | wc -l || echo 0)))
echo "${total_updates:-0}"
}
get_list_updates() {
echo -e "\033[1m\033[34mRegular updates:\033[0m"
checkupdates | sed 's/->/\x1b[32;1m\x1b[0m/g'
}
print_updates() {
local print_updates=$(get_total_updates)
if [[ "$print_updates" -gt 0 ]]; then
echo -e "\033[1m\033[33mThere are $print_updates updates available:\033[0m\n"
get_list_updates
else
echo -e "\033[1m\033[32mYour system is already updated!\033[0m"
fi
}
update_system() {
paru -Syu --nocombinedupgrade
}
case "$1" in
--get-updates)get_total_updates;;
--print-updates)print_updates;;
--update-system)update_system;;
--help|*)echo -e "Updates [options]
Options:
--get-updates Get the numer of updates available.
--print-updates Print the available package to updates.
--update-system Update your system including AUR.\n"
esac