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:
27
scripts/misc/battery-level.sh
Executable file
27
scripts/misc/battery-level.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set path for running in a cron job
|
||||
PATH='/snap/bin:/home/sahin/.poetry/bin:/home/sahin/.pyenv/bin:/home/sahin/.pyenv/shims:/home/sahin/.pyenv/bin:/home/sahin/.cargo/bin:/home/sahin/.poetry/bin:/home/sahin/.local/bin:/home/sahin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/sahin/Downloads/ArchiveFiles/idea-IU-211.7628.21/bin:/home/sahin/scripts:/home/sahin/.fzf/bin'
|
||||
|
||||
# Set limit to shell argument
|
||||
batteryLimit=$1
|
||||
|
||||
export DISPLAY=:0
|
||||
export XDG_RUNTIME_DIR=/run/user/$(id -u)
|
||||
|
||||
# Get the current battery level with acpi
|
||||
batteryLevel=$(acpi | cut -d ' ' -f 4 | tr -d '%|,| ')
|
||||
charging=$(acpi | cut -d ' ' -f 3 | tr -d ',| ')
|
||||
|
||||
# Must have the Xdus file to run in a cron job. If this is not
|
||||
# necessary functionality, this can be ignored, otherwise one must
|
||||
# run the /scripts/xdbus.sh script in this repository at startup,
|
||||
# which is called by default from my i3/config file.
|
||||
# if [ -r "$HOME/.dbus/Xdbus" ]; then
|
||||
# . "$HOME/.dbus/Xdbus"
|
||||
# fi
|
||||
|
||||
if [[ "$batteryLevel" -le "$batteryLimit" ]] && [[ "$charging" == "Discharging" ]]; then
|
||||
/usr/bin/notify-send -a "Battery Warning" --urgency critical "Battery level at ${batteryLevel}%" -i abrt
|
||||
/usr/bin/paplay /usr/share/sounds/Oxygen-K3B-Finish-Error.ogg
|
||||
fi
|
11
scripts/rofi/launch.sh
Executable file
11
scripts/rofi/launch.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
menu="$1"
|
||||
|
||||
if [ "$menu" = "music" ]; then
|
||||
rofi -modi 'Music:~/scripts/rofi/music.sh' -show Music -theme music-launcher
|
||||
elif [ "$menu" = "appmenu" ]; then
|
||||
rofi -show drun -theme clean
|
||||
elif [ "$menu" = "powermenu" ]; then
|
||||
rofi -modi 'Powermenu:~/scripts/rofi/powermenu.sh' -show Powermenu -theme powermenu -location 3 -xoffset -24 -yoffset 70
|
||||
fi
|
24
scripts/rofi/music.sh
Executable file
24
scripts/rofi/music.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
MUSIC="$HOME/music"
|
||||
|
||||
|
||||
function get_music() {
|
||||
IFS=$'\n'
|
||||
for i in $(ls "$MUSIC" | grep -v 'thumbs'); do
|
||||
name="${i%.*}"
|
||||
echo -en "${i}\0icon\x1f${MUSIC}/thumbs/${name}.png\n"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if [ -z "$@" ]; then
|
||||
echo -en "Shuffle\0icon\x1fmedia-playlist-shuffle\n"
|
||||
get_music
|
||||
else
|
||||
if [ "$1" = "Shuffle" ]; then
|
||||
$HOME/scripts/music/mpv-controller.sh start shuffle &
|
||||
else
|
||||
$HOME/scripts/music/mpv-controller.sh start "${MUSIC}/$1" &
|
||||
fi
|
||||
fi
|
19
scripts/rofi/powermenu.sh
Executable file
19
scripts/rofi/powermenu.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
if [ -z "$@" ]; then
|
||||
echo -en "Shutdown\0icon\x1fsystem-shutdown\n"
|
||||
echo -en "Logout\0icon\x1fsystem-log-out\n"
|
||||
echo -en "Suspend\0icon\x1fsystem-suspend\n"
|
||||
echo -en "Reboot\0icon\x1fsystem-restart\n"
|
||||
else
|
||||
if [ "$1" = "Shutdown" ]; then
|
||||
shutdown now
|
||||
elif [ "$1" = "Logout" ]; then
|
||||
i3-msg exit
|
||||
elif [ "$1" = "Reboot" ]; then
|
||||
reboot
|
||||
elif [ "$1" = "Suspend" ]; then
|
||||
systemctl suspend
|
||||
fi
|
||||
fi
|
Reference in New Issue
Block a user