Ubuntu20.04 个人配置和i3美化

Ubuntu20.04 个人配置和i3美化

本文是基于个人习惯和审美,快速配置一个新ubuntu的步骤。脚本在资源里给出,但仍有部分配置文件需在脚本执行后手动修改,文中已用红色字体标出

更新apt源

  1. 备份原来的源
  2. 更换阿里源
# 备份
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
# 阿里源
sudo echo "deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
" > /etc/apt/sources.list

更新apt

sudo apt update
sudo apt upgrade -y

这个时间比较长

安装vim

sudo apt install -y vim

安装mysql8.0

sudo apt install -y mysql-client-8.0

安装jdk8

sudo apt install -y openjdk-8-jdk

安装git

sudo apt install -y git

安装python3,python

sudo apt install -y python3
sudo apt install -y python

安装typora

sudo snap install typora

安装搜狗输入法

访问搜狗输入法 for linux并下载自己需要的版本(一般都是X86-64)

下载完成后得到一个deb包,双击他安装或者按如下命令安装(deb包名字可能不一样)

cd ~/Downloads/
sudo dpkg -i sogoupinyin_2.1.0.0082_amd64.deb

安装网页的提示操作即可

安装VSCode

sudo snap install code --classics

终端美化-安装zsh,oh-my-zsh

sudo apt install -y zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
chsh -s /bin/zsh
cd ~/.oh-my-zsh/plugins/
git clone https://github.com/zsh-users/zsh-autosuggestions
git clone https://github.com/wting/autojump.git ~/.oh-my-zsh/plugins/autojump
cd autojump
./install.py

autojump使用:在终端输入 j a,或者jump a,会自动进入与a最匹配的你最可能想要进的最近进入过的目录

zsh-autosuggestions使用:在终端输入命令时,可以看到灰色的自动补全语句,按up down键可切换,,键可直接自动补全

需手动修改配置文件,打开~/.zshrc,找到ZSH_THEME="robbyrussell",修改为ZSH_THEME="ys"

找到plugins,修改为

plugins=(
  git
  zsh-autosuggestions
  autojump
  extract
  vi-mode
  wd
)

在末尾加上[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

或者可以直接把下面我的.zshrc内容来替换你的.zshrc,内容有多但没有错

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

export PATH=$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# 主题
#ZSH_THEME="agnoster"
ZSH_THEME="ys"
#ZSH_THEME="random" # (...please let it be pie... please be some pie..)

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
#DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
  rake
  ruby
  bundler
  extract
  web-search
  vi-mode
  wd
  zsh-autosuggestions
  catimg
)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
 alias ohmyzsh="mate ~/.oh-my-zsh"
 alias cls='clear'
 alias zshrc="vim ~/.zshrc"
 alias vi='gvim'
 alias ff='firefox'
 alias -s txt=vi
 alias -s cpp=vi
 alias -s pdf=evince
 alias -s md=typora
 alias -s c=vi
 alias -s gz='tar -xzvf'
 alias -s tgz='tar -xzvf'
 alias -s zip='unzip'
 alias -s bz2='tar -xjvf'
 alias -s h
 alias fy='sdcv -u 朗道英汉字典5.0'
 alias Fy='sdcv -u 朗道汉英字典5.0'
 alias unrar="rar"
 bindkey ',' autosuggest-accept
 # 后台运行程序 : nohup a.sh &
 #hash
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

GTK_MODULES=unity-gtk-module

美化-安装终端仿真器tilix

下面那条命令用来替换默认终端

sudo apt install -y tilix
gsettings set org.gnome.desktop.default-applications.terminal exec 'tilix'

需手动配置

打开tilix后右键上面的那一栏找到preference,在appearance里找到Theme variant,设置为dark,同在这里找到Window style,设置为Disable CSD,hide toolbar

快速打开软件-rofi

sudo apt install -y rofi

终端中使用:rofi -show run

图片查看feh

sudo apt install -y feh

使用以下命令可以设置随机桌面图片

feh --randomize --bg-fill ~/picture # 后面为你放图片的路径,每运行一次随机替换一次

安装i3wm

sudo apt install -y i3
sudo apt install -y i3lock
sudo add-apt-repository ppa:regolith-linux/stable
sudo apt-get update
sudo apt-get install i3-gaps

重启后在登录前的右下角选择i3,进入后一路enter键,之后请找网络资源进行学习使用和配置,学好后可以不使用鼠标。

配置文件在~/.config/i3/config,以下为我的config

# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!

set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8

# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8

# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

bindsym $mod+Alt+l exec i3lock-fancy

# start a terminal
bindsym $mod+Return exec tilix

# kill focused window
bindsym $mod+Shift+q kill

# start dmenu (a program launcher)
bindsym $mod+d exec "rofi -show run"
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l 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+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l 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

# split in horizontal orientation
bindsym $mod+b 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

# focus the child container
#bindsym $mod+d focus child

# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

# 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'"

