From a5938074a9f1a93ee984ea37a6332788562bb44d Mon Sep 17 00:00:00 2001 From: Sravan Balaji Date: Sun, 29 Sep 2024 14:53:32 -0400 Subject: [PATCH] Clean Up Wayland Init Script and Startup - Re-org system settings setion to split into x11 and wayland - Add wayland startup script - Add .winitrc with env vars and startup script for wayland sessions (e.g., dwl) - Update dwl config to disable autostart and env var patches --- README.org | 234 +++++++++++++++++++++++--------- dwl/.config/dwl | 2 +- dwl/.scripts/wayland-startup.sh | 116 ++++++++++++++++ dwl/.winitrc | 11 +- 4 files changed, 293 insertions(+), 70 deletions(-) create mode 100755 dwl/.scripts/wayland-startup.sh diff --git a/README.org b/README.org index 2fd61c4..024ae72 100644 --- a/README.org +++ b/README.org @@ -101,20 +101,13 @@ - [[#ssh][SSH]] - [[#config-2][Config]] - [[#system-settings][System Settings]] - - [[#xinit][Xinit]] - - [[#environment-variables][Environment Variables]] - - [[#load-xresources][Load Xresources]] - - [[#startup-applications--processes][Startup Applications & Processes]] - - [[#launch-environment][Launch Environment]] - - [[#xresources][Xresources]] - - [[#colors-1][Colors]] - - [[#sizes][Sizes]] - - [[#application-specific-changes][Application Specific Changes]] - - [[#winit][Winit]] - - [[#environment-variables-1][Environment Variables]] - - [[#startup-applications--processes-1][Startup Applications & Processes]] - - [[#launch-environment-1][Launch Environment]] - - [[#x11-startup][X11 Startup]] + - [[#x11][X11]] + - [[#xinit][Xinit]] + - [[#xresources][Xresources]] + - [[#x11-startup][X11 Startup]] + - [[#wayland][Wayland]] + - [[#winit][Winit]] + - [[#wayland-startup][Wayland Startup]] - [[#justfile][Justfile]] - [[#miscellaneous-scripts][Miscellaneous Scripts]] - [[#media-control][Media Control]] @@ -8694,9 +8687,11 @@ Host gitea.sravanbalaji.com * System Settings -** Xinit +** X11 -*** Environment Variables +*** Xinit + +**** Environment Variables #+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwm/.xinitrc export TERM=xterm-256color # Sets the terminal type @@ -8709,13 +8704,13 @@ export QT_QPA_PLATFORMTHEME=qt6ct # QGtkStyle export _JAVA_AWT_WM_NONREPARENTING=1 # Java fix for Window Managers #+END_SRC -*** Load Xresources +**** Load Xresources #+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwm/.xinitrc xrdb ~/.Xresources #+END_SRC -*** Startup Applications & Processes +**** Startup Applications & Processes #+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwm/.xinitrc # Startup Applications @@ -8728,15 +8723,15 @@ xrdb ~/.Xresources /home/sravan/.scripts/x11-startup.sh --delay) & #+END_SRC -*** Launch Environment +**** Launch Environment #+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwm/.xinitrc exec dwm #+END_SRC -** Xresources +*** Xresources -*** Colors +**** Colors #+BEGIN_SRC conf :tangle dwm/.Xresources ! Colors @@ -8782,7 +8777,7 @@ exec dwm ,*.color16: ORANGE #+END_SRC -*** Sizes +**** Sizes *NOT IN USE* #+BEGIN_SRC conf :tangle no @@ -8834,9 +8829,9 @@ exec dwm #define CURSOR_SIZE 32 #+END_SRC -*** Application Specific Changes +**** Application Specific Changes -**** dwm +***** dwm #+BEGIN_SRC conf :tangle dwm/.Xresources ! DWM @@ -8853,7 +8848,7 @@ dwm.gappoh: OUTER_GAPS dwm.gappov: OUTER_GAPS #+END_SRC -**** Polybar +***** Polybar #+BEGIN_SRC conf :tangle dwm/.Xresources ! Polybar @@ -8866,7 +8861,7 @@ polybar.tray-scale: TRAY_SCALE polybar.maxlen: MAXLEN #+END_SRC -**** Display Scaling +***** Display Scaling #+BEGIN_SRC conf :tangle dwm/.Xresources ! Display Scaling @@ -8874,41 +8869,7 @@ polybar.maxlen: MAXLEN Xcursor.size: CURSOR_SIZE #+END_SRC -** Winit - -*** Environment Variables - -#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwl/.winitrc -export TERM=xterm-256color # Sets the terminal type -export SHELL=/bin/fish # Preferred shell -export EDITOR="emacs" # Default editor -export GIT_EDITOR="emacs" # Default git editor -export BROWSER=vivaldi-stable # Web Browser -export XDG_CONFIG_HOME=$HOME/.config # Set Config directory -export QT_QPA_PLATFORMTHEME=qt6ct # QGtkStyle -export _JAVA_AWT_WM_NONREPARENTING=1 # Java fix for Window Managers -#+END_SRC - -*** Startup Applications & Processes - -#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwl/.winitrc -# Startup Applications -/home/sravan/.scripts/wayland-startup.sh --kill-startup && - /home/sravan/.scripts/wayland-startup.sh --startup - -# Delayed Startup Applications -(sleep 5 && - /home/sravan/.scripts/wayland-startup.sh --kill-delay && - /home/sravan/.scripts/wayland-startup.sh --delay) & -#+END_SRC - -*** Launch Environment - -#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwl/.winitrc -exec dwl -#+END_SRC - -** X11 Startup +*** X11 Startup #+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwm/.scripts/x11-startup.sh declare -a startup_array=(\ @@ -9058,6 +9019,157 @@ main() { main $@ #+END_SRC +** Wayland + +*** Winit + +**** Environment Variables + +#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwl/.winitrc +export TERM=xterm-256color # Sets the terminal type +export SHELL=/bin/fish # Preferred shell +export EDITOR="emacs" # Default editor +export GIT_EDITOR="emacs" # Default git editor +export BROWSER=vivaldi-stable # Web Browser +export XDG_CONFIG_HOME=$HOME/.config # Set Config directory +export QT_QPA_PLATFORMTHEME=qt6ct # QGtkStyle +export _JAVA_AWT_WM_NONREPARENTING=1 # Java fix for Window Managers +export XDG_CURRENT_DESKTOP=wlroots # Set XDG current desktop +#+END_SRC + +**** Launch Environment + +#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwl/.winitrc +dwl & +#+END_SRC + +**** Startup Applications & Processes + +#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwl/.winitrc +/home/sravan/.scripts/wayland-startup.sh --kill-startup && + /home/sravan/.scripts/wayland-startup.sh --startup +#+END_SRC + +*** Wayland Startup + +#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle dwl/.scripts/wayland-startup.sh +declare -a startup_array=(\ + # Display / Compositor Setup + "/usr/bin/shikane" \ # Display Setup + "/usr/bin/bash $HOME/.azotebg" \ # Wallpaper + "/usr/bin/gammastep -x" \ # Reset gammastep night light + # Background Processes + "/usr/libexec/polkit-gnome-authentication-agent-1" \ # GNOME Polkit Authentication Agent + "/usr/bin/kdeconnectd --replace" \ # KDE Connect Daemon + "/usr/bin/bash $HOME/.scripts/dunst.sh" \ # Dunst Notification Daemon + "/usr/bin/wl-paste --type text --watch cliphist store" \ # Clipboard for Text + "/usr/bin/wl-paste --type image --watch cliphist store" \ # Clipboard for Images + # Tray Applications + "/usr/bin/gammastep-indicator" \ # Gamamstep Night Light Indicator + "/usr/bin/blueman-applet" \ # Bluetooth Manager Applet + "/usr/bin/nm-applet" \ # Network Manager Applet + "/usr/bin/kdeconnect-indicator" \ # KDE Connect Indicator + "/usr/bin/udiskie -a -n -s" \ # Udiskie + # Status Bar + "/usr/bin/sh -c $HOME/.config/dwl/waybar/launch.sh" \ # Waybar (dwl configuration) + # GUI Applications + "/usr/bin/nextcloud" \ # NextCloud Client + "/usr/bin/syncthing-gtk" \ # Syncthing GUI + "/usr/bin/openrgb" \ # OpenRGB +) + +declare -a kill_startup_array=(\ + # Display / Compositor Setup + "pkill shikane" \ + "pkill gammastep" \ + # Background Processes + "pkill polkit-gnome-au" \ + "pkill kdeconnectd" \ + "pkill dunst" \ + "pkill wl-paste" \ + # Tray Applications + "pkill gammastep-indic" \ + "pkill blueman-applet" \ + "pkill nm-applet" \ + "pkill kdeconnect-indi" \ + "pkill udiskie" \ + # Status Bar + "pkill waybar" \ + # GUI Applications + "pkill nextcloud" \ + "pkill syncthing-gtk" \ + "pkill openrgb" \ +) + +help_menu() { + echo "Main script to launch and kill startup processes. 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 Startup Processes - startup" + " Kill Startup Processes - kill-startup" + "󰌍 Back - back" + "󰗼 Quit - quit" + ) + + choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i) + option=$(printf '%s\n' "${choice}" | awk '{print $NF}') + + if [[ "$option" == "quit" ]]; then + pkill rofi + elif [[ "$option" != "back" ]]; then + main "--$option" && main "--rofi" + fi +} + +main() { + if [ $# -eq 0 ]; then + # No arguments + help_menu + else + case $1 in + --help | -h) + help_menu + ;; + --startup) + for i in "${startup_array[@]}" + do + if ! command -v $i > /dev/null + then + do_nothing() { :; } + else + $i & + fi + done + ;; + --kill-startup) + for i in "${kill_startup_array[@]}" + do + if ! command -v $i > /dev/null + then + do_nothing() { :; } + else + $i & + fi + done + ;; + --rofi) + rofi_menu + ;; + esac + fi +} + +main $@ +#+END_SRC + * Justfile #+BEGIN_SRC just :tangle justfile diff --git a/dwl/.config/dwl b/dwl/.config/dwl index 85892f3..cfd3455 160000 --- a/dwl/.config/dwl +++ b/dwl/.config/dwl @@ -1 +1 @@ -Subproject commit 85892f35179ce2ac94a791d51a73d05c3ba845d1 +Subproject commit cfd345571f486f89524fd2f8d6798458f2044690 diff --git a/dwl/.scripts/wayland-startup.sh b/dwl/.scripts/wayland-startup.sh new file mode 100755 index 0000000..623dd73 --- /dev/null +++ b/dwl/.scripts/wayland-startup.sh @@ -0,0 +1,116 @@ +#!/usr/bin/env bash +declare -a startup_array=(\ + # Display / Compositor Setup + "/usr/bin/shikane" \ # Display Setup + "/usr/bin/bash $HOME/.azotebg" \ # Wallpaper + "/usr/bin/gammastep -x" \ # Reset gammastep night light + # Background Processes + "/usr/libexec/polkit-gnome-authentication-agent-1" \ # GNOME Polkit Authentication Agent + "/usr/bin/kdeconnectd --replace" \ # KDE Connect Daemon + "/usr/bin/bash $HOME/.scripts/dunst.sh" \ # Dunst Notification Daemon + "/usr/bin/wl-paste --type text --watch cliphist store" \ # Clipboard for Text + "/usr/bin/wl-paste --type image --watch cliphist store" \ # Clipboard for Images + # Tray Applications + "/usr/bin/gammastep-indicator" \ # Gamamstep Night Light Indicator + "/usr/bin/blueman-applet" \ # Bluetooth Manager Applet + "/usr/bin/nm-applet" \ # Network Manager Applet + "/usr/bin/kdeconnect-indicator" \ # KDE Connect Indicator + "/usr/bin/udiskie -a -n -s" \ # Udiskie + # Status Bar + "/usr/bin/sh -c $HOME/.config/dwl/waybar/launch.sh" \ # Waybar (dwl configuration) + # GUI Applications + "/usr/bin/nextcloud" \ # NextCloud Client + "/usr/bin/syncthing-gtk" \ # Syncthing GUI + "/usr/bin/openrgb" \ # OpenRGB +) + +declare -a kill_startup_array=(\ + # Display / Compositor Setup + "pkill shikane" \ + "pkill gammastep" \ + # Background Processes + "pkill polkit-gnome-au" \ + "pkill kdeconnectd" \ + "pkill dunst" \ + "pkill wl-paste" \ + # Tray Applications + "pkill gammastep-indic" \ + "pkill blueman-applet" \ + "pkill nm-applet" \ + "pkill kdeconnect-indi" \ + "pkill udiskie" \ + # Status Bar + "pkill waybar" \ + # GUI Applications + "pkill nextcloud" \ + "pkill syncthing-gtk" \ + "pkill openrgb" \ +) + +help_menu() { + echo "Main script to launch and kill startup processes. 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 Startup Processes - startup" + " Kill Startup Processes - kill-startup" + "󰌍 Back - back" + "󰗼 Quit - quit" + ) + + choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i) + option=$(printf '%s\n' "${choice}" | awk '{print $NF}') + + if [[ "$option" == "quit" ]]; then + pkill rofi + elif [[ "$option" != "back" ]]; then + main "--$option" && main "--rofi" + fi +} + +main() { + if [ $# -eq 0 ]; then + # No arguments + help_menu + else + case $1 in + --help | -h) + help_menu + ;; + --startup) + for i in "${startup_array[@]}" + do + if ! command -v $i > /dev/null + then + do_nothing() { :; } + else + $i & + fi + done + ;; + --kill-startup) + for i in "${kill_startup_array[@]}" + do + if ! command -v $i > /dev/null + then + do_nothing() { :; } + else + $i & + fi + done + ;; + --rofi) + rofi_menu + ;; + esac + fi +} + +main $@ diff --git a/dwl/.winitrc b/dwl/.winitrc index 9382d7e..9afea15 100755 --- a/dwl/.winitrc +++ b/dwl/.winitrc @@ -7,14 +7,9 @@ export BROWSER=vivaldi-stable # Web Browser export XDG_CONFIG_HOME=$HOME/.config # Set Config directory export QT_QPA_PLATFORMTHEME=qt6ct # QGtkStyle export _JAVA_AWT_WM_NONREPARENTING=1 # Java fix for Window Managers +export XDG_CURRENT_DESKTOP=wlroots # Set XDG current desktop + +dwl & -# Startup Applications /home/sravan/.scripts/wayland-startup.sh --kill-startup && /home/sravan/.scripts/wayland-startup.sh --startup - -# Delayed Startup Applications -(sleep 5 && - /home/sravan/.scripts/wayland-startup.sh --kill-delay && - /home/sravan/.scripts/wayland-startup.sh --delay) & - -exec dwl