diff --git a/.scripts/startup.sh b/.scripts/startup.sh new file mode 100755 index 0000000..73ac8a0 --- /dev/null +++ b/.scripts/startup.sh @@ -0,0 +1,108 @@ +#!/bin/bash +declare -a start_array=(\ + # System Restore Processes + "bash /home/sravan/.screenlayout/default.sh" \ # Restore default screen layout + "nitrogen --restore" \ # Restore wallpaper + "numlockx on" \ # Enable numlock + # System Tray Applications + "nyrna" \ # Nyrna Application Suspend + "blueman-tray" \ # Blueman Bluetooth Manager + "nm-applet" \ # Network Manager Applet + "kdeconnect-indicator" \ # KDE Connect + "flameshot" \ # Flameshot Screenshot Tool + "xfce4-power-manager" \ # XFCE4 Power Manager + # Background Processes + "bash /home/sravan/.scripts/picom.sh --on" \ # Picom Compositor + "bash /home/sravan/.scripts/dunst.sh --on" \ # Dunst Notification Daemon + "greenclip daemon" \ # Greenclip Clipboard Manager + "redshift -x" \ # Reset redshift display gamma + "redshift-gtk" \ # Redshift Blue Light Filter + "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1" \ # GNOME Polkit Authentication Agent + "light-locker --lock-on-suspend --lock-on-lid" \ # screen lock for lightdm +) + +declare -a kill_array=(\ + # System Tray Applications + "pkill nyrna" \ # Nyrna Application Suspend + "pkill blueman-tray" \ # Blueman Bluetooth Manager + "pkill nm-applet" \ # Network Manager Applet + "pkill kdeconnect-indicator" \ # KDE Connect + "pkill flameshot" \ # Flameshot Screenshot Tool + "pkill xfce4-power-manager" \ # XFCE4 Power Manager + # Background Processes + "bash /home/sravan/.scripts/picom.sh --off" \ # Picom Compositor + "bash /home/sravan/.scripts/dunst.sh --off" \ # Dunst Notification Daemon + "pkill greenclip" \ # Greenclip Clipboard Manager + "pkill redshift" \ # Redshift Blue Light Filter + "pkill polkit" \ # GNOME Polkit Authentication Agent + "pkill light-locker" \ # screen lock for lightdm +) + +help_menu() { + echo "Main script to launch and kill autostart processes & applications. Use only one argument at a time." + # echo " - Play / Pause: playerctl.sh --play-pause" + # echo " - Next: playerctl.sh --next" + # echo " - Previous: playerctl.sh --prev" + # echo " - Change Player: playerctl.sh --change" + # echo " - Rofi Menu: playerctl.sh --rofi" + # echo " - Help: playerctl.sh --help OR playerctl.sh -h" +} + +rofi_menu() { + declare -a options=( + " Launch Autostart Processes - start" + "ﮊ Kill Autostart Processes - kill" + " Quit - quit" + ) + + choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i) + option=$(printf '%s\n' "${choice}" | awk '{print $NF}') + + if [[ "$option" != "quit" ]]; then + main "--$option" && main "--rofi" + fi +} + +main() { + if [ $# -eq 0 ]; then + # No arguments + help_menu + else + case $1 in + --help | -h) + help_menu + ;; + --start) + main "--kill" + + # Run applications (ignore if they don't exist) + for i in "${start_array[@]}" + do + if ! command -v $i > /dev/null + then + do_nothing() { :; } + else + $i & + fi + done + ;; + --kill) + # Kill applications (ignore if they don't exist) + for i in "${kill_array[@]}" + do + if ! command -v $i > /dev/null + then + do_nothing() { :; } + else + $i & + fi + done + ;; + --rofi) + rofi_menu + ;; + esac + fi +} + +main $@ diff --git a/.xinitrc b/.xinitrc index 8925fe8..21c441c 100755 --- a/.xinitrc +++ b/.xinitrc @@ -8,4 +8,6 @@ export QT_QPA_PLATFORMTHEME=qt5ct # QGtkStyle xrdb ~/.Xresources +/home/sravan/.scripts/startup.sh --start + exec xmonad diff --git a/.xmonad b/.xmonad index 0b3d2cb..cbed4fe 160000 --- a/.xmonad +++ b/.xmonad @@ -1 +1 @@ -Subproject commit 0b3d2cb30ea828acf74894c37edf22a5045d08b5 +Subproject commit cbed4fea8f9569dc193df2c76d068bb818ce2a4c diff --git a/README.org b/README.org index cd0324d..105bfac 100644 --- a/README.org +++ b/README.org @@ -6418,6 +6418,12 @@ Configuration for Alacritty, the GPU enhanced terminal emulator. xrdb ~/.Xresources #+end_src +*** Startup Applications & Processes + +#+begin_src shell :shebang #!/bin/sh :tangle .xinitrc + /home/sravan/.scripts/startup.sh --start +#+end_src + *** Launch Environment #+begin_src shell :shebang #!/bin/sh :tangle .xinitrc @@ -6847,6 +6853,117 @@ Configuration for Alacritty, the GPU enhanced terminal emulator. main $@ #+end_src +** Startup + +#+begin_src shell :shebang #!/bin/bash :tangle .scripts/startup.sh + declare -a start_array=(\ + # System Restore Processes + "bash /home/sravan/.screenlayout/default.sh" \ # Restore default screen layout + "nitrogen --restore" \ # Restore wallpaper + "numlockx on" \ # Enable numlock + # System Tray Applications + "nyrna" \ # Nyrna Application Suspend + "blueman-tray" \ # Blueman Bluetooth Manager + "nm-applet" \ # Network Manager Applet + "kdeconnect-indicator" \ # KDE Connect + "flameshot" \ # Flameshot Screenshot Tool + "xfce4-power-manager" \ # XFCE4 Power Manager + # Background Processes + "bash /home/sravan/.scripts/picom.sh --on" \ # Picom Compositor + "bash /home/sravan/.scripts/dunst.sh --on" \ # Dunst Notification Daemon + "greenclip daemon" \ # Greenclip Clipboard Manager + "redshift -x" \ # Reset redshift display gamma + "redshift-gtk" \ # Redshift Blue Light Filter + "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1" \ # GNOME Polkit Authentication Agent + "light-locker --lock-on-suspend --lock-on-lid" \ # screen lock for lightdm + ) + + declare -a kill_array=(\ + # System Tray Applications + "pkill nyrna" \ # Nyrna Application Suspend + "pkill blueman-tray" \ # Blueman Bluetooth Manager + "pkill nm-applet" \ # Network Manager Applet + "pkill kdeconnect-indicator" \ # KDE Connect + "pkill flameshot" \ # Flameshot Screenshot Tool + "pkill xfce4-power-manager" \ # XFCE4 Power Manager + # Background Processes + "bash /home/sravan/.scripts/picom.sh --off" \ # Picom Compositor + "bash /home/sravan/.scripts/dunst.sh --off" \ # Dunst Notification Daemon + "pkill greenclip" \ # Greenclip Clipboard Manager + "pkill redshift" \ # Redshift Blue Light Filter + "pkill polkit" \ # GNOME Polkit Authentication Agent + "pkill light-locker" \ # screen lock for lightdm + ) + + help_menu() { + echo "Main script to launch and kill autostart processes & applications. Use only one argument at a time." + # echo " - Play / Pause: playerctl.sh --play-pause" + # echo " - Next: playerctl.sh --next" + # echo " - Previous: playerctl.sh --prev" + # echo " - Change Player: playerctl.sh --change" + # echo " - Rofi Menu: playerctl.sh --rofi" + # echo " - Help: playerctl.sh --help OR playerctl.sh -h" + } + + rofi_menu() { + declare -a options=( + " Launch Autostart Processes - start" + "ﮊ Kill Autostart Processes - kill" + " Quit - quit" + ) + + choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i) + option=$(printf '%s\n' "${choice}" | awk '{print $NF}') + + if [[ "$option" != "quit" ]]; then + main "--$option" && main "--rofi" + fi + } + + main() { + if [ $# -eq 0 ]; then + # No arguments + help_menu + else + case $1 in + --help | -h) + help_menu + ;; + --start) + main "--kill" + + # Run applications (ignore if they don't exist) + for i in "${start_array[@]}" + do + if ! command -v $i > /dev/null + then + do_nothing() { :; } + else + $i & + fi + done + ;; + --kill) + # Kill applications (ignore if they don't exist) + for i in "${kill_array[@]}" + do + if ! command -v $i > /dev/null + then + do_nothing() { :; } + else + $i & + fi + done + ;; + --rofi) + rofi_menu + ;; + esac + fi + } + + main $@ +#+end_src ** Control Center #+begin_src shell :shebang #!/bin/bash :tangle .scripts/control-center.sh @@ -6911,6 +7028,7 @@ Configuration for Alacritty, the GPU enhanced terminal emulator. main $@ #+end_src + * Acknowledgements I followed [[https://www.youtube.com/channel/UCVls1GmFKf6WlTraIb_IaJg][DistroTube]]'s process for setting up a git bare repository as shown in [[https://youtu.be/tBoLDpTWVOM][Git Bare Repository - A Better Way To Manage Dotfiles]].