From ab56d0711471b7042d5a6c31a16d62bb2b0a2730 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 22 Nov 2021 10:15:27 +0100 Subject: [PATCH] Initial commit --- cat | 26 +++++++ fleckenstein.zsh-theme | 164 +++++++++++++++++++++++++++++++++++++++++ i3-config | 164 +++++++++++++++++++++++++++++++++++++++++ install.sh | 24 ++++++ kitty.conf | 27 +++++++ picom.conf | 3 + zshrc | 7 ++ 7 files changed, 415 insertions(+) create mode 100755 cat create mode 100644 fleckenstein.zsh-theme create mode 100644 i3-config create mode 100755 install.sh create mode 100644 kitty.conf create mode 100644 picom.conf create mode 100644 zshrc diff --git a/cat b/cat new file mode 100755 index 0000000..a783161 --- /dev/null +++ b/cat @@ -0,0 +1,26 @@ +#! /usr/bin/env lua +function string:ends_with(str) + return self:sub(#self - #str + 1, #self) == str +end + +local commands = { + ["batcat"] = {".c", ".cpp", ".h", ".hpp", ".lua", ".rb", ".java", ".xml", ".html", ".py", ".go", ".asm", ".php", ".rs", ".sh", ".diff", ".patch", ".js", ".css", "Makefile", ".basrc", ".bash_aliases", ".zshrc"}, + ["~/.local/kitty.app/bin/kitty +kitten icat"] = {".png", ".jpg", ".jpeg", ".gif", ".svg"}, + ["lolcat"] = {".txt"}, +} + +function get_command(file) + for cmd, endings in pairs(commands) do + for _, ending in pairs(endings) do + if file:ends_with(ending) then + return cmd + end + end + end + + return "/bin/cat" +end + +for _, file in ipairs(arg) do + os.execute(get_command(file) .. " \"" .. file .. "\"", "r") +end diff --git a/fleckenstein.zsh-theme b/fleckenstein.zsh-theme new file mode 100644 index 0000000..2d896a7 --- /dev/null +++ b/fleckenstein.zsh-theme @@ -0,0 +1,164 @@ +functions rbenv_prompt_info >& /dev/null || rbenv_prompt_info(){} + +if [[ "$USER_ALIAS" == "" ]]; then + USER_ALIAS=$USER +fi + +function theme_precmd { + local TERMWIDTH + (( TERMWIDTH = ${COLUMNS} - 1 )) + + + ### + # Truncate the path if it's too long. + + PR_FILLBAR="" + PR_PWDLEN="" + + if [[ "$USER_ALIAS" == "" ]]; then + USER_ALIAS=$USER + fi + + if [[ "USER_ALIAS_LENGTH" == "" ]]; then + USER_ALIAS_LENGTH=${#$USER_ALIAS} + fi + + local promptsize=${#${(%):-------[@%m:%l)---()--}} + local rubyprompt=`rvm_prompt_info || rbenv_prompt_info` + local rubypromptsize=${#${rubyprompt}} + local pwdsize=${#${(%):-%~}} + + if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then + ((PR_PWDLEN=$TERMWIDTH - $promptsize)) + else + PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $USER_ALIAS_LENGTH + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}" + fi + +} + + +setopt extended_glob +theme_preexec () { + if [[ "$TERM" == "screen" ]]; then + local CMD=${1[(wr)^(*=*|sudo|-*)]} + echo -n "\ek$CMD\e\\" + fi +} + + +setprompt () { + ### + # Need this so the prompt will work. + + setopt prompt_subst + + + ### + # See if we can use colors. + + autoload zsh/terminfo + for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do + eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' + eval PR_LIGHT_$color='%{$terminfo[bold]$fg[${(L)color}]%}' + (( count = $count + 1 )) + done + PR_NO_COLOUR="%{$terminfo[sgr0]%}" + + ### + # Modify Git prompt + ZSH_THEME_GIT_PROMPT_PREFIX=" $PR_YELLOW" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ⚡" + ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ⚒️" + ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} 🗑️ " + ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} 💱" + ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} 🗜️ " + ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} 🆕" + + ### + # See if we can use extended characters to look nicer. + # UTF-8 Fixed + + if [[ $(locale charmap) == "UTF-8" ]]; then + PR_SET_CHARSET="" + PR_SHIFT_IN="" + PR_SHIFT_OUT="" + PR_HBAR="─" + PR_ULCORNER="┌" + PR_LLCORNER="└" + PR_LRCORNER="┘" + PR_URCORNER="┐" + else + typeset -A altchar + set -A altchar ${(s..)terminfo[acsc]} + # Some stuff to help us draw nice lines + PR_SET_CHARSET="%{$terminfo[enacs]%}" + PR_SHIFT_IN="%{$terminfo[smacs]%}" + PR_SHIFT_OUT="%{$terminfo[rmacs]%}" + PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT' + PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT' + PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT' + PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT' + PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT' + fi + + + ### + # Decide if we need to set titlebar text. + + #case $TERM in + #xterm*) + # PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' + # ;; + #screen) + # PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' + # ;; + #*) + # PR_TITLEBAR='' + # ;; + #esac + + PR_TITLEBAR=$'%{\e]0;zsh\a%}' + + ### + # Decide whether to set a screen title + if [[ "$TERM" == "screen" ]]; then + PR_STITLE=$'%{\ekzsh\e\\%}' + else + PR_STITLE='' + fi + + ### + # Finally, the prompt. + + PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ +$PR_MAGENTA$PR_ULCORNER$PR_HBAR nya \ +$PR_YELLOW%$PR_PWDLEN<...<%~%<< \ +`rvm_prompt_info || rbenv_prompt_info`$PR_BLUE$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}─[\ +$PR_GREEN$USER_ALIAS$PR_BLUE@$PR_GREEN%m:%l\ +$PR_BLUE]$PR_BLUE$PR_HBAR$PR_URCORNER\ + +$PR_MAGENTA╰─%{$reset_color%}`git_prompt_info``git_prompt_status`\ +$PR_MAGENTA λ $PR_NO_COLOUR' + + # display exitcode on the right when >0 + return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + RPROMPT=' $return_code\ +$PR_BLUE [$PR_GREEN%D{%a %b %d %H:%M:%S}$PR_BLUE]$PR_HBAR$PR_BLUE$PR_LRCORNER$PR_NO_COLOUR' + + PS2='$PR_BLUE$PR_HBAR\ +$PR_BLUE$PR_HBAR(\ +$PR_LIGHT_GREEN%_$PR_BLUE)$PR_HBAR\ +$PR_CYAN$PR_HBAR$PR_NO_COLOUR ' +} + +setprompt + +autoload -U add-zsh-hook +add-zsh-hook precmd theme_precmd +add-zsh-hook preexec theme_preexec + +fortune | cowsay | lolcat -S 5 diff --git a/i3-config b/i3-config new file mode 100644 index 0000000..ca8c790 --- /dev/null +++ b/i3-config @@ -0,0 +1,164 @@ +set $mod Mod4 +floating_modifier $mod + +font pango:Ubuntu 11 + +# startup +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork +exec --no-startup-id nm-applet +exec_always --no-startup-id feh --bg-fill $HOME/wallpaper.png +exec_always --no-startup-id killall -qw picom; picom -b + +# audio keys +set $refresh_i3status killall -SIGUSR1 i3status +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status + +# applications +bindsym $mod+Return exec $HOME/.local/kitty.app/bin/kitty +bindsym $mod+Shift+f exec firefox +bindsym $mod+Shift+d exec discord +bindsym $mod+Shift+h exec hexchat +bindsym $mod+Shift+m exec element-desktop + +# kill focused window +bindsym $mod+Shift+q kill + +# start dmenu (a program launcher) +bindsym $mod+d exec dmenu_run + +# gaps +for_window [class=".*"] border pixel 0 +gaps inner 10 +gaps outer 0 +smart_borders on +smart_borders no_gaps + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + status_command i3status + height 25 + position top + output primary +} + +# split in horizontal orientation +bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# change focus +bindsym $mod+j focus left +bindsym $mod+k focus down +bindsym $mod+l focus up +bindsym $mod+odiaeresis focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+j move left +bindsym $mod+Shift+k move down +bindsym $mod+Shift+l move up +bindsym $mod+Shift+odiaeresis move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +# bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" + +bindsym $mod+r mode "resize" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym j resize shrink width 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym l resize shrink height 10 px or 10 ppt + bindsym odiaeresis resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..6c3cd0f --- /dev/null +++ b/install.sh @@ -0,0 +1,24 @@ +#! /bin/bash +sudo add-apt-repository -y ppa:regolith-linux/stable +sudo apt install -y i3-gaps feh picom batcat lolcat cowsay zsh lua git + +curl -L https://sw.kovidgoyal.net/kitty/installer.sh | bash +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + +mkdir -p ~/bin/ +cp cat ~/bin/ + +mkdir -p ~/.config/i3/ +cp i3-config ~/.config/i3/config + +mkdir -p ~/.config/kitty/ +cp kitty.conf ~/.config/kitty/kitty.conf + +mkdir -p ~/.config/ +cp picom.conf ~/.config/picom.conf + +mkdir -p ~/.oh-my-zsh/themes/ +cp fleckenstein.zsh-theme ~/.oh-my-zsh/themes/fleckenstein.zsh-theme + +mkdir -p ~/ +cp zshrc ~/.zshrc diff --git a/kitty.conf b/kitty.conf new file mode 100644 index 0000000..a4b4e4c --- /dev/null +++ b/kitty.conf @@ -0,0 +1,27 @@ +font_family Hack +font_size 12 +box_drawing_scale 1.75, 1.75, 1.75, 1.75 +remember_window_size no +initial_window_width 1100 +initial_window_height 650 +foreground #c3c7d1 +selection_foreground #161925 +background #161925 +selection_background #c3c7d1 +color0 #282c34 +color10 #282c34 +color1 #ed254e +color11 #ed254e +color2 #71f79f +color12 #71f79f +color3 #f9dc5c +color13 #f9dc5c +color4 #7cb7ff +color14 #7cb7ff +color5 #c74ded +color15 #c74ded +color6 #00c1e4 +color16 #00c1e4 +color7 #dcdfe4 +color17 #dcdfe4 +cursor #f9dc5c diff --git a/picom.conf b/picom.conf new file mode 100644 index 0000000..a14fe94 --- /dev/null +++ b/picom.conf @@ -0,0 +1,3 @@ +opacity-rule = [ + "80:class_g = 'kitty'" +]; diff --git a/zshrc b/zshrc new file mode 100644 index 0000000..1997424 --- /dev/null +++ b/zshrc @@ -0,0 +1,7 @@ +export ZSH="$HOME/.oh-my-zsh" +export PATH="$HOME/bin:$PATH" +ZSH_THEME="fleckenstein" +USER_ALIAS="ふれけんしたいん" +USER_ALIAS_LENGTH=16 +plugins=(git) +source $ZSH/oh-my-zsh.sh -- 2.44.0