Cambios i3
This commit is contained in:
parent
9c0071dcc7
commit
f2786b9388
31
bash_aliases
31
bash_aliases
|
@ -1,13 +1,24 @@
|
|||
alias binario='torify ssh binario@elbinario.net -p 3222'
|
||||
alias comeflores='ssh comeflores@comeflores.net -p 3222'
|
||||
alias torre='ssh drymer@torre'
|
||||
alias bittorrent='ssh werler@bittorrent'
|
||||
alias banana='ssh drymer@banana'
|
||||
|
||||
alias ipcurl='curl ifconfig.me && curl --silent http://geoiptool.com/|grep maker_country | cut -d" " -f5 | cut -d"<" -f1 | head -n1'
|
||||
alias profanity='torify profanity'
|
||||
alias cuoc='cd /home/drymer/Documentos/UOC/'
|
||||
alias radio_bronka='mplayer http://stream.nonfqdn.net:8000/rbronka.ogg'
|
||||
alias radio_ela='mplayer -playlist http://www.radioela.org/radioela.m3u'
|
||||
alias khal="khal -c ~/.khal/config"
|
||||
alias smediacrush="scrot -d 5 'mediacrush.png' && mediacrush mediacrush.png && rm mediacrush.png"
|
||||
#alias emacs="emacs -nw"
|
||||
alias ipcurl='curl icanhazip.com && curl --silent http://geoiptool.com/|grep maker_country | cut -d" " -f5 | cut -d"<" -f1 | head -n1'
|
||||
alias toripcurl='torify curl icanhazip.com && torify curl --silent http://geoiptool.com/|grep maker_country | cut -d" " -f5 | cut -d"<" -f1 | head -n1'
|
||||
alias pastebinit="pastebinit"
|
||||
alias captura="scrot -d 5 'compartir .png' && pomfload compartir.png && rm compartir.png"
|
||||
alias grep="grep --color"
|
||||
|
||||
#alias emacs="env TERM=xterm-256color emacs -nw"
|
||||
#alias nano="env TERM=xterm-256color nano -nw"
|
||||
alias nano="nano -nw"
|
||||
|
||||
alias suena='echo $(mpc current | cut -d"/" -f1) - $(mpc current | cut -d"/" -f3 | cut -d'.' -f1)'
|
||||
alias khal='khal -c ~/.khal/config'
|
||||
alias ikhal='ikhal -c ~/.khal/config'
|
||||
alias yt='cd ~/Musica/; youtube-dl -x -c -o "%(title)s.%(ext)s" -f "bestaudio" --audio-format "mp3" --audio-quality 0 '
|
||||
alias sube='scrot -d 5 /tmp/mierda.jpg && torify mediacrush /tmp/mierda.jpg && rm /tmp/mierda.jpg && notify-send "Imagen subida"'
|
||||
|
||||
alias notify-send='notify-send -i terminal'
|
||||
|
||||
alias pull="torify git pull"
|
||||
alias push="torify git push"
|
||||
|
|
8
bashrc
8
bashrc
|
@ -29,13 +29,15 @@ unset profile_script
|
|||
source ~/.bash_aliases
|
||||
|
||||
#Green Prompt
|
||||
#PS1='\[\e[0;32m\]\u\[\e[31m\] % \[\e[0;32m\]\h \[\e[1;33m\]\w\[\e[0;32m\]\$ '
|
||||
#PS1='\[\e[0;92m\]\u\[\e[0;93m\] % \[\e[0;92m\]\h \[\e[1;93m\]\w\[\e[0;92m\]\$ '
|
||||
#Blue Prompt
|
||||
PS1='\[\e[1;94m\]\u\[\e[0m\] % \[\e[1;91m\]\h \[\e[1;93m\]\w\[\e[1;34m\] $ \e[0m'
|
||||
PS1='\[\e[1;94m\]\u\[\e[0m\] % \[\e[1;91m\]\h \[\e[1;93m\]\w\[\e[1;34m\] $\[\033[0m\] '
|
||||
|
||||
export EDITOR=/usr/bin/emacs
|
||||
export EDITOR="/usr/local/bin/emacs -nw"
|
||||
export ALTERNATE_EDITOR="vim"
|
||||
export MAKEFLAGS=-j9
|
||||
|
||||
ESC="\033"
|
||||
NORMAL="\[$ESC[m\]"
|
||||
RESET="\[$ESC[${DULL};${FG_WHITE};${BG_NULL}m\]"
|
||||
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
(add-to-list 'load-path "~/.emacs.d/")
|
||||
|
||||
(global-set-key (kbd "C-x C-b") 'ibuffer)
|
||||
(tool-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
(menu-bar-mode -1)
|
||||
(global-set-key [f12] 'eshell)
|
||||
(setq auto-save-default nil)
|
||||
(custom-set-variables
|
||||
'(inhibit-startup-screen t))
|
||||
(custom-set-faces)
|
||||
|
||||
;;; Transparency
|
||||
(set-frame-parameter (selected-frame) 'alpha '(5 50))
|
||||
(add-to-list 'default-frame-alist '(alpha 5 50))
|
||||
;; C-8 will increase opacity (== decrease transparency)
|
||||
;; C-9 will decrease opacity (== increase transparency
|
||||
;; C-0 will returns the state to normal
|
||||
(global-set-key (kbd "C-8") '(lambda()(interactive)(djcb-opacity-modify)))
|
||||
(global-set-key (kbd "C-9") '(lambda()(interactive)(djcb-opacity-modify t)))
|
||||
(global-set-key (kbd "C-0") '(lambda()(interactive)
|
||||
(modify-frame-parameters nil `((alpha . 100)))))
|
||||
;;;Lines Numeration
|
||||
(add-hook 'find-file-hook (lambda () (linum-mode 1)))
|
||||
(global-linum-mode 1)
|
||||
(setq linum-format "%4d \u2502 ")
|
||||
|
||||
;;;Auto-indent
|
||||
(global-set-key (kbd "RET") 'newline-and-indent)
|
||||
|
||||
;;;Compile comand
|
||||
(setq compile-command "gcc -U_FORTIFY_SOURCE -Wall -Wuninitialized -Werror -O1")
|
||||
|
||||
;;; Markdown mode
|
||||
(autoload 'markdown-mode "markdown-mode"
|
||||
"Major mode for editing Markdown files" t)
|
||||
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
|
||||
;; Preview
|
||||
(autoload 'markdown-preview "realtime-markdown-viewer"
|
||||
"Display markdown on a browser in realtime" t)
|
||||
|
||||
;;; Install From Melpa
|
||||
(when (>= emacs-major-version 24)
|
||||
(require 'package)
|
||||
(package-initialize)
|
||||
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
|
||||
)
|
||||
|
||||
;;; PHP Mode
|
||||
(defun my-setup-php ()
|
||||
;; enable web mode
|
||||
(web-mode)
|
||||
|
||||
; auto-complete mode
|
||||
(require 'auto-complete)
|
||||
(auto-complete-mode t)
|
||||
|
||||
;; make these variables local
|
||||
(make-local-variable 'web-mode-code-indent-offset)
|
||||
(make-local-variable 'web-mode-markup-indent-offset)
|
||||
(make-local-variable 'web-mode-css-indent-offset)
|
||||
|
||||
;; set indentation, can set different indentation level for different code type
|
||||
(setq web-mode-code-indent-offset 4)
|
||||
(setq web-mode-css-indent-offset 2)
|
||||
(setq web-mode-markup-indent-offset 2))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.php$" . my-setup-php))
|
||||
|
||||
(setq web-mode-ac-sources-alist
|
||||
'(("css" . (ac-source-words-in-buffer ac-source-css-property))
|
||||
("html" . (ac-source-words-in-buffer ac-source-abbrev))
|
||||
("php" . (ac-source-words-in-buffer
|
||||
ac-source-words-in-same-mode-buffers
|
||||
ac-source-dictionary))))
|
||||
;Activar la función anterior
|
||||
(add-to-list 'auto-mode-alist '("\\.php$" . my-setup-php))
|
||||
|
||||
;; Gatete
|
||||
(nyan-mode)
|
||||
|
75
h2statusrc
75
h2statusrc
|
@ -1,75 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Use this as a template for your own configuration, to be placed in ~/.h2statusrc.
|
||||
# All three functions are optional as a default NOP implementation is provided.
|
||||
# Remember to configure output_format = "i3bar" in ~/.i3status.conf.
|
||||
|
||||
# theme
|
||||
black_dark="#2e3436"
|
||||
black_light="#6e706b"
|
||||
red_dark="#cc0000"
|
||||
red_light="#ef2929"
|
||||
green_dark="#4e9a06"
|
||||
green_light="#8ae234"
|
||||
yellow_dark="#edd400"
|
||||
yellow_light="#fce94f"
|
||||
blue_dark="#3465a4"
|
||||
blue_light="#729fcf"
|
||||
magenta_dark="#92659a"
|
||||
magenta_light="#c19fbe"
|
||||
cyan_dark="#07c7ca"
|
||||
cyan_light="#63e9e9"
|
||||
orange_dark="F57900"
|
||||
orange_light="#FCAF3E"
|
||||
grey_dark="#fdf6e3"
|
||||
|
||||
function status {
|
||||
local POMODORO="$(~/.i3/pomodoro status)"
|
||||
local SENSOR="$(sensors | grep "Physical id 0" | awk '{print $4}')"
|
||||
|
||||
case "${POMODORO}" in
|
||||
work)
|
||||
entry pomodoro " $(~/.i3/pomodoro)" "\"color\":\"${red_light}\""
|
||||
;;
|
||||
break)
|
||||
entry pomodoro " $(~/.i3/pomodoro)" "\"color\":\"${green_light}\""
|
||||
;;
|
||||
*)
|
||||
entry pomodoro ""
|
||||
;;
|
||||
esac
|
||||
if [[ "${POMODORO}" != "work" ]]; then
|
||||
entry mail "$(cached_status mail 60 '~/.i3/mail')" \
|
||||
"\"color\":\"${orange_light}\""
|
||||
fi
|
||||
entry weather "$(cached_status weather 300 '~/.i3/weather')"
|
||||
entry sensor " ${SENSOR#+}"
|
||||
}
|
||||
|
||||
function on_event {
|
||||
case $name in
|
||||
mail) [[ $button == 1 ]] && write_status mail "$(~/.i3/mail)" ;;
|
||||
weather) [[ $button == 1 ]] && write_status weather "$(~/.i3/weather)" ;;
|
||||
pomodoro) [[ $button == 1 ]] && ~/.i3/pomodoro switch
|
||||
;;
|
||||
volume) if [[ $button == 4 ]]; then
|
||||
amixer -D pulse set Master 1%+ && killall -SIGUSR1 i3status
|
||||
elif [[ $button == 5 ]]; then
|
||||
amixer -D pulse set Master 1%- && killall -SIGUSR1 i3status
|
||||
elif [[ $button == 1 ]]; then
|
||||
amixer -D pulse set Master toggle && killall -SIGUSR1 i3status
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function transform {
|
||||
AUDIO="$(amixer get Master | grep 'Front Left:')"
|
||||
AUDIO=${AUDIO#*[}
|
||||
AUDIO=${AUDIO%%\%*}
|
||||
[[ ${AUDIO} -lt 50 ]] && AICON="" || AICON=""
|
||||
|
||||
sed -r "s/♪://g
|
||||
s/VOLUME [^%]*/${AICON} ${AUDIO}/g;
|
||||
s/\"name\":\"mail\",\"full_text\":\"\",\"color\":\"${orange_light}\"/\"name\":\"mail\",\"full_text\":\"\",\"color\":\"${grey_dark}\"/g"
|
||||
}
|
BIN
i3/bell.ogg
BIN
i3/bell.ogg
Binary file not shown.
163
i3/config
163
i3/config
|
@ -10,6 +10,7 @@
|
|||
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
|
||||
# Tango colors
|
||||
# $i3-status
|
||||
|
||||
set color_bad = "#CC0000"
|
||||
set color_degraded = "#EDD400"
|
||||
set color_good = "#73D216"
|
||||
|
@ -53,23 +54,25 @@ set $darkwhite #D3D7CF
|
|||
set $mod Mod4
|
||||
|
||||
# font for window titles. ISO 10646 = Unicode
|
||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||
#font pango:DejaVu Sans Mono 10
|
||||
font pango:DejaVu Sans Mono 11
|
||||
|
||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||
floating_modifier $mod
|
||||
|
||||
# f10 and f11 to modify screenlight
|
||||
bindsym XF86Switch_VT_10 xbacklight -dec 20
|
||||
bindsym XF86Switch_VT_11 xbacklight -inc 20
|
||||
|
||||
#Display
|
||||
set $display LVDS1
|
||||
set $display2 VGA1
|
||||
|
||||
#Multimedia
|
||||
bindsym XF86AudioLowerVolume exec amixer -c 0 set Master 2dB-
|
||||
bindsym XF86AudioRaiseVolume exec amixer -c 0 set Master 2dB+
|
||||
bindsym XF86AudioMute exec amixer -c 0 set Master toggle
|
||||
bindsym $mod+U exec amixer set Master unmute
|
||||
# volver a la misma ventana que estabas
|
||||
workspace_auto_back_and_forth yes
|
||||
|
||||
# start a terminal
|
||||
bindsym $mod+Return exec urxvt
|
||||
|
||||
# kill focused window
|
||||
bindsym $mod+Shift+Q kill
|
||||
|
||||
|
@ -78,6 +81,7 @@ bindsym $mod+d exec dmenu_run
|
|||
|
||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||
bindsym $mod+Shift+r restart
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
|
@ -113,47 +117,56 @@ bindsym $mod+space focus mode_toggle
|
|||
# focus the parent container
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
# focus the child container
|
||||
#bindcode $mod+d focus child
|
||||
# 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 <big>10</big>
|
||||
|
||||
# workspace names
|
||||
workspace "1:Shell" output $display
|
||||
workspace "2:WWW" output $display
|
||||
workspace "3:Shell" output $display
|
||||
workspace "4:Shell" output $display
|
||||
workspace "5:Generic" output $display
|
||||
workspace "6" output $display
|
||||
workspace "7" output $display
|
||||
workspace "8: " output $display
|
||||
workspace "9: " output $display
|
||||
workspace "10" output $display2
|
||||
# workspace $ws1 output $display
|
||||
# workspace $ws2 output $display
|
||||
# workspace $ws3 output $display
|
||||
# workspace $ws4 output $display
|
||||
# workspace $ws5 output $display
|
||||
# workspace $ws6 output $display
|
||||
# workspace $ws7 output $display
|
||||
# workspace $ws8 output $display
|
||||
# workspace $ws9 output $display
|
||||
# workspace $ws10 output $display2
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace 1:Shell
|
||||
bindsym $mod+2 workspace 2:WWW
|
||||
bindsym $mod+3 workspace 3:Shell
|
||||
bindsym $mod+4 workspace 4:Shell
|
||||
bindsym $mod+5 workspace 5:Generic
|
||||
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
|
||||
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
|
||||
|
||||
bindsym $mod+Shift+1 move container to workspace 1:Shell
|
||||
bindsym $mod+Shift+2 move container to workspace 2:WWW
|
||||
bindsym $mod+Shift+3 move container to workspace 3:Shell
|
||||
bindsym $mod+Shift+4 move container to workspace 4:Shell
|
||||
bindsym $mod+Shift+5 move container to workspace 5:Generic
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
# resize window (you can also use the mouse for that)
|
||||
mode "resize" {
|
||||
mode "Resize" {
|
||||
# These bindings trigger as soon as you enter the resize mode
|
||||
|
||||
# Pressing left will shrink the window’s width.
|
||||
|
@ -176,32 +189,32 @@ mode "resize" {
|
|||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
bindsym $mod+r mode "resize"
|
||||
bindsym $mod+r mode "Resize"
|
||||
|
||||
# Start i3bar to display a workspace bar (plus the system information i3status
|
||||
# finds out, if available)
|
||||
bar {
|
||||
font pango:Dyuthi3, Awesome, Icons 10
|
||||
status_command ~/.i3/h2status
|
||||
|
||||
status_command /usr/local/bin/i3blocks
|
||||
# quitar los putos números del nombre del workspace
|
||||
strip_workspace_numbers yes
|
||||
position top
|
||||
|
||||
colors {
|
||||
background #222222
|
||||
separator #555555
|
||||
statusline $darkgrey
|
||||
background #000000
|
||||
separator #000000
|
||||
|
||||
###XXX: Details border backgr. text
|
||||
focused_workspace $lightblue $blue $white
|
||||
inactive_workspace $darkgrey $black $grey
|
||||
active_workspace $black $darkblack $grey
|
||||
urgent_workspace $lightred $red $white
|
||||
focused_workspace #990099 #222222 #729FCF
|
||||
inactive_workspace #222222 #222222 #729FCF
|
||||
active_workspace #222222 #222222 #729FCF
|
||||
urgent_workspace $red #22222 $red
|
||||
}
|
||||
}
|
||||
|
||||
# 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'"
|
||||
|
||||
|
||||
#shutdown
|
||||
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
|
||||
mode "$mode_system" {
|
||||
|
@ -215,27 +228,41 @@ mode "$mode_system" {
|
|||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
bindsym $mod+Escape mode "$mode_system"
|
||||
|
||||
#windows colors
|
||||
new_window pixel
|
||||
# class border backgr. text indicator
|
||||
client.focused $darkblue $darkblue $white $blue
|
||||
client.focused_inactive $darkgrey $black $grey $darkgrey
|
||||
client.unfocused $black $darkblack $grey $darkgrey
|
||||
client.urgent $lightred $red $white $lightred
|
||||
|
||||
#Wallpaper
|
||||
exec --no-startup-id feh --bg-scale ~/Imagenes/Fondos\ de\ Pantalla/hacking-matrix_azul.png
|
||||
# class border backgr text indicator
|
||||
client.focused #990099 #990099 $white $blue
|
||||
client.focused_inactive #990099 #990099 $white $blue
|
||||
client.unfocused #990099 $gray $white $blue
|
||||
client.urgent #FF0000 #8C5665 #ffffff #FF0000
|
||||
|
||||
#Layout
|
||||
assign [class="(?i)firefox"] "2:WWW"
|
||||
assign [class="(?i)tor"] "2:WWW"
|
||||
assign [class="(?i)thunderbird"] "9: "
|
||||
assign [class="(?i)keepassx"] "5:Generic"
|
||||
assign [class="(?i)mumble"] "8: "
|
||||
assign [title="bittorrent"] "3:Chat"
|
||||
# Wallpaper
|
||||
exec --no-startup-id feh --bg-scale ~/Imagenes/Fondos\ de\ Pantalla/Debian_Electric_Blue_by_EnlightenedShadow.jpg
|
||||
|
||||
# Autostart
|
||||
exec --no-startup-id owncloud
|
||||
exec --no-startup-id emacs
|
||||
exec --no-startup-id start-tor
|
||||
exec --no-startup-id iceweasel
|
||||
exec --no-startup-id xmodmap ~/.Xmodmap
|
||||
|
||||
# Move programs to layout
|
||||
assign [class="(?i)iceweasel"] → $ws2
|
||||
assign [class="(?i)tor"] → $ws2
|
||||
assign [class="(?i)icedove"] → $ws9
|
||||
assign [class="(?i)keepassx"] → $ws5
|
||||
assign [class="(?i)mumble"] → $ws8
|
||||
assign [title="bittorrent"] → $ws3
|
||||
assign [title="emacs24@torre"] → $ws1
|
||||
assign [title="Steam"] → $ws7
|
||||
|
||||
|
||||
|
||||
# Enable floating to certain programs
|
||||
for_window [window_role="Preferences"] floating enable
|
||||
for_window [window_role="help-browser"] floating enable
|
||||
for_window [class="(?i)xcalc"] floating enable
|
||||
|
@ -246,3 +273,9 @@ 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
|
||||
|
||||
# gapps
|
||||
gaps inner 10
|
||||
gaps outer 10
|
||||
smart_borders on
|
||||
smart_gaps on
|
||||
|
|
14
i3/exit
14
i3/exit
|
@ -5,22 +5,22 @@ lock() {
|
|||
|
||||
case "$1" in
|
||||
lock)
|
||||
slock
|
||||
i3lock
|
||||
;;
|
||||
logout)
|
||||
i3-msg exit
|
||||
;;
|
||||
suspend)
|
||||
i3lock && pm-suspend
|
||||
;;
|
||||
hibernate)
|
||||
lock && dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
|
||||
password=$(zenity --title Exit --password --text "Introduce tu contraseña:")
|
||||
echo -n $password | sudo --stdin pm-suspend & i3lock
|
||||
;;
|
||||
reboot)
|
||||
sudo /sbin/shutdown -r now
|
||||
password=$(zenity --title Exit --password --text "Introduce tu contraseña:")
|
||||
echo -n $password | sudo --stdin reboot
|
||||
;;
|
||||
shutdown)
|
||||
sudo /sbin/shutdown -h now
|
||||
password=$(zenity --title Exit --password --text "Introduce tu contraseña:")
|
||||
echo -n $password | sudo --stdin poweroff
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
|
||||
|
|
58
i3/h2status
58
i3/h2status
|
@ -1,58 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
function status { :; }
|
||||
|
||||
function on_event { :; }
|
||||
|
||||
function transform { cat; }
|
||||
|
||||
function entry {
|
||||
echo -ne '{"name":"'$1'","full_text":"'$2'"'${3:+,$3}'},'
|
||||
}
|
||||
|
||||
function cached_status {
|
||||
local file=$tmp$1 interval=$2 command=$3
|
||||
read_status $1
|
||||
[[ -f $file ]] && (( $(date +%s) - $(stat -c %Y $file) < $interval )) && return
|
||||
touch $file
|
||||
{ write_status $1 "$(eval $command)"; } >/dev/null &
|
||||
}
|
||||
|
||||
function read_status {
|
||||
[[ -f $tmp$1 ]] && flock -s ${tmp}lock -c "cat $tmp$1"
|
||||
}
|
||||
|
||||
function write_status {
|
||||
flock ${tmp}lock -c "echo '$2' > $tmp$1"
|
||||
update
|
||||
}
|
||||
|
||||
function update {
|
||||
killall -USR1 i3status
|
||||
}
|
||||
|
||||
function event_loop {
|
||||
while read line
|
||||
do
|
||||
eval $(echo "$line" | sed -re 's/^,|\{|\}|"//g' -e 'y/,:/;=/')
|
||||
on_event > /dev/null
|
||||
done
|
||||
}
|
||||
|
||||
function status_loop {
|
||||
read; read; echo -e '{"version":1,"click_events":true}\n['
|
||||
while read line
|
||||
do
|
||||
echo "$line" | sed -r 's/^(,?\[)\{/\1'"$(status)"'{/' | transform
|
||||
done
|
||||
}
|
||||
|
||||
tmp=/tmp/h2status_
|
||||
[[ $1 == "update" && ! $2 ]] && { update; exit 0; }
|
||||
[[ $1 == "write" && $2 && $3 && ! $4 ]] && { write_status $2 "$3"; exit 0; }
|
||||
[[ $* ]] && { echo "Usage: h2status [update|write <module> <value>]"; exit 1; }
|
||||
. ~/.h2statusrc
|
||||
trap 'rm -f $tmp*; exit' EXIT INT TERM HUP
|
||||
rm -f $tmp*
|
||||
i3status | status_loop &
|
||||
event_loop
|
|
@ -0,0 +1,59 @@
|
|||
# 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
|
||||
full_text=
|
||||
align=center
|
||||
color=#990099
|
||||
separator=false
|
||||
separator_block_width=5
|
||||
markup=pango
|
||||
|
||||
[weather]
|
||||
interval=30600
|
||||
border=#729FCF
|
||||
border_top=0
|
||||
border_right=0
|
||||
border_left=0
|
||||
|
||||
[separator]
|
||||
|
||||
[network]
|
||||
interval=10
|
||||
border=#729FCF
|
||||
border_top=0
|
||||
border_right=0
|
||||
border_left=0
|
||||
|
||||
[separator]
|
||||
|
||||
[sensors]
|
||||
interval=1
|
||||
border=#729FCF
|
||||
border_top=0
|
||||
border_right=0
|
||||
border_left=0
|
||||
|
||||
[separator]
|
||||
|
||||
[volume]
|
||||
instance=Master
|
||||
interval=once
|
||||
signal=1
|
||||
border=#729FCF
|
||||
border_top=0
|
||||
border_right=0
|
||||
border_left=0
|
||||
|
||||
[separator]
|
||||
|
||||
[date]
|
||||
interval=1
|
||||
border=#729FCF
|
||||
border_top=0
|
||||
border_right=0
|
||||
border_left=0
|
||||
signal=1
|
BIN
i3/loud-bell.ogg
BIN
i3/loud-bell.ogg
Binary file not shown.
15
i3/openvpn
15
i3/openvpn
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
TMP=/var/run/openvpn.pid
|
||||
|
||||
ps="$(ps aux|grep openvpn | grep 'openvpn --config' | grep -v grep | cut -d' ' -f1)"
|
||||
|
||||
if [[ -z $ps ]];
|
||||
then
|
||||
if [[ -e $TMP ]];
|
||||
then
|
||||
rm $TMP
|
||||
fi
|
||||
else
|
||||
echo $(pidof openvpn) > $TMP
|
||||
fi
|
59
i3/pomodoro
59
i3/pomodoro
|
@ -1,59 +0,0 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
TMP=/tmp/drymer-pomodoro.pid
|
||||
|
||||
pomodoro_time=1500
|
||||
break_time=300
|
||||
long_break=4
|
||||
|
||||
if [[ -f ${TMP} ]]; then
|
||||
read date1 state count < ${TMP}
|
||||
if [[ ${1} == switch ]]; then
|
||||
echo "stop!"
|
||||
rm ${TMP}
|
||||
exit
|
||||
elif [[ ${1} == status ]]; then
|
||||
echo ${state}
|
||||
exit
|
||||
fi
|
||||
date2=$(date +"%s")
|
||||
diff=$(($date2-$date1))
|
||||
if [[ ${state} == "work" ]]; then
|
||||
if [[ ${diff} -le ${pomodoro_time} ]]; then
|
||||
time=$(($pomodoro_time-$diff))
|
||||
min=$(($time/60))
|
||||
sec=$(($time%60))
|
||||
printf "%0*d:%0*d\n" 2 ${min} 2 ${sec}
|
||||
else
|
||||
mplayer ~/.i3/loud-bell.ogg 2> /dev/null &
|
||||
if [[ ${count} -lt ${long_break} ]]; then
|
||||
echo "00:00"
|
||||
notify-send "Pomodoro" "Take a break!"
|
||||
echo "$(date +"%s") break ${count}" > ${TMP}
|
||||
else
|
||||
echo "00:00"
|
||||
notify-send "Pomodoro" "Take a long break!" &
|
||||
rm ${TMP}
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [[ ${diff} -le ${break_time} ]]; then
|
||||
time=$(($break_time-$diff))
|
||||
min=$(($time/60))
|
||||
sec=$(($time%60))
|
||||
printf "%0*d:%0*d\n" 2 ${min} 2 ${sec}
|
||||
else
|
||||
echo "00:00"
|
||||
mplayer ~/.i3/bell.ogg 2> /dev/null &
|
||||
echo "$(date +"%s") work $((++count))" > ${TMP}
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [[ ${1} == switch ]]; then
|
||||
echo "start!"
|
||||
mplayer ~/.i3/bell.ogg 2> /dev/null &
|
||||
echo "$(date +"%s") work 1" > ${TMP}
|
||||
elif [[ ${1} == status ]]; then
|
||||
echo "stop"
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,73 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
|
||||
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
|
||||
#
|
||||
# Licensed under the terms of the GNU GPL v3, or any later version.
|
||||
#
|
||||
# This script is meant to use with i3blocks. It parses the output of the "acpi"
|
||||
# command (often provided by a package of the same name) to read the status of
|
||||
# the battery, and eventually its remaining time (to full charge or discharge).
|
||||
#
|
||||
# The color will gradually change for a percentage below 85%, and the urgency
|
||||
# (exit code 33) is set if there is less that 5% remaining.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
||||
my $acpi;
|
||||
my $status;
|
||||
my $percent;
|
||||
my $full_text;
|
||||
my $short_text;
|
||||
|
||||
# read the first line of the "acpi" command output
|
||||
open (ACPI, 'acpi -b |') or die "Can't exec acpi: $!\n";
|
||||
$acpi = <ACPI>;
|
||||
close(ACPI);
|
||||
|
||||
# fail on unexpected output
|
||||
if ($acpi !~ /: (\w+), (\d+)%/) {
|
||||
die "$acpi\n";
|
||||
}
|
||||
|
||||
$status = $1;
|
||||
$percent = $2;
|
||||
$full_text = "$percent%";
|
||||
|
||||
if ($status eq 'Discharging') {
|
||||
$full_text .= ' DIS';
|
||||
} elsif ($status eq 'Charging') {
|
||||
$full_text .= ' CHR';
|
||||
}
|
||||
|
||||
$short_text = $full_text;
|
||||
|
||||
if ($acpi =~ /(\d\d:\d\d):/) {
|
||||
$full_text .= " ($1)";
|
||||
}
|
||||
|
||||
# print text
|
||||
print "$full_text\n";
|
||||
print "$short_text\n";
|
||||
|
||||
# consider color and urgent flag only on discharge
|
||||
if ($status eq 'Discharging') {
|
||||
|
||||
if ($percent < 20) {
|
||||
print "#FF0000\n";
|
||||
} elsif ($percent < 40) {
|
||||
print "#FFAE00\n";
|
||||
} elsif ($percent < 60) {
|
||||
print "#FFF600\n";
|
||||
} elsif ($percent < 85) {
|
||||
print "#A8FF00\n";
|
||||
}
|
||||
|
||||
if ($percent < 5) {
|
||||
exit(33);
|
||||
}
|
||||
}
|
||||
|
||||
exit(0);
|
|
@ -0,0 +1,55 @@
|
|||
#!/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
|
||||
printf "%.2f%%\n", $cpu_usage;
|
||||
printf "%.2f%%\n", $cpu_usage;
|
||||
|
||||
# Print color, if needed
|
||||
if ($cpu_usage >= $t_crit) {
|
||||
print "#FF0000\n";
|
||||
exit 33;
|
||||
} elsif ($cpu_usage >= $t_warn) {
|
||||
print "#FFFC00\n";
|
||||
}
|
||||
|
||||
exit 0;
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
time='<span foreground="#729FCF"></span> '"$(date '+%H:%M:%S')"
|
||||
date='<span foreground="#729FCF"></span> '"$(date '+%d/%m/%Y')"
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "$date" ;;
|
||||
3) notify-send "$date" ;;
|
||||
esac
|
||||
|
||||
echo -n "$time"
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
# 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/>.
|
||||
|
||||
DIR="${BLOCK_INSTANCE:-$HOME}"
|
||||
ALERT_LOW="${1:-10}" # color will turn red under this value (default: 10%)
|
||||
|
||||
df -h -P -l "$DIR" 2>/dev/null |
|
||||
awk -v alert_low=$ALERT_LOW '
|
||||
/\/.*/ {
|
||||
# full text
|
||||
print $4
|
||||
|
||||
# short text
|
||||
print $4
|
||||
|
||||
use=$5
|
||||
|
||||
# no need to continue parsing
|
||||
exit 0
|
||||
}
|
||||
END {
|
||||
gsub(/%$/,"",use)
|
||||
if (100 - use < alert_low) {
|
||||
# color
|
||||
print "#FF0000"
|
||||
}
|
||||
}
|
||||
'
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) xbacklight -inc 20 ;; # left click, high light
|
||||
3) xbacklight -dec 20 ;; # right click, low light
|
||||
4) xbacklight -inc 20 ;; # scroll up, increase light
|
||||
5) xbacklight -dec 20 ;; # scroll down, decrease light
|
||||
esac
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
# 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/>.
|
||||
|
||||
load="$(cut -d ' ' -f1 /proc/loadavg)"
|
||||
cpus="$(nproc)"
|
||||
|
||||
# full text
|
||||
echo "$load"
|
||||
|
||||
# short text
|
||||
echo "$load"
|
||||
|
||||
# color if load is too high
|
||||
if [ $(awk 'BEGIN{ print "'$cpus'"<="'$load'" }') -eq 1 ]; then
|
||||
echo "#FF0000"
|
||||
fi
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh
|
||||
# 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}"
|
||||
|
||||
awk -v type=$TYPE '
|
||||
/^MemTotal:/ {
|
||||
mem_total=$2
|
||||
}
|
||||
/^MemFree:/ {
|
||||
mem_free=$2
|
||||
}
|
||||
/^Buffers:/ {
|
||||
mem_free+=$2
|
||||
}
|
||||
/^Cached:/ {
|
||||
mem_free+=$2
|
||||
}
|
||||
/^SwapTotal:/ {
|
||||
swap_total=$2
|
||||
}
|
||||
/^SwapFree:/ {
|
||||
swap_free=$2
|
||||
}
|
||||
END {
|
||||
# full text
|
||||
if (type == "swap")
|
||||
printf("%.1fG\n", (swap_total-swap_free)/1024/1024)
|
||||
else
|
||||
printf("%.1fG\n", mem_free/1024/1024)
|
||||
|
||||
# TODO: short text
|
||||
|
||||
# TODO: color (if less than X%)
|
||||
}
|
||||
' /proc/meminfo
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
# 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/>.
|
||||
|
||||
INTERFACE="${1:-eth0}"
|
||||
|
||||
state="$(cat /sys/class/net/$INTERFACE/operstate)"
|
||||
|
||||
ISON=$(ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && echo On || echo Off)
|
||||
ipaddr="$(ip addr show $INTERFACE | perl -n -e'/inet (.+)\// && print $1')"
|
||||
ipaddr="${ipaddr:-0.0.0.0}"
|
||||
|
||||
if [ "$ISON" = "Off" ] || [ "$state" != 'up' ]; then # no internet? color will turn red
|
||||
echo -n '<span foreground="red"></span> Down'
|
||||
exit 33
|
||||
else
|
||||
echo -n '<span foreground="#729FCF"></span> '"$ipaddr"
|
||||
exit 0
|
||||
fi
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo -n '<span foreground="#729FCF"></span> ' "$(sensors | grep temp1 | cut -d"+" -f2 | cut -d" " -f1)"
|
|
@ -0,0 +1,27 @@
|
|||
################################
|
||||
# Calculates a given expression
|
||||
#
|
||||
# Dependencies:
|
||||
# - bc
|
||||
#
|
||||
# @param {String} 1: The expression to calculate
|
||||
# @return {Number}: The result of the expression
|
||||
################################
|
||||
calc() {
|
||||
echo "$1" | bc
|
||||
}
|
||||
|
||||
|
||||
################################
|
||||
# Counts lines in text, accounting for empty values
|
||||
#
|
||||
# @param {String} 1: The input text
|
||||
# @return {Number}: The number of lines
|
||||
################################
|
||||
numLines() {
|
||||
if [[ $1 == "" ]]; then
|
||||
echo 0
|
||||
else
|
||||
echo "$1" | wc -l
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
#!/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="default"
|
||||
[ -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 foreground="red"> </span>'
|
||||
echo -e $print
|
||||
exit 33
|
||||
else
|
||||
echo -n '<span foreground="#729FCF"> </span>'
|
||||
echo -e $print
|
||||
exit 0
|
||||
fi
|
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
################################
|
||||
# Shows info about the weather (in Cincinnati) from accuweather.com
|
||||
#
|
||||
# TODO: completely rewrite, probably using openweather APIs
|
||||
# TODO: make location configurable
|
||||
# TODO: make temperature unit configurable
|
||||
#
|
||||
# @return {Number(degrees Fahrenheit)}: Current temperature in Cincinnati
|
||||
################################
|
||||
|
||||
dir=$(dirname $0)
|
||||
source $dir/util.sh
|
||||
|
||||
full=""
|
||||
short=""
|
||||
color=""
|
||||
status=0
|
||||
|
||||
|
||||
URL='http://www.accuweather.com/en/es/barcelona/307297/weather-forecast/307297'
|
||||
SITE="$(torify curl -s "$URL")"
|
||||
|
||||
weather="$(echo "$SITE" | awk -F\' '/acm__RecentLocationsCarousel\.push/{print $14 }'| head -1)"
|
||||
temp="$(echo "$SITE" | awk -F\' '/acm_RecentLocationsCarousel\.push/{print $12"°" }'| head -1)"
|
||||
|
||||
|
||||
if [[ $weather == *thunder* || $weather == *Thunder* ]]; then
|
||||
icon=""
|
||||
else
|
||||
if [[ $weather == *rain* || $weather == *Rain* ]]; then
|
||||
icon=""
|
||||
else
|
||||
if [[ $weather == *cloud* || $weather == *Cloud* ]]; then
|
||||
icon=""
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
full='<span foreground="#729FCF">'"$icon"'</span> '"$temp"
|
||||
short="$temp"
|
||||
|
||||
|
||||
echo $full
|
||||
echo $short
|
||||
echo $color
|
||||
exit $status
|
45
i3/weather
45
i3/weather
|
@ -1,45 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
readonly TMP="$(mktemp /tmp/openweather.XXXXXX)"
|
||||
|
||||
CITY="Barcelona, ES"
|
||||
UNITS=metric
|
||||
URL="http://api.openweathermap.org/data/2.5/weather"
|
||||
|
||||
torify wget -q "${URL}?q=${CITY}&mode=xml&units=${UNITS}" -O ${TMP}
|
||||
|
||||
TEMPERATURE=$(xmllint --xpath "string(//temperature/@value)" ${TMP})
|
||||
HUMIDITY=$(xmllint --xpath "string(//humidity/@value)" ${TMP})
|
||||
WEATHER=$(xmllint --xpath "string(//weather/@icon)" ${TMP})
|
||||
if [[ $? -ne 0 ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
rm ${TMP}
|
||||
|
||||
case ${WEATHER} in
|
||||
01d|02d)
|
||||
ICON=""
|
||||
;;
|
||||
01n|02n)
|
||||
ICON=""
|
||||
;;
|
||||
03*|04*)
|
||||
ICON=""
|
||||
;;
|
||||
09*|10*)
|
||||
ICON=""
|
||||
;;
|
||||
11*)
|
||||
ICON=""
|
||||
;;
|
||||
13*)
|
||||
ICON=""
|
||||
;;
|
||||
50*)
|
||||
ICON=""
|
||||
;;
|
||||
esac
|
||||
|
||||
#LC_NUMERIC="C" printf '%s %0.0f°C %0.0f\n' "${ICON}" "${TEMPERATURE}" "${HUMIDITY}%"
|
||||
echo "$ICON $TEMPERATUREºC $HUMIDITY%"
|
|
@ -1,63 +0,0 @@
|
|||
# i3status configuration file.
|
||||
# see "man i3status" for documentation.
|
||||
|
||||
# It is important that this file is edited as UTF-8.
|
||||
# The following line should contain a sharp s:
|
||||
# ß
|
||||
# If the above line is not correctly displayed, fix your editor first!
|
||||
|
||||
|
||||
general {
|
||||
output_format = "i3bar"
|
||||
#colors = true
|
||||
color_good = "#12A90D"
|
||||
color_bad = "#CC0000"
|
||||
color_degraded = "#EDD400"
|
||||
interval = 1
|
||||
}
|
||||
|
||||
#order += "run_watch VPN"
|
||||
order += "battery 0"
|
||||
order += "volume master"
|
||||
order += "ethernet eth0"
|
||||
order += "tztime local"
|
||||
|
||||
|
||||
wireless wlan0 {
|
||||
format_up = "Wifi: (%quality at %essid, %bitrate) %ip"
|
||||
format_up = "%ip"
|
||||
format_down = ""
|
||||
}
|
||||
|
||||
run_watch VPN {
|
||||
pidfile = "/var/run/openvpn.pid"
|
||||
# format_up = "VPN"
|
||||
# format_down = "ho"
|
||||
}
|
||||
|
||||
ethernet eth0 {
|
||||
# if you use %speed, i3status requires the cap_net_admin capability
|
||||
format_up = ""
|
||||
format_down = ""#""
|
||||
}
|
||||
|
||||
battery 0 {
|
||||
format = " %percentage"
|
||||
path = "/sys/class/power_supply/BAT%d/uevent"
|
||||
low_threshold = 10
|
||||
#format_up = "a"
|
||||
format_down = ""
|
||||
last_full_capacity = true
|
||||
}
|
||||
#meter vpn
|
||||
tztime local {
|
||||
format = " %a %b %d | %H:%M:%S"
|
||||
}
|
||||
|
||||
volume master {
|
||||
format = ": %volume"
|
||||
device = "default"
|
||||
mixer = "Master"
|
||||
mixer_idx = 0
|
||||
}
|
||||
|
145
root_bashrc
145
root_bashrc
|
@ -1,125 +1,42 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
# Set the default system $PATH:
|
||||
PATH="/sbin/:/usr/sbin/:/usr/local/bin:/usr/bin:/bin:/usr/games"
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
# I had problems with the backspace key using 'eval tset' instead of 'TERM=',
|
||||
# but you might want to try it anyway instead of the section below it. I
|
||||
# think with the right /etc/termcap it would work.
|
||||
# eval `tset -sQ "$TERM"`
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
# Set TERM to linux for unknown type or unset variable:
|
||||
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
|
||||
TERM=linux
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
#force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
# Notify user of incoming mail. This can be overridden in the user's
|
||||
# local startup file (~/.bash.login or whatever, depending on the shell)
|
||||
if [ -x /usr/bin/biff ]; then
|
||||
biff y 2> /dev/null
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='\[\e[1;34m\]\u\[\e[0m\] % \[\e[31m\]\h \[\e[93m\]\w\[\e[1;34m\] $ '
|
||||
else
|
||||
PS1='\[\e[1;34m\]\u\[\e[0m\] % \[\e[31m\]\h \[\e[93m\]\w\[\e[1;34m\] $ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1='\[\e[1;34m\]\u\[\e[0m\] % \[\e[31m\]\h \[\e[93m\]\w\[\e[1;34m\] $ '
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# some more ls aliases
|
||||
#alias ll='ls -l'
|
||||
#alias la='ls -A'
|
||||
#alias l='ls -CF'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
# Append any additional sh scripts found in /etc/profile.d/:
|
||||
for profile_script in /etc/profile.d/*.sh ; do
|
||||
if [ -x $profile_script ]; then
|
||||
. $profile_script
|
||||
fi
|
||||
fi
|
||||
done
|
||||
unset profile_script
|
||||
|
||||
#source ~/.bash_aliases
|
||||
|
||||
#Green Prompt
|
||||
#PS1='\[\e[0;92m\]\u\[\e[0;93m\] % \[\e[0;92m\]\h \[\e[1;93m\]\w\[\e[0;92m\]\$ '
|
||||
#Blue Prompt
|
||||
PS1='\[\e[1;94m\]\u\[\e[0m\] % \[\e[1;91m\]\h \[\e[1;93m\]\w\[\e[1;34m\] # \e[0m'
|
||||
|
||||
export EDITOR="/usr/bin/emacs -nw"
|
||||
|
||||
alias busca='slackpkg file-search'
|
||||
alias instala='slackpkg install'
|
||||
alias quita='slackpkg remove'
|
||||
alias reinstala='slackpkg reinstall'
|
||||
alias actualiza="slackpkg update && slackpkg upgrade-all"
|
||||
|
||||
alias git="torify git"
|
||||
alias emacs="emacs -nw"
|
||||
PS1='\[\e[1;94m\]\u\[\e[0m\] % \[\e[1;91m\]\h \[\e[1;93m\]\w\[\e[1;34m\] $\[\033[0m\] '
|
||||
|
||||
export EDITOR="/usr/local/bin/emacs -nw"
|
||||
export ALTERNATE_EDITOR="vim"
|
||||
export MAKEFLAGS=-j9
|
||||
|
||||
ESC="\033"
|
||||
NORMAL="\[$ESC[m\]"
|
||||
RESET="\[$ESC[${DULL};${FG_WHITE};${BG_NULL}m\]"
|
||||
|
|
Loading…
Reference in New Issue