From 2648c660023c3eb1538fba2ea6dd7f00768cddda Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sun, 24 Nov 2024 22:35:14 +0100 Subject: [PATCH] Added autologin --- bashrc | 32 ++++++++++++--------- config/hypr/hyprland.conf | 6 +++- getty@.service | 60 +++++++++++++++++++++++++++++++++++++++ login | 8 ++++++ update.sh | 7 ++++- 5 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 getty@.service create mode 100644 login diff --git a/bashrc b/bashrc index 457248d..a6c646a 100644 --- a/bashrc +++ b/bashrc @@ -4,8 +4,10 @@ case $- in *) return ;; esac -if [[ $TERM =~ tmux ]]; then - source ~/.local/share/blesh/ble.sh --noattach +if [[ ! $TERM =~ linux ]]; then + if [[ $TERM =~ tmux ]]; then + source ~/.local/share/blesh/ble.sh --noattach + fi fi # don't put duplicate lines or lines starting with space in the history. @@ -44,16 +46,20 @@ alias ls="eza -1 -l --icons=auto --git-repos --git -h -g -o --no-permissions" alias lsa="eza -1 -l --icons=auto --git-repos --git -h -g -o --no-permissions -a" alias lss="eza -1 -l --icons=auto --git-repos --git -h -g --total-size -o --no-permissions -a" -if [[ $TERM =~ tmux ]]; then - source ~/.fzf.bash - eval "$(zoxide init bash)" - eval "$(starship init bash)" - [[ ! ${BLE_VERSION-} ]] || ble-attach -fi - -# TMUX -if [[ ! $TERM =~ tmux ]]; then - if which tmux >/dev/null 2>&1; then - tmux new-session +if [[ ! $TERM =~ linux ]]; then + if [[ $TERM =~ tmux ]]; then + source ~/.fzf.bash + eval "$(zoxide init bash)" + eval "$(starship init bash)" + [[ ! ${BLE_VERSION-} ]] || ble-attach fi + + # TMUX + if [[ ! $TERM =~ tmux ]]; then + if which tmux >/dev/null 2>&1; then + tmux new-session + fi + fi +else + wrappedhl fi diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index 1f62c28..4504730 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -52,8 +52,9 @@ exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 # exec-once = waybar -exec-once = $terminal exec-once = $browser +exec-once = flatpak run com.moonlight_stream.Moonlight +exec-once = $terminal # exec-once = nm-applet & # exec-once = waybar & hyprpaper & firefox @@ -170,6 +171,7 @@ dwindle { # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more master { new_status = slave + mfact = 0.5 } # https://wiki.hyprland.org/Configuring/Variables/#misc @@ -296,6 +298,8 @@ bindl = , XF86AudioPrev, exec, playerctl previous # Example windowrule v2 # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ +# windowrulev2 = float,class:(com.moonlight_stream.moonlight),title:(moonlight) +# windowrulev2 = tile,class:(com.moonlight_stream.moonlight),title:(moonlight) # Ignore maximize requests from apps. You'll probably like this. windowrulev2 = suppressevent maximize, class:.* diff --git a/getty@.service b/getty@.service new file mode 100644 index 0000000..761564c --- /dev/null +++ b/getty@.service @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Getty on %I +Documentation=man:agetty(8) man:systemd-getty-generator(8) +Documentation=https://0pointer.de/blog/projects/serial-console.html +After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target + +# If additional gettys are spawned during boot then we should make +# sure that this is synchronized before getty.target, even though +# getty.target didn't actually pull it in. +Before=getty.target +IgnoreOnIsolate=yes + +# IgnoreOnIsolate causes issues with sulogin, if someone isolates +# rescue.target or starts rescue.service from multi-user.target or +# graphical.target. +Conflicts=rescue.service +Before=rescue.service + +# On systems without virtual consoles, don't start any getty. Note +# that serial gettys are covered by serial-getty@.service, not this +# unit. +ConditionPathExists=/dev/tty0 + +[Service] +# the VT is cleared by TTYVTDisallocate +# The '-o' option value tells agetty to replace 'login' arguments with an +# option to preserve environment (-p), followed by '--' for safety, and then +# the entered username. +ExecStart=-/sbin/agetty -n -o '-p -- \\u' --noclear - $TERM +Type=idle +Restart=always +RestartSec=0 +UtmpIdentifier=%I +StandardInput=tty +StandardOutput=tty +TTYPath=/dev/%I +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes +IgnoreSIGPIPE=no +SendSIGHUP=yes +ImportCredential=agetty.* +ImportCredential=login.* + +# Unset locale for the console getty since the console has problems +# displaying some internationalized messages. +UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION + +[Install] +WantedBy=getty.target +DefaultInstance=tty1 diff --git a/login b/login new file mode 100644 index 0000000..7097ea3 --- /dev/null +++ b/login @@ -0,0 +1,8 @@ +#%PAM-1.0 +auth required pam_autologin.so +auth include system-local-login +auth optional pam_gnome_keyring.so +account include system-local-login +session include system-local-login +password include system-local-login +session optional pam_gnome_keyring.so auto_start diff --git a/update.sh b/update.sh index 6cfeac8..cc1ff89 100755 --- a/update.sh +++ b/update.sh @@ -57,10 +57,15 @@ elif [ "$OS" == "Arch Linux" ]; then cd ~ if [ -d ~/yay-bin ]; then rm -rf ~/yay-bin; fi fi - sudo pacman --noconfirm --needed -S waybar wofi hyprland hyprlock polkit-gnome xorg-xhost greetd pipewire git base-devel cmake gawk wget gettext unzip curl tmux btop ncdu ranger qt5ct qt6ct gnome-themes-extra qt5-wayland qt6-wayland lxappearance + sudo pacman --noconfirm --needed -S waybar wofi hyprland hyprlock polkit-gnome xorg-xhost gnome-keyring pipewire git base-devel cmake gawk wget gettext unzip curl tmux btop ncdu ranger qt5ct qt6ct gnome-themes-extra qt5-wayland qt6-wayland lxappearance yay --noconfirm -S --needed --aur adwaita-qt5-git yay --noconfirm -S --needed --aur adwaita-qt6-git + yay --noconfirm -S --needed --aur pam_autologin + + sudo /bin/cp -rf ~/code_server/login /etc/pam.d/login + sudo /bin/cp -rf ~/code_server/getty@.service /usr/lib/systemd/system/getty@.service + sudo touch /etc/security/autologin.conf fi