TheRepoClub-DotFiles/localbin/.local/bin/autostart

164 lines
3.7 KiB
Plaintext
Raw Normal View History

2021-01-09 12:38:56 -05:00
#!/usr/bin/env bash
2022-01-20 15:38:50 -05:00
# -*-coding:utf-8 -*-
# Auto updated?
# Yes
#File :
# autostart
2022-01-21 08:38:27 -05:00
#Author:
# The-Repo-Club [wayne6324@gmail.com]
#Github:
2022-01-20 15:38:50 -05:00
# https://github.com/The-Repo-Club/
#
# Created:
# Mon 22 November 2021, 03:15:54 PM [GMT]
2022-01-21 08:38:27 -05:00
# Modified:
# Sat 22 January 2022, 11:56:31 AM [GMT]
2022-01-20 15:38:50 -05:00
#
# Description:
# <Todo>
#
2021-01-09 12:38:56 -05:00
2022-01-21 08:38:27 -05:00
if command -v /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &>/dev/null; then
if ! pgrep -f "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1" >/dev/null; then
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
else
echo "polkit-gnome already Running"
fi
2021-01-09 12:38:56 -05:00
fi
2022-01-21 08:38:27 -05:00
if command -v autotiling &>/dev/null; then
if ! pgrep -f "autotiling" >/dev/null; then
autotiling &
else
echo "autotiling already Running"
fi
2021-01-09 12:38:56 -05:00
fi
if command -v xroot &>/dev/null; then
if ! pgrep -f "xroot" >/dev/null; then
xroot -r xmenu_desktop &
2022-01-21 08:38:27 -05:00
else
echo "xroot already Running"
2022-01-21 08:38:27 -05:00
fi
2021-01-09 12:38:56 -05:00
fi
2022-01-21 08:38:27 -05:00
if command -v clipmenu-daemon &>/dev/null; then
if ! pgrep -f "clipmenu-daemon" >/dev/null; then
clipmenu-daemon &
else
echo "clipmenu-daemon already Running"
fi
2022-01-20 11:18:33 -05:00
fi
2022-01-21 08:38:27 -05:00
if ! command -v picom &>/dev/null; then
echo "picom could not be found"
2021-01-09 12:38:56 -05:00
else
2022-01-21 08:38:27 -05:00
if ! pgrep -x "picom" >/dev/null; then
picom -CGb --experimental-backend --config "$HOME"/.config/i3/picom.conf &
else
echo "picom already Running"
fi
2021-01-09 12:38:56 -05:00
fi
2022-01-21 08:38:27 -05:00
if ! command -v feh &>/dev/null; then
echo "feh could not be found"
2021-01-09 12:38:56 -05:00
else
2022-01-21 08:38:27 -05:00
if ! test -f "$HOME/.fehbg"; then
echo "$HOME/.fehbg could not be found"
else
sh "$HOME/.fehbg"
fi
2021-01-09 12:38:56 -05:00
fi
################
## Tray Icons ##
################
2022-01-21 08:38:27 -05:00
if ! command -v ckb-next &>/dev/null; then
echo "ckb-next could not be found"
2021-01-09 12:38:56 -05:00
else
2022-01-21 08:38:27 -05:00
if ! pgrep -x "ckb-next" >/dev/null; then
ckb-next --background &
else
echo "ckb-next already Running"
fi
2021-01-09 12:38:56 -05:00
fi
2022-01-21 08:38:27 -05:00
if command -v nm-applet &>/dev/null; then
if ! pgrep -x "nm-applet" >/dev/null; then
nm-applet &
else
echo "nm-applet already Running"
fi
2021-01-09 12:38:56 -05:00
fi
2022-01-21 08:38:27 -05:00
if command -v blueman-applet &>/dev/null; then
if ! pgrep -x "blueman-applet" >/dev/null; then
blueman-applet &
else
echo "blueman-applet already Running"
fi
2021-01-09 12:38:56 -05:00
fi
2022-01-21 08:38:27 -05:00
if command -v touchpad-indicator &>/dev/null; then
if ! pgrep -f "touchpad-indicator" >/dev/null; then
touchpad-indicator &
else
echo "touchpad-indicator already Running"
fi
2021-01-09 12:38:56 -05:00
fi
2022-01-21 08:38:27 -05:00
if command -v numlockx &>/dev/null; then
numlockx on &
2021-01-09 12:38:56 -05:00
fi
2022-01-21 08:38:27 -05:00
if command -v volumeicon &>/dev/null; then
if ! pgrep -x "volumeicon" >/dev/null; then
volumeicon &
else
echo "volumeicon already Running"
fi
2021-01-09 12:38:56 -05:00
fi
###############
## Auto Lock ##
###############
2022-01-21 08:38:27 -05:00
if command -v xidlehook &>/dev/null; then
# shellcheck disable=SC2155
export PRIMARY_DISPLAY="$(xrandr | awk '/ primary/{print $1}')"
if ! pgrep -x "xidlehook" >/dev/null; then
xidlehook \
--not-when-fullscreen \
--not-when-audio \
--timer 300 \
"xrandr --output $PRIMARY_DISPLAY --brightness .1" \
"xrandr --output $PRIMARY_DISPLAY --brightness 1" \
--timer 30 \
"xrandr --output $PRIMARY_DISPLAY --brightness 1; multimonitorlock -l -- --time-str=%I:%M:%S %p" \
"" \
--timer 3600 \
"systemctl suspend" \
""
else
echo "xidlehook already Running"
fi
2021-01-09 12:38:56 -05:00
fi
################
## Other Junk ##
################
2022-01-21 08:38:27 -05:00
systemctl --user import-environment DISPLAY XAUTHORITY
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
dbus-update-activation-environment DISPLAY XAUTHORITY
fi
2022-01-19 04:11:28 -05:00
# see https://wiki.archlinux.org/title/GNOME/Keyring#xinitrc
2022-01-21 08:38:27 -05:00
eval "$(/usr/bin/gnome-keyring-daemon --start)"
2022-01-19 04:11:28 -05:00
export SSH_AUTH_SOCK
# see https://github.com/NixOS/nixpkgs/issues/14966#issuecomment-520083836
2022-01-21 08:38:27 -05:00
mkdir -p "$HOME"/.local/share/keyrings