From 0deb53ef212bc7603d66409b6304fce2b4b6ee7e Mon Sep 17 00:00:00 2001 From: inkch Date: Thu, 18 Jan 2024 23:04:08 +0900 Subject: [PATCH] X11: add xinitrc, xprofile, Xmodmap, etc. --- dot_config/X11/Xmodmap.tmpl | 4 ++ dot_config/X11/Xresources.tmpl | 90 ++++++++++++++++++++++++++++++++++ dot_config/X11/xendrc.tmpl | 5 ++ dot_config/X11/xinitrc.tmpl | 62 +++++++++++++++++++++++ dot_config/X11/xprofile.tmpl | 80 ++++++++++++++++++++++++++++++ dot_config/X11/xsession.tmpl | 7 +++ 6 files changed, 248 insertions(+) create mode 100644 dot_config/X11/Xmodmap.tmpl create mode 100644 dot_config/X11/Xresources.tmpl create mode 100644 dot_config/X11/xendrc.tmpl create mode 100644 dot_config/X11/xinitrc.tmpl create mode 100644 dot_config/X11/xprofile.tmpl create mode 100644 dot_config/X11/xsession.tmpl diff --git a/dot_config/X11/Xmodmap.tmpl b/dot_config/X11/Xmodmap.tmpl new file mode 100644 index 0000000..0553230 --- /dev/null +++ b/dot_config/X11/Xmodmap.tmpl @@ -0,0 +1,4 @@ +clear lock +clear control +keycode 66 = Control_L +add control = Control_L Control_R diff --git a/dot_config/X11/Xresources.tmpl b/dot_config/X11/Xresources.tmpl new file mode 100644 index 0000000..381aec6 --- /dev/null +++ b/dot_config/X11/Xresources.tmpl @@ -0,0 +1,90 @@ +Xft.lcdfiler: lcddefault +Xft.antialias: true +Xft.hinting: true +Xft.hintstyle: hintfull + +Xcursor.size: 16 + +me: xterm-256color + +XTerm*locale: true +XTerm*selectToClipboard: true +XTerm*faceName: Source Han Code JP +XTerm*faceNameDoublesize: Source Han Code JP +XTerm*faceSize: 8 + +! molokai color scheme + +XTerm*background: #101010 +XTerm*foreground: #d0d0d0 +XTerm*cursorColor: #d0d0d0 +XTerm*color0: #101010 +XTerm*color1: #960050 +XTerm*color2: #66aa11 +XTerm*color3: #c47f2c +XTerm*color4: #30309b +XTerm*color5: #7e40a5 +XTerm*color6: #3579a8 +XTerm*color7: #9999aa +XTerm*color8: #303030 +XTerm*color9: #ff0090 +XTerm*color10: #80ff00 +XTerm*color11: #ffba68 +XTerm*color12: #5f5fee +XTerm*color13: #bb88dd +XTerm*color14: #4eb4fa +XTerm*color15: #d0d0d0 + +! urxvt settings {{{ +URxvt.scrollBar: False +URxvt.font: xft:Source Han Code JP:medium:size=7.6 +URxvt.boldFont: xft:Source Han Code JP:medium:size=7.6 +URxvt.letterSpace: -0.3 +! }}} + +! Base16 Tomorrow Night +! Author: Chris Kempson (http://chriskempson.com) + +*.foreground : #c5c8c6 +*.cursorColor : #f0c674 +*.background : #1e1f21 + +! 16 color space + +! Black, Gray, Silver, White +*.color0 : #1d1f21 +*.color8 : #969896 +*.color7 : #c5c8c6 +*.color15 : #ffffff + +! Red +*.color1 : #cc6666 +*.color9 : #cc6666 + +! Green +*.color2 : #b5bd68 +*.color10 : #b5bd68 + +! Yellow +*.color3 : #f0c674 +*.color11 : #f0c674 + +! Blue +*.color4 : #81a2be +*.color12 : #81a2be + +! Purple +*.color5 : #b294bb +*.color13 : #b294bb + +! Teal +*.color6 : #8abeb7 +*.color14 : #8abeb7 + +! Extra colors +*.color16 : #de935f +*.color17 : #a3685a +*.color18 : #282a2e +*.color19 : #373b41 +*.color20 : #b4b7b4 +*.color21 : #e0e0e0 diff --git a/dot_config/X11/xendrc.tmpl b/dot_config/X11/xendrc.tmpl new file mode 100644 index 0000000..b1bd3de --- /dev/null +++ b/dot_config/X11/xendrc.tmpl @@ -0,0 +1,5 @@ +#!/bin/sh + +while [ -n "$(wmctrl -l | grep "Firefox")" ]; do + wmctrl -c "Firefox" +done diff --git a/dot_config/X11/xinitrc.tmpl b/dot_config/X11/xinitrc.tmpl new file mode 100644 index 0000000..e571e2d --- /dev/null +++ b/dot_config/X11/xinitrc.tmpl @@ -0,0 +1,62 @@ +# Load profile + +for file in "/etc/profile" "$HOME/.config/.profile" "/etc/xprofile" "$HOME/.config/X11/xprofile"; do + if [ -f "$file" ]; then + echo "Loading profile from $file" + . "$file" + fi +done + +# Load resources +for file in "/etc/X11/Xresources" "$HOME/.config/X11/Xresources"; do + if [ -f "$file" ]; then + echo "Loading resource: $file" + xrdb -merge "$file" + fi +done + +# Load keymaps +for file in "/etc/X11/Xkbmap" "$HOME/.config/X11/Xkbmap"; do + if [ -f "$file" ]; then + echo "Loading keymap: $file" + setxkbmap $(cat "$file") + XKB_IN_USE=yes + fi +done + +# Load xmodmap if not using XKB +if [ -z "$XKB_IN_USE" ]; then + for file in "/etc/X11/Xmodmap" "$HOME/.config/X11/Xmodmap"; do + if [ -f "$file" ]; then + echo "Loading modmap: $file" + xmodmap "$file" + fi + done +fi + +unset XKB_IN_USE + +# Run all system xinitrc shell scripts +xinitdir="/etc/X11/xinit/xinitrc.d" +if [ -d "$xinitdir" ]; then + for script in $xinitdir/*; do + echo "Loading xinit script $script" + if [ -x "$script" -a ! -d "$script" ]; then + . "$script" + fi + done +fi + +# Run user xsession shell script +script="$HOME/.config/X11/xsession" +if [ -x "$script" -a ! -d "$script" ]; then + echo "Loading xsession script $script" + . "$script" +fi + +export USERXSESSION="$XDG_CACHE_HOME/X11/xsession" +export USERXSESSIONRC="$XDG_CACHE_HOME/X11/xsessionrc" +export ALTUSERXSESSION="$XDG_CACHE_HOME/X11/Xsession" +export ERRFILE="$XDG_CACHE_HOME/X11/xsession-errors" + +exec i3 diff --git a/dot_config/X11/xprofile.tmpl b/dot_config/X11/xprofile.tmpl new file mode 100644 index 0000000..b22057e --- /dev/null +++ b/dot_config/X11/xprofile.tmpl @@ -0,0 +1,80 @@ +############################################# +# Disabling .xsession-errors +############################################# +# export ERRFILE=/dev/null +# export ERRFILE=/tmp/xsession-errors + +############################################# +# Setting XDG-Based directories +############################################# +export XDG_RUNTIME_DIR=/run/user/1000 +export XDG_CONFIG_HOME=$HOME/.config +export XDG_CACHE_HOME=$HOME/.cache +export XDG_DATA_HOME=$HOME/.local/share + +############################################# +# Setting XDG User directories +############################################# +## # Default Path +export XDG_DESKTOP_DIR="$HOME/ws" +export XDG_DOCUMENTS_DIR="$HOME/vc/docs" +export XDG_DOWNLOAD_DIR="$HOME/dl" +export XDG_MUSIC_DIR="$HOME/vc/audio" +export XDG_PICTURES_DIR="$HOME/vc/pix" +# export XDG_PUBLICSHARE_DIR="$HOME/Public" +# export XDG_TEMPLATES_DIR="$HOME/Templates" +export XDG_VIDEOS_DIR="$HOME/vc/vids" + +# Append PATH +export PATH=$PATH:$XDG_CONFIG_HOME/rofi/scripts +export PATH=$PATH:$HOME/.local/bin +export PATH=$PATH:$HOME/.local/share/myscripts + +# For GTK & QT +export GTK_IM_MODULE=fcitx +export QT_IM_MODULE=fcitx +export QT_QPA_PLATFORMTHEME='qt6ct' +export XMODIFIERS=@im=fcitx +export DefaultIMModule=fcitx +export GTK2_RC_FILES=$XDG_CONFIG_HOME/gtk-2.0/gtkrc +export GTK_THEME=Adwaita:dark + +############################################# +# X11 +############################################# +export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" + +# Default Applications +export TERM=alacritty-256color + +# For CUDA +export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv + +############################## +# For Applications +############################## + +# Filezilla +export FZ_DATADIR=$XDG_DATA_HOME/filezilla + +# `pass` command +export PASSWORD_STORE_DIR=$XDG_DATA_HOME/password-store + +# gpg (gnupg) +export GNUPGHOME=$XDG_DATA_HOME/gnupg + +############################### +# xset +############################## +/bin/xset r rate 200 80 +/bin/xset s off +/bin/xset -dpms + +# tmux +# Cannot set config-file-path as env. +# $ tmux -f +# 2020-05-07: Now, config file is ~/.config/tmux/tmux.conf +export TMUX_TMPDIR="$XDG_RUNTIME_DIR" + +# nvidia-settings +nvidia-settings --config="$XDG_CONFIG_HOME/nvidia/settings" --load-config-only diff --git a/dot_config/X11/xsession.tmpl b/dot_config/X11/xsession.tmpl new file mode 100644 index 0000000..f7370c5 --- /dev/null +++ b/dot_config/X11/xsession.tmpl @@ -0,0 +1,7 @@ +#!/bin/bash + +# Disabling .xsession-errors +# export ERRFILE=/tmp/xsession-errors + +# Run polkit agent (See: https://wiki.archlinux.org/title/Polkit) +/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1