# 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 h resize shrink width 10 px or 10 ppt
        bindsym j resize grow height 10 px or 10 ppt
        bindsym k resize shrink height 10 px or 10 ppt
        bindsym l 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
        bindsym Return mode "default"
        bindsym Escape mode "default"
}

bindsym $mod+r mode "resize"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
#bar {
        #status_command i3status
#}
exec --no-startup-id compton -b
exec --no-startup-id feh --randomize --bg-scale ~/Pictures/

#********************************************i3-gaps*********************************
for_window [class="^.*"] border pixel 0
gaps inner 8
gaps outer 6
set $mode_gaps Gaps: (o) outer, (i) inner
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+Shift+g mode "$mode_gaps"

mode "$mode_gaps" {
        bindsym o      mode "$mode_gaps_outer"
        bindsym i      mode "$mode_gaps_inner"
        bindsym Return mode "default"
        bindsym Escape mode "default"
}

mode "$mode_gaps_inner" {
        bindsym plus  gaps inner current plus 5
        bindsym minus gaps inner current minus 5
        bindsym 0     gaps inner current set 0

        bindsym Shift+plus  gaps inner all plus 5
        bindsym Shift+minus gaps inner all minus 5
        bindsym Shift+0     gaps inner all set 0

        bindsym Return mode "default"
        bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
        bindsym plus  gaps outer current plus 5
        bindsym minus gaps outer current minus 5
        bindsym 0     gaps outer current set 0

        bindsym Shift+plus  gaps outer all plus 5
        bindsym Shift+minus gaps outer all minus 5
        bindsym Shift+0     gaps outer all set 0

        bindsym Return mode "default"
        bindsym Escape mode "default"
}

【可选】安装keynav

sudo apt install -y keynav

设置快捷键后可用来通过键盘使用鼠标操作,在启动keynav后,使用c+;激活,移动方法同VIM

以下为.keynavrc,可不进行配置,使用默认的即可

clear
ctrl+semicolon start
Escape end
ctrl+bracketleft end
w warp
space warp,click 1,end
Return warp,click 1,end
semicolon warp,end

q record ~/.keynav_macros
shift+at playback
a history-back
t windowzoom
c cursorzoom 300 300

1 warp,click 1
2 warp,click 2
3 warp,click 3
4 warp,click 4
5 warp,click 5
6 warp,click 6
7 warp,click 7

h cut-left
j cut-down
k cut-up
l cut-right
y cut-left,cut-up
u cut-right,cut-up
b cut-left,cut-down
n cut-right,cut-down

ctrl+h move-left
ctrl+j move-down
ctrl+k move-up
ctrl+l move-right
ctrl+y move-left,move-up
ctrl+u move-right,move-up
ctrl+b move-left,move-down
ctrl+n move-right,move-down

shift+h move-left
shift+j move-down
shift+k move-up
shift+l move-right
shift+y move-left,move-up
shift+u move-right,move-up
shift+b move-left,move-down
shift+n move-right,move-down

i warp,click 5
o warp,click 4

d drag 1
shift+d drag 1 ctrl+shift

大功告成!

ppO8vU1.md.png

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/10151.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

基于Pytorch的可视化工具

深度学习网络通常具有很深的层次结构,而且层与层之间通常会有并联、串联等连接方式。当使用PyTorch建立一个深度学习网络并输出文本向读者展示网络的连接方式是非常低效的,所以需要有效的工具将建立的深度学习网络结构有层次化的展示,这就需要…

RK3399平台开发系列讲解(基础篇)Linux 传统间隔定时器

🚀返回专栏总目录 文章目录 一、设置间隔定时器 setitimer()二、查询定时器状态 getitimer()三、更简单的定时接口 alarm()四、传统定时器的应用4.1、为阻塞操作设置超时4.2、性能剖析五、传统定时器的局限性沉淀、分享、成长,让自己和他人都能有所收获!😄 📢本篇将详细…

【Vue】el与data的两种写法

data与el的2种写法 el有两种写法 new Vue时配置el属性。先创建Vue实例。随后再通过vm.$mount(‘root’)指定el的值。 data有2种写法 对象式: data:{}函数式: data(){ return {}} 如何选择:目前哪种写法都可以,以后学习到组件时,data必须使…

ERP软件的作用

ERP软件的运用是在企业管理系统的数据基础上实现的,它的应用涉及到企业的各个部门。ERP软件是在制造资源计划的基础上进一步发展而成的对企业供应链的管理软件。ERP是集采购、销售和库存、财务、生产管理和委托加工为一体的企业管理软件。它是集企业管理理念、业务流…

快速排序详解

一、定义 快速排序(英语:Quicksort),又称分区交换排序(英语:partition-exchange sort),简称「快排」,是一种被广泛运用的排序算法。 二、基本原理 快速排序是一个基于 分…

PostgreSQL下载、安装、Problem running post-install step的解决、连接PostgreSQL

我是参考《SQL基础教程》来安装的,关于书的介绍、配套视频、相关代码可以参照下面的链接: SQL基础教程(第2版) (ituring.com.cn) 一、下载 我直接打开书中的下载链接时,显示的是这个界面: You are not …

