From 8d600f8f2fea3c3e4f556867b4d1a67d55367615 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Mon, 2 Sep 2024 16:33:47 -0500 Subject: [PATCH 1/5] Compile date and version fix --- Cargo.lock | 222 ++++++------------ Cargo.toml | 2 +- .../applications-setup/dwmtitus-setup.sh | 158 ++++++++++++- src/state.rs | 2 +- 4 files changed, 234 insertions(+), 150 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e05cbcd06..465a2e4df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,21 +20,6 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "anstream" version = "0.6.14" @@ -114,12 +99,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - [[package]] name = "cassowary" version = "0.3.0" @@ -135,32 +114,12 @@ dependencies = [ "rustversion", ] -[[package]] -name = "cc" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324c74f2155653c90b04f25b2a47a8a631360cb908f92a772695f430c7e31052" - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-targets 0.52.5", -] - [[package]] name = "clap" version = "4.5.16" @@ -221,10 +180,18 @@ dependencies = [ ] [[package]] -name = "core-foundation-sys" -version = "0.8.6" +name = "compile-time" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "e55ede5279d4d7c528906853743abeb26353ae1e6c440fcd6d18316c2c2dd903" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "rustc_version", + "semver", + "time", +] [[package]] name = "crossterm" @@ -251,6 +218,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "downcast-rs" version = "1.2.1" @@ -327,29 +303,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "iana-time-zone" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "include_dir" version = "0.7.4" @@ -409,15 +362,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "js-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -503,13 +447,10 @@ dependencies = [ ] [[package]] -name = "num-traits" -version = "0.2.19" +name = "num-conv" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "once_cell" @@ -579,6 +520,12 @@ dependencies = [ "winreg", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "proc-macro2" version = "1.0.83" @@ -673,6 +620,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.38.34" @@ -704,6 +660,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + [[package]] name = "serde" version = "1.0.205" @@ -921,6 +883,37 @@ dependencies = [ "syn", ] +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "toml" version = "0.8.19" @@ -959,8 +952,8 @@ dependencies = [ name = "tui" version = "0.1.0" dependencies = [ - "chrono", "clap", + "compile-time", "crossterm", "ego-tree", "include_dir", @@ -1064,60 +1057,6 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - [[package]] name = "which" version = "6.0.3" @@ -1152,15 +1091,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.5", -] - [[package]] name = "windows-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index 5dd600343..e3eb99b48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -chrono = "0.4.33" clap = { version = "4.5.16", features = ["derive"] } +compile-time = "0.2.0" crossterm = "0.27.0" ego-tree = "0.6.2" oneshot = "0.1.8" diff --git a/src/commands/applications-setup/dwmtitus-setup.sh b/src/commands/applications-setup/dwmtitus-setup.sh index 548d9073a..0936449a0 100644 --- a/src/commands/applications-setup/dwmtitus-setup.sh +++ b/src/commands/applications-setup/dwmtitus-setup.sh @@ -5,7 +5,6 @@ makeDWM() { cd "$HOME" && git clone https://github.com/ChrisTitusTech/dwm-titus.git # CD to Home directory to install dwm-titus # This path can be changed (e.g. to linux-toolbox directory) cd dwm-titus/ # Hardcoded path, maybe not the best. - $ESCALATION_TOOL ./setup.sh # Run setup $ESCALATION_TOOL make clean install # Run make clean install } @@ -15,13 +14,168 @@ setupDWM() { pacman) $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 ;; - *) + apt) $ESCALATION_TOOL "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev ;; + dnf) + $ESCALATION_TOOL "$PACKAGER" groupinstall -y "Development Tools" + $ESCALATION_TOOL "$PACKAGER" install -y libx11-devel libxinerama-devel libxft-devel imlib2-devel + ;; + *) + echo "Unsupported package manager: $PACKAGER" + exit 1 + ;; esac } +install_nerd_font() { + FONT_DIR="$HOME/.local/share/fonts" + FONT_ZIP="$FONT_DIR/Meslo.zip" + FONT_URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Meslo.zip" + FONT_INSTALLED=$(fc-list | grep -i "Meslo") + + # Check if Meslo Nerd-font is already installed + if [ -n "$FONT_INSTALLED" ]; then + echo "Meslo Nerd-fonts are already installed." + return 0 + fi + + echo "Installing Meslo Nerd-fonts" + + # Create the fonts directory if it doesn't exist + if [ ! -d "$FONT_DIR" ]; then + mkdir -p "$FONT_DIR" || { + echo "Failed to create directory: $FONT_DIR" + return 1 + } + else + echo "$FONT_DIR exists, skipping creation." + fi + + # Check if the font zip file already exists + if [ ! -f "$FONT_ZIP" ]; then + # Download the font zip file + wget -P "$FONT_DIR" "$FONT_URL" || { + echo "Failed to download Meslo Nerd-fonts from $FONT_URL" + return 1 + } + else + echo "Meslo.zip already exists in $FONT_DIR, skipping download." + fi + + # Unzip the font file if it hasn't been unzipped yet + if [ ! -d "$FONT_DIR/Meslo" ]; then + unzip "$FONT_ZIP" -d "$FONT_DIR" || { + echo "Failed to unzip $FONT_ZIP" + return 1 + } + else + echo "Meslo font files already unzipped in $FONT_DIR, skipping unzip." + fi + + # Remove the zip file + rm "$FONT_ZIP" || { + echo "Failed to remove $FONT_ZIP" + return 1 + } + + # Rebuild the font cache + fc-cache -fv || { + echo "Failed to rebuild font cache" + return 1 + } + + echo "Meslo Nerd-fonts installed successfully" +} + +picom_animations() { + # Clone the repository in the home/build directory + mkdir -p ~/build + if [ ! -d ~/build/picom ]; then + if ! git clone https://github.com/FT-Labs/picom.git ~/build/picom; then + echo "Failed to clone the repository" + return 1 + fi + else + echo "Repository already exists, skipping clone" + fi + + cd ~/build/picom || { echo "Failed to change directory to picom"; return 1; } + + # Build the project + if ! meson setup --buildtype=release build; then + echo "Meson setup failed" + return 1 + fi + + if ! ninja -C build; then + echo "Ninja build failed" + return 1 + fi + + # Install the built binary + if ! sudo ninja -C build install; then + echo "Failed to install the built binary" + return 1 + fi + + echo "Picom animations installed successfully" +} + +clone_config_folders() { + # Ensure the target directory exists + [ ! -d ~/.config ] && mkdir -p ~/.config + + # Iterate over all directories in config/* + for dir in config/*/; do + # Extract the directory name + dir_name=$(basename "$dir") + + # Clone the directory to ~/.config/ + if [ -d "$dir" ]; then + cp -r "$dir" ~/.config/ + echo "Cloned $dir_name to ~/.config/" + else + echo "Directory $dir_name does not exist, skipping" + fi + done +} + +configure_backgrounds() { + # Set the variable BG_DIR to the path where backgrounds will be stored + BG_DIR="$HOME/Pictures/backgrounds" + + # Check if the ~/Pictures directory exists + if [ ! -d "~/Pictures" ]; then + # If it doesn't exist, print an error message and return with a status of 1 (indicating failure) + echo "Pictures directory does not exist" + mkdir ~/Pictures + echo "Directory was created in Home folder" + fi + + # Check if the backgrounds directory (BG_DIR) exists + if [ ! -d "$BG_DIR" ]; then + # If the backgrounds directory doesn't exist, attempt to clone a repository containing backgrounds + if ! git clone https://github.com/ChrisTitusTech/nord-background.git ~/Pictures; then + # If the git clone command fails, print an error message and return with a status of 1 + echo "Failed to clone the repository" + return 1 + fi + # Rename the cloned directory to 'backgrounds' + mv ~/Pictures/nord-background ~/Pictures/backgrounds + # Print a success message indicating that the backgrounds have been downloaded + echo "Downloaded desktop backgrounds to $BG_DIR" + else + # If the backgrounds directory already exists, print a message indicating that the download is being skipped + echo "Path $BG_DIR exists for desktop backgrounds, skipping download of backgrounds" + fi +} + + checkEnv checkEscalationTool setupDWM makeDWM +install_nerd_font +clone_config_folders +configure_backgrounds \ No newline at end of file diff --git a/src/state.rs b/src/state.rs index 66f99972c..24c090e50 100644 --- a/src/state.rs +++ b/src/state.rs @@ -155,7 +155,7 @@ impl AppState { }) .block(Block::default().borders(Borders::ALL).title(format!( "Linux Toolbox - {}", - chrono::Local::now().format("%Y-%m-%d") + compile_time::date_str!() ))) .scroll_padding(1); frame.render_stateful_widget(list, chunks[1], &mut self.selection); From f5532d16234427354d088d92ed6ab78fc0f4372a Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Mon, 2 Sep 2024 16:56:41 -0500 Subject: [PATCH 2/5] remove old compile-time --- Cargo.lock | 82 ---------------------------------------------------- Cargo.toml | 1 - src/state.rs | 9 +++--- 3 files changed, 5 insertions(+), 87 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 465a2e4df..40e820699 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -179,20 +179,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "compile-time" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55ede5279d4d7c528906853743abeb26353ae1e6c440fcd6d18316c2c2dd903" -dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "rustc_version", - "semver", - "time", -] - [[package]] name = "crossterm" version = "0.27.0" @@ -218,15 +204,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - [[package]] name = "downcast-rs" version = "1.2.1" @@ -446,12 +423,6 @@ dependencies = [ "pin-utils", ] -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - [[package]] name = "once_cell" version = "1.19.0" @@ -520,12 +491,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - [[package]] name = "proc-macro2" version = "1.0.83" @@ -620,15 +585,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - [[package]] name = "rustix" version = "0.38.34" @@ -660,12 +616,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - [[package]] name = "serde" version = "1.0.205" @@ -883,37 +833,6 @@ dependencies = [ "syn", ] -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - [[package]] name = "toml" version = "0.8.19" @@ -953,7 +872,6 @@ name = "tui" version = "0.1.0" dependencies = [ "clap", - "compile-time", "crossterm", "ego-tree", "include_dir", diff --git a/Cargo.toml b/Cargo.toml index e3eb99b48..77ca0ab46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,6 @@ edition = "2021" [dependencies] clap = { version = "4.5.16", features = ["derive"] } -compile-time = "0.2.0" crossterm = "0.27.0" ego-tree = "0.6.2" oneshot = "0.1.8" diff --git a/src/state.rs b/src/state.rs index 24c090e50..6c597445f 100644 --- a/src/state.rs +++ b/src/state.rs @@ -153,10 +153,11 @@ impl AppState { } else { Style::new() }) - .block(Block::default().borders(Borders::ALL).title(format!( - "Linux Toolbox - {}", - compile_time::date_str!() - ))) + .block( + Block::default() + .borders(Borders::ALL) + .title(format!("Linux Toolbox")), + ) .scroll_padding(1); frame.render_stateful_widget(list, chunks[1], &mut self.selection); From 71abf56038b7debf369b4387ffaf9fee5e947c0e Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Tue, 3 Sep 2024 15:14:21 -0500 Subject: [PATCH 3/5] Xorg setup --- .../applications-setup/dwmtitus-setup.sh | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/commands/applications-setup/dwmtitus-setup.sh b/src/commands/applications-setup/dwmtitus-setup.sh index 0936449a0..5759d31f5 100644 --- a/src/commands/applications-setup/dwmtitus-setup.sh +++ b/src/commands/applications-setup/dwmtitus-setup.sh @@ -171,9 +171,32 @@ configure_backgrounds() { fi } +setupDisplayManager() { + echo "Setting up Xorg" + case "$PACKAGER" in + pacman) + $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm xorg-xinit xorg-server + ;; + apt) + $ESCALATION_TOOL "$PACKAGER" install -y xorg xinit + ;; + dnf) + $ESCALATION_TOOL "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg + ;; + *) + echo "Unsupported package manager: $PACKAGER" + exit 1 + ;; + esac + echo "Xorg installed successfully" + echo "Setting up Display Manager" + + +} checkEnv checkEscalationTool +setupDisplayManager setupDWM makeDWM install_nerd_font From 022bdb7659a91c520347bb09741f7cb69f1bbbee Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Tue, 3 Sep 2024 15:34:21 -0500 Subject: [PATCH 4/5] Update dwmtitus-setup.sh --- src/commands/applications-setup/dwmtitus-setup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/applications-setup/dwmtitus-setup.sh b/src/commands/applications-setup/dwmtitus-setup.sh index 5759d31f5..01a49fdda 100644 --- a/src/commands/applications-setup/dwmtitus-setup.sh +++ b/src/commands/applications-setup/dwmtitus-setup.sh @@ -12,14 +12,14 @@ setupDWM() { echo "Installing DWM-Titus if not already installed" case "$PACKAGER" in # Install pre-Requisites pacman) - $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 + $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb ;; apt) - $ESCALATION_TOOL "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev + $ESCALATION_TOOL "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev libxcb1-dev ;; dnf) $ESCALATION_TOOL "$PACKAGER" groupinstall -y "Development Tools" - $ESCALATION_TOOL "$PACKAGER" install -y libx11-devel libxinerama-devel libxft-devel imlib2-devel + $ESCALATION_TOOL "$PACKAGER" install -y libx11-devel libxinerama-devel libxft-devel imlib2-devel libxcb-devel ;; *) echo "Unsupported package manager: $PACKAGER" From 88697517f798e8c79ddbdfe32860997ebaf423a2 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Tue, 3 Sep 2024 17:26:45 -0500 Subject: [PATCH 5/5] Update dwmtitus-setup.sh --- .../applications-setup/dwmtitus-setup.sh | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/src/commands/applications-setup/dwmtitus-setup.sh b/src/commands/applications-setup/dwmtitus-setup.sh index 01a49fdda..6a1fb1624 100644 --- a/src/commands/applications-setup/dwmtitus-setup.sh +++ b/src/commands/applications-setup/dwmtitus-setup.sh @@ -190,7 +190,108 @@ setupDisplayManager() { esac echo "Xorg installed successfully" echo "Setting up Display Manager" + currentdm="none" + for dm in gdm sddm lightdm; do + if systemctl is-active --quiet $dm.service; then + currentdm=$dm + break + fi + done + echo "Current display manager: $currentdm" + if [ "$currentdm" = "none" ]; then + DM="sddm" + echo "No display manager found, installing $DM" + case "$PACKAGER" in + pacman) + $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm $DM + ;; + apt) + $ESCALATION_TOOL "$PACKAGER" install -y $DM + ;; + dnf) + $ESCALATION_TOOL "$PACKAGER" install -y $DM + ;; + *) + echo "Unsupported package manager: $PACKAGER" + exit 1 + ;; + esac + echo "$DM installed successfully" + systemctl enable $DM + + # Clear the screen + clear + + # Prompt user for auto-login + echo "Do you want to enable auto-login?" + echo "Use arrow keys or j/k to navigate, Enter to select" + options=("Yes" "No") + selected=0 + + # Function to print menu + print_menu() { + for i in "${!options[@]}"; do + if [ $i -eq $selected ]; then + echo "> ${options[$i]}" + else + echo " ${options[$i]}" + fi + done + } + + # Handle user input + while true; do + print_menu + read -rsn1 key + case "$key" in + $'\x1B') # ESC sequence for arrow keys + read -rsn2 key + case "$key" in + '[A' | 'k') ((selected > 0)) && ((selected--));; # Up arrow or k + '[B' | 'j') ((selected < ${#options[@]}-1)) && ((selected++));; # Down arrow or j + esac + ;; + '') break;; # Enter key + esac + clear + done + + if [ "${options[$selected]}" = "Yes" ]; then + echo "Configuring SDDM for autologin" + SDDM_CONF="/etc/sddm.conf" + if [ ! -f "$SDDM_CONF" ]; then + echo "[Autologin]" | sudo tee -a "$SDDM_CONF" + echo "User=$USER" | sudo tee -a "$SDDM_CONF" + echo "Session=dwm" | sudo tee -a "$SDDM_CONF" + else + sudo sed -i '/^\[Autologin\]/d' "$SDDM_CONF" + sudo sed -i '/^User=/d' "$SDDM_CONF" + sudo sed -i '/^Session=/d' "$SDDM_CONF" + echo "[Autologin]" | sudo tee -a "$SDDM_CONF" + echo "User=$USER" | sudo tee -a "$SDDM_CONF" + echo "Session=dwm" | sudo tee -a "$SDDM_CONF" + fi + echo "Checking if autologin group exists" + if ! getent group autologin > /dev/null; then + echo "Creating autologin group" + sudo groupadd autologin + else + echo "Autologin group already exists" + fi + echo "Adding user with UID 1000 to autologin group" + USER_UID_1000=$(getent passwd 1000 | cut -d: -f1) + if [ -n "$USER_UID_1000" ]; then + sudo usermod -aG autologin "$USER_UID_1000" + echo "User $USER_UID_1000 added to autologin group" + else + echo "No user with UID 1000 found - Auto login not possible" + fi + else + echo "Auto-login configuration skipped" + fi + fi + }