Advertisement
javidocente

CONVIERTE TU LINUX EN UN ENTORNO PROFESIONAL DE TRABAJO (2021)

Jul 27th, 2022 (edited)
83
2
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## Creditos a s4vitar --> https://www.youtube.com/watch?v=mHLwfI1nHHY
  2. 1. Instalamos los siguientes paquetes:
  3.  
  4. apt install build-essential git vim xcb libxcb-util0-dev libxcb-ewmh-dev libxcb-randr0-dev libxcb-icccm4-dev libxcb-keysyms1-dev libxcb-xinerama0-dev libasound2-dev libxcb-xtest0-dev libxcb-shape0-dev
  5.  
  6. 2. Instalamos bspwm y sxhkd:
  7.  
  8. cd /home/s4vitar/Descargas/
  9. git clone https://github.com/baskerville/bspwm.git
  10. git clone https://github.com/baskerville/sxhkd.git
  11. cd bspwm/
  12. make
  13. sudo make install
  14. cd ../sxhkd/
  15. make
  16. sudo make install
  17.  
  18. sudo apt install bspwm
  19.  
  20. 3. Cargamos en bspwm y sxhkd ficheros de ejemplo:
  21.  
  22. mkdir ~/.config/bspwm
  23. mkdir ~/.config/sxhkd
  24. cd /home/s4vitar/Descargas/bspwm/
  25. cp examples/bspwmrc ~/.config/bspwm/
  26. chmod +x ~/.config/bspwm/bspwmrc
  27. cp examples/sxhkdrc ~/.config/sxhkd/
  28.  
  29. 4. Abrimos el sxhkdrc y configuramos el tipo de terminal así como algunos key bindings:
  30. # ------------------------------------------------------------------------------------------------
  31. #
  32. # wm independent hotkeys
  33. #
  34.  
  35. # terminal emulator
  36. super + Return
  37.     gnome-terminal
  38.  
  39. # program launcher
  40. super + d
  41.     rofi -show run
  42.  
  43. # make sxhkd reload its configuration files:
  44. super + Escape
  45.     pkill -USR1 -x sxhkd
  46.  
  47. #
  48. # bspwm hotkeys
  49. #
  50.  
  51. # quit/restart bspwm
  52. super + alt + {q,r}
  53.     bspc {quit,wm -r}
  54.  
  55. # close and kill
  56. super + {_,shift + }w
  57.     bspc node -{c,k}
  58.  
  59. # alternate between the tiled and monocle layout
  60. super + m
  61.     bspc desktop -l next
  62.  
  63. # send the newest marked node to the newest preselected node
  64. super + y
  65.     bspc node newest.marked.local -n newest.!automatic.local
  66.  
  67. # swap the current node and the biggest node
  68. super + g
  69.     bspc node -s biggest
  70.  
  71. #
  72. # state/flags
  73. #
  74.  
  75. # set the window state
  76. super + {t,shift + t,s,f}
  77.     bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
  78.  
  79. # set the node flags
  80. super + ctrl + {m,x,y,z}
  81.     bspc node -g {marked,locked,sticky,private}
  82.  
  83. #
  84. # focus/swap
  85. #
  86.  
  87. super + {_,shift + }{Left,Down,Up,Right}
  88.        bspc node -{f,s} {west,south,north,east}
  89.  
  90.  
  91. # focus the node for the given path jump
  92. super + {p,b,comma,period}
  93.     bspc node -f @{parent,brother,first,second}
  94.  
  95. # focus the next/previous node in the current desktop
  96. super + {_,shift + }c
  97.     bspc node -f {next,prev}.local
  98.  
  99. # focus the next/previous desktop in the current monitor
  100. super + bracket{left,right}
  101.     bspc desktop -f {prev,next}.local
  102.  
  103. # focus the last node/desktop
  104. super + {grave,Tab}
  105.     bspc {node,desktop} -f last
  106.  
  107. # focus the older or newer node in the focus history
  108. super + {o,i}
  109.     bspc wm -h off; \
  110.     bspc node {older,newer} -f; \
  111.     bspc wm -h on
  112.  
  113. # focus or send to the given desktop
  114. super + {_,shift + }{1-9,0}
  115.     bspc {desktop -f,node -d} '^{1-9,10}'
  116.  
  117. #
  118. # preselect
  119. #
  120.  
  121. # preselect the direction
  122. super + ctrl + alt + {Left,Down,Up,Right}
  123.     bspc node -p {west,south,north,east}
  124.  
  125.  
  126. # preselect the ratio
  127. super + ctrl + {1-9}
  128.     bspc node -o 0.{1-9}
  129.  
  130. # cancel the preselection for the focused node
  131. super + ctrl + space
  132.     bspc node -p cancel
  133.  
  134. # cancel the preselection for the focused desktop
  135. super + ctrl + alt + space
  136.     bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
  137.  
  138. #
  139. # move/resize
  140. #
  141.  
  142. # expand a window by moving one of its side outward
  143. #super + alt + {h,j,k,l}
  144. #   bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
  145.  
  146. # contract a window by moving one of its side inward
  147. #super + alt + shift + {h,j,k,l}
  148. #   bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
  149.  
  150. # move a floating window
  151. super + ctrl + {Left,Down,Up,Right}
  152.     bspc node -v {-20 0,0 20,0 -20,20 0}
  153.  
  154. # Custom move/resize
  155. alt + super + {Left,Down,Up,Right}
  156.     /home/s4vitar/.config/bspwm/scripts/bspwm_resize {west,south,north,east}
  157. # ------------------------------------------------------------------------------------------------
  158.  
  159. 5. Creamos el archivo bspwm_resize:
  160.  
  161. mkdir ~/.config/bspwm/scripts/
  162. touch ~/.config/bspwm/scripts/bspwm_resize; chmod +x ~/.config/bspwm/scripts/bspwm_resize
  163.  
  164. Mediante la siguiente configuración podremos en el futuro controlar las dimensiones de las vetanas, así como
  165. modificarlas con atajos de teclado:
  166. # ------------------------------------------------------------------------------------------------
  167. #!/usr/bin/env dash
  168.  
  169. if bspc query -N -n focused.floating > /dev/null; then
  170.     step=20
  171. else
  172.     step=100
  173. fi
  174.  
  175. case "$1" in
  176.     west) dir=right; falldir=left; x="-$step"; y=0;;
  177.     east) dir=right; falldir=left; x="$step"; y=0;;
  178.     north) dir=top; falldir=bottom; x=0; y="-$step";;
  179.     south) dir=top; falldir=bottom; x=0; y="$step";;
  180. esac
  181.  
  182. bspc node -z "$dir" "$x" "$y" || bspc node -z "$falldir" "$x" "$y"
  183. # -------------------------------------------------------------------------------------------------
  184.  
  185. 6. Procedemos a instalar la polybar. Para ello, instalamos primero los siguientes paquetes:
  186.  
  187. sudo apt install cmake cmake-data pkg-config python3-sphinx libcairo2-dev libxcb1-dev libxcb-util0-dev libxcb-randr0-dev libxcb-composite0-dev python3-xcbgen xcb-proto libxcb-image0-dev libxcb-ewmh-dev libxcb-icccm4-dev libxcb-xkb-dev libxcb-xrm-dev libxcb-cursor-dev libasound2-dev libpulse-dev libjsoncpp-dev libmpdclient-dev libcurl4-openssl-dev libnl-genl-3-dev
  188.  
  189. Para instalar la polybar hacemos lo siguiente:
  190.  
  191. cd /home/s4vitar/Descargas/
  192. git clone --recursive https://github.com/polybar/polybar
  193. cd polybar/
  194. mkdir build
  195. cd build/
  196. cmake ..
  197. make -j$(nproc)
  198. sudo make install
  199.  
  200. 7. Procedemos con la instalación de Picom para ajustar las transparencias (Compton ya está deprecated).
  201.  
  202. Primeramente, instalamos los siguientes paquetes, no sin antes actualizar el sistema:
  203.  
  204. sudo apt update
  205. sudo apt install meson libxext-dev libxcb1-dev libxcb-damage0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-randr0-dev libxcb-composite0-dev libxcb-image0-dev libxcb-present-dev libxcb-xinerama0-dev libpixman-1-dev libdbus-1-dev libconfig-dev libgl1-mesa-dev libpcre2-dev libevdev-dev uthash-dev libev-dev libx11-xcb-dev libxcb-glx0-dev
  206.  
  207. Posteriormente, ejecutamos los siguientes comandos bajo el directorio ~/Descargas:
  208.  
  209. git clone https://github.com/ibhagwan/picom.git
  210. cd picom/
  211. git submodule update --init --recursive
  212. meson --buildtype=release . build
  213. ninja -C build
  214. sudo ninja -C build install
  215.  
  216. 8. Instalamos rofi (Posteriormente instalaremos el tema Nord para Rofi):
  217.  
  218. sudo apt install rofi
  219.  
  220. 9. En este punto, reiniciamos el equipo y seleccionamos bspwm (Probamos que los shortcuts estén funcionando correctamente).
  221.  
  222. 10. Configuramos un poco la terminal e instalamos las Hack Nerd Fonts, además del Firefox (hay que descargarse la última versión, también instalaremos firejail con 'apt install firejail' con el objetivo de lanzar firefox bajo este contexto enjaulado con sxhkd). [Las fuentes de Hack Nerd Fonts deben ir descomprimidas en /usr/local/share/fonts/, una vez hecho hay que ejecutar el comando 'fc-cache -v']
  223.  
  224. 11. Instalamos el addon 'FoxyProxy' para Firefox.
  225.  
  226. 12. Configuramos la privacidad en Firefox y el directorio de descargas principal
  227.  
  228. 13. Instalamos 'feh' con 'apt install feh' para poder cargar fondos de pantalla.
  229.  
  230. 14. Cargamos en el archivo bspwmrc justo al final la siguiente línea:
  231.  
  232. feh --bg-fill /home/s4vitar/Desktop/S4vitar/Images/fondo.jpg
  233.  
  234. 15. Para configurar nuestra Polybar, clonaremos primeramente en 'Descargas' el siguiente repositorio:
  235.  
  236. git clone https://github.com/VaughnValle/blue-sky.git
  237.  
  238. Posteriormente, ejecutaremos los siguientes comandos:
  239.  
  240. mkdir ~/.config/polybar
  241. cd ~/Descargas/blue-sky/polybar/
  242. cp * -r ~/.config/polybar
  243. echo '~/.config/polybar/./launch.sh' >> ~/.config/bspwm/bspwmrc
  244. cd fonts
  245. sudo cp * /usr/share/fonts/truetype/
  246. fc-cache -v
  247.  
  248. Hacemos Windows + Shift + R para cargar la configuración y deberíamos ver la Polybar por arriba.
  249.  
  250. 16. Para configurar Picom y ajustar las transparencias además de bordeados de ventana, ejecutamos los siguientes pasos:
  251.  
  252. mkdir ~/.config/picom
  253. cd ~/.config/picom
  254. cp ~/Descargas/blue-sky/picom.conf .
  255.  
  256. Editamos el archivo picom.conf y cambiamos 'backend = "glx"' por 'backend = "xrender"', comentando el de glx. Posteriormente, comentamos todas las líneas referentes a glx (En algunos ordenadores al dejar el glx puesto se puede llegar a experimentar una lentitud muy molesta).
  257.  
  258. Antes de recargar la configuración, hacemos un seguimiento del ratón para saber en qué ventana estamos con la siguiente instrucción en el 'bspwm':
  259.  
  260. bspc config focus_follows_pointer true
  261.  
  262. Posteriormente, ejecutamos los siguientes comandos para aplicar los bordeados:
  263.  
  264. echo 'picom --experimental-backends &' >> ~/.config/bspwm/bspwmrc
  265. echo 'bspc config border_width 0' >> ~/.config/bspwm/bspwmrc
  266.  
  267. 17. Configuramos los colores de la polybar (paleta central), además de las paletas deseadas.
  268.  
  269. Estructura de un nuevo módulo:
  270.  
  271. Previamente tenemos que crear una carpeta en "~/.config/bin"
  272.  
  273. [module/tumodulo]
  274. type = custom/script
  275. interval = 2
  276. exec = ~/.config/bin/binario.sh
  277.  
  278. Por ejemplo, para el módulo del ethernet_status:
  279.  
  280. #!/bin/sh
  281.  
  282. echo "%{F#2495e7} %{F#ffffff}$(/usr/sbin/ifconfig eth0 | grep "inet " | awk '{print $2}')%{u-}"
  283.  
  284. Para el módulo de hackthebox_status.sh:
  285.  
  286. #!/bin/sh
  287.  
  288. IFACE=$(/usr/sbin/ifconfig | grep tun0 | awk '{print $1}' | tr -d ':')
  289.  
  290. if [ "$IFACE" = "tun0" ]; then
  291.     echo "%{F#1bbf3e} %{F#ffffff}$(/usr/sbin/ifconfig tun0 | grep "inet " | awk '{print $2}')%{u-}"
  292. else
  293.     echo "%{F#1bbf3e}%{u-} Disconnected"
  294. fi
  295.  
  296. 18. Configuramos el tema Nord de Rofi:
  297.  
  298. mkdir -p ~/.config/rofi/themes
  299. cp ~/Descargas/blue-sky/nord.rasi ~/.config/rofi/themes
  300.  
  301. Posteriormente con 'rofi-theme-selector' seleccionamos el tema Nord.
  302.  
  303. 19. Instalamos slim y slimlock
  304.  
  305. Instalamos los siguientes paquetes, no sin antes hacer una actualización:
  306.  
  307. sudo apt update
  308. sudo apt install slim libpam0g-dev libxrandr-dev libfreetype6-dev libimlib2-dev libxft-dev
  309.  
  310. Posteriormente, ejecutamos los siguientes comandos:
  311.  
  312. cd ~/Descargas/
  313. git clone https://github.com/joelburget/slimlock.git
  314. cd slimlock/
  315. sudo make
  316. sudo make install
  317. cd ~/Descargas/blue-sky/slim
  318. sudo cp slim.conf /etc/
  319. sudo cp slimlock.conf /etc
  320. sudo cp -r default /usr/share/slim/themes
  321.  
  322. Si queremos cambiar la imagen del panel, nos vamos a la ruta '/usr/share/slim/themes/default' y retocamos el archivo 'panel.png'.
  323.  
  324. 20. Reiniciamos el sistema y una vez arrancado, incorporamos en el archivo 'bspwmrc' la siguiente línea para arreglar el cursor:
  325.  
  326. xsetroot -cursor_name left_ptr &
  327.  
  328. 21. Instalamos la powerlevel10k en zsh
  329.  
  330. 22. Creamos enlace simbólico de la zshrc para root
  331.  
  332. 23. Cambiamos el tipo de shell por defecto tanto para root como para el usuario con bajos privilegios
  333.  
  334. usermod --shell /usr/bin/zsh tuUsuario
  335. usermod --shell /usr/bin/zsh root
  336.  
  337. 24. Retocamos el archivo .p10k.zsh para adecuarlo a nuestro gusto
  338.  
  339. Para el de root, podemos ir a 'POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE' para asignar el Hashtag.
  340.  
  341. Comentamos la siguiente línea:
  342.  
  343. # POWERLEVEL9K_CONTEXT_PREFIX='%246Fwith '
  344.  
  345. Para evitar un pequeño problema de permisos a la hora de desde el usuario root migrar con 'su' al usuario con bajos privilegios, ejecutamos los siguientes comandos:
  346.  
  347. chown s4vitar:s4vitar /root
  348. chown s4vitar:s4vitar /root/.cache -R
  349. chown s4vitar:s4vitar /root/.local -R
  350.  
  351. 25. Instalamos bat, lsd, fzf y ranger
  352.  
  353. 26. Instalar el plugin sudo
  354.  
  355. 27. Instalamos nvim con el theme nord
  356.  
  357. cd .config/nvim/
  358. wget https://github.com/arcticicestudio/nord-vim/archive/master.zip
  359. unzip master.zip
  360. rm master.zip
  361. mv nord-vim-master/colors/ .
  362. rm -r nord-vim-master/
  363.  
  364. Añadimos al archivo 'init.vim' la línea 'colorscheme nord' justo al final.
  365.  
  366. wget https://raw.githubusercontent.com/Necros1s/lotus/master/lotus.vim
  367. wget https://raw.githubusercontent.com/Necros1s/lotus/master/lotusbar.vim
  368. wget https://raw.githubusercontent.com/Necros1s/lotus/master/init.vim (Quitamos las líneas del plug)
  369.  
  370. Añadimos justo al final del 'init.vim' la línea 'syntax on' para la detección de sintaxis.
  371.  
  372. [TODO ESTE PROCESO HAY QUE HACERLO TAMBIÉN COMO EL USUARIO ROOT]
  373.  
  374. Incorporamos posteriormente las siguientes líneas al final del zshrc para que al salir del nvim no se quede el cursor en modo Block:
  375.  
  376. # Change cursor shape for different vi modes.
  377. function zle-keymap-select {
  378.   if [[ $KEYMAP == vicmd ]] || [[ $1 = 'block' ]]; then
  379.     echo -ne '\e[1 q'
  380.   elif [[ $KEYMAP == main ]] || [[ $KEYMAP == viins ]] || [[ $KEYMAP = '' ]] || [[ $1 = 'beam' ]]; then
  381.     echo -ne '\e[5 q'
  382.   fi
  383. }
  384. zle -N zle-keymap-select
  385.  
  386. # Start with beam shape cursor on zsh startup and after every command.
  387. zle-line-init() { zle-keymap-select 'beam'}
  388.  
  389. 28. Instalamos Oh My Tmux
  390.  
  391. 29. Whichsystem.py
  392.  
  393. https://github.com/Akronox/WichSystem.py
  394.  
  395. 30. fastTCPScan.go
  396.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement