From caf1b13445bd5a07d9b0709b7f8489851f55455f Mon Sep 17 00:00:00 2001 From: meliurwen Date: Sun, 5 Jun 2022 16:34:15 +0200 Subject: [PATCH] Added numlock handling for TTY and X, source of `$XDG_CONFIG_HOME/.conf/locale.conf`, disabled sourcing of `/etc/X11/Xsession.d` and added Gnome polkit agent to i3 --- common-shells/.profile | 13 +++++++++-- i3/.config/i3/config | 6 ++--- x/.xinitrc | 50 +++++++++++++++++++++++++++++++++--------- x/.xsessionrc | 7 ++++-- 4 files changed, 59 insertions(+), 17 deletions(-) diff --git a/common-shells/.profile b/common-shells/.profile index 3f65a25..a5a453a 100644 --- a/common-shells/.profile +++ b/common-shells/.profile @@ -8,12 +8,21 @@ # logins, install and configure the libpam-umask package. #umask 022 -# Set font for console tty -# Source: https://github.com/powerline/fonts/tree/master/Terminus/PSF +# If inside a TTY if [ "$TERM" = "linux" ]; then + # Set font for TTY + # Source: https://github.com/powerline/fonts/tree/master/Terminus/PSF CONSOLE_FONTD=$HOME/.local/share/consolefonts CONSOLE_FONT=ter-powerline-v12n.psf.gz if [ -f "$CONSOLE_FONTD/$CONSOLE_FONT" ]; then setfont "$CONSOLE_FONTD/$CONSOLE_FONT" fi + # Enable numlock for TTY + if command -v setleds; then + setleds -D +num + fi +fi + +if [ -r "${XDG_CONFIG_HOME:-$HOME/.config/locale.conf}" ]; then + . "${XDG_CONFIG_HOME:-$HOME/.config/locale.conf}" fi diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 577d745..5ed621c 100755 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -193,9 +193,6 @@ for_window [title="mpv-floating-window"] border none # WebCam Toggle bindsym XF86WebCam exec ~/.config/i3/scripts/webcam-toggle.sh -# Numlock -exec_always --no-startup-id numlockx on - # Note: # `exec` commands are executed in order, but asynchronously; # In other words the commands are launched in sequence without waiting the @@ -217,6 +214,9 @@ exec --no-startup-id envsubst < \ ~/.config/dunst/dunstrc && \ dunst --config $HOME/.config/dunst/dunstrc +# Gnome Authentication Agent for PolicyKit (password prompt for gparted, etc...) +exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 + ## Use `xprop` to determine windows paramenters. Guide below: ## https://i3wm.org/docs/userguide.html#list_of_commands # Calculators diff --git a/x/.xinitrc b/x/.xinitrc index 7704986..480b010 100755 --- a/x/.xinitrc +++ b/x/.xinitrc @@ -21,20 +21,50 @@ fi # moment I don't have the time (and the will) to grasp the secuirty # consequences of removing them. # run all system xinitrc shell scripts. -if [ -d /etc/X11/Xsession.d ]; then - SESSIONFILES=$(run-parts --list /etc/X11/Xsession.d) - if [ -n "$SESSIONFILES" ]; then - set +e - for SESSIONFILE in $SESSIONFILES; do - . "$SESSIONFILE" - done - set -e - fi +#if [ -d /etc/X11/Xsession.d ]; then +# SESSIONFILES=$(run-parts --list /etc/X11/Xsession.d) +# if [ -n "$SESSIONFILES" ]; then +# set +e +# for SESSIONFILE in $SESSIONFILES; do +# . "$SESSIONFILE" +# done +# set -e +# fi +#fi + +# Set the Numlock for X session +# TODO: define a way to set it locally +if [ -r /etc/default/numlockx ]; then + . /etc/default/numlockx +fi +NUMLOCK="${NUMLOCK:-on}" +case "$NUMLOCK" in + on|off|toggle|keep) + ;; + auto) + # Yeah... I don't see why it shouldn't be on. + NUMLOCK=on + ;; + *) + println "Warning: incorrect value assigned to NUMLOCK variable!" + NUMLOCK=off + ;; +esac +if command -v numlockx && [ "$NUMLOCK" != "keep" ]; then + numlockx "$NUMLOCK" fi # To avoid very solw startup of many GTK apps # https://dbus.freedesktop.org/doc/dbus-update-activation-environment.1.html -#dbus-update-activation-environment --systemd DISPLAY +if [ -x "/usr/bin/dbus-update-activation-environment" ]; then + # tell dbus-daemon --session (and systemd --user, if running) + # to put a minimal subset of the Xsession's environment in activated + # services' environments + dbus-update-activation-environment --systemd \ + DISPLAY +# DBUS_SESSION_BUS_ADDRESS \ +# XAUTHORITY +fi # invoke local X session script . "$HOME/.xsession" diff --git a/x/.xsessionrc b/x/.xsessionrc index c080b81..5d7b80a 100755 --- a/x/.xsessionrc +++ b/x/.xsessionrc @@ -10,8 +10,11 @@ export QT_STYLE_OVERRIDE=adwaita-dark # Add `~/.local/bin` to $PATH C_PATH="$HOME/.local/bin" -[ -d "$C_PATH" ] && export PATH="$C_PATH:$PATH" || \ - echo "Custom PATH dir not found: $C_PATH" +if [ -d "$C_PATH" ]; then + export PATH="$C_PATH:$PATH" +else + printf "Custom PATH dir not found: %s" "$C_PATH" +fi unset C_PATH # Mount remote volumes