gentoo intel 安装桌面
使用 intel 的集成显卡,用于显示驱动。
首先增加 vim ~/.xinitrc
[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources
# dbus before fcitx
eval `dbus-launch --sh-syntax --exit-with-session`
# use gtk and qt
#export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
# not use gtk and qt
export GTK_IM_MODULE=xim
#export QT_IM_MODULE=xim
#export XMODIFIERS=@im=fcitx
exec i3
然后 查找 i5 480m 属于 gen5, 所以在 make.conf 中增加 VIDEO_CARDS="intel i965", 增加 USE="glamor"
然后 vim /etc/X11/xorg.conf.d/20-modesetting.conf
Section "Device"
Identifier "Intel Graphics"
Driver "modesetting"
Option "AccelMethod" "glamor"
Option "DRI" "3"
EndSection
增加用户到用户组: gpasswd -a ptz video
然后 vim /etc/X11/xorg.conf.d/modesetting.conf
Section "Device"
Identifier "modesetting"
Driver "modesetting"
EndSection
HTML5/VAAPI GPU hangs
Device Drivers --->
[*] IOMMU Hardware Support --->
[*] Support for Intel IOMMU using DMA Remapping Devices
[*] Enable Intel DMA Remapping Devices by default
安装 i3, dmenu, i3status, i3lock, uxvt-unicode, 设置 uxvt-unicode 的 USE=“x11-terms/rxvt-unicode 256-color perl wcwidth xft -vanilla”, google-chrome.
vim ~/.Xresources
! Using XLFD
! URxvt*font: monospace:size=8
! Using Xft
!URxvt*font: xft:wqy-microhei:size=10 monospace:size=8
!URxvt*font: xft:wqy-microhei:size=10
!URxvt*font: xft:Dejavu sans mono:size=10
!URxvt*font: xft:Inconsolata:size=12
!URxvt*font: xft:Inconsolata:size=12:style=Regular:antialias=true, xft:wqy-microhei:size=10:style=Regular:antialias=true
URxvt*font: xft:Inconsolata:size=12:style=Regular:antialias=true, xft:wqy-bitmapsong:size=10:style=Regular:antialias=true
!URxvt*font: xft:Inconsolata:size=12:style=Regular:antialias=true
!URxvt*boldfont: xft:Inconsolata:size=12:style=Bold:antialias=true, xft:wqy-microhei:size=10:style=Bold:antialias=true
URxvt*boldfont: xft:Inconsolata:size=12:style=Bold:antialias=true, xft:wqy-bitmapsong:size=10:style=Bold:antialias=true
Xft.dpi: 96
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
Xft.autohint: false
Xft.lcdfilter: lcddefault
URxvt.scrollBar:true
URxvt.scrollBar_right:true
URxvt.scrollBar_floating:false
URxvt.scrollstyle:rxvt
! input method
URxvt.inputMethod:fcitx
!-*- Perl extensions -*-
URxvt.perl-ext-common: default,selection-to-clipboard,pasta,matcher,keyboard-select
URxvt.keysym.M-u: perl:url-select:select_next
URxvt.url-launcher: /usr/bin/google-chrome-stable
URxvt.underlineURLs: True
URxvt.matcher.button: 1
URxvt.keysym.M-Escape:perl:keyboard-select:activate
URxvt.keysym.Control-Shift-V: perl:pasta:paste
! Comment this if you dont want copy when text is selected
URxvt.clipboard.autocopy: true
! Colors
URxvt*background: #000000
URxvt*foreground: #B2B2B2
! black
URxvt*color0: #000000
URxvt*color8: #686868
! red
URxvt*color1: #B21818
URxvt*color9: #FF5454
! green
URxvt*color2: #18B218
URxvt*color10: #54FF54
! yellow
URxvt*color3: #B26818
URxvt*color11: #FFFF54
! blue
URxvt*color4: #1818B2
URxvt*color12: #5454FF
! purple
URxvt*color5: #B218B2
URxvt*color13: #FF54FF
! cyan
URxvt*color6: #18B2B2
URxvt*color14: #54FFFF
! white
URxvt*color7: #B2B2B2
URxvt*color15: #FFFFFF
vim ~/.config/i3/config
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
#
# This config file uses keycodes (bindsym) and was written for the QWERTY
# layout.
#
# To get a config file with the same key positions, but for your current
# layout, use the i3-config-wizard
#
# 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
font pango:wqy-microhei 10
font pango:fontawesome 10
# mod
set $Mod Mod4
# mode
bindsym $Mod+o mode "$mode_launcher"
mode "$mode_launcher" {
bindsym b mode "$mode_browser_launcher"
bindsym e mode "$mode_edit_launcher"
bindsym i mode "$mode_ide_launcher"
bindsym r mode "$mode_read_launcher"
bindsym n mode "$mode_net_launcher"
bindsym f mode "$mode_finance_launcher"
bindsym v mode "$mode_virtual_launcher"
bindsym Escape mode "default"
bindsym Return mode "default"
}
mode "$mode_browser_launcher" {
bindsym c exec google-chrome-stable
bindsym Escape mode "default"
bindsym Return mode "default"
}
mode "$mode_input_launcher" {
bindsym f exec fcitx
bindsym Escape mode "default"
bindsym Return mode "default"
}
mode "$mode_edit_launcher" {
bindsym e exec emacs
bindsym g exec gvim
bindsym l exec libreoffice
bindsym Escape mode "default"
bindsym Return mode "default"
}
mode "$mode_ide_launcher" {
bindsym e exec eclipse-cpp
bindsym q exec qtcreator
bindsym t exec true_studio
bindsym Escape mode "default"
bindsym Return mode "default"
}
mode "$mode_read_launcher" {
bindsym z exec zathura
bindsym Escape mode "default"
bindsym Return mode "default"
}
mode "$mode_net_launcher" {
bindsym i mode "$mode_im_launcher"
bindsym Escape mode "default"
bindsym Return mode "default"
}
mode "$mode_im_launcher" {
bindsym p exec pidgin
bindsym Escape mode "default"
bindsym Return mode "default"
}
mode "$mode_finance_launcher" {
bindsym g exec gnucash
bindsym Escape mode "default"
bindsym Return mode "default"
}
mode "$mode_virtual_launcher" {
bindsym v exec sudo virt-manager
bindsym b exec sudo VirtualBox
bindsym Escape mode "default"
bindsym Return mode "default"
}
# compton
# work with i3 start
exec_always --no-startup-id compton -b
#exec --no-startup-id compton -b
# urxvt daemon
exec_always --no-startup-id urxvtd --quiet --opendisplay --fork
#exec --no-startup-id urxvtd --quiet --opendisplay --fork
# 0-100
bindsym $Mod+Return exec urxvtc -sh 50
#bindsym $Mod+Return exec urxvt
# picture
exec_always --no-startup-id feh --bg-scale "/home/ptz/picture/shortcut_key/emacs_scrot_1.png"
# input
exec_always --no-startup-id fcitx -r
# 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 these keys for focus, movement, and resize directions when reaching for
# the arrows is not convenient
set $up l
set $down k
set $left j
set $right semicolon
#set $up k
#set $down j
#set $left h
#set $right l
# use Mouse+$Mod to drag floating windows to their wanted position
floating_modifier $Mod
# start a terminal
#bindsym $Mod+Return exec i3-sensible-terminal
#bindsym $Mod+Return exec urxvt
# kill focused window
bindsym $Mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $Mod+d exec dmenu_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+$left focus left
bindsym $Mod+$down focus down
bindsym $Mod+$up focus up
bindsym $Mod+$right 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+$left move left
bindsym $Mod+Shift+$down move down
bindsym $Mod+Shift+$up move up
bindsym $Mod+Shift+$right 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+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
# focus the child container
#bindsym $Mod+d focus child
# move the currently focused window to the scratchpad
bindsym $Mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $Mod+minus scratchpad show
# 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 $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
# 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
}
#######################################################################
# automatically start i3-config-wizard to offer the user to create a
# keysym-based config which used their favorite modifier (alt or windows)
#
# i3-config-wizard will not launch if there already is a config file
# in ~/.i3/config.
#
# Please remove the following exec line:
#######################################################################
exec i3-config-wizard
cp /etc/i3status.conf ~/.config/i3status/config 增加 CPU 温度显示 vim ~/.config/i3status/config
order += "cpu_temperature 0"
cpu_temperature 0 {
format = "T: %degrees °C"
max_threshold = 65
path = "/sys/devices/platform/coretemp.0/temp1_input"
}
vim ~/.bashrc
# /etc/skel/.bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# Put your fun stuff here.
export PATH="/home/ptz/bin:/home/ptz/opt/gcc-arm-none-eabi/bin:${PATH}"
#export PATH="/home/ptz/bin:${PATH}"
export jlink_path="/home/ptz/opt/JLink_Linux"
export LANG="en_US.UTF-8"
#export LANG="zh_CN.UTF-8"
export LC_CTYPE="zh_CN.UTF-8"
alias rm='rm -i'
alias cp='cp -i'
HISTFILESIZE=2000
HISTSIZE=2000
HISTTIMEFORMAT='%F %T '
export HISTTIMEFORMAT
# Users that want bash completion with sudo need to run this once.
complete -cf sudo
exec zsh
vim /etc/locale.gen
# /etc/locale.gen: list all of the locales you want to have on your system.
# See the locale.gen(5) man page for more details.
#
# The format of each line:
# <locale name> <charset>
#
# Where <locale name> starts with a name as found in /usr/share/i18n/locales/.
# It must be unique in the file as it is used as the key to locale variables.
# For non-default encodings, the <charset> is typically appended.
#
# Where <charset> is a charset located in /usr/share/i18n/charmaps/ (sans any
# suffix like ".gz").
#
# All blank lines and lines starting with # are ignored.
#
# For the default list of supported combinations, see the file:
# /usr/share/i18n/SUPPORTED
#
# Whenever glibc is emerged, the locales listed here will be automatically
# rebuilt for you. After updating this file, you can simply run `locale-gen`
# yourself instead of re-emerging glibc.
en_US ISO-8859-1
en_US.UTF-8 UTF-8
#ja_JP.EUC-JP EUC-JP
#ja_JP.UTF-8 UTF-8
#ja_JP EUC-JP
#en_HK ISO-8859-1
#en_PH ISO-8859-1
#de_DE ISO-8859-1
#de_DE@euro ISO-8859-15
#es_MX ISO-8859-1
#fa_IR UTF-8
#fr_FR ISO-8859-1
#fr_FR@euro ISO-8859-15
#it_IT ISO-8859-1
zh_CN GB18030
zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN.GB2312 GB2312
locale-gen 生成语言相关文件.
vim ~/.zshrc
#!/bin/zsh
# https://wiki.gentoo.org/wiki/Zsh/Guide
# Completion
autoload -U compinit
compinit
# improve default completion
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
# Correction
setopt correctall
# Prompt
autoload -U promptinit
promptinit
prompt gentoo
#export PS1="[%* - %D] %n@%M@%l %d %% "
# History
# include command history support
export HISTSIZE=2000
export HISTFILE="$HOME/.history"
# History won't be saved without the following command:
export SAVEHIST=$HISTSIZE
# To prevent history from recording duplicated entries
setopt hist_ignore_all_dups
# A useful trick to prevent particular entries from being recorded into a history by preceding them with at least one space.
setopt hist_ignore_space
# The autocd option can be set to avoid tedious typing of cd command while changing current directory (for example /etc instead of cd /etc).
setopt autocd
# If standard bash-like globbing does not satisfy, extendedglob option may be set to enable extended globbing (one similar to regular expressions).
setopt extendedglob
# https://wiki.gentoo.org/wiki/Zsh
# Enabling Portage completions and Gentoo prompt for zsh
zstyle ':completion::complete:*' use-cache 1
autoload -U colors && colors
alias rm='rm -i'
alias cp='cp -i'
# https://www.cnblogs.com/bamanzi/p/colorful-shell.html
alias ls='ls --color=auto'
alias grep='grep --color=auto'
# sudo complete
zstyle ':completion:*:sudo:*' environ PATH="$SUDO_PATH:$PATH"
为了安装 samba 和 nfs,修改内核
File Systems --->
[*] Network File Systems --->
[*] CIFS support (advanced network filesystem, SMBFS successor)--->
[*] CIFS Statistics
[*] Extended Statistics
[*] CIFS Extended Attributes
[*] CIFS POSIX Extentions
[*] SMB2 and SMB3 network file system support
File systems --->
[*] Dnotify support
[*] Network File Systems --->
<*> NFS client support
<*> NFS client support for NFS version 3
<*> NFS client support for NFS version 4
[*] NFS client support for NFSv4.1
<*> NFS server support
[*] NFS server support for NFS version 3
[*] NFS server support for NFS version 4
[*] NFSv4.1 server support for Parallel NFS (pNFS)
然后安装 nfs-utils, samba,vsftpd。 使用 mount.cifs 来挂载共享盘。
安装字体文件 wqy-bitmapfont, wqy-zenhei, wqy-unibit, wqy-microhei, Inconsolata
然后安装 fcitx, fcitx-sunpinyin, fcitx-configtool, 注意 dbus 的USE 中需要增加 "X"。双拼的时候可以选择使用紫光的双拼方案。
配置声卡: 使用启动盘中的 lsmod,查看 hda 相关的选项,然后在内核中开启这些选项。然后安装emerge --ask media-sound/alsa-utils,使用 aplay -L 查看声卡对应的名称 和数字编号。 vim ~/.asoundrc
defaults.pcm.!card Generic
defaults.pcm.!device 0
defaults.pcm.!ctl Generic
然后使用 speaker-test 测试一下有没有声音,使用 alsamixer 来调节音量, gpasswd -a ptz audio,加入声音组,rc-update add alsasound boot,加入启动组。
然后双硬盘启动: 主硬盘 gentoo,副盘 win7,安装 os-prober,然后挂载 /boot,grub-mkconfig -o /boot/grub/grub.cfg, grub 可以通过 os-prober,找到 win7,并加入到 grub.cfg中。 这样启动时候就可以选择 win7了。
安装虚拟机 virtualbox, emerge --ask app-emulation/virtualbox-bin, 因为准备跑 win 的虚拟机, 所以 emerge --ask usermode-utilities, bridge-utils。新建一个脚本,里面写入 modprobe vboxdrv modprobe vboxnetadp modprobe vboxnetflt modprobe vboxpci 需要使用 vbox 的时候, 就先调用这个脚本,加载模块。 然后 VirtualBox 就可以开启虚拟机了。
安装 wps-office, 注意:需要相应的字体文件, http://blog.chinaunix.net/uid-11009175-id-3775053.html 这里可以下载字体文件,下载好了以后解压后, 把字体文件放入 /usr/share/fonts/wps-office, 然后重启 wps-office 即可。
安装 feh,注意 feh 的图片格式由 imlib2 来提供,默认支持的图片格式非常少,jpg都不支持,所以需要把 imlib2 对应的 jpg, png 等图片格式的 USE 都打开。
emacs, pcmanfm, mplayer, calibre, moc, sudo
安装 truestudio, 需要安装 webkit-gtk作为信息中心的依赖。 jlink,
因为 eclipse 在 i3wm 中使用的时候, 编辑区会一直闪烁, 所以转成 openbox 使用环境. emerge --ask x11-wm/openbox cp /etc/xdg/openbox/* ~/.config/openbox/ ~/.xinitrc 中把 i3 改为 openbox-session
安装 obmenu-generator, 使用obmenu-generator -s ,obmenu-generator -p 生成 右键菜单。 使用 truestudio 的时候, 提示没有 ncurses 的库,做个软链接即可, 提示没有 tinfo 的库,这个需要开启 ncurses 的 tinfo 的选项。