mirror of
https://github.com/sahinakkaya/dotfiles.git
synced 2025-07-04 19:19:41 +03:00
Switch to i3
This commit is contained in:
3
.config/polybar/scripts/gpu.sh
Executable file
3
.config/polybar/scripts/gpu.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | awk '{ print "GPU",""$1"","%"}'
|
3
.config/polybar/scripts/launcher.sh
Executable file
3
.config/polybar/scripts/launcher.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rofi -no-config -no-lazy-grab -show drun -modi drun -theme ~/.config/rofi/andromeda.rasi
|
67
.config/polybar/scripts/network.sh
Executable file
67
.config/polybar/scripts/network.sh
Executable file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
style="$($HOME/.config/rofi/)"
|
||||
|
||||
dir="$HOME/.config/rofi$style"
|
||||
rofi_command="rofi -theme $dir/andromeda.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
|
94
.config/polybar/scripts/powermenu.sh
Executable file
94
.config/polybar/scripts/powermenu.sh
Executable file
@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
dir="~/.config/polybar/rofi"
|
||||
uptime=$(uptime -p | sed -e 's/up //g')
|
||||
|
||||
rofi_command="rofi -theme $dir/powermenu.rasi"
|
||||
|
||||
# Options
|
||||
shutdown=" Shutdown"
|
||||
reboot=" Restart"
|
||||
lock=" Lock"
|
||||
suspend=" Sleep"
|
||||
logout=" 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="$lock\n$suspend\n$logout\n$reboot\n$shutdown"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)"
|
||||
case $chosen in
|
||||
$shutdown)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "ye" || $ans == "YE" || $ans == "yeah" || $ans == "yep" || $ans == "YEAH" || $ans == "YEP" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl poweroff
|
||||
elif [[ $ans == "no" || $ans == "nope" || $ans == "NOPE" || $ans == "nah" || $ans == "NAH" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$reboot)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "ye" || $ans == "YE" || $ans == "yeah" || $ans == "yep" || $ans == "YEAH" || $ans == "YEP" ||$ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl reboot
|
||||
elif [[ $ans == "no" || $ans == "nope" || $ans == "NOPE" || $ans == "nah" || $ans == "NAH" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$lock)
|
||||
if [[ -f /usr/bin/betterlockscreen ]]; then
|
||||
betterlockscreen -l -b 0.5
|
||||
elif [[ -f /usr/bin/betterlockscreen ]]; then
|
||||
betterlockscreen -l
|
||||
fi
|
||||
;;
|
||||
$suspend)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "ye" || $ans == "YE" || $ans == "yeah" || $ans == "yep" || $ans == "YEAH" || $ans == "YEP" ||$ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
mpc -q pause
|
||||
amixer set Master mute
|
||||
systemctl suspend
|
||||
elif [[ $ans == "no" || $ans == "nope" || $ans == "NOPE" || $ans == "nah" || $ans == "NAH" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
$logout)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "ye" || $ans == "YE" || $ans == "yeah" || $ans == "yep" || $ans == "YEAH" || $ans == "YEP" ||$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 == "nope" || $ans == "NOPE" || $ans == "nah" || $ans == "NAH" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
||||
exit 0
|
||||
else
|
||||
msg
|
||||
fi
|
||||
;;
|
||||
esac
|
3
.config/polybar/scripts/uptime.sh
Executable file
3
.config/polybar/scripts/uptime.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
notify-send -u low "$(awk '{print "Uptime: " int($1/3600)" Hours "int(($1%3600)/60)" minutes "int($1%60)" seconds"}' /proc/uptime)"
|
3
.config/polybar/scripts/weather.sh
Executable file
3
.config/polybar/scripts/weather.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec notify-send "$(curl -s http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=76692 \ | sed -n '/Currently:/ s/.*: \(.*\): \([0-9]*\)\([CF]\).*/\2°\3 \1/p')"
|
4
.config/polybar/scripts/wttr.sh
Executable file
4
.config/polybar/scripts/wttr.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
curl wttr.in/76692
|
||||
|
Reference in New Issue
Block a user