notes

Dash Eclipse's Notes
git clone git://ezup.dev/notes.git
Log | Files | Refs | Submodules | README | LICENSE

desktop.org (5246B)


      1#+STARTUP: content
      2#+STARTUP: indent
      3* Desktop
      4:PROPERTIES:
      5:CUSTOM_ID: desktop
      6:END:
      7** Shell (zsh)
      8:PROPERTIES:
      9:CUSTOM_ID: desktop_shell-zsh
     10:END:
     11- zsh
     12- grml-zsh-config
     13- zsh-autosuggestions
     14- zsh-completion
     15- zsh-syntax-highlighting
     16- skim-key-bindings.zsh
     17- powerlevel10k
     18*Plugins*
     19#+BEGIN_SRC sh
     20  # $HOME/.zshrc.local
     21
     22  . /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
     23  . /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
     24  . /usr/share/zsh/site-functions/skim-key-bindings.zsh
     25
     26  if [ ! -z ${DISPLAY+x} ] ; then
     27          . /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
     28          . $HOME/.p10k.zsh
     29          POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir rbenv vcs)
     30          ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=240'
     31          #ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=blue,underline'
     32          #ZSH_HIGHLIGHT_STYLES[precommand]='fg=blue,underline'
     33          #ZSH_HIGHLIGHT_STYLES[arg0]='fg=blue'
     34          #ZSH_HIGHLIGHT_STYLES[comment]='fg=239'
     35          ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=32,underline
     36          ZSH_HIGHLIGHT_STYLES[precommand]=fg=32,underline
     37          ZSH_HIGHLIGHT_STYLES[arg0]=fg=32 # 26
     38          ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=38'
     39          ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=38'
     40          ZSH_HIGHLIGHT_STYLES[default]='fg=38'
     41          ZSH_HIGHLIGHT_STYLES[single-quoted-argument-unclosed]='fg=red'
     42          ZSH_HIGHLIGHT_STYLES[double-quoted-argument-unclosed]='fg=red'
     43  fi
     44#+END_SRC
     45*Functions*
     46#+BEGIN_SRC sh
     47  # $HOME/.zsh.local
     48  # wordnet
     49  wn() { while true; do dict -d wn $(read -e); done }
     50  # memory usage
     51  memu() {
     52          local CHECK=" $@"
     53          [ -z $1 ] || [ "${CHECK#* -}" != "$CHECK" ] && { echo "Usage: memu program [program...]"; return 1; }
     54          local PIDS=$(pidof "$@")
     55          test -z "$PIDS" && return 0
     56          echo "$PIDS" \
     57                  | xargs -I{} ps -p "{}" -o size,vsize,rss,cmd \
     58                  | awk 'NR==1; NR>1 {print $1"K", $2"Ki", $3"K", $4}' \
     59                  | numfmt --header --field 1,3 --from=si --to=si --suffix=B --format %.1f \
     60                  | numfmt --header --field 2 --from=iec-i --to=iec-i --suffix=B --format %.1f \
     61                  | sort -hk3,3 \
     62                  | column -t -R1,2,3 \
     63                  | GREP_COLORS='mt=1;94' egrep --color=always '.*SIZE.*VSZ.*RSS.*CMD.*|$' \
     64                  | GREP_COLORS='mt=1;32' egrep --color=always "KB|KiB|$" \
     65                  | GREP_COLORS='mt=0;33' egrep --color=always 'MB|MiB|$' \
     66                  | GREP_COLORS='mt=1;31' egrep --color=always "GB|GiB|$"
     67  }
     68#+END_SRC
     69*Environment variables*
     70#+BEGIN_SRC sh
     71  # $HOME/.zshenv
     72  # http://zsh.sourceforge.net/Guide/zshguide02.html#l24
     73  typeset -U path
     74  path=(~/.local/bin $path)
     75  SRC_GITHUB="$HOME/.local/src/github"
     76  PROXYCHAINS_QUIET_MODE=1
     77  CLICOLOR_FORCE=1
     78  export GPG_TTY=$(tty)
     79#+END_SRC
     80** Xorg
     81:PROPERTIES:
     82:CUSTOM_ID: desktop_xorg
     83:END:
     84- xorg-server
     85- xf86-input-libinput
     86- xf86-video-intel
     87- sx
     88- dwm
     89- slock
     90- st
     91
     92non-root Xorg
     93#+BEGIN_EXAMPLE
     94  # /etc/X11/Xwrapper.config
     95  needs_root_rights = no
     96#+END_EXAMPLE
     97*** Keyboard
     98:PROPERTIES:
     99:CUSTOM_ID: desktop_xorg_keyboard
    100:END:
    101Programmer Dvorak keyboard layout
    102#+BEGIN_EXAMPLE
    103  # /etc/X11/xorg.conf.d/00-keyboard.conf
    104  Section "InputClass"
    105          Identifier "Cherry GmbH G83 (RS 6000) Keyboard"
    106          MatchIsKeyboard "on"
    107          MatchUSBID "046a:0011"
    108          Driver "libinput"
    109          Option "XkbLayout" "us"
    110          Option "XkbModel" "pc104"
    111          Option "XkbVariant" "dvp"
    112  EndSection
    113#+END_EXAMPLE
    114*** Mouse
    115:PROPERTIES:
    116:CUSTOM_ID: desktop_xorg_mouse
    117:END:
    118Left-handed mouse
    119#+BEGIN_EXAMPLE
    120  # /etc/X11/xorg.conf.d/50-mouse.conf
    121  Section "InputClass"
    122          Identifier "Pixart Imaging, Inc. Optical Mouse"
    123          MatchIsPointer "yes"
    124          MatchUSBID "093a:2510"
    125          Driver "libinput"
    126          Option "ButtonMapping" "3 2 1"
    127  EndSection
    128#+END_EXAMPLE
    129*** Monitors
    130:PROPERTIES:
    131:CUSTOM_ID: desktop_xorg_monitors
    132:END:
    133Dual-monitor
    134#+BEGIN_EXAMPLE
    135  # /etc/X11/xorg.conf.d/10-monitor.conf
    136  Section "Monitor"
    137          Identifier	"VGA1"
    138          Option		"Primary" "true"
    139          Option		"PreferredMode" "1440x900"
    140          Option		"Position" "0 1020"
    141  EndSection
    142
    143  Section "Monitor"
    144          Identifier	"HDMI1"
    145          Option		"RightOf" "VGA1"
    146          Option		"PreferredMode" "1920x1080"
    147          Option		"Position" "1440 0"
    148          Option		"Rotate" "right"
    149          Option		"DPMS" "true"
    150          Option		"StandbyTime" "60"
    151          Option		"SuspendTime" "120"
    152          Option		"OffTime" "180"
    153  EndSection
    154#+END_EXAMPLE
    155
    156** Automatic Login
    157:PROPERTIES:
    158:CUSTOM_ID: desktop_automatic-login
    159:END:
    160~ln -s /etc/sv/agetty-autologin-tty1 /var/service/agetty-tty1~
    161
    162*/etc/sv/agetty-autologin-tty1/conf*
    163#+BEGIN_SRC sh
    164  if [ -x /sbin/agetty -o -x /bin/agetty ]; then
    165          # util-linux specific settings
    166          if [ "${tty}" = "tty1" ]; then
    167                  GETTY_ARGS="--autologin username --noclear"
    168          fi
    169  fi
    170
    171  BAUD_RATE=38400
    172  TERM_NAME=linux
    173#+END_SRC
    174
    175*$HOME/.zprofile*
    176#+BEGIN_SRC sh
    177  if [ -z "$DISPLAY" ] && [ "$(fgconsole)" -eq 1 ]; then
    178          sx ~/.config/sx/sxrc dwm
    179  fi
    180#+END_SRC