aboutsummaryrefslogtreecommitdiff
path: root/rofi/powermenu/type-5/powermenu.sh
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus.morhtuuzh@gmx.com>2023-07-25 23:50:32 +0200
committerAnhgelus Morhtuuzh <anhgelus.morhtuuzh@gmx.com>2023-07-25 23:50:32 +0200
commit1b72a07b4459ebdac1399e919bccc8ae215b916d (patch)
tree1c9b3b52fa6138a1b4efbb90f8d1307eb595ec85 /rofi/powermenu/type-5/powermenu.sh
parentc57e8ab185623510e527400a34d729b313daffc4 (diff)
feat(polybar): switch to 24h date
Diffstat (limited to 'rofi/powermenu/type-5/powermenu.sh')
-rwxr-xr-xrofi/powermenu/type-5/powermenu.sh117
1 files changed, 0 insertions, 117 deletions
diff --git a/rofi/powermenu/type-5/powermenu.sh b/rofi/powermenu/type-5/powermenu.sh
deleted file mode 100755
index 561e30c..0000000
--- a/rofi/powermenu/type-5/powermenu.sh
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/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/powermenu/type-5"
-theme='style-1'
-
-# CMDs
-lastlogin="`last $USER | head -n1 | tr -s ' ' | cut -d' ' -f5,6,7`"
-uptime="`uptime -p | sed -e 's/up //g'`"
-host=`hostname`
-
-# Options
-hibernate=''
-shutdown=''
-reboot=''
-lock=''
-suspend=''
-logout=''
-yes=''
-no=''
-
-# Rofi CMD
-rofi_cmd() {
- rofi -dmenu \
- -p " $USER@$host" \
- -mesg " Last Login: $lastlogin |  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$hibernate\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 == '--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