二维(三维)坐标系中旋转矩阵

求三维坐标系的旋转矩阵通常需要求分别沿3个坐标轴的二维坐标系下的旋转矩阵,二维坐标系下的旋转矩阵的推导过程通常以某一点逆时针旋转θ\thetaθ角度进行推理。以下将通过此例来详细讲解二维坐标系下的旋转矩阵推导过程,并进一步给出其他方式的旋转矩阵…

Surfshark下载到使用完整教程|2023最新

2023年3月16日更新 在正式介绍surfshark的教程( 教程直达学习地址: qptool.net/shark.html )之前,我们可以来看看最近surfshark的服务与产品退化到什么程度了。我曾经是Surshark两年的忠实用户,但是,现在,作为一个负责人的测评&a…

文件操作File类,OutputStream、InputStream、Reader、Writer的用法

文章目录File 类OutputStream、InputStreamInputStreamOutputStreamReader、WriterReaderWriter注意事项简单模拟实战File 类 Java标准库中提供的File类是对硬盘上的文件的抽象,每一个File对象代表了一个文件,因为文件在硬盘上存储,而直接操…

网络编程三要素

网络编程三要素 IP、端口号、协议 三要素分别代表什么 ip:设备在网络中的地址,是唯一的标识 端口号:应用程序在设备中的唯一标识 协议:数据在网络中传输的规则 常见的协议有UDP、TCP、http、https、ftp ip:IPv4和…

Java通过继承的方法来实现长方形的面积和体积

目录 前言 一、测试.java类 1.1运行流程(思想) 1.2代码段 二、Changfangxing.java类 1.1运行流程(思想) 1.2代码段 三、Jxing.java类 1.1运行流程(思想) 1.2代码段 1.3运行截图 前言 1.若有选择…

五、Locust之HTTP用户类

HttpUser是最常用的用户。它增加了一个客户端属性,用来进行HTTP请求。 from locust import HttpUser, task, betweenclass MyUser(HttpUser):wait_time between(5, 15)task(4)def index(self):self.client.get("/")task(1)def about(self):self.client.…

Java避免死锁的几个常见方法(有测试代码和分析过程)

目录 Java避免死锁的几个常见方法 死锁产生的条件 上死锁代码 然后 :jstack 14320 >> jstack.text Java避免死锁的几个常见方法 Java避免死锁的几个常见方法 避免一个线程同时获取多个锁。避免一个线程在锁内同时占用多个资源,尽量保证每个锁…

DMDSC问题测试

问题一:手动停止两节点,单独启动节点二测试 集群停库前状态,登录监视器查看 dmcssm INI_PATHdmcssm.ini show 节点一: [dmdbalocalhost ~]$ DmServiceDMSERVER stop Stopping DmServiceDMSERVER: …

亚马逊 CodeWhisperer: 个人免费的类似GitHubCopilot能代码补全的 AI 编程助手

1、官网 AI Code Generator - Amazon CodeWhisperer - AWS 官方扩展安装教程 2、安装VSCode 下载安装VSCode 3、VSCode安装CodeWhisperer插件 安装VSCode插件 - AWS Toolkit主侧栏,点击AWS ,展开CodeWhisperer,点击Start 在下拉菜单中点…

SAR ADC系列24:冗余设计

目录 冗余(Redundancy) 比较器出错:原因 比较器出错:后果 引入冗余:纠错 冗余:容错量 冗余:非二进制CDAC --sub二进制 冗余:提速 另一种冗余设计方法: 下面的关…

【Homebrew】MacBook的第二个AppStore

英文官网:Homebrew — The Missing Package Manager for macOS (or Linux) 中文官网:macOS(或 Linux)缺失的软件包的管理器 — Homebrew 1 简介 Homebrew 由开发者 Max Howell 开发,并基于 BSD 开源,是一…

Java虚拟机内存区域

Java虚拟机所管理的内存将会包括以下几个运行时数据区域 程序计数器 是一块较小的内存空间,可以看作当前线程所执行的字节码的行号指示器。分支、循环、跳转、异常处理、线程恢复等基础功能都需要通过更改这个计数器的值来改变下一条需要执行的字节码。 由于各个线…

如虎添翼,强大插件让ChatGPT更加游刃有余

ChatGPT模型是当前人工智能领域中备受瞩目的存在。作为一款强大的自然语言处理模型,它具备跨时代的意义,将深刻影响我们的未来。而强大的插件不仅可以丰富ChatGPT的功能,提高其应对复杂问题的能力。还也可以解决一些常见的错误,如…

rust的并发以及kv server网络处理和网络安全部分

理解并发和并行 Golang 的创始人之一,对此有很精辟很直观的解释:并发是一种同时处理很多事情的能力,并行是一种同时执行很多事情的手段。 我们把要做的事情放在多个线程中,或者多个异步任务中处理,这是并发的能力。在多…