Naposledy aktivní 1790232580

Indonesian date time, synth-shell, custom LS_COLORS with vivid

.bashrc Raw
1# ~/.bashrc: executed by bash(1) for non-login shells.
2# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
3# for examples
4
5# If not running interactively, don't do anything
6case $- in
7 *i*) ;;
8 *) return;;
9esac
10
11# don't put duplicate lines or lines starting with space in the history.
12# See bash(1) for more options
13HISTCONTROL=ignoreboth:erasedups
14
15# append to the history file, don't overwrite it
16shopt -s histappend cmdhist lithist
17
18# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
19HISTSIZE=100000
20HISTFILESIZE=500000
21
22# check the window size after each command and, if necessary,
23# update the values of LINES and COLUMNS.
24shopt -s checkwinsize
25
26# If set, the pattern "**" used in a pathname expansion context will
27# match all files and zero or more directories and subdirectories.
28#shopt -s globstar
29
30blue="\033[0;34m"
31nocolor="\033[0m"
32
33day=$(date +%A)
34case $day in
35 Monday)
36 hari="Senin"
37 ;;
38 Tuesday)
39 hari="Selasa"
40 ;;
41 Wednesday)
42 hari="Rabu"
43 ;;
44 Thursday)
45 hari="Kamis"
46 ;;
47 Friday)
48 hari="Jum'at"
49 ;;
50 Saturday)
51 hari="Sabtu"
52 ;;
53 Sunday)
54 hari="Ahad"
55 ;;
56 *)
57 hari="Tidak diketahui"
58 ;;
59esac
60
61month=$(date +%B)
62case $month in
63 January)
64 bulan="Januari"
65 ;;
66 February)
67 bulan="Februari"
68 ;;
69 March)
70 bulan="Maret"
71 ;;
72 April)
73 bulan="April"
74 ;;
75 May)
76 bulan="Mei"
77 ;;
78 June)
79 bulan="Juni"
80 ;;
81 July)
82 bulan="Juli"
83 ;;
84 August)
85 bulan="Agustus"
86 ;;
87 September)
88 bulan="September"
89 ;;
90 October)
91 bulan="Oktober"
92 ;;
93 November)
94 bulan="November"
95 ;;
96 December)
97 bulan="Desember"
98 ;;
99 *)
100 bulan="Tidak diketahui"
101 ;;
102esac
103
104#PS1='\[\e[38;5;160m\][\[\e[38;5;39m\]\D{%A, %d %B %Y}\[\e[0;1m\] - \[\e[38;5;184m\]\t\[\e[0;38;5;160m\]]\[\e[0m\]'
105
106#HISTTIMEFORMAT=`echo -e ${blue}[${hari}, %d ${bulan} %Y - %T] $nocolor `
107HISTTIMEFORMAT=`echo -e "\e[38;5;160m[\e[38;5;39m${hari}, %d ${bulan} %Y \e[0;1m - \e[38;5;184m %T\e[0;38;5;160m]\e[0m " `
108HISTIGNORE="ls:ll:pwd:bg:fg:history:tree"
109
110# make less more friendly for non-text input files, see lesspipe(1)
111#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
112
113# set variable identifying the chroot you work in (used in the prompt below)
114if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
115 debian_chroot=$(cat /etc/debian_chroot)
116fi
117
118# set a fancy prompt (non-color, unless we know we "want" color)
119case "$TERM" in
120 xterm-color|*-256color) color_prompt=yes;;
121esac
122
123# uncomment for a colored prompt, if the terminal has the capability; turned
124# off by default to not distract the user: the focus in a terminal window
125# should be on the output of commands, not on the prompt
126#force_color_prompt=yes
127
128if [ -n "$force_color_prompt" ]; then
129 if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
130 # We have color support; assume it's compliant with Ecma-48
131 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
132 # a case would tend to support setf rather than setaf.)
133 color_prompt=yes
134 else
135 color_prompt=
136 fi
137fi
138
139if [ "$color_prompt" = yes ]; then
140 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
141else
142 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
143fi
144unset color_prompt force_color_prompt
145
146# If this is an xterm set the title to user@host:dir
147case "$TERM" in
148xterm*|rxvt*)
149 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
150 ;;
151*)
152 ;;
153esac
154
155# enable color support of ls and also add handy aliases
156if [ -x /usr/bin/dircolors ]; then
157 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
158 alias ls='ls -lah --color=auto'
159 #alias dir='dir --color=auto'
160 #alias vdir='vdir --color=auto'
161
162 #alias grep='grep --color=auto'
163 #alias fgrep='fgrep --color=auto'
164 #alias egrep='egrep --color=auto'
165fi
166
167# colored GCC warnings and errors
168#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
169
170# some more ls aliases
171#alias ll='ls -l'
172#alias la='ls -A'
173#alias l='ls -CF'
174alias sudo="sudo "
175
176# Standard listing
177alias ls='ls -lah --color=auto'
178
179# Sort by modification time — newest first
180alias lssortdate='ls -lah --color=auto --time-style="+%B %d, %Y %H:%M" --sort=time'
181
182# Sort by modification time — oldest first
183alias lssortold='ls -lah --color=auto --time-style="+%B %d, %Y %H:%M" --sort=time --reverse'
184
185# Directory only
186alias lsdir='ls -lahd --color=auto */'
187
188# Tree with owner/group, human-readable size, and total size
189alias treeall='tree -ugsh --du'
190
191lssortsize() {
192 local cmd=()
193 local dir="."
194
195 if [[ "$1" == "-s" || "$1" == "--sudo" ]]; then
196 cmd=(sudo)
197 shift
198 fi
199
200 dir="${1:-.}"
201
202 "${cmd[@]}" du -sh --apparent-size -- "$dir"/* 2>/dev/null |
203 sort -hr
204}
205
206newest() {
207 local cmd=()
208 local dir="."
209
210 if [[ "$1" == "-s" || "$1" == "--sudo" ]]; then
211 cmd=(sudo)
212 shift
213 fi
214
215 dir="${1:-.}"
216
217 "${cmd[@]}" find "$dir" -type f \
218 -printf '%T@ %TY-%Tm-%Td %TH:%TM %s bytes %p\n' 2>/dev/null |
219 sort -nr |
220 cut -d' ' -f2-
221}
222
223# Alias definitions.
224# You may want to put all your additions into a separate file like
225# ~/.bash_aliases, instead of adding them here directly.
226# See /usr/share/doc/bash-doc/examples in the bash-doc package.
227
228if [ -f ~/.bash_aliases ]; then
229 . ~/.bash_aliases
230fi
231
232# enable programmable completion features (you don't need to enable
233# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
234# sources /etc/bash.bashrc).
235if ! shopt -oq posix; then
236 if [ -f /usr/share/bash-completion/bash_completion ]; then
237 . /usr/share/bash-completion/bash_completion
238 elif [ -f /etc/bash_completion ]; then
239 . /etc/bash_completion
240 fi
241fi
242
243##-----------------------------------------------------
244## synth-shell-prompt.sh
245[ -f /etc/shell-prompt.sh ] && source /etc/shell-prompt.sh
246
247#export LS_COLORS="$(vivid generate snazzy)"
248
249##---------------------------------------------------------
250## change LS_COLORS with random theme generated by vivid
251##---------------------------------------------------------
252
253# Define the list of items
254themes=("alabaster_dark" "ayu" "catppuccin-frappe" "catppuccin-latte" "dracula" "iceberg-dark" "jellybeans" "lava" "molokai" "nord" "one-dark" "one-light" "rose-pine" "rose-pine-dawn" "snazzy" "solarized-dark" "tokyonight-moon" "zenburn")
255
256# Get the current date in YYYYMMDD format
257current_date=$(date +%Y%m%d)
258
259# Use the date as a seed for the random number generator
260RANDOM=$current_date
261
262# Get a random index based on the number of items
263random_index=$((RANDOM % ${#themes[@]}))
264theme_now=${themes[$random_index]}
265
266export LS_COLORS="$(vivid generate $theme_now)"
267
268
269##---------------------------------------------------------
270## Fastfetch
271##---------------------------------------------------------
272
273fastfetch --config /etc/fastfetch/config.jsonc
274