feat: stop using ansible to manage dotfiles and packages

This commit is contained in:
drymer 2021-08-16 00:37:46 +02:00
parent 37ef017584
commit 4725d3fec2
94 changed files with 0 additions and 37331 deletions

15
LICENSE
View file

@ -1,15 +0,0 @@
Author:: drymer <drymer [ EN ] autistici.org>
Copyright:: Copyright (c) 2016, drymer
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

View file

@ -1,60 +0,0 @@
#+startup: indent
* Proveedor de entorno
Este playbook instala lo siguiente:
- Docker
- Emacs
- Fuentes
- Paquetes de Debian que uso
- i3blocks-gaps
- i3-gaps
- Paquetes de Pip que uso
- Qutebrowser
- SLim
- Syncthing
- Termite
- Virtualbox
- Virtualenvwrapper
- Otros paquetes que me gusta tener
Además, también instala mis ficheros de configuración de emacs, i3-wm, qutebrowser y zsh. Básicamente instala todo lo que necesito en un ordenador.
Para poder usarlo, antes hay que instalar algunas dependencias:
#+BEGIN_SRC bash
sudo apt install sudo python-pip git
sudo pip install ansible
#+END_SRC
Luego copiamos el repositorio:
#+BEGIN_SRC bash
git clone https://git.daemons.it/drymer/dotfiles
#+END_SRC
Instalamos los roles que tiene como dependencias:
#+BEGIN_SRC bash
cd dotfiles
ansible-galaxy install -r requirements.yml -p roles
#+END_SRC
Y solo queda ejecutar el playbook:
#+BEGIN_SRC bash
ansible-playbook install-all.yml -K
#+END_SRC
Se pueden usar los tags =configuration= o =packages= para instalar solo configuración o paquetes, respectivamente.

2
TODO
View file

@ -1,2 +0,0 @@
Configurar crontab
Configurar gitconfig

View file

@ -1,38 +0,0 @@
---
- hosts: localhost
connection: local
vars:
install_dir: ~/Instalados/
shell_user: ~/Scripts/bin
emacs_version: emacs-26.1
i3_gaps_version: 4.14.1
termite_version: v12
vte_version: 0.44.1.b
syncthing_inotify_version: v0.8.7
go_path: /opt/go/
roles:
- slim
- habitual-packages
- docker
- emacs
- i3-gaps
- qutebrowser
- termite
- syncthing
- pip-packages
- virtualbox
- virtualenvwrapper
- fonts
- runc
tags:
- packages
- hosts: localhost
roles:
- emacs-dotfiles
- i3-dotfiles
- neomutt-dotfiles
- qutebrowser-dotfiles
- shell-dotfiles
tags:
- configuration

View file

@ -1,7 +0,0 @@
FROM {{ item.image }}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi

View file

@ -1,46 +0,0 @@
*******
Install
*******
This set of playbooks have specific dependencies on Ansible due to the modules
being used.
Requirements
============
* Ansible 2.2
* Docker Engine
* docker-py
Install OS dependencies on CentOS 7
.. code-block:: bash
$ sudo yum install -y epel-release
$ sudo yum install -y gcc python-pip python-devel openssl-devel
# If installing Molecule from source.
$ sudo yum install libffi-devel git
Install OS dependencies on Ubuntu 16.x
.. code-block:: bash
$ sudo apt-get update
$ sudo apt-get install -y python-pip libssl-dev docker-engine
# If installing Molecule from source.
$ sudo apt-get install -y libffi-dev git
Install OS dependencies on Mac OS
.. code-block:: bash
$ brew install python
$ brew install git
Install using pip:
.. code-block:: bash
$ sudo pip install ansible
$ sudo pip install docker-py
$ sudo pip install molecule --pre

View file

@ -1,47 +0,0 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: False
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
vars:
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}"
molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}"
molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}"
tasks:
- name: Create Dockerfiles from image names
template:
src: "{{ molecule_scenario_directory }}/Dockerfile.j2"
dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}"
with_items: "{{ molecule_yml.platforms }}"
register: platforms
- name: Discover local Docker images
docker_image_facts:
name: "molecule_local/{{ item.item.name }}"
with_items: "{{ platforms.results }}"
register: docker_images
- name: Build an Ansible compatible image
docker_image:
path: "{{ molecule_ephemeral_directory }}"
name: "molecule_local/{{ item.item.image }}"
dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}"
force: "{{ item.item.force | default(True) }}"
with_items: "{{ platforms.results }}"
when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0
- name: Create molecule instance(s)
docker_container:
name: "{{ item.name }}"
hostname: "{{ item.name }}"
image: "molecule_local/{{ item.image }}"
state: started
recreate: False
log_driver: syslog
command: "{{ item.command | default('sleep infinity') }}"
privileged: "{{ item.privileged | default(omit) }}"
volumes: "{{ item.volumes | default(omit) }}"
capabilities: "{{ item.capabilities | default(omit) }}"
with_items: "{{ molecule_yml.platforms }}"

