Fix dotfiles structure
This commit is contained in:
94
.config/rofi/bin/android_apps
Executable file
94
.config/rofi/bin/android_apps
Executable file
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
dir="$HOME/.config/rofi/applets/android"
|
||||
rofi_command="rofi -theme $dir/six.rasi"
|
||||
|
||||
# Links
|
||||
terminal=""
|
||||
files=""
|
||||
editor=""
|
||||
browser=""
|
||||
music=""
|
||||
settings=""
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$dir/message.rasi" -e "$1"
|
||||
}
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$terminal\n$files\n$editor\n$browser\n$music\n$settings"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "Most Used" -dmenu -selected-row 0)"
|
||||
case $chosen in
|
||||
$terminal)
|
||||
if [[ -f /usr/bin/termite ]]; then
|
||||
termite &
|
||||
elif [[ -f /usr/bin/urxvt ]]; then
|
||||
urxvt &
|
||||
elif [[ -f /usr/bin/kitty ]]; then
|
||||
kitty &
|
||||
elif [[ -f /usr/bin/xterm ]]; then
|
||||
xterm &
|
||||
elif [[ -f /usr/bin/xfce4-terminal ]]; then
|
||||
xfce4-terminal &
|
||||
elif [[ -f /usr/bin/gnome-terminal ]]; then
|
||||
gnome-terminal &
|
||||
else
|
||||
msg "No suitable terminal found!"
|
||||
fi
|
||||
;;
|
||||
$files)
|
||||
if [[ -f /usr/bin/thunar ]]; then
|
||||
thunar &
|
||||
elif [[ -f /usr/bin/pcmanfm ]]; then
|
||||
pcmanfm &
|
||||
else
|
||||
msg "No suitable file manager found!"
|
||||
fi
|
||||
;;
|
||||
$editor)
|
||||
if [[ -f /usr/bin/geany ]]; then
|
||||
geany &
|
||||
elif [[ -f /usr/bin/leafpad ]]; then
|
||||
leafpad &
|
||||
elif [[ -f /usr/bin/mousepad ]]; then
|
||||
mousepad &
|
||||
elif [[ -f /usr/bin/code ]]; then
|
||||
code &
|
||||
else
|
||||
msg "No suitable text editor found!"
|
||||
fi
|
||||
;;
|
||||
$browser)
|
||||
if [[ -f /usr/bin/firefox ]]; then
|
||||
firefox &
|
||||
elif [[ -f /usr/bin/chromium ]]; then
|
||||
chromium &
|
||||
elif [[ -f /usr/bin/midori ]]; then
|
||||
midori &
|
||||
else
|
||||
msg "No suitable web browser found!"
|
||||
fi
|
||||
;;
|
||||
$music)
|
||||
if [[ -f /usr/bin/lxmusic ]]; then
|
||||
lxmusic &
|
||||
else
|
||||
msg "No suitable music player found!"
|
||||
fi
|
||||
;;
|
||||
$settings)
|
||||
if [[ -f /usr/bin/xfce4-settings-manager ]]; then
|
||||
xfce4-settings-manager &
|
||||
else
|
||||
msg "No suitable settings manager found!"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
84
.config/rofi/bin/android_backlight
Executable file
84
.config/rofi/bin/android_backlight
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
dir="$HOME/.config/rofi/applets/android"
|
||||
rofi_command="rofi -theme $dir/three.rasi"
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$dir/message.rasi" -e "$1"
|
||||
}
|
||||
|
||||
## Get Brightness
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
BNESS="$(brightnessctl get)"
|
||||
MAX="$(brightnessctl max)"
|
||||
PERC="$((BNESS*100/MAX))"
|
||||
BLIGHT=${PERC%.*}
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
DEVICE=$(ls /sys/class/backlight | head -n 1)
|
||||
BNESS="$(blight -d $DEVICE get brightness)"
|
||||
PERC="$(($BNESS*100/255))"
|
||||
BLIGHT=${PERC%.*}
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
VAR="$(xbacklight -get)"
|
||||
BLIGHT="$(printf "%.0f\n" "$VAR")"
|
||||
else
|
||||
msg "No suitable backlight utility found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $BLIGHT -ge 1 ]] && [[ $BLIGHT -le 29 ]]; then
|
||||
MSG="Low"
|
||||
elif [[ $BLIGHT -ge 30 ]] && [[ $BLIGHT -le 49 ]]; then
|
||||
MSG="Optimal"
|
||||
elif [[ $BLIGHT -ge 50 ]] && [[ $BLIGHT -le 69 ]]; then
|
||||
MSG="High"
|
||||
elif [[ $BLIGHT -ge 70 ]] && [[ $BLIGHT -le 99 ]]; then
|
||||
MSG="Too Much"
|
||||
fi
|
||||
|
||||
## Icons
|
||||
ICON_UP=""
|
||||
ICON_DOWN=""
|
||||
ICON_OPT=""
|
||||
|
||||
notify="notify-send -u low -t 1500"
|
||||
options="$ICON_UP\n$ICON_OPT\n$ICON_DOWN"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$BLIGHT%" -dmenu -selected-row 1)"
|
||||
case $chosen in
|
||||
"$ICON_UP")
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
brightnessctl -q set +10% && $notify "Brightness Up $ICON_UP"
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
blight -d "$DEVICE" set +10% && $notify "Brightness Up $ICON_UP"
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
xbacklight -inc 10 && $notify "Brightness Up $ICON_UP"
|
||||
fi
|
||||
;;
|
||||
"$ICON_DOWN")
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
brightnessctl -q set 10%- && $notify "Brightness Down $ICON_DOWN"
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
blight -d "$DEVICE" set -10% && $notify "Brightness Down $ICON_DOWN"
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
xbacklight -dec 10 && $notify "Brightness Down $ICON_DOWN"
|
||||
fi
|
||||
;;
|
||||
"$ICON_OPT")
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
brightnessctl -q set 25% && $notify "Optimal Brightness $ICON_OPT"
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
blight -d "$DEVICE" set 25% && $notify "Optimal Brightness $ICON_OPT"
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
xbacklight -set 30 && $notify "Optimal Brightness $ICON_OPT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
76
.config/rofi/bin/android_mpd
Executable file
76
.config/rofi/bin/android_mpd
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
dir="$HOME/.config/rofi/applets/android"
|
||||
rofi_command="rofi -theme $dir/six.rasi"
|
||||
|
||||
# Gets the current status of mpd (for us to parse it later on)
|
||||
status="$(mpc status)"
|
||||
# Defines the Play / Pause option content
|
||||
if [[ $status == *"[playing]"* ]]; then
|
||||
play_pause=""
|
||||
else
|
||||
play_pause=""
|
||||
fi
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
# Display if repeat mode is on / off
|
||||
tog_repeat=""
|
||||
if [[ $status == *"repeat: on"* ]]; then
|
||||
active="-a 4"
|
||||
elif [[ $status == *"repeat: off"* ]]; then
|
||||
urgent="-u 4"
|
||||
else
|
||||
tog_repeat=" Parsing error"
|
||||
fi
|
||||
|
||||
# Display if random mode is on / off
|
||||
tog_random=""
|
||||
if [[ $status == *"random: on"* ]]; then
|
||||
[ -n "$active" ] && active+=",5" || active="-a 5"
|
||||
elif [[ $status == *"random: off"* ]]; then
|
||||
[ -n "$urgent" ] && urgent+=",5" || urgent="-u 5"
|
||||
else
|
||||
tog_random=" Parsing error"
|
||||
fi
|
||||
stop=""
|
||||
next=""
|
||||
previous=""
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$previous\n$play_pause\n$stop\n$next\n$tog_repeat\n$tog_random"
|
||||
|
||||
# Get the current playing song
|
||||
current=$(mpc -f %title% current)
|
||||
# If mpd isn't running it will return an empty string, we don't want to display that
|
||||
if [[ -z "$current" ]]; then
|
||||
current="-"
|
||||
fi
|
||||
|
||||
# Spawn the mpd menu with the "Play / Pause" entry selected by default
|
||||
chosen="$(echo -e "$options" | $rofi_command -p " $current" -dmenu $active $urgent -selected-row 1)"
|
||||
case $chosen in
|
||||
$previous)
|
||||
mpc -q prev && notify-send -u low -t 1800 " $(mpc current)"
|
||||
;;
|
||||
$play_pause)
|
||||
mpc -q toggle && notify-send -u low -t 1800 " $(mpc current)"
|
||||
;;
|
||||
$stop)
|
||||
mpc -q stop
|
||||
;;
|
||||
$next)
|
||||
mpc -q next && notify-send -u low -t 1800 " $(mpc current)"
|
||||
;;
|
||||
$tog_repeat)
|
||||
mpc -q repeat
|
||||
;;
|
||||
$tog_random)
|
||||
mpc -q random
|
||||
;;
|
||||
esac
|
||||
94
.config/rofi/bin/android_powermenu
Executable file
94
.config/rofi/bin/android_powermenu
Executable file
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
dir="$HOME/.config/rofi/applets/android"
|
||||
rofi_command="rofi -theme $dir/five.rasi"
|
||||
|
||||
uptime=$(uptime -p | sed -e 's/up //g')
|
||||
|
||||
# Options
|
||||
shutdown=""
|
||||
reboot=""
|
||||
lock=""
|
||||
suspend=""
|
||||
logout=""
|
||||
|
||||
# Confirmation
|
||||
confirm_exit() {
|
||||
rofi -dmenu\
|
||||
-i\
|
||||
-no-fixed-num-lines\
|
||||
-p "Are You Sure? : "\
|
||||
-theme $dir/confirm.rasi
|
||||
}
|
||||
|
||||
# Message
|
||||
msg() {
|
||||
rofi -theme "$dir/message.rasi" -e "Available Options - yes / y / no / n"
|
||||
}
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 2)"
|
||||
case $chosen in
|
||||
$shutdown)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl poweroff
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$reboot)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl reboot
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$lock)
|
||||
if [[ -f /usr/bin/i3lock ]]; then
|
||||
i3lock
|
||||
elif [[ -f /usr/bin/betterlockscreen ]]; then
|
||||
betterlockscreen -l
|
||||
fi
|
||||
;;
|
||||
$suspend)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
mpc -q pause
|
||||
amixer set Master mute
|
||||
systemctl suspend
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$logout)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then
|
||||
openbox --exit
|
||||
elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then
|
||||
bspc quit
|
||||
elif [[ "$DESKTOP_SESSION" == "i3" ]]; then
|
||||
i3-msg exit
|
||||
fi
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
60
.config/rofi/bin/android_quicklinks
Executable file
60
.config/rofi/bin/android_quicklinks
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
dir="$HOME/.config/rofi/applets/android"
|
||||
rofi_command="rofi -theme $dir/six.rasi"
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$dir/message.rasi" -e "$1"
|
||||
}
|
||||
|
||||
# Browser
|
||||
if [[ -f /usr/bin/firefox ]]; then
|
||||
app="firefox"
|
||||
elif [[ -f /usr/bin/chromium ]]; then
|
||||
app="chromium"
|
||||
elif [[ -f /usr/bin/midori ]]; then
|
||||
app="midori"
|
||||
else
|
||||
msg "No suitable web browser found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Links
|
||||
google=""
|
||||
facebook=""
|
||||
twitter=""
|
||||
github=""
|
||||
mail=""
|
||||
youtube=""
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$google\n$facebook\n$twitter\n$github\n$mail\n$youtube"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "Open In : Firefox" -dmenu -selected-row 0)"
|
||||
case $chosen in
|
||||
$google)
|
||||
$app https://www.google.com &
|
||||
;;
|
||||
$facebook)
|
||||
$app https://www.facebook.com &
|
||||
;;
|
||||
$twitter)
|
||||
$app https://www.twitter.com &
|
||||
;;
|
||||
$github)
|
||||
$app https://www.github.com &
|
||||
;;
|
||||
$mail)
|
||||
$app https://www.gmail.com &
|
||||
;;
|
||||
$youtube)
|
||||
$app https://www.youtube.com &
|
||||
;;
|
||||
esac
|
||||
|
||||
48
.config/rofi/bin/android_screenshot
Executable file
48
.config/rofi/bin/android_screenshot
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
dir="$HOME/.config/rofi/applets/android"
|
||||
rofi_command="rofi -theme $dir/three.rasi"
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$dir/message.rasi" -e "Please install 'scrot' first."
|
||||
}
|
||||
|
||||
# Options
|
||||
screen=""
|
||||
area=""
|
||||
window=""
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$screen\n$area\n$window"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p '' -dmenu -selected-row 1)"
|
||||
case $chosen in
|
||||
$screen)
|
||||
if [[ -f /usr/bin/scrot ]]; then
|
||||
sleep 1; scrot 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$area)
|
||||
if [[ -f /usr/bin/scrot ]]; then
|
||||
scrot -s 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$window)
|
||||
if [[ -f /usr/bin/scrot ]]; then
|
||||
sleep 1; scrot -u 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
56
.config/rofi/bin/android_volume
Executable file
56
.config/rofi/bin/android_volume
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
dir="$HOME/.config/rofi/applets/android"
|
||||
rofi_command="rofi -theme $dir/three.rasi"
|
||||
|
||||
## Get Volume
|
||||
#VOLUME=$(amixer get Master | tail -n 1 | awk -F ' ' '{print $5}' | tr -d '[]%')
|
||||
MUTE=$(amixer get Master | tail -n 1 | awk -F ' ' '{print $6}' | tr -d '[]%')
|
||||
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
if [[ $MUTE == *"off"* ]]; then
|
||||
active="-a 1"
|
||||
else
|
||||
urgent="-u 1"
|
||||
fi
|
||||
|
||||
if [[ $MUTE == *"off"* ]]; then
|
||||
active="-a 1"
|
||||
else
|
||||
urgent="-u 1"
|
||||
fi
|
||||
|
||||
if [[ $MUTE == *"on"* ]]; then
|
||||
VOLUME="$(amixer get Master | tail -n 1 | awk -F ' ' '{print $5}' | tr -d '[]%')%"
|
||||
else
|
||||
VOLUME="Mu..."
|
||||
fi
|
||||
|
||||
## Icons
|
||||
ICON_UP=""
|
||||
ICON_DOWN=""
|
||||
ICON_MUTED=""
|
||||
|
||||
options="$ICON_UP\n$ICON_MUTED\n$ICON_DOWN"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$VOLUME" -dmenu $active $urgent -selected-row 0)"
|
||||
case $chosen in
|
||||
$ICON_UP)
|
||||
amixer -Mq set Master,0 5%+ unmute && notify-send -u low -t 1500 "Volume Up $ICON_UP"
|
||||
;;
|
||||
$ICON_DOWN)
|
||||
amixer -Mq set Master,0 5%- unmute && notify-send -u low -t 1500 "Volume Down $ICON_DOWN"
|
||||
;;
|
||||
$ICON_MUTED)
|
||||
amixer -q set Master toggle
|
||||
;;
|
||||
esac
|
||||
|
||||
95
.config/rofi/bin/applet_apps
Executable file
95
.config/rofi/bin/applet_apps
Executable file
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/applets/configs/$style"
|
||||
rofi_command="rofi -theme $dir/apps.rasi"
|
||||
|
||||
# Links
|
||||
terminal=""
|
||||
files=""
|
||||
editor=""
|
||||
browser=""
|
||||
music=""
|
||||
settings=""
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "$1"
|
||||
}
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$terminal\n$files\n$editor\n$browser\n$music\n$settings"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "Most Used" -dmenu -selected-row 0)"
|
||||
case $chosen in
|
||||
$terminal)
|
||||
if [[ -f /usr/bin/termite ]]; then
|
||||
termite &
|
||||
elif [[ -f /usr/bin/urxvt ]]; then
|
||||
urxvt &
|
||||
elif [[ -f /usr/bin/kitty ]]; then
|
||||
kitty &
|
||||
elif [[ -f /usr/bin/xterm ]]; then
|
||||
xterm &
|
||||
elif [[ -f /usr/bin/xfce4-terminal ]]; then
|
||||
xfce4-terminal &
|
||||
elif [[ -f /usr/bin/gnome-terminal ]]; then
|
||||
gnome-terminal &
|
||||
else
|
||||
msg "No suitable terminal found!"
|
||||
fi
|
||||
;;
|
||||
$files)
|
||||
if [[ -f /usr/bin/thunar ]]; then
|
||||
thunar &
|
||||
elif [[ -f /usr/bin/pcmanfm ]]; then
|
||||
pcmanfm &
|
||||
else
|
||||
msg "No suitable file manager found!"
|
||||
fi
|
||||
;;
|
||||
$editor)
|
||||
if [[ -f /usr/bin/geany ]]; then
|
||||
geany &
|
||||
elif [[ -f /usr/bin/leafpad ]]; then
|
||||
leafpad &
|
||||
elif [[ -f /usr/bin/mousepad ]]; then
|
||||
mousepad &
|
||||
elif [[ -f /usr/bin/code ]]; then
|
||||
code &
|
||||
else
|
||||
msg "No suitable text editor found!"
|
||||
fi
|
||||
;;
|
||||
$browser)
|
||||
if [[ -f /usr/bin/firefox ]]; then
|
||||
firefox &
|
||||
elif [[ -f /usr/bin/chromium ]]; then
|
||||
chromium &
|
||||
elif [[ -f /usr/bin/midori ]]; then
|
||||
midori &
|
||||
else
|
||||
msg "No suitable web browser found!"
|
||||
fi
|
||||
;;
|
||||
$music)
|
||||
if [[ -f /usr/bin/lxmusic ]]; then
|
||||
lxmusic &
|
||||
else
|
||||
msg "No suitable music player found!"
|
||||
fi
|
||||
;;
|
||||
$settings)
|
||||
if [[ -f /usr/bin/xfce4-settings-manager ]]; then
|
||||
xfce4-settings-manager &
|
||||
else
|
||||
msg "No suitable settings manager found!"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
86
.config/rofi/bin/applet_backlight
Executable file
86
.config/rofi/bin/applet_backlight
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/applets/configs/$style"
|
||||
rofi_command="rofi -theme $dir/backlight.rasi"
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "$1"
|
||||
}
|
||||
|
||||
## Get Brightness
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
BNESS="$(brightnessctl get)"
|
||||
MAX="$(brightnessctl max)"
|
||||
PERC="$((BNESS*100/MAX))"
|
||||
BLIGHT=${PERC%.*}
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
DEVICE=$(ls /sys/class/backlight | head -n 1)
|
||||
BNESS="$(blight -d $DEVICE get brightness)"
|
||||
PERC="$(($BNESS*100/255))"
|
||||
BLIGHT=${PERC%.*}
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
VAR="$(xbacklight -get)"
|
||||
BLIGHT="$(printf "%.0f\n" "$VAR")"
|
||||
else
|
||||
msg "No suitable backlight utility found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $BLIGHT -ge 1 ]] && [[ $BLIGHT -le 29 ]]; then
|
||||
MSG="Low"
|
||||
elif [[ $BLIGHT -ge 30 ]] && [[ $BLIGHT -le 49 ]]; then
|
||||
MSG="Optimal"
|
||||
elif [[ $BLIGHT -ge 50 ]] && [[ $BLIGHT -le 69 ]]; then
|
||||
MSG="High"
|
||||
elif [[ $BLIGHT -ge 70 ]] && [[ $BLIGHT -le 99 ]]; then
|
||||
MSG="Too Much"
|
||||
fi
|
||||
|
||||
## Icons
|
||||
ICON_UP=""
|
||||
ICON_DOWN=""
|
||||
ICON_OPT=""
|
||||
|
||||
notify="notify-send -u low -t 1500"
|
||||
options="$ICON_UP\n$ICON_OPT\n$ICON_DOWN"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$BLIGHT%" -dmenu -selected-row 1)"
|
||||
case $chosen in
|
||||
"$ICON_UP")
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
brightnessctl -q set +10% && $notify "Brightness Up $ICON_UP"
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
blight -d "$DEVICE" set +10% && $notify "Brightness Up $ICON_UP"
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
xbacklight -inc 10 && $notify "Brightness Up $ICON_UP"
|
||||
fi
|
||||
;;
|
||||
"$ICON_DOWN")
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
brightnessctl -q set 10%- && $notify "Brightness Down $ICON_DOWN"
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
blight -d "$DEVICE" set -10% && $notify "Brightness Down $ICON_DOWN"
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
xbacklight -dec 10 && $notify "Brightness Down $ICON_DOWN"
|
||||
fi
|
||||
;;
|
||||
"$ICON_OPT")
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
brightnessctl -q set 25% && $notify "Optimal Brightness $ICON_OPT"
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
blight -d "$DEVICE" set 25% && $notify "Optimal Brightness $ICON_OPT"
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
xbacklight -set 30 && $notify "Optimal Brightness $ICON_OPT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
65
.config/rofi/bin/applet_battery
Executable file
65
.config/rofi/bin/applet_battery
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/applets/configs/$style"
|
||||
rofi_command="rofi -theme $dir/battery.rasi"
|
||||
|
||||
## Get data
|
||||
BATTERY="$(acpi | awk -F ' ' '{print $4}' | tr -d \%,)"
|
||||
CHARGE="$(acpi | awk -F ' ' '{print $3}' | tr -d \,)"
|
||||
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
if [[ $CHARGE = *"Charging"* ]]; then
|
||||
active="-a 1"
|
||||
ICON_CHRG=""
|
||||
MSG=$CHARGE
|
||||
elif [[ $CHARGE = *"Full"* ]]; then
|
||||
active="-u 1"
|
||||
ICON_CHRG=""
|
||||
MSG=$CHARGE
|
||||
else
|
||||
urgent="-u 1"
|
||||
ICON_CHRG=""
|
||||
MSG=$CHARGE
|
||||
fi
|
||||
|
||||
# Discharging
|
||||
#if [[ $CHARGE -eq 1 ]] && [[ $BATTERY -eq 100 ]]; then
|
||||
# ICON_DISCHRG=""
|
||||
if [[ $BATTERY -ge 5 ]] && [[ $BATTERY -le 19 ]]; then
|
||||
ICON_DISCHRG=""
|
||||
elif [[ $BATTERY -ge 20 ]] && [[ $BATTERY -le 39 ]]; then
|
||||
ICON_DISCHRG=""
|
||||
elif [[ $BATTERY -ge 40 ]] && [[ $BATTERY -le 59 ]]; then
|
||||
ICON_DISCHRG=""
|
||||
elif [[ $BATTERY -ge 60 ]] && [[ $BATTERY -le 79 ]]; then
|
||||
ICON_DISCHRG=""
|
||||
elif [[ $BATTERY -ge 80 ]] && [[ $BATTERY -le 100 ]]; then
|
||||
ICON_DISCHRG=""
|
||||
fi
|
||||
|
||||
## Icons
|
||||
ICON_PMGR=""
|
||||
|
||||
options="$ICON_DISCHRG\n$ICON_CHRG\n$ICON_PMGR"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$BATTERY%" -dmenu $active $urgent -selected-row 0)"
|
||||
case $chosen in
|
||||
$ICON_CHRG)
|
||||
;;
|
||||
$ICON_DISCHRG)
|
||||
;;
|
||||
$ICON_PMGR)
|
||||
xfce4-power-manager-settings
|
||||
;;
|
||||
esac
|
||||
|
||||
78
.config/rofi/bin/applet_mpd
Executable file
78
.config/rofi/bin/applet_mpd
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/applets/configs/$style"
|
||||
rofi_command="rofi -theme $dir/mpd.rasi"
|
||||
|
||||
# Gets the current status of mpd (for us to parse it later on)
|
||||
status="$(mpc status)"
|
||||
# Defines the Play / Pause option content
|
||||
if [[ $status == *"[playing]"* ]]; then
|
||||
play_pause=""
|
||||
else
|
||||
play_pause=""
|
||||
fi
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
# Display if repeat mode is on / off
|
||||
tog_repeat=""
|
||||
if [[ $status == *"repeat: on"* ]]; then
|
||||
active="-a 4"
|
||||
elif [[ $status == *"repeat: off"* ]]; then
|
||||
urgent="-u 4"
|
||||
else
|
||||
tog_repeat=" Parsing error"
|
||||
fi
|
||||
|
||||
# Display if random mode is on / off
|
||||
tog_random=""
|
||||
if [[ $status == *"random: on"* ]]; then
|
||||
[ -n "$active" ] && active+=",5" || active="-a 5"
|
||||
elif [[ $status == *"random: off"* ]]; then
|
||||
[ -n "$urgent" ] && urgent+=",5" || urgent="-u 5"
|
||||
else
|
||||
tog_random=" Parsing error"
|
||||
fi
|
||||
stop=""
|
||||
next=""
|
||||
previous=""
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$previous\n$play_pause\n$stop\n$next\n$tog_repeat\n$tog_random"
|
||||
|
||||
# Get the current playing song
|
||||
current=$(mpc -f "%title%" current)
|
||||
# If mpd isn't running it will return an empty string, we don't want to display that
|
||||
if [[ -z "$current" ]]; then
|
||||
current="-"
|
||||
fi
|
||||
|
||||
# Spawn the mpd menu with the "Play / Pause" entry selected by default
|
||||
chosen="$(echo -e "$options" | $rofi_command -p " $current" -dmenu $active $urgent -selected-row 1)"
|
||||
case $chosen in
|
||||
$previous)
|
||||
mpc -q prev && notify-send -u low -t 1800 " $(mpc current)"
|
||||
;;
|
||||
$play_pause)
|
||||
mpc -q toggle && notify-send -u low -t 1800 " $(mpc current)"
|
||||
;;
|
||||
$stop)
|
||||
mpc -q stop
|
||||
;;
|
||||
$next)
|
||||
mpc -q next && notify-send -u low -t 1800 " $(mpc current)"
|
||||
;;
|
||||
$tog_repeat)
|
||||
mpc -q repeat
|
||||
;;
|
||||
$tog_random)
|
||||
mpc -q random
|
||||
;;
|
||||
esac
|
||||
68
.config/rofi/bin/applet_network
Executable file
68
.config/rofi/bin/applet_network
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/applets/configs/$style"
|
||||
rofi_command="rofi -theme $dir/network.rasi"
|
||||
|
||||
## Get info
|
||||
IFACE="$(nmcli | grep -i interface | awk '/interface/ {print $2}')"
|
||||
#SSID="$(iwgetid -r)"
|
||||
#LIP="$(nmcli | grep -i server | awk '/server/ {print $2}')"
|
||||
#PIP="$(dig +short myip.opendns.com @resolver1.opendns.com )"
|
||||
STATUS="$(nmcli radio wifi)"
|
||||
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
if (ping -c 1 archlinux.org || ping -c 1 google.com || ping -c 1 bitbucket.org || ping -c 1 github.com || ping -c 1 sourceforge.net) &>/dev/null; then
|
||||
if [[ $STATUS == *"enable"* ]]; then
|
||||
if [[ $IFACE == e* ]]; then
|
||||
connected=""
|
||||
else
|
||||
connected=""
|
||||
fi
|
||||
active="-a 0"
|
||||
SSID=" $(iwgetid -r)"
|
||||
PIP="$(wget --timeout=30 http://ipinfo.io/ip -qO -)"
|
||||
fi
|
||||
else
|
||||
urgent="-u 0"
|
||||
SSID="Disconnected"
|
||||
PIP="Not Available"
|
||||
connected=""
|
||||
fi
|
||||
|
||||
## Icons
|
||||
bmon=""
|
||||
launch_cli=""
|
||||
launch=""
|
||||
|
||||
options="$connected\n$bmon\n$launch_cli\n$launch"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$SSID" -dmenu $active $urgent -selected-row 1)"
|
||||
case $chosen in
|
||||
$connected)
|
||||
if [[ $STATUS == *"enable"* ]]; then
|
||||
nmcli radio wifi off
|
||||
else
|
||||
nmcli radio wifi on
|
||||
fi
|
||||
;;
|
||||
$bmon)
|
||||
termite -e bmon
|
||||
;;
|
||||
$launch_cli)
|
||||
termite -e nmtui
|
||||
;;
|
||||
$launch)
|
||||
nm-connection-editor
|
||||
;;
|
||||
esac
|
||||
|
||||
98
.config/rofi/bin/applet_powermenu
Executable file
98
.config/rofi/bin/applet_powermenu
Executable file
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/applets/configs/$style"
|
||||
rofi_command="rofi -theme $dir/powermenu.rasi"
|
||||
|
||||
uptime=$(uptime -p | sed -e 's/up //g')
|
||||
cpu=$($HOME/.config/rofi/bin/usedcpu)
|
||||
memory=$($HOME/.config/rofi/bin/usedram)
|
||||
|
||||
# Options
|
||||
shutdown=""
|
||||
reboot=""
|
||||
lock=""
|
||||
suspend=""
|
||||
logout=""
|
||||
|
||||
# Confirmation
|
||||
confirm_exit() {
|
||||
rofi -dmenu\
|
||||
-i\
|
||||
-no-fixed-num-lines\
|
||||
-p "Are You Sure? : "\
|
||||
-theme $HOME/.config/rofi/applets/styles/confirm.rasi
|
||||
}
|
||||
|
||||
# Message
|
||||
msg() {
|
||||
rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "Available Options - yes / y / no / n"
|
||||
}
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "UP - $uptime" -dmenu -selected-row 2)"
|
||||
case $chosen in
|
||||
$shutdown)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl poweroff
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$reboot)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl reboot
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$lock)
|
||||
if [[ -f /usr/bin/i3lock ]]; then
|
||||
i3lock
|
||||
elif [[ -f /usr/bin/betterlockscreen ]]; then
|
||||
betterlockscreen -l
|
||||
fi
|
||||
;;
|
||||
$suspend)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
mpc -q pause
|
||||
amixer set Master mute
|
||||
systemctl suspend
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$logout)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then
|
||||
openbox --exit
|
||||
elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then
|
||||
bspc quit
|
||||
elif [[ "$DESKTOP_SESSION" == "i3" ]]; then
|
||||
i3-msg exit
|
||||
fi
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
62
.config/rofi/bin/applet_quicklinks
Executable file
62
.config/rofi/bin/applet_quicklinks
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/applets/configs/$style"
|
||||
rofi_command="rofi -theme $dir/quicklinks.rasi"
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "$1"
|
||||
}
|
||||
|
||||
# Browser
|
||||
if [[ -f /usr/bin/firefox ]]; then
|
||||
app="firefox"
|
||||
elif [[ -f /usr/bin/chromium ]]; then
|
||||
app="chromium"
|
||||
elif [[ -f /usr/bin/midori ]]; then
|
||||
app="midori"
|
||||
else
|
||||
msg "No suitable web browser found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Links
|
||||
google=""
|
||||
facebook=""
|
||||
twitter=""
|
||||
github=""
|
||||
mail=""
|
||||
youtube=""
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$google\n$facebook\n$twitter\n$github\n$mail\n$youtube"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "Open In : $app" -dmenu -selected-row 0)"
|
||||
case $chosen in
|
||||
$google)
|
||||
$app https://www.google.com &
|
||||
;;
|
||||
$facebook)
|
||||
$app https://www.facebook.com &
|
||||
;;
|
||||
$twitter)
|
||||
$app https://www.twitter.com &
|
||||
;;
|
||||
$github)
|
||||
$app https://www.github.com &
|
||||
;;
|
||||
$mail)
|
||||
$app https://www.gmail.com &
|
||||
;;
|
||||
$youtube)
|
||||
$app https://www.youtube.com &
|
||||
;;
|
||||
esac
|
||||
|
||||
50
.config/rofi/bin/applet_screenshot
Executable file
50
.config/rofi/bin/applet_screenshot
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/applets/configs/$style"
|
||||
rofi_command="rofi -theme $dir/screenshot.rasi"
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "Please install 'scrot' first."
|
||||
}
|
||||
|
||||
# Options
|
||||
screen=""
|
||||
area=""
|
||||
window=""
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$screen\n$area\n$window"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p 'scrot' -dmenu -selected-row 1)"
|
||||
case $chosen in
|
||||
$screen)
|
||||
if [[ -f /usr/bin/scrot ]]; then
|
||||
sleep 1; scrot 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$area)
|
||||
if [[ -f /usr/bin/scrot ]]; then
|
||||
scrot -s 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$window)
|
||||
if [[ -f /usr/bin/scrot ]]; then
|
||||
sleep 1; scrot -u 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
24
.config/rofi/bin/applet_time
Executable file
24
.config/rofi/bin/applet_time
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/applets/configs/$style"
|
||||
rofi_command="rofi -theme $dir/time.rasi"
|
||||
|
||||
## Get time and date
|
||||
TIME="$(date +"%I:%M %p")"
|
||||
DN=$(date +"%A")
|
||||
MN=$(date +"%B")
|
||||
DAY="$(date +"%d")"
|
||||
MONTH="$(date +"%m")"
|
||||
YEAR="$(date +"%Y")"
|
||||
|
||||
options="$DAY\n$MONTH\n$YEAR"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p " $DN, $TIME" -dmenu -selected-row 1)"
|
||||
58
.config/rofi/bin/applet_volume
Executable file
58
.config/rofi/bin/applet_volume
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/applets/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/applets/configs/$style"
|
||||
rofi_command="rofi -theme $dir/volume.rasi"
|
||||
|
||||
## Get Volume
|
||||
#VOLUME=$(amixer get Master | tail -n 1 | awk -F ' ' '{print $5}' | tr -d '[]%')
|
||||
MUTE=$(amixer get Master | tail -n 1 | awk -F ' ' '{print $6}' | tr -d '[]%')
|
||||
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
if [[ $MUTE == *"off"* ]]; then
|
||||
active="-a 1"
|
||||
else
|
||||
urgent="-u 1"
|
||||
fi
|
||||
|
||||
if [[ $MUTE == *"off"* ]]; then
|
||||
active="-a 1"
|
||||
else
|
||||
urgent="-u 1"
|
||||
fi
|
||||
|
||||
if [[ $MUTE == *"on"* ]]; then
|
||||
VOLUME="$(amixer get Master | tail -n 1 | awk -F ' ' '{print $5}' | tr -d '[]%')%"
|
||||
else
|
||||
VOLUME="Mute"
|
||||
fi
|
||||
|
||||
## Icons
|
||||
ICON_UP=""
|
||||
ICON_DOWN=""
|
||||
ICON_MUTED=""
|
||||
|
||||
options="$ICON_UP\n$ICON_MUTED\n$ICON_DOWN"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$VOLUME" -dmenu $active $urgent -selected-row 0)"
|
||||
case $chosen in
|
||||
$ICON_UP)
|
||||
amixer -Mq set Master,0 5%+ unmute && notify-send -u low -t 1500 "Volume Up $ICON_UP"
|
||||
;;
|
||||
$ICON_DOWN)
|
||||
amixer -Mq set Master,0 5%- unmute && notify-send -u low -t 1500 "Volume Down $ICON_DOWN"
|
||||
;;
|
||||
$ICON_MUTED)
|
||||
amixer -q set Master toggle
|
||||
;;
|
||||
esac
|
||||
|
||||
51
.config/rofi/bin/launcher_colorful
Executable file
51
.config/rofi/bin/launcher_colorful
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
# Available Styles
|
||||
# >> Created and tested on : rofi 1.6.0-1
|
||||
#
|
||||
# style_1 style_2 style_3 style_4 style_5 style_6
|
||||
# style_7 style_8 style_9 style_10 style_11 style_12
|
||||
|
||||
theme="style_1"
|
||||
dir="$HOME/.config/rofi/launchers/colorful"
|
||||
|
||||
# dark
|
||||
ALPHA="#00000000"
|
||||
BG="#000000ff"
|
||||
FG="#FFFFFFff"
|
||||
SELECT="#101010ff"
|
||||
|
||||
# light
|
||||
#ALPHA="#00000000"
|
||||
#BG="#FFFFFFff"
|
||||
#FG="#000000ff"
|
||||
#SELECT="#f3f3f3ff"
|
||||
|
||||
# accent colors
|
||||
COLORS=('#EC7875' '#61C766' '#FDD835' '#42A5F5' '#BA68C8' '#4DD0E1' '#00B19F' \
|
||||
'#FBC02D' '#E57C46' '#AC8476' '#6D8895' '#EC407A' '#B9C244' '#6C77BB')
|
||||
ACCENT="${COLORS[$(( $RANDOM % 14 ))]}ff"
|
||||
|
||||
# overwrite colors file
|
||||
cat > $dir/colors.rasi <<- EOF
|
||||
/* colors */
|
||||
|
||||
* {
|
||||
al: $ALPHA;
|
||||
bg: $BG;
|
||||
se: $SELECT;
|
||||
fg: $FG;
|
||||
ac: $ACCENT;
|
||||
}
|
||||
EOF
|
||||
|
||||
# comment these lines to disable random style
|
||||
themes=($(ls -p --hide="launcher.sh" --hide="colors.rasi" $dir))
|
||||
theme="${themes[$(( $RANDOM % 12 ))]}"
|
||||
|
||||
rofi -no-lazy-grab -show drun -modi drun -theme $dir/"$theme"
|
||||
22
.config/rofi/bin/launcher_misc
Executable file
22
.config/rofi/bin/launcher_misc
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
# Available Styles
|
||||
# >> Created and tested on : rofi 1.6.0-1
|
||||
#
|
||||
# blurry blurry_full kde_simplemenu kde_krunner launchpad
|
||||
# gnome_do slingshot appdrawer appdrawer_alt appfolder
|
||||
# column row row_center screen row_dock row_dropdown
|
||||
|
||||
theme="screen"
|
||||
dir="$HOME/.config/rofi/launchers/misc"
|
||||
|
||||
# comment these lines to disable random style
|
||||
themes=($(ls -p --hide="launcher.sh" $dir))
|
||||
theme="${themes[$(( $RANDOM % 16 ))]}"
|
||||
|
||||
rofi -no-lazy-grab -show drun -modi drun -theme $dir/"$theme"
|
||||
28
.config/rofi/bin/launcher_ribbon
Executable file
28
.config/rofi/bin/launcher_ribbon
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
# Available Styles
|
||||
# >> Created and tested on : rofi 1.6.0-1
|
||||
#
|
||||
# ribbon_top ribbon_top_round ribbon_bottom ribbon_bottom_round
|
||||
# ribbon_left ribbon_left_round ribbon_right ribbon_right_round
|
||||
# full_bottom full_top full_left full_right
|
||||
|
||||
theme="ribbon_top_round"
|
||||
|
||||
dir="$HOME/.config/rofi/launchers/ribbon"
|
||||
styles=($(ls -p --hide="colors.rasi" $dir/styles))
|
||||
color="${styles[$(( $RANDOM % 8 ))]}"
|
||||
|
||||
# comment this line to disable random colors
|
||||
sed -i -e "s/@import .*/@import \"$color\"/g" $dir/styles/colors.rasi
|
||||
|
||||
# comment these lines to disable random style
|
||||
themes=($(ls -p --hide="launcher.sh" --hide="styles" $dir))
|
||||
theme="${themes[$(( $RANDOM % 12 ))]}"
|
||||
|
||||
rofi -no-lazy-grab -show drun -modi drun -theme $dir/"$theme"
|
||||
27
.config/rofi/bin/launcher_slate
Executable file
27
.config/rofi/bin/launcher_slate
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
# Available Styles
|
||||
# >> Created and tested on : rofi 1.6.0-1
|
||||
#
|
||||
# slate_full slate_center slate_left
|
||||
# slate_right slate_top slate_bottom
|
||||
|
||||
theme="slate_full"
|
||||
|
||||
dir="$HOME/.config/rofi/launchers/slate"
|
||||
styles=($(ls -p --hide="colors.rasi" $dir/styles))
|
||||
color="${styles[$(( $RANDOM % 20 ))]}"
|
||||
|
||||
# comment this line to disable random colors
|
||||
sed -i -e "s/@import .*/@import \"$color\"/g" $dir/styles/colors.rasi
|
||||
|
||||
# comment these lines to disable random style
|
||||
themes=($(ls -p --hide="launcher.sh" --hide="styles" $dir))
|
||||
theme="${themes[$(( $RANDOM % 6 ))]}"
|
||||
|
||||
rofi -no-lazy-grab -show drun -modi drun -theme $dir/"$theme"
|
||||
29
.config/rofi/bin/launcher_text
Executable file
29
.config/rofi/bin/launcher_text
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
# Available Styles
|
||||
# >> Created and tested on : rofi 1.6.0-1
|
||||
#
|
||||
# style_1 style_2 style_3 style_4 style_5 style_6 style_7
|
||||
|
||||
theme="style_2"
|
||||
|
||||
dir="$HOME/.config/rofi/launchers/text"
|
||||
styles=($(ls -p --hide="colors.rasi" $dir/styles))
|
||||
color="${styles[$(( $RANDOM % 10 ))]}"
|
||||
|
||||
# comment this line to disable random colors
|
||||
sed -i -e "s/@import .*/@import \"$color\"/g" $dir/styles/colors.rasi
|
||||
|
||||
# comment these lines to disable random style
|
||||
themes=($(ls -p --hide="launcher.sh" --hide="styles" $dir))
|
||||
theme="${themes[$(( $RANDOM % 7 ))]}"
|
||||
|
||||
rofi -no-lazy-grab -show drun \
|
||||
-modi run,drun,window \
|
||||
-theme $dir/"$theme"
|
||||
|
||||
95
.config/rofi/bin/menu_apps
Executable file
95
.config/rofi/bin/menu_apps
Executable file
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/menu/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/menu/configs/$style"
|
||||
rofi_command="rofi -theme $dir/apps.rasi"
|
||||
|
||||
# Links
|
||||
terminal=""
|
||||
files=""
|
||||
editor=""
|
||||
browser=""
|
||||
music=""
|
||||
settings=""
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "$1"
|
||||
}
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$terminal\n$files\n$editor\n$browser\n$music\n$settings"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "Most Used" -dmenu -selected-row 0)"
|
||||
case $chosen in
|
||||
$terminal)
|
||||
if [[ -f /usr/bin/termite ]]; then
|
||||
termite &
|
||||
elif [[ -f /usr/bin/urxvt ]]; then
|
||||
urxvt &
|
||||
elif [[ -f /usr/bin/kitty ]]; then
|
||||
kitty &
|
||||
elif [[ -f /usr/bin/xterm ]]; then
|
||||
xterm &
|
||||
elif [[ -f /usr/bin/xfce4-terminal ]]; then
|
||||
xfce4-terminal &
|
||||
elif [[ -f /usr/bin/gnome-terminal ]]; then
|
||||
gnome-terminal &
|
||||
else
|
||||
msg "No suitable terminal found!"
|
||||
fi
|
||||
;;
|
||||
$files)
|
||||
if [[ -f /usr/bin/thunar ]]; then
|
||||
thunar &
|
||||
elif [[ -f /usr/bin/pcmanfm ]]; then
|
||||
pcmanfm &
|
||||
else
|
||||
msg "No suitable file manager found!"
|
||||
fi
|
||||
;;
|
||||
$editor)
|
||||
if [[ -f /usr/bin/geany ]]; then
|
||||
geany &
|
||||
elif [[ -f /usr/bin/leafpad ]]; then
|
||||
leafpad &
|
||||
elif [[ -f /usr/bin/mousepad ]]; then
|
||||
mousepad &
|
||||
elif [[ -f /usr/bin/code ]]; then
|
||||
code &
|
||||
else
|
||||
msg "No suitable text editor found!"
|
||||
fi
|
||||
;;
|
||||
$browser)
|
||||
if [[ -f /usr/bin/firefox ]]; then
|
||||
firefox &
|
||||
elif [[ -f /usr/bin/chromium ]]; then
|
||||
chromium &
|
||||
elif [[ -f /usr/bin/midori ]]; then
|
||||
midori &
|
||||
else
|
||||
msg "No suitable web browser found!"
|
||||
fi
|
||||
;;
|
||||
$music)
|
||||
if [[ -f /usr/bin/lxmusic ]]; then
|
||||
lxmusic &
|
||||
else
|
||||
msg "No suitable music player found!"
|
||||
fi
|
||||
;;
|
||||
$settings)
|
||||
if [[ -f /usr/bin/xfce4-settings-manager ]]; then
|
||||
xfce4-settings-manager &
|
||||
else
|
||||
msg "No suitable settings manager found!"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
86
.config/rofi/bin/menu_backlight
Executable file
86
.config/rofi/bin/menu_backlight
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/menu/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/menu/configs/$style"
|
||||
rofi_command="rofi -theme $dir/backlight.rasi"
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "$1"
|
||||
}
|
||||
|
||||
## Get Brightness
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
BNESS="$(brightnessctl get)"
|
||||
MAX="$(brightnessctl max)"
|
||||
PERC="$((BNESS*100/MAX))"
|
||||
BLIGHT=${PERC%.*}
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
DEVICE=$(ls /sys/class/backlight | head -n 1)
|
||||
BNESS="$(blight -d $DEVICE get brightness)"
|
||||
PERC="$(($BNESS*100/255))"
|
||||
BLIGHT=${PERC%.*}
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
VAR="$(xbacklight -get)"
|
||||
BLIGHT="$(printf "%.0f\n" "$VAR")"
|
||||
else
|
||||
msg "No suitable backlight utility found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $BLIGHT -ge 1 ]] && [[ $BLIGHT -le 29 ]]; then
|
||||
MSG="Low"
|
||||
elif [[ $BLIGHT -ge 30 ]] && [[ $BLIGHT -le 49 ]]; then
|
||||
MSG="Optimal"
|
||||
elif [[ $BLIGHT -ge 50 ]] && [[ $BLIGHT -le 69 ]]; then
|
||||
MSG="High"
|
||||
elif [[ $BLIGHT -ge 70 ]] && [[ $BLIGHT -le 99 ]]; then
|
||||
MSG="Too Much"
|
||||
fi
|
||||
|
||||
## Icons
|
||||
ICON_UP=""
|
||||
ICON_DOWN=""
|
||||
ICON_OPT=""
|
||||
|
||||
notify="notify-send -u low -t 1500"
|
||||
options="$ICON_UP\n$ICON_OPT\n$ICON_DOWN"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$BLIGHT% : $MSG" -dmenu -selected-row 1)"
|
||||
case $chosen in
|
||||
"$ICON_UP")
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
brightnessctl -q set +10% && $notify "Brightness Up $ICON_UP"
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
blight -d "$DEVICE" set +10% && $notify "Brightness Up $ICON_UP"
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
xbacklight -inc 10 && $notify "Brightness Up $ICON_UP"
|
||||
fi
|
||||
;;
|
||||
"$ICON_DOWN")
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
brightnessctl -q set 10%- && $notify "Brightness Down $ICON_DOWN"
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
blight -d "$DEVICE" set -10% && $notify "Brightness Down $ICON_DOWN"
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
xbacklight -dec 10 && $notify "Brightness Down $ICON_DOWN"
|
||||
fi
|
||||
;;
|
||||
"$ICON_OPT")
|
||||
if [[ -f /bin/brightnessctl ]]; then
|
||||
brightnessctl -q set 25% && $notify "Optimal Brightness $ICON_OPT"
|
||||
elif [[ -f /usr/bin/blight ]]; then
|
||||
blight -d "$DEVICE" set 25% && $notify "Optimal Brightness $ICON_OPT"
|
||||
elif [[ -f /usr/bin/xbacklight ]]; then
|
||||
xbacklight -set 30 && $notify "Optimal Brightness $ICON_OPT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
65
.config/rofi/bin/menu_battery
Executable file
65
.config/rofi/bin/menu_battery
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/menu/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/menu/configs/$style"
|
||||
rofi_command="rofi -theme $dir/battery.rasi"
|
||||
|
||||
## Get data
|
||||
BATTERY="$(acpi | awk -F ' ' '{print $4}' | tr -d \%,)"
|
||||
CHARGE="$(acpi | awk -F ' ' '{print $3}' | tr -d \,)"
|
||||
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
if [[ $CHARGE = *"Charging"* ]]; then
|
||||
active="-a 1"
|
||||
ICON_CHRG=""
|
||||
MSG=$CHARGE
|
||||
elif [[ $CHARGE = *"Full"* ]]; then
|
||||
active="-u 1"
|
||||
ICON_CHRG=""
|
||||
MSG=$CHARGE
|
||||
else
|
||||
urgent="-u 1"
|
||||
ICON_CHRG=""
|
||||
MSG=$CHARGE
|
||||
fi
|
||||
|
||||
# Discharging
|
||||
#if [[ $CHARGE -eq 1 ]] && [[ $BATTERY -eq 100 ]]; then
|
||||
# ICON_DISCHRG=""
|
||||
if [[ $BATTERY -ge 5 ]] && [[ $BATTERY -le 19 ]]; then
|
||||
ICON_DISCHRG=""
|
||||
elif [[ $BATTERY -ge 20 ]] && [[ $BATTERY -le 39 ]]; then
|
||||
ICON_DISCHRG=""
|
||||
elif [[ $BATTERY -ge 40 ]] && [[ $BATTERY -le 59 ]]; then
|
||||
ICON_DISCHRG=""
|
||||
elif [[ $BATTERY -ge 60 ]] && [[ $BATTERY -le 79 ]]; then
|
||||
ICON_DISCHRG=""
|
||||
elif [[ $BATTERY -ge 80 ]] && [[ $BATTERY -le 100 ]]; then
|
||||
ICON_DISCHRG=""
|
||||
fi
|
||||
|
||||
## Icons
|
||||
ICON_PMGR=""
|
||||
|
||||
options="$ICON_DISCHRG\n$ICON_CHRG\n$ICON_PMGR"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$MSG : $BATTERY%" -dmenu $active $urgent -selected-row 0)"
|
||||
case $chosen in
|
||||
$ICON_CHRG)
|
||||
;;
|
||||
$ICON_DISCHRG)
|
||||
;;
|
||||
$ICON_PMGR)
|
||||
xfce4-power-manager-settings
|
||||
;;
|
||||
esac
|
||||
|
||||
78
.config/rofi/bin/menu_mpd
Executable file
78
.config/rofi/bin/menu_mpd
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/menu/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/menu/configs/$style"
|
||||
rofi_command="rofi -theme $dir/mpd.rasi"
|
||||
|
||||
# Gets the current status of mpd (for us to parse it later on)
|
||||
status="$(mpc status)"
|
||||
# Defines the Play / Pause option content
|
||||
if [[ $status == *"[playing]"* ]]; then
|
||||
play_pause=""
|
||||
else
|
||||
play_pause=""
|
||||
fi
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
# Display if repeat mode is on / off
|
||||
tog_repeat=""
|
||||
if [[ $status == *"repeat: on"* ]]; then
|
||||
active="-a 4"
|
||||
elif [[ $status == *"repeat: off"* ]]; then
|
||||
urgent="-u 4"
|
||||
else
|
||||
tog_repeat=" Parsing error"
|
||||
fi
|
||||
|
||||
# Display if random mode is on / off
|
||||
tog_random=""
|
||||
if [[ $status == *"random: on"* ]]; then
|
||||
[ -n "$active" ] && active+=",5" || active="-a 5"
|
||||
elif [[ $status == *"random: off"* ]]; then
|
||||
[ -n "$urgent" ] && urgent+=",5" || urgent="-u 5"
|
||||
else
|
||||
tog_random=" Parsing error"
|
||||
fi
|
||||
stop=""
|
||||
next=""
|
||||
previous=""
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$previous\n$play_pause\n$stop\n$next\n$tog_repeat\n$tog_random"
|
||||
|
||||
# Get the current playing song
|
||||
current=$(mpc -f "%artist% - %title%" current)
|
||||
# If mpd isn't running it will return an empty string, we don't want to display that
|
||||
if [[ -z "$current" ]]; then
|
||||
current="-"
|
||||
fi
|
||||
|
||||
# Spawn the mpd menu with the "Play / Pause" entry selected by default
|
||||
chosen="$(echo -e "$options" | $rofi_command -p " $current" -dmenu $active $urgent -selected-row 1)"
|
||||
case $chosen in
|
||||
$previous)
|
||||
mpc -q prev && notify-send -u low -t 1800 " $(mpc current)"
|
||||
;;
|
||||
$play_pause)
|
||||
mpc -q toggle && notify-send -u low -t 1800 " $(mpc current)"
|
||||
;;
|
||||
$stop)
|
||||
mpc -q stop
|
||||
;;
|
||||
$next)
|
||||
mpc -q next && notify-send -u low -t 1800 " $(mpc current)"
|
||||
;;
|
||||
$tog_repeat)
|
||||
mpc -q repeat
|
||||
;;
|
||||
$tog_random)
|
||||
mpc -q random
|
||||
;;
|
||||
esac
|
||||
68
.config/rofi/bin/menu_network
Executable file
68
.config/rofi/bin/menu_network
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/menu/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/menu/configs/$style"
|
||||
rofi_command="rofi -theme $dir/network.rasi"
|
||||
|
||||
## Get info
|
||||
IFACE="$(nmcli | grep -i interface | awk '/interface/ {print $2}')"
|
||||
#SSID="$(iwgetid -r)"
|
||||
#LIP="$(nmcli | grep -i server | awk '/server/ {print $2}')"
|
||||
#PIP="$(dig +short myip.opendns.com @resolver1.opendns.com )"
|
||||
STATUS="$(nmcli radio wifi)"
|
||||
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
if (ping -c 1 archlinux.org || ping -c 1 google.com || ping -c 1 bitbucket.org || ping -c 1 github.com || ping -c 1 sourceforge.net) &>/dev/null; then
|
||||
if [[ $STATUS == *"enable"* ]]; then
|
||||
if [[ $IFACE == e* ]]; then
|
||||
connected=""
|
||||
else
|
||||
connected=""
|
||||
fi
|
||||
active="-a 0"
|
||||
SSID=" $(iwgetid -r)"
|
||||
PIP="$(wget --timeout=30 http://ipinfo.io/ip -qO -)"
|
||||
fi
|
||||
else
|
||||
urgent="-u 0"
|
||||
SSID="Disconnected"
|
||||
PIP="Not Available"
|
||||
connected=""
|
||||
fi
|
||||
|
||||
## Icons
|
||||
bmon=""
|
||||
launch_cli=""
|
||||
launch=""
|
||||
|
||||
options="$connected\n$bmon\n$launch_cli\n$launch"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$SSID : $PIP" -dmenu $active $urgent -selected-row 1)"
|
||||
case $chosen in
|
||||
$connected)
|
||||
if [[ $STATUS == *"enable"* ]]; then
|
||||
nmcli radio wifi off
|
||||
else
|
||||
nmcli radio wifi on
|
||||
fi
|
||||
;;
|
||||
$bmon)
|
||||
termite -e bmon
|
||||
;;
|
||||
$launch_cli)
|
||||
termite -e nmtui
|
||||
;;
|
||||
$launch)
|
||||
nm-connection-editor
|
||||
;;
|
||||
esac
|
||||
|
||||
98
.config/rofi/bin/menu_powermenu
Executable file
98
.config/rofi/bin/menu_powermenu
Executable file
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/menu/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/menu/configs/$style"
|
||||
rofi_command="rofi -theme $dir/powermenu.rasi"
|
||||
|
||||
uptime=$(uptime -p | sed -e 's/up //g')
|
||||
cpu=$($HOME/.config/rofi/bin/usedcpu)
|
||||
memory=$($HOME/.config/rofi/bin/usedram)
|
||||
|
||||
# Options
|
||||
shutdown=""
|
||||
reboot=""
|
||||
lock=""
|
||||
suspend=""
|
||||
logout=""
|
||||
|
||||
# Confirmation
|
||||
confirm_exit() {
|
||||
rofi -dmenu\
|
||||
-i\
|
||||
-no-fixed-num-lines\
|
||||
-p "Are You Sure? : "\
|
||||
-theme $HOME/.config/rofi/applets/styles/confirm.rasi
|
||||
}
|
||||
|
||||
# Message
|
||||
msg() {
|
||||
rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "Available Options - yes / y / no / n"
|
||||
}
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "祥 $uptime | $cpu | $memory " -dmenu -selected-row 2)"
|
||||
case $chosen in
|
||||
$shutdown)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl poweroff
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$reboot)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl reboot
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$lock)
|
||||
if [[ -f /usr/bin/i3lock ]]; then
|
||||
i3lock
|
||||
elif [[ -f /usr/bin/betterlockscreen ]]; then
|
||||
betterlockscreen -l
|
||||
fi
|
||||
;;
|
||||
$suspend)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
mpc -q pause
|
||||
amixer set Master mute
|
||||
systemctl suspend
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$logout)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then
|
||||
openbox --exit
|
||||
elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then
|
||||
bspc quit
|
||||
elif [[ "$DESKTOP_SESSION" == "i3" ]]; then
|
||||
i3-msg exit
|
||||
fi
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
62
.config/rofi/bin/menu_quicklinks
Executable file
62
.config/rofi/bin/menu_quicklinks
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/menu/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/menu/configs/$style"
|
||||
rofi_command="rofi -theme $dir/quicklinks.rasi"
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "$1"
|
||||
}
|
||||
|
||||
# Browser
|
||||
if [[ -f /usr/bin/firefox ]]; then
|
||||
app="firefox"
|
||||
elif [[ -f /usr/bin/chromium ]]; then
|
||||
app="chromium"
|
||||
elif [[ -f /usr/bin/midori ]]; then
|
||||
app="midori"
|
||||
else
|
||||
msg "No suitable web browser found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Links
|
||||
google=""
|
||||
facebook=""
|
||||
twitter=""
|
||||
github=""
|
||||
mail=""
|
||||
youtube=""
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$google\n$facebook\n$twitter\n$github\n$mail\n$youtube"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "Open In : $app" -dmenu -selected-row 0)"
|
||||
case $chosen in
|
||||
$google)
|
||||
$app https://www.google.com &
|
||||
;;
|
||||
$facebook)
|
||||
$app https://www.facebook.com &
|
||||
;;
|
||||
$twitter)
|
||||
$app https://www.twitter.com &
|
||||
;;
|
||||
$github)
|
||||
$app https://www.github.com &
|
||||
;;
|
||||
$mail)
|
||||
$app https://www.gmail.com &
|
||||
;;
|
||||
$youtube)
|
||||
$app https://www.youtube.com &
|
||||
;;
|
||||
esac
|
||||
|
||||
50
.config/rofi/bin/menu_screenshot
Executable file
50
.config/rofi/bin/menu_screenshot
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/menu/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/menu/configs/$style"
|
||||
rofi_command="rofi -theme $dir/screenshot.rasi"
|
||||
|
||||
# Error msg
|
||||
msg() {
|
||||
rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "Please install 'scrot' first."
|
||||
}
|
||||
|
||||
# Options
|
||||
screen=""
|
||||
area=""
|
||||
window=""
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$screen\n$area\n$window"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p 'App : scrot' -dmenu -selected-row 1)"
|
||||
case $chosen in
|
||||
$screen)
|
||||
if [[ -f /usr/bin/scrot ]]; then
|
||||
sleep 1; scrot 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$area)
|
||||
if [[ -f /usr/bin/scrot ]]; then
|
||||
scrot -s 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$window)
|
||||
if [[ -f /usr/bin/scrot ]]; then
|
||||
sleep 1; scrot -u 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
24
.config/rofi/bin/menu_time
Executable file
24
.config/rofi/bin/menu_time
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/menu/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/menu/configs/$style"
|
||||
rofi_command="rofi -theme $dir/time.rasi"
|
||||
|
||||
## Get time and date
|
||||
TIME="$(date +"%I:%M %p")"
|
||||
DN=$(date +"%A")
|
||||
MN=$(date +"%B")
|
||||
DAY="$(date +"%d")"
|
||||
MONTH="$(date +"%m")"
|
||||
YEAR="$(date +"%Y")"
|
||||
|
||||
options="$DAY\n$MONTH\n$YEAR"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p " at $TIME on $DN in $MN" -dmenu -selected-row 1)"
|
||||
58
.config/rofi/bin/menu_volume
Executable file
58
.config/rofi/bin/menu_volume
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/applets/menu/style.sh)"
|
||||
|
||||
dir="$HOME/.config/rofi/applets/menu/configs/$style"
|
||||
rofi_command="rofi -theme $dir/volume.rasi"
|
||||
|
||||
## Get Volume
|
||||
#VOLUME=$(amixer get Master | tail -n 1 | awk -F ' ' '{print $5}' | tr -d '[]%')
|
||||
MUTE=$(amixer get Master | tail -n 1 | awk -F ' ' '{print $6}' | tr -d '[]%')
|
||||
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
if [[ $MUTE == *"off"* ]]; then
|
||||
active="-a 1"
|
||||
else
|
||||
urgent="-u 1"
|
||||
fi
|
||||
|
||||
if [[ $MUTE == *"off"* ]]; then
|
||||
active="-a 1"
|
||||
else
|
||||
urgent="-u 1"
|
||||
fi
|
||||
|
||||
if [[ $MUTE == *"on"* ]]; then
|
||||
VOLUME="$(amixer get Master | tail -n 1 | awk -F ' ' '{print $5}' | tr -d '[]%')%"
|
||||
else
|
||||
VOLUME="Mute"
|
||||
fi
|
||||
|
||||
## Icons
|
||||
ICON_UP=""
|
||||
ICON_DOWN=""
|
||||
ICON_MUTED=""
|
||||
|
||||
options="$ICON_UP\n$ICON_MUTED\n$ICON_DOWN"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$VOLUME" -dmenu $active $urgent -selected-row 0)"
|
||||
case $chosen in
|
||||
$ICON_UP)
|
||||
amixer -Mq set Master,0 5%+ unmute && notify-send -u low -t 1500 "Volume Up $ICON_UP"
|
||||
;;
|
||||
$ICON_DOWN)
|
||||
amixer -Mq set Master,0 5%- unmute && notify-send -u low -t 1500 "Volume Down $ICON_DOWN"
|
||||
;;
|
||||
$ICON_MUTED)
|
||||
amixer -q set Master toggle
|
||||
;;
|
||||
esac
|
||||
|
||||
117
.config/rofi/bin/powermenu
Executable file
117
.config/rofi/bin/powermenu
Executable file
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
# Available Styles
|
||||
# >> Created and tested on : rofi 1.6.0-1
|
||||
#
|
||||
# column_circle column_square column_rounded column_alt
|
||||
# card_circle card_square card_rounded card_alt
|
||||
# dock_circle dock_square dock_rounded dock_alt
|
||||
# drop_circle drop_square drop_rounded drop_alt
|
||||
# full_circle full_square full_rounded full_alt
|
||||
# row_circle row_square row_rounded row_alt
|
||||
|
||||
theme="full_circle"
|
||||
dir="$HOME/.config/rofi/powermenu"
|
||||
|
||||
# random colors
|
||||
styles=($(ls -p --hide="colors.rasi" $dir/styles))
|
||||
color="${styles[$(( $RANDOM % 8 ))]}"
|
||||
|
||||
# comment this line to disable random colors
|
||||
sed -i -e "s/@import .*/@import \"$color\"/g" $dir/styles/colors.rasi
|
||||
|
||||
# comment these lines to disable random style
|
||||
themes=($(ls -p --hide="powermenu.sh" --hide="styles" --hide="confirm.rasi" --hide="message.rasi" $dir))
|
||||
theme="${themes[$(( $RANDOM % 24 ))]}"
|
||||
|
||||
uptime=$(uptime -p | sed -e 's/up //g')
|
||||
|
||||
rofi_command="rofi -theme $dir/$theme"
|
||||
|
||||
# Options
|
||||
shutdown=""
|
||||
reboot=""
|
||||
lock=""
|
||||
suspend=""
|
||||
logout=""
|
||||
|
||||
# Confirmation
|
||||
confirm_exit() {
|
||||
rofi -dmenu\
|
||||
-i\
|
||||
-no-fixed-num-lines\
|
||||
-p "Are You Sure? : "\
|
||||
-theme $dir/confirm.rasi
|
||||
}
|
||||
|
||||
# Message
|
||||
msg() {
|
||||
rofi -theme "$dir/message.rasi" -e "Available Options - yes / y / no / n"
|
||||
}
|
||||
|
||||
# Variable passed to rofi
|
||||
options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 2)"
|
||||
case $chosen in
|
||||
$shutdown)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl poweroff
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$reboot)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl reboot
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$lock)
|
||||
if [[ -f /usr/bin/i3lock ]]; then
|
||||
i3lock
|
||||
elif [[ -f /usr/bin/betterlockscreen ]]; then
|
||||
betterlockscreen -l
|
||||
fi
|
||||
;;
|
||||
$suspend)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
mpc -q pause
|
||||
amixer set Master mute
|
||||
systemctl suspend
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$logout)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then
|
||||
openbox --exit
|
||||
elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then
|
||||
bspc quit
|
||||
elif [[ "$DESKTOP_SESSION" == "i3" ]]; then
|
||||
i3-msg exit
|
||||
fi
|
||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
45
.config/rofi/bin/usedcpu
Executable file
45
.config/rofi/bin/usedcpu
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PREV_TOTAL=0
|
||||
PREV_IDLE=0
|
||||
|
||||
cpuFile="/tmp/.cpu"
|
||||
|
||||
if [[ -f "${cpuFile}" ]]; then
|
||||
fileCont=$(cat "${cpuFile}")
|
||||
PREV_TOTAL=$(echo "${fileCont}" | head -n 1)
|
||||
PREV_IDLE=$(echo "${fileCont}" | tail -n 1)
|
||||
fi
|
||||
|
||||
CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
|
||||
unset CPU[0] # Discard the "cpu" prefix.
|
||||
IDLE=${CPU[4]} # Get the idle CPU time.
|
||||
|
||||
# Calculate the total CPU time.
|
||||
TOTAL=0
|
||||
|
||||
for VALUE in "${CPU[@]:0:4}"; do
|
||||
let "TOTAL=$TOTAL+$VALUE"
|
||||
done
|
||||
|
||||
if [[ "${PREV_TOTAL}" != "" ]] && [[ "${PREV_IDLE}" != "" ]]; then
|
||||
# Calculate the CPU usage since we last checked.
|
||||
let "DIFF_IDLE=$IDLE-$PREV_IDLE"
|
||||
let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL"
|
||||
let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10"
|
||||
if [[ $1 = "-i" ]]; then
|
||||
echo " ${DIFF_USAGE}%"
|
||||
else
|
||||
echo "${DIFF_USAGE}%"
|
||||
fi
|
||||
else
|
||||
if [[ $1 = "-i" ]]; then
|
||||
echo " ?"
|
||||
else
|
||||
echo "?"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remember the total and idle CPU times for the next check.
|
||||
echo "${TOTAL}" > "${cpuFile}"
|
||||
echo "${IDLE}" >> "${cpuFile}"
|
||||
27
.config/rofi/bin/usedram
Executable file
27
.config/rofi/bin/usedram
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mem_info=$(</proc/meminfo)
|
||||
mem_info=$(echo $(echo $(mem_info=${mem_info// /}; echo ${mem_info//kB/})))
|
||||
for m in $mem_info; do
|
||||
case ${m//:*} in
|
||||
"MemTotal") usedmem=$((usedmem+=${m//*:})); totalmem=${m//*:} ;;
|
||||
"ShMem") usedmem=$((usedmem+=${m//*:})) ;;
|
||||
"MemFree"|"Buffers"|"Cached"|"SReclaimable") usedmem=$((usedmem-=${m//*:})) ;;
|
||||
esac
|
||||
done
|
||||
usedmem=$((usedmem / 1024))
|
||||
totalmem=$((totalmem / 1024))
|
||||
mem="${usedmem}MB / ${totalmem}MB"
|
||||
|
||||
## Complete summary
|
||||
if [[ $1 = "-fi" ]]; then
|
||||
echo " $mem"
|
||||
elif [[ $1 = "-f" ]]; then
|
||||
echo "$mem"
|
||||
|
||||
## Only used RAM
|
||||
elif [[ $1 = "-i" ]]; then
|
||||
echo " $usedmem MB"
|
||||
else
|
||||
echo "$usedmem MB"
|
||||
fi
|
||||
Reference in New Issue
Block a user