From f696e5d5d9340521e0ebffbae489a36544191f10 Mon Sep 17 00:00:00 2001 From: drymer Date: Tue, 24 Jan 2017 11:53:01 +0000 Subject: [PATCH] Cambios varios en i3 --- .gitignore | 2 + i3/config.i3blocks | 228 ++++++++++++++++++++++++++++ i3/i3blocks.conf | 27 ++-- i3/scripts/autolock.sh | 2 +- i3/scripts/exit | 4 +- i3/scripts/lock | 33 ++++ i3/scripts/network | 12 +- i3/scripts/notmuch | 4 + i3/scripts/slack_updates | 7 +- i3/scripts/susp | 6 + i3/scripts/weather.example | 40 +++++ i3/scripts/{weather => weather.old} | 0 12 files changed, 339 insertions(+), 26 deletions(-) create mode 100644 .gitignore create mode 100644 i3/config.i3blocks create mode 100755 i3/scripts/lock create mode 100755 i3/scripts/notmuch create mode 100755 i3/scripts/susp create mode 100755 i3/scripts/weather.example rename i3/scripts/{weather => weather.old} (100%) mode change 100755 => 100644 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01f2f7b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +i3/scripts/weather +emacs.d/private-literate.org \ No newline at end of file diff --git a/i3/config.i3blocks b/i3/config.i3blocks new file mode 100644 index 0000000..60fe80e --- /dev/null +++ b/i3/config.i3blocks @@ -0,0 +1,228 @@ +# Tango colors +# $i3-status + +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 $display LVDS1 +set $display2 VGA1 + +# volver a la misma ventana que estaba apretando el mismo worskpace +workspace_auto_back_and_forth yes + +# abrir una terminal +bindsym $mod+Return exec terminal + +# cerrat ventana +bindsym $mod+Shift+Q kill + +# arrancar dmenu +bindsym $mod+d exec dmenu_run + +# Reinicia i3 +bindsym $mod+Shift+r restart + +# Cambiar foco +bindsym $mod+j focus left +bindsym $mod+k focus down +bindsym $mod+l focus up +bindsym $mod+h 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+j move left +bindsym $mod+Shift+k move down +bindsym $mod+Shift+l move up +bindsym $mod+Shift+semicolon 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+h split h + +# Cambiar la orientación en vertical +bindsym $mod+v split v + +# Fullscreen +bindsym $mod+f fullscreen + +# Cambiar layout +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout default + +# Cambiar entre tiling / floating +bindsym $mod+Shift+space floating toggle + +# Cambiar foco entre tiling / floating windows +bindsym $mod+space focus mode_toggle + +# Foco al padre +bindsym $mod+a focus parent + +# Definir workspaces +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 + +# 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 $ws2 output $display2 +workspace $ws8 output $display1 + +# Cambiar tamaño de ventana +mode "Resize" { + # These bindings trigger as soon as you enter the resize mode + 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 ntilde resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 1 px or 1 ppt + bindsym Down resize grow height 1 px or 1 ppt + bindsym Up resize shrink height 1 px or 1 ppt + bindsym Right resize grow width 1 px or 1 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:DejaVu Sans Mono 11, Awesome, Icons 10 + status_command /usr/local/bin/i3blocks + position top + # quitar los putos números del nombre del workspace + strip_workspace_numbers yes + 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 + } +} + +# Modo sistema +set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown +mode "$mode_system" { + bindsym l exec --no-startup-id ~/.i3/scripts/exit lock, mode "default" + bindsym s exec --no-startup-id ~/.i3/scripts/exit pm-suspend, mode "default" + bindsym r exec --no-startup-id ~/.i3/scripts/exit reboot, mode "default" + bindsym e exec --no-startup-id ~/.i3/scripts/exit logout, mode "default" + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+Escape mode "$mode_system" + +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/Fondos\ de\ Pantalla/hacking-matrix_azul.png + +# Autostart +exec --no-startup-id xbacklight -set 100 +exec --no-startup-id bash ~/.i3/scripts/autolock.sh +exec --no-startup-id parcellite +exec --no-startup-id compton +exec --no-startup-id mpd + +# Mover programas automáticamente a workspace +assign [title="(?i)emacs"] $ws1 +assign [class="(?i)firefox"] $ws2 +assign [class="(?i)tor"] $ws2 +assign [class="(?i)qutebrowser"] $ws2 +assign [class="(?i)icecat"] $ws2 +assign [title="bittorrent"] $ws3 +assign [class="(?i)keepassx"] $ws5 +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="emacsclient"] floating enable + +# i3-gaps +gaps inner 10 +gaps outer 10 +smart_borders on +smart_gaps on diff --git a/i3/i3blocks.conf b/i3/i3blocks.conf index 98a0c33..c51c69c 100644 --- a/i3/i3blocks.conf +++ b/i3/i3blocks.conf @@ -12,18 +12,23 @@ separator=false separator_block_width=5 markup=pango -# [focused window] -# command=xdotool getactivewindow getwindowname -# interval=repeat -# separator=false -# color=#9fbc00 - -[weather] -interval=30600 +[notmuch] +interval=1800 border=#729FCF border_top=0 border_right=0 border_left=0 +signal=1 + +[separator] + +[weather] +interval=3600 +border=#729FCF +border_top=0 +border_right=0 +border_left=0 +signal=1 [separator] @@ -72,9 +77,3 @@ border_top=0 border_right=0 border_left=0 signal=1 - -[separator] - -[batterybar] -interval=5 -min_width=loooooool diff --git a/i3/scripts/autolock.sh b/i3/scripts/autolock.sh index fa4809a..62e1418 100755 --- a/i3/scripts/autolock.sh +++ b/i3/scripts/autolock.sh @@ -1,3 +1,3 @@ #!/bin/sh -xautolock -time 10 -locker "slock" -notify 30 & +xautolock -time 10 -locker "lock" -notify 30 & diff --git a/i3/scripts/exit b/i3/scripts/exit index 827dc8f..035e074 100755 --- a/i3/scripts/exit +++ b/i3/scripts/exit @@ -1,11 +1,11 @@ #!/bin/sh lock() { - slock + lock } case "$1" in lock) - /usr/bin/slock & + /usr/local/bin/lock ;; logout) i3-msg exit diff --git a/i3/scripts/lock b/i3/scripts/lock new file mode 100755 index 0000000..2e100df --- /dev/null +++ b/i3/scripts/lock @@ -0,0 +1,33 @@ +#!/bin/bash + +# 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 diff --git a/i3/scripts/network b/i3/scripts/network index eb81119..c5811ab 100755 --- a/i3/scripts/network +++ b/i3/scripts/network @@ -14,17 +14,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -wlan=eth0 -eth=eth1 +#wlan=eth0 +eth=eth0 if [ `cat /sys/class/net/$eth/operstate` = 'up' ] then INTERFACE=${eth} SYMBOL="" -elif [ `cat /sys/class/net/$wlan/operstate` = 'up' ] -then - INTERFACE=${wlan} - SYMBOL="" +#elif [ `cat /sys/class/net/$wlan/operstate` = 'up' ] +#then +# INTERFACE=${wlan} +# SYMBOL="" else SYMBOL="" fi diff --git a/i3/scripts/notmuch b/i3/scripts/notmuch new file mode 100755 index 0000000..4260256 --- /dev/null +++ b/i3/scripts/notmuch @@ -0,0 +1,4 @@ +#!/bin/bash + +new=`notmuch search tag:unread and tag:inbox 2> /dev/null | wc -l` +echo "$new" diff --git a/i3/scripts/slack_updates b/i3/scripts/slack_updates index 4492963..596fedf 100755 --- a/i3/scripts/slack_updates +++ b/i3/scripts/slack_updates @@ -5,7 +5,10 @@ update="$(echo $update | grep 'No news is good news')" version="$(cat /etc/slackware-version | cut -d' ' -f2)" arch="$(uname -m)" -mirror="http://mirrors.slackware.com/slackware/slackware" +mirror="https://freeslack.net/fxp/freeslack64-14.2/" + +wget -q -O - $mirror/ChangeLog.txt | iconv -f ISO-8859-1 -t UTF-8 > /tmp/changelog.txt + end="$(grep -n '+--------------------------+' /tmp/changelog.txt | head -n1 | cut -d':' -f1)" changelog="$(head -n$end /tmp/changelog.txt | grep txz | cut -d'/' -f2 | cut -d':' -f1)" num_changelog="$(head -n$end /tmp/changelog.txt | grep txz | cut -d'/' -f2 | cut -d':' -f1 | wc -l)" @@ -27,8 +30,6 @@ case $BLOCK_BUTTON in 3) notify-send -u low "`echo "$changelog"`" ;; esac -wget -q -O - $mirror$arch-$version/ChangeLog.txt | iconv -f ISO-8859-1 -t UTF-8 > /tmp/changelog.txt - if [ -z "$update" ] then echo -n " `echo $num_changelog` Updates" diff --git a/i3/scripts/susp b/i3/scripts/susp new file mode 100755 index 0000000..85e9e33 --- /dev/null +++ b/i3/scripts/susp @@ -0,0 +1,6 @@ +#!/bin/bash + +lock +sleep 1 +echo 'mem' > /sys/power/state + diff --git a/i3/scripts/weather.example b/i3/scripts/weather.example new file mode 100755 index 0000000..9dc7fa4 --- /dev/null +++ b/i3/scripts/weather.example @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright (C) 2016 Ning Sun + +# 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 . + +CITY= +APPID="" + +OUTPUT=$(curl --silent http://api.openweathermap.org/data/2.5/weather\?APPID\=$APPID\&q\=$CITY\&units\=metric) + +TEMP=$(echo $OUTPUT | jq -r ".main.temp") +WEATHER=$(echo $OUTPUT | jq -r ".weather[0].main") +case $WEATHER in + "Clear"*) + WEATHER= + ;; + "Rain"*) + WEATHER= + ;; + "Thunderstorm"*) + WEATHER= + ;; + "Clouds"*) + WEATHER= + ;; +esac + +echo "$WEATHER $TEMP°C" +echo "$TEMP°C" diff --git a/i3/scripts/weather b/i3/scripts/weather.old old mode 100755 new mode 100644 similarity index 100% rename from i3/scripts/weather rename to i3/scripts/weather.old