View file

@ -1,16 +0,0 @@
---
- name: Destroy
hosts: localhost
connection: local
gather_facts: False
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
vars:
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}"
tasks:
- name: Destroy molecule instance(s)
docker_container:
name: "{{ item.name }}"
state: absent
force_kill: "{{ item.force_kill | default(True) }}"
with_items: "{{ molecule_yml.platforms }}"

View file

@ -1,28 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: geerlingguy_docker_debian9_ansible
image: geerlingguy/docker-debian9-ansible
privileged: True
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
command: /lib/systemd/systemd
provisioner:
name: ansible
lint:
name: ansible-lint
options:
extra-vars: force_docker=yes
env:
ANSIBLE_ROLES_PATH: ../../roles/
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8

View file

@ -1,24 +0,0 @@
---
- name: Converge
hosts: all
vars:
install_dir: ~/Instalados/
emacs_version: emacs-25.3
i3_gaps_version: 4.14.1
termite_version: v12
vte_version: 0.44.1.b
syncthing_inotify_version: v0.8.7
go_path: /opt/go/
roles:
- slim
- habitual-packages
- docker
- emacs
- i3-gaps
- qutebrowser
- termite
- syncthing
- pip-packages
- virtualbox
- virtualenvwrapper
- fonts

View file

@ -1,14 +0,0 @@
- src: git+https://git.daemons.it/ansible-roles/emacs
- src: git+https://git.daemons.it/ansible-roles/slim
- src: git+https://git.daemons.it/ansible-roles/syncthing
- src: git+https://git.daemons.it/ansible-roles/syncthing-inotify
- src: git+https://git.daemons.it/ansible-roles/vte-ng
- src: git+https://git.daemons.it/ansible-roles/termite
- src: git+https://git.daemons.it/ansible-roles/virtualenvwrapper
- src: git+https://git.daemons.it/ansible-roles/virtualbox
- src: git+https://git.daemons.it/drymer/emacs-dotfiles
- src: git+https://git.daemons.it/ansible-roles/docker
- src: git+https://git.daemons.it/ansible-roles/fonts
- src: git+https://git.daemons.it/ansible-roles/i3-gaps
- src: git+https://git.daemons.it/ansible-roles/i3blocks-gaps
- src: git+https://git.daemons.it/ansible-roles/qutebrowser

View file

@ -1,44 +0,0 @@
Habitual Packages
=========
Install the packages I usually use.
Requirements
------------
None
Role Variables
--------------
* `habitual_packages`: A list containing all the packages.
Dependencies
------------
None
Example Playbook
----------------
```yaml
- hosts: servers
roles:
- { role: habitual-packages }
```
Compatible
----------
With:
- Debian 9
License
-------
GPLv3
Author Information
------------------
drymer [ AT ] autistici.org

View file

@ -1,11 +0,0 @@
Install firefox quantum and extensions:
- Use docker
- https://addons.mozilla.org/en-US/firefox/addon/vimium-ff/
Install podman
- https://github.com/containers/libpod/blob/master/install.md
Kubectx:
- https://github.com/ahmetb/kubectx
Kubetail:
- https://github.com/johanhaleby/kubetail/
Instalar git de backports

View file

@ -1,137 +0,0 @@
---
habitual_packages:
- kpcli
- rsync
- dunst
- parcellite
- pandoc
- python-dev
- python3
- python3-dev
- mlocate
- mpd
- mpc
- ncmpcpp
- ruby
- texlive
- wicd
- wicd-curses
- wicd-gtk
- wicd-cli
- mpv
- vlc
- dia
- acpi
- pm-utils
- jq
- silversearcher-ag
- wget
- curl
- mumble
- tor
- torsocks
- proxychains
- apt-transport-https
- ca-certificates
- gnupg2
- software-properties-common
- android-tools-adb
- android-tools-fastboot
- htop
- dfc
- net-tools
- multitail
- perl
- abook
- feh
- zathura
- offlineimap
- unp
- nmap
- fonts-font-awesome
- unclutter
- scrot
- compton
- python-pip
- python3-pip
- graphviz
- gimp
- imagemagick
- haveged
- socat
- sysstat
- haveged
- aptitude
- texi2html
- i3lock
- notmuch
- keepassx
- xautolock
- arandr
- parallel
- autojump
- tmux
- chromium
- firefox-esr
- rofi
- armagetronad
- fonts-font-awesome
- fonts-powerline
- sl
- ncdu
- khal
- bc
- zsh
- wipe
- psmisc
- mutt
- xserver-xorg
- pulseaudio
- pavucontrol
- alsa-utils
- mongodb-clients
- cifs-utils
- nfs-common
- nodejs
- encfs
- gajim
- libnotify-bin
- at
- x11-apps
- ttyrec
- recordmydesktop
- openvpn
- transmission-qt
- unoconv
- ledger
- gnuplot
- gawk
- tcpdump
- wireshark
- libxslt1-dev
- xdotool
- pv
- libvirt-dev
- xcape
- git-flow
- kvm
- virt-manager
- kdeconnect
- pyqt4-dev-tools
- qt4-dev-tools
- python-qt4-dbus
- cmake
- libappindicator3-dev
- shellcheck
- powertop
- mysql-client
- gocode
- resolvconf
- pass
- asciidoctor
- libssl-dev
- git-extras
- rxvt-unicode
- redshift
installed_path: ~/Instalados/
shell_path: ~/Scripts/bin

View file

@ -1,29 +0,0 @@
---
# handlers file for habitual-packages
- name: Disable Network Manager
become: yes
systemd:
name: "NetworkManager.service"
enabled: no
when:
(ansible_distribution == 'Debian'
or
ansible_distribution == 'Ubuntu')
and
ansible_connection != 'docker'
listen:
- disable nm
- name: Enable Wicd
become: yes
systemd:
name: "wicd.service"
enabled: no
when:
(ansible_distribution == 'Debian'
or
ansible_distribution == 'Ubuntu')
and
ansible_connection != 'docker'
listen:
- enable wicd

View file

@ -1,13 +0,0 @@
---
galaxy_info:
author: drymer
description: Install my used packages
license: GPLv3
min_ansible_version: 2.3
platforms:
- name: Debian
versions:
- 9

View file

@ -1,7 +0,0 @@
FROM {{ item.image }}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi

View file

@ -1,46 +0,0 @@
*******
Install
*******
This set of playbooks have specific dependencies on Ansible due to the modules
being used.
Requirements
============
* Ansible 2.2
* Docker Engine
* docker-py
Install OS dependencies on CentOS 7
.. code-block:: bash
$ sudo yum install -y epel-release
$ sudo yum install -y gcc python-pip python-devel openssl-devel
# If installing Molecule from source.
$ sudo yum install libffi-devel git
Install OS dependencies on Ubuntu 16.x
.. code-block:: bash
$ sudo apt-get update
$ sudo apt-get install -y python-pip libssl-dev docker-engine
# If installing Molecule from source.
$ sudo apt-get install -y libffi-dev git
Install OS dependencies on Mac OS
.. code-block:: bash
$ brew install python
$ brew install git
Install using pip:
.. code-block:: bash
$ sudo pip install ansible
$ sudo pip install docker-py
$ sudo pip install molecule --pre

View file

@ -1,47 +0,0 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: False
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
vars:
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}"
molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}"
molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}"
tasks:
- name: Create Dockerfiles from image names
template:
src: "{{ molecule_scenario_directory }}/Dockerfile.j2"
dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}"
with_items: "{{ molecule_yml.platforms }}"
register: platforms
- name: Discover local Docker images
docker_image_facts:
name: "molecule_local/{{ item.item.name }}"
with_items: "{{ platforms.results }}"
register: docker_images
- name: Build an Ansible compatible image
docker_image:
path: "{{ molecule_ephemeral_directory }}"
name: "molecule_local/{{ item.item.image }}"
dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}"
force: "{{ item.item.force | default(True) }}"
with_items: "{{ platforms.results }}"
when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0
- name: Create molecule instance(s)
docker_container:
name: "{{ item.name }}"
hostname: "{{ item.name }}"
image: "molecule_local/{{ item.image }}"
state: started
recreate: False
log_driver: syslog
command: "{{ item.command | default('sleep infinity') }}"
privileged: "{{ item.privileged | default(omit) }}"
volumes: "{{ item.volumes | default(omit) }}"
capabilities: "{{ item.capabilities | default(omit) }}"
with_items: "{{ molecule_yml.platforms }}"

View file

@ -1,16 +0,0 @@
---
- name: Destroy
hosts: localhost
connection: local
gather_facts: False
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
vars:
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}"
tasks:
- name: Destroy molecule instance(s)
docker_container:
name: "{{ item.name }}"
state: absent
force_kill: "{{ item.force_kill | default(True) }}"
with_items: "{{ molecule_yml.platforms }}"

View file

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: geerlingguy_docker_debian9_ansible
image: geerlingguy/docker-debian9-ansible
privileged: True
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
command: /lib/systemd/systemd
provisioner:
name: ansible
lint:
name: ansible-lint
options:
extra-vars: force_docker=yes
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8

View file

@ -1,5 +0,0 @@
---
- name: Converge
hosts: all
roles:
- role: habitual-packages

View file

@ -1,15 +0,0 @@
import os
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
habitual_packages = open("../../defaults/main.yml").read()\
.replace('- ', '')\
.split()[2:]
@pytest.mark.parametrize("name", habitual_packages)
def test_packages(host, name):
package = host.package(name)
assert package.is_installed

View file

@ -1,24 +0,0 @@
---
# tasks file for habitual-packages
- name: Install habitual packages
become: yes
apt:
name: "{{ item }}"
state: present
with_items:
"{{ habitual_packages }}"
notify:
- disable nm
- enable wicd
- name: Install kubetail
git:
repo: https://github.com/johanhaleby/kubetail
dest: "{{ installed_path }}/kubetail/"
version: master
- name: Put kubetail in my PATH
file:
src: "{{ installed_path }}/kubetail/kubetail"
dest: "{{ shell_path }}/kubetail"
state: link

View file

@ -1,247 +0,0 @@
# -*- mode: i3wm-config -*-
set $color_bad = #CC0000
set $color_degraded = #EDD400
set $color_good = #73D216
set $mod Mod4
# Fuente para títulos de ventanas
font pango:DejaVu Sans Mono 8
# Usar Ratón+$mod para mover las ventanas flotantes
floating_modifier $mod
# Display
set $display1 eDP-1
set $display2 DP-1
# volver a la misma ventana que estaba apretando el mismo worskpace
workspace_auto_back_and_forth yes
# abrir una terminal
bindsym $mod+Return exec termite
# cerrar ventana
bindsym $mod+Shift+Q kill
# arrancar launcher
bindsym $mod+d exec --no-startup-id ~/Scripts/bin/launcher
for_window [title="fuzzylauncher"] floating enable
# Reinicia i3
bindsym $mod+Shift+r restart
# Cambiar foco
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# Cambiar foco con las flechas
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Mover de workspace
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# Mover de workspace usando las flechas
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# Cambiar la orientación en horizontal
bindsym $mod+b split h
# Cambiar la orientación en vertical
bindsym $mod+v split v
# Fullscreen
bindsym $mod+f fullscreen
# Cambiar layout
bindsym $mod+y layout stacking
bindsym $mod+a layout default
bindsym $mod+s layout tabbed
# Cambiar entre tiling / floating
bindsym $mod+Shift+space floating toggle
# Cambiar foco entre tiling / floating windows
bindsym $mod+space focus mode_toggle
# Definir workspaces
set $ws1 1<big></big>
set $ws2 2<big></big>
set $ws3 3<big></big>
set $ws4 4<big></big>
set $ws5 5<big></big>
set $ws6 6<big></big>
set $ws7 7<big></big>
set $ws8 8<big></big>
set $ws9 9<big></big>
set $ws10 10<big></big>
# Cambiar a workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
# Mover a workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
# Workspace a monitores
workspace $ws1 output $display2
workspace $ws2 output $display2
workspace $ws3 output $display1
workspace $ws4 output $display2
workspace $ws5 output $display2
workspace $ws6 output $display2
workspace $ws7 output $display1
workspace $ws8 output $display1
workspace $ws9 output $display1
workspace $ws10 output $display1
# Cambiar tamaño de ventana
mode "Resize" {
# These bindings trigger as soon as you enter the resize mode
bindsym h resize shrink width 2 px or 2 ppt
bindsym j resize grow height 2 px or 2 ppt
bindsym k resize shrink height 2 px or 2 ppt
bindsym l resize grow width 2 px or 2 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"
# Barra principal
bar {
font pango:Dyuthi3, Awesome, Icons 10, DejaVu Sans Mono for Powerline 8
status_command /usr/local/bin/i3blocks
position top
# quitar los putos números del nombre del workspace
strip_workspace_numbers yes
i3bar_command i3bar -t
colors {
background #000000
separator #000000
###XXX: Details border backgr. text
focused_workspace #990099 #222222 #729FCF
inactive_workspace #222222 #222222 #729FCF
active_workspace #222222 #222222 #729FCF
urgent_workspace #FF0000 #222222 #FF0000
}
}
# Bloquear pantalla
bindsym $mod+Control+l exec --no-startup-id ~/.i3/scripts/lock, mode "default"
# Seleccionar padre
bindsym $mod+i focus parent
# Seleccionar hijo
bindsym $mod+o focus child
# evitar titulos feos
new_window pixel
# Colors de las ventanas
# class border backgr text indicator
client.focused #990099 #222222 #ffffff #729FCF
client.focused_inactive #222222 #222222 #ffffff #729FCF
client.unfocused #222222 #222222 #ffffff #729FCF
client.urgent #FF0000 #8C5665 #ffffff #FF0000
# Wallpaper
exec --no-startup-id feh --bg-scale ~/Imagenes/debian-background.jpg
# Autostart
exec --no-startup-id bash ~/.xinitrc
exec --no-startup-id bash ~/.i3/scripts/autolock.sh
exec --no-startup-id parcellite
exec --no-startup-id compton
exec --no-startup-id dunst
exec --no-startup-id xcape
exec --no-startup-id redshift -l 40.25:03.45 -t 5700:3600 -g 0.8 -m randr
# Mover programas automáticamente a workspace
assign [class="(?i)firefox"] $ws2
assign [class="(?i)tor"] $ws2
assign [class="(?i)chromium"] $ws2
assign [class="(?i)qutebrowser"] $ws2
assign [class="(?i)icecat"] $ws2
assign [title="Steam"] $ws7
assign [class="(?i)mumble"] $ws8
assign [class="(?i)mpv"] $ws8
assign [class="(?i)transmission"] $ws8
assign [class="(?i)thunderbird"] $ws9
assign [title="mutt"] $ws9
# Hacer ventanas flotantes automáticamente
for_window [window_role="Preferences"] floating enable
for_window [window_role="help-browser"] floating enable
for_window [class="(?i)xcalc"] floating enable
for_window [window_role="pop-up"] floating enable
for_window [window_role="About"] floating enable
for_window [class="(?i)wicd"] floating enable
for_window [class="(?i)plasma-desktop"] floating enable
for_window [class="(?i)klipper"] floating enable
for_window [class="(?i)feh"] floating enable
for_window [class="Progreso de operación de archivo"] floating enable
for_window [title="textarea"] floating enable
for_window [title="qutebrowser-editor"] floating enable
for_window [title="SM-J710F"] floating enable
for_window [title="Dispositivos Bluetooth"] floating enable
# i3-gaps
smart_borders on
# Popups en pantalla completa
popup_during_fullscreen smart
# El foco no lo decide el ratón
focus_follows_mouse no
# Scratchpad
bindsym $mod+Shift+p move scratchpad
bindsym $mod+p scratchpad show
# keybinds varios
bindsym XF86MonBrightnessUp exec --no-startup-id luz 1
bindsym XF86MonBrightnessDown exec --no-startup-id luz 2
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 7 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 7 -5% #decrease sound volume

View file

@ -1,79 +0,0 @@
# i3blocks config file
#
# Please see man i3blocks for a complete reference!
# The man page is also hosted at http://vivien.github.io/i3blocks
# Global properties
command=~/.i3/scripts/$BLOCK_NAME
align=center
separator=false
separator_block_width=0
markup=pango
[weather]
interval=60
border_top=0
border_right=0
border_left=-1
signal=1
[notmuch]
interval=1800
border_top=0
border_right=0
border_left=-1
signal=1
[memory]
interval=2
border_top=0
border_right=0
border_left=-1
[uptime]
border_top=0
border_right=0
border_left=-1
interval=60
[sensors]
interval=1
border_top=0
border_right=0
border_left=-1
[cpu_usage]
interval=2
border_top=0
border_right=0
border_left=-1
[apt_updates]
interval=3600
border_top=0
border_right=0
border_left=-1
[volume-pulseaudio]
# command=/home/ap/.i3/scripts/volume-pulseaudio -a | head -n1 | awk -F '[' '{print $1}'
interval=once
signal=1
border_top=0
border_right=0
border_left=-1
# [volume]
# instance=Master
# interval=once
# signal=1
# border_top=0
# border_right=0
# border_left=-1
[date]
interval=1
border_top=0
border_right=0
border_left=-1
signal=1

View file

@ -1,18 +0,0 @@
#!/bin/bash
num_updates=$(apt list --upgradable 2> /dev/null | grep -v Listando | wc -l)
updates=$(apt list --upgradable 2> /dev/null | grep -v Listando | cut -d'/' -f1)
case $BLOCK_BUTTON in
1) notify-send -u low "`echo "$updates"`" ;;
3) notify-send -u low "`echo "$updates"`" ;;
esac
if [ -z "$update" ]
then
echo -n "<span foreground='black' background='#4c83ff'> &#xf021; `echo $num_updates` Updates </span>"
else
echo -n "<span foreground='black' background='#4c83ff'> &#xf021; No Updates </span>"
fi
exit 0

View file

@ -1,3 +0,0 @@
#!/bin/sh
xautolock -time 10 -locker "~/.i3/scripts/lock" &

View file

@ -1,52 +0,0 @@
#!/usr/bin/perl
#
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
#
# Licensed under the terms of the GNU GPL v3, or any later version.
use strict;
use warnings;
use utf8;
use Getopt::Long;
# default values
my $t_warn = 50;
my $t_crit = 80;
my $cpu_usage = -1;
sub help {
print "Usage: cpu_usage [-w <warning>] [-c <critical>]\n";
print "-w <percent>: warning threshold to become yellow\n";
print "-c <percent>: critical threshold to become red\n";
exit 0;
}
GetOptions("help|h" => \&help,
"w=i" => \$t_warn,
"c=i" => \$t_crit);
# Get CPU usage
$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
open (MPSTAT, 'mpstat 1 1 |') or die;
while (<MPSTAT>) {
if (/^Average:\s+all\s+(\d+\.\d+)\s+\d+\.\d+\s+(\d+\.\d+)/) {
$cpu_usage = $1 + $2; # %usr + %sys
last;
}
}
close(MPSTAT);
$cpu_usage eq -1 and die 'Can\'t find CPU information';
# Print short_text, full_text
if ($cpu_usage >= $t_crit) {
printf '<span background="#ffd700" foreground="#B60900"></span><span background="#B60900" foreground="black">  %.2f%% </span><span foreground="#4c83ff" background="#B60900"></span>', $cpu_usage;
} elsif ($cpu_usage >= $t_warn) {
printf '<span background="#ffd700" foreground="#ffa500"></span><span background="#ffa500" foreground="black">  %.2f%% </span><span foreground="#4c83ff" background="#ffa500"></span>', $cpu_usage;
} else {
printf '<span background="#ffd700" foreground="#61CE3C"></span><span background="#61CE3C" foreground="black">  %.2f%% </span><span foreground="#4c83ff" background="#61CE3C"></span>', $cpu_usage;
}
exit 0;

View file

@ -1,13 +0,0 @@
#!/bin/sh
time='<span background="#ffd700"><span foreground="black">  '"$(date '+%H:%M:%S') </span></span>"
date='<span foreground="#ffd700"></span> '"$(date '+%d/%m/%Y')"
case $BLOCK_BUTTON in
1) notify-send -u low "$date" ;;
3) notify-send -u low "$date" ;;
esac
echo -n "$time"
exit 0

View file

@ -1,15 +0,0 @@
#!/bin/sh
lock() {
lock
}
case "$1" in
lock)
~/.i3/scripts/lock
;;
suspend)
~/.i3/scripts/susp
;;
esac
exit 0

View file

@ -1,34 +0,0 @@
#!/bin/bash
sleep 0.01
# i3lock blurred screen inspired by /u/patopop007 and the blog post
# http://plankenau.com/blog/post-10/gaussianlock
# Timings are on an Intel i7-2630QM @ 2.00GHz
# Dependencies:
# imagemagick
# i3lock
# scrot (optional but default)
IMAGE=/tmp/i3lock.png
SCREENSHOT="scrot $IMAGE" # 0.46s
# Alternate screenshot method with imagemagick. NOTE: it is much slower
# SCREENSHOT="import -window root $IMAGE" # 1.35s
# Here are some imagemagick blur types
# Uncomment one to use, if you have multiple, the last one will be used
# All options are here: http://www.imagemagick.org/Usage/blur/#blur_args
BLURTYPE="0x5" # 7.52s
#BLURTYPE="0x2" # 4.39s
#BLURTYPE="5x2" # 3.80s
#BLURTYPE="2x8" # 2.90s
#BLURTYPE="2x3" # 2.92s
# Get the screenshot, add the blur and lock the screen with it
$SCREENSHOT
convert $IMAGE -blur $BLURTYPE $IMAGE
i3lock -i $IMAGE
rm $IMAGE

View file

@ -1,26 +0,0 @@
#!/bin/bash
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
TYPE="${BLOCK_INSTANCE:-mem}"
ram=$((`free | grep Mem | awk '{print $7}'`/1024/1024))
if [[ $ram -lt 4 ]]
then
echo -n "<span foreground='#B60900' background='#61CE3C'></span><span foreground='black' background='#B60900'>  $ram </span><span foreground='#8A458A' background='#B60900'> </span>"
else
echo -n "<span foreground='#4c83ff' background='#61CE3C'></span><span foreground='black' background='#4c83ff'>  $ram </span><span foreground='#8A458A' background='#4c83ff'> </span>"
fi

View file

@ -1,9 +0,0 @@
#!/bin/bash
number=`notmuch search tag:unread and tag:inbox 2> /dev/null | wc -l`
if [[ $number != 0 ]]
then
echo "<span background='#61CE3C'><span foreground='black'>  $number </span></span>"
else
echo "<span background='#61CE3C'><span foreground='black'>  $number </span></span>"
fi

View file

@ -1,2 +0,0 @@
#!/bin/sh
xrandr --output VIRTUAL1 --off --output LVDS1 --mode 1024x768 --pos 0x768 --rotate normal --output VGA1 --mode 1024x768 --pos 0x0 --rotate normal

View file

@ -1,10 +0,0 @@
#!/bin/sh
temp=$(acpi -t | grep "Thermal 1" | cut -d' ' -f4)
if [[ -z $temp ]]
then
temp=$(acpi -t | head -n1 | cut -d' ' -f4)
fi
echo -n "<span foreground='#ffd700' background='#8A458A'></span><span foreground='black' background='#ffd700'>  " $temp "º </span>"

View file

@ -1,6 +0,0 @@
#!/bin/bash
~/.i3/scripts/lock
sleep 1
echo 'mem' > /sys/power/state

View file

@ -1,13 +0,0 @@
#!/bin/bash
#
# Author: Raphael P. Ribeiro <raphaelpr01@gmail.com>
uptime=$(</proc/uptime)
uptime=${uptime%%.*}
s=$(( uptime%60 ))
m=$(( uptime/60%60 ))
h=$(( uptime/60/60%24 ))
d=$(( uptime/60/60/24 ))
echo '<span background="#8A458A" foreground="black">  '$d'd'$h'h'$m'm </span>'

View file

@ -1,82 +0,0 @@
#!/bin/bash
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
# Copyright (C) 2014 Alexander Keller <github@nycroth.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------
# The second parameter overrides the mixer selection
# For PulseAudio users, use "pulse"
# For Jack/Jack2 users, use "jackplug"
# For ALSA users, you may use "default" for your primary card
# or you may use hw:# where # is the number of the card desired
MIXER="pulse"
[ -n "$(lsmod | grep pulse)" ] && MIXER="pulse"
[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
MIXER="${2:-$MIXER}"
# The instance option sets the control to report and configure
# This defaults to the first control of your selected mixer
# For a list of the available, use `amixer -D $Your_Mixer scontrols`
SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
sed -n "s/Simple mixer control '\([A-Za-z ]*\)',0/\1/p" |
head -n1
)}"
# The first parameter sets the step to change the volume by (and units to display)
# This may be in in % or dB (eg. 5% or 3dB)
STEP="${1:-5%}"
#------------------------------------------------------------------------
capability() { # Return "Capture" if the device is a capture device
amixer -D $MIXER get $SCONTROL |
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
}
volume() {
amixer -D $MIXER get $SCONTROL $(capability)
}
format() {
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
perl_filter+='{CORE::say $4 eq "off" ? "MUTE" : "'
# If dB was selected, print that instead
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
perl_filter+='"; exit}'
perl -ne "$perl_filter"
}
#------------------------------------------------------------------------
case $BLOCK_BUTTON in
3) amixer -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute
4) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ ;; # scroll up, increase
5) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- ;; # scroll down, decrease
esac
print=$(volume | format)
if [ $print = "MUTE" ]
then
echo -n '<span background="#4c83ff" foreground="#B60900"></span><span background="#B60900" foreground="black"> </span>'
echo -e "<span background=\"#B60900\" foreground=\"black\">$print</span><span foreground=\"#ffd700\" background=\"#B60900\"> </span>"
exit 33
else
echo -n '<span background="#4c83ff" foreground="#8A458A"></span><span background="#8A458A" foreground="black"> </span>'
echo -e "<span background=\"#8A458A\" foreground=\"black\">$print</span><span foreground=\"#ffd700\" background=\"#8A458A\"> </span>"
exit 0
fi

View file

@ -1,177 +0,0 @@
#!/bin/bash
# Displays the default device, volume, and mute status for i3blocks
AUDIO_HIGH_SYMBOL=' '
AUDIO_MED_THRESH=50
AUDIO_MED_SYMBOL=' '
AUDIO_LOW_THRESH=0
AUDIO_LOW_SYMBOL=' '
AUDIO_MUTED_SYMBOL=' '
AUDIO_INTERVAL=5
DEFAULT_COLOR="#ffffff"
MUTED_COLOR="#a0a0a0"
LONG_FORMAT=0
SHORT_FORMAT=2
USE_PERCENT=1
USE_ALSA_NAME=0
USE_DESCRIPTION=0
SUBSCRIBE=0
while getopts F:Sf:padH:M:L:X:T:t:C:c:i:m:s:h opt; do
case "$opt" in
S) SUBSCRIBE=1 ;;
F) LONG_FORMAT="$OPTARG" ;;
f) SHORT_FORMAT="$OPTARG" ;;
p) USE_PERCENT=0 ;;
a) USE_ALSA_NAME=1 ;;
d) USE_DESCRIPTION=1 ;;
H) AUDIO_HIGH_SYMBOL="$OPTARG" ;;
M) AUDIO_MED_SYMBOL="$OPTARG" ;;
L) AUDIO_LOW_SYMBOL="$OPTARG" ;;
X) AUDIO_MUTED_SYMBOL="$OPTARG" ;;
T) AUDIO_MED_THRESH="$OPTARG" ;;
t) AUDIO_LOW_THRESH="$OPTARG" ;;
C) DEFAULT_COLOR="$OPTARG" ;;
c) MUTED_COLOR="$OPTARG" ;;
i) AUDIO_INTERVAL="$OPTARG" ;;
m) MIXER="$OPTARG" ;;
s) SCONTROL="$OPTARG" ;;
h) printf \
"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
[-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
[-m mixer] [-s scontrol] [-h]
Options:
-F, -f\tOutput format (-F long format, -f short format) to use, amongst:
\t0\t symb vol [index:name]\t (default long)
\t1\t symb vol [name]
\t2\t symb vol [index]\t (default short)
\t3\t symb vol
-S\tSubscribe to volume events (requires persistent block, always uses long format)
-p\tOmit the percent sign (%%) in volume
-a\tUse ALSA name if possible
-d\tUse device description instead of name if possible
-H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL'
-M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL'
-L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL'
-X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL'
-T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH
-t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH
-C\tColor for non-muted audio. Default: $DEFAULT_COLOR
-c\tColor for muted audio. Default: $MUTED_COLOR
-i\tInterval size of volume increase/decrease. Default: $AUDIO_INTERVAL
-m\tUse the given mixer.
-s\tUse the given scontrol.
-h\tShow this help text
" && exit 0;;
esac
done
if [[ -z "$MIXER" ]] ; then
MIXER="default"
if amixer -D pulse info >/dev/null 2>&1 ; then
MIXER="pulse"
fi
fi
if [[ -z "$SCONTROL" ]] ; then
SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1)
fi
CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p")
function move_sinks_to_new_default {
DEFAULT_SINK=$1
pacmd list-sink-inputs | grep index: | grep -o '[0-9]\+' | while read SINK
do
pacmd move-sink-input $SINK $DEFAULT_SINK
done
}
function set_default_playback_device_next {
inc=${1:-1}
num_devices=$(pacmd list-sinks | grep -c index:)
sink_arr=($(pacmd list-sinks | grep index: | grep -o '[0-9]\+'))
default_sink_index=$(( $(pacmd list-sinks | grep index: | grep -no '*' | grep -o '^[0-9]\+') - 1 ))
default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices ))
default_sink=${sink_arr[$default_sink_index]}
pacmd set-default-sink $default_sink
move_sinks_to_new_default $default_sink
}
case "$BLOCK_BUTTON" in
1) set_default_playback_device_next ;;
2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;;
3) set_default_playback_device_next -1 ;;
4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_INTERVAL%+ ;;
5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_INTERVAL%- ;;
esac
function print_format {
PERCENT="%"
[[ $USE_PERCENT == 0 ]] && PERCENT=""
echo -n '<span background="#4c83ff" foreground="#8A458A"></span><span background="#8A458A" foreground="black"> </span>'
echo -e "<span background=\"#8A458A\" foreground=\"black\">$VOL$PERCENT</span><span foreground=\"#ffd700\" background=\"#8A458A\"> </span>"
}
function print_block {
for name in INDEX NAME VOL MUTED; do
read $name
done < <(pacmd list-sinks | grep "index:\|name:\|volume: front\|muted:" | grep -A3 '*')
INDEX=$(echo "$INDEX" | grep -o '[0-9]\+')
VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 )
VOL="${VOL%?}"
NAME=$(echo "$NAME" | sed \
's/.*<.*\.\(.*\)>.*/\1/; t;'\
's/.*<\(.*\)>.*/\1/; t;'\
's/.*/unknown/')
if [[ $USE_ALSA_NAME == 1 ]] ; then
ALSA_NAME=$(pacmd list-sinks |\
awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
grep "alsa.name\|alsa.mixer_name" |\
head -n1 |\
sed 's/.*= "\(.*\)".*/\1/')
NAME=${ALSA_NAME:-$NAME}
elif [[ $USE_DESCRIPTION == 1 ]] ; then
DESCRIPTION=$(pacmd list-sinks |\
awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
grep "device.description" |\
head -n1 |\
sed 's/.*= "\(.*\)".*/\1/')
NAME=${DESCRIPTION:-$NAME}
fi
if [[ $MUTED =~ "no" ]] ; then
SYMBOL=$AUDIO_HIGH_SYMBOL
[[ $VOL -le $AUDIO_MED_THRESH ]] && SYMBOL=$AUDIO_MED_SYMBOL
[[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMBOL=$AUDIO_LOW_SYMBOL
COLOR=$DEFAULT_COLOR
else
SYMBOL=$AUDIO_MUTED_SYMBOL
COLOR=$MUTED_COLOR
fi
if [[ $SUBSCRIBE == 1 ]] ; then
print_format "$LONG_FORMAT"