commit 63486f5372e47ce81788da2b2a67d32dc35a25c4
parent 435d7a8da14003848dcf43153189d03de2c036b3
Author: oscarbenedito <oscar@oscarbenedito.com>
Date:   Fri, 24 Apr 2020 22:25:09 +0200

New i3 config (with i3blocks and dunst)

Diffstat:
M.chezmoiignore | 2++
Adot_config/dunst/dunstrc | 257+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdot_config/i3/config | 446+++++++++++++++++++++----------------------------------------------------------
Adot_config/i3blocks/bin/executable_battery2 | 102+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adot_config/i3blocks/bin/executable_disk | 4++++
Adot_config/i3blocks/bin/executable_volume-pulseaudio | 182+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adot_config/i3blocks/config | 20++++++++++++++++++++
7 files changed, 686 insertions(+), 327 deletions(-)

diff --git a/.chezmoiignore b/.chezmoiignore @@ -1,8 +1,10 @@ COPYING README.md +meta {{ if not .website }}.local/bin/website{{ end }} {{ if not (eq .chezmoi.hostname "white") }} .config/kitty +{{ else }} .config/i3 {{ end }} {{ if not .backup }} diff --git a/dot_config/dunst/dunstrc b/dot_config/dunst/dunstrc @@ -0,0 +1,257 @@ +[global] +font = Iosevka Term 11 + +# Allow a small subset of html markup: +# <b>bold</b> +# <i>italic</i> +# <s>strikethrough</s> +# <u>underline</u> +# +# For a complete reference see +# <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>. +# If markup is not allowed, those tags will be stripped out of the +# message. +markup = yes +plain_text = no + +# The format of the message. Possible variables are: +# %a appname +# %s summary +# %b body +# %i iconname (including its path) +# %I iconname (without its path) +# %p progress value if set ([ 0%] to [100%]) or nothing +# Markup is allowed +format = "<b>%s</b>\n%b" + +# Sort messages by urgency. +sort = no + +# Show how many messages are currently hidden (because of geometry). +indicate_hidden = yes + +# Alignment of message text. +# Possible values are "left", "center" and "right". +alignment = center + +# The frequency with wich text that is longer than the notification +# window allows bounces back and forth. +# This option conflicts with "word_wrap". +# Set to 0 to disable. +bounce_freq = 0 + +# Show age of message if message is older than show_age_threshold +# seconds. +# Set to -1 to disable. +show_age_threshold = -1 + +# Split notifications into multiple lines if they don't fit into +# geometry. +word_wrap = yes + +# Ignore newlines '\n' in notifications. +ignore_newline = no + +# Hide duplicate's count and stack them +stack_duplicates = yes +hide_duplicates_count = yes + + +# The geometry of the window: +# [{width}]x{height}[+/-{x}+/-{y}] +# The geometry of the message window. +# The height is measured in number of notifications everything else +# in pixels. If the width is omitted but the height is given +# ("-geometry x2"), the message window expands over the whole screen +# (dmenu-like). If width is 0, the window expands to the longest +# message displayed. A positive x is measured from the left, a +# negative from the right side of the screen. Y is measured from +# the top and down respectevly. +# The width can be negative. In this case the actual width is the +# screen width minus the width defined in within the geometry option. +#geometry = "250x50-40+40" +geometry = "300x50-15+49" + +# Shrink window if it's smaller than the width. Will be ignored if +# width is 0. +shrink = no + +# The transparency of the window. Range: [0; 100]. +# This option will only work if a compositing windowmanager is +# present (e.g. xcompmgr, compiz, etc.). +transparency = 5 + +# Don't remove messages, if the user is idle (no mouse or keyboard input) +# for longer than idle_threshold seconds. +# Set to 0 to disable. +idle_threshold = 0 + +# Which monitor should the notifications be displayed on. +monitor = 0 + +# Display notification on focused monitor. Possible modes are: +# mouse: follow mouse pointer +# keyboard: follow window with keyboard focus +# none: don't follow anything +# +# "keyboard" needs a windowmanager that exports the +# _NET_ACTIVE_WINDOW property. +# This should be the case for almost all modern windowmanagers. +# +# If this option is set to mouse or keyboard, the monitor option +# will be ignored. +follow = none + +# Should a notification popped up from history be sticky or timeout +# as if it would normally do. +sticky_history = yes + +# Maximum amount of notifications kept in history +history_length = 15 + +# Display indicators for URLs (U) and actions (A). +show_indicators = no + +# The height of a single line. If the height is smaller than the +# font height, it will get raised to the font height. +# This adds empty space above and under the text. +line_height = 3 + +# Draw a line of "separatpr_height" pixel height between two +# notifications. +# Set to 0 to disable. +separator_height = 2 + +# Padding between text and separator. +padding = 6 + +# Horizontal padding. +horizontal_padding = 6 + +# Define a color for the separator. +# possible values are: +# * auto: dunst tries to find a color fitting to the background; +# * foreground: use the same color as the foreground; +# * frame: use the same color as the frame; +# * anything else will be interpreted as a X color. +separator_color = frame + +# Print a notification on startup. +# This is mainly for error detection, since dbus (re-)starts dunst +# automatically after a crash. +startup_notification = false + +# dmenu path. +dmenu = /usr/bin/dmenu -p dunst: + +# Browser for opening urls in context menu. +browser = /usr/bin/firefox -new-tab + +# Align icons left/right/off +icon_position = off +max_icon_size = 80 + +# Paths to default icons. +icon_path = /usr/share/icons/Paper/16x16/mimetypes/:/usr/share/icons/Paper/48x48/status/:/usr/share/icons/Paper/16x16/devices/:/usr/share/icons/Paper/48x48/notifications/:/usr/share/icons/Paper/48x48/emblems/ + +frame_width = 3 +frame_color = "#8EC07C" + +[shortcuts] + +# Shortcuts are specified as [modifier+][modifier+]...key +# Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", +# "mod3" and "mod4" (windows-key). +# Xev might be helpful to find names for keys. + +# Close notification. +close = ctrl+space + +# Close all notifications. +close_all = ctrl+shift+space + +# Redisplay last message(s). +# On the US keyboard layout "grave" is normally above TAB and left +# of "1". +history = ctrl+grave + +# Context menu. +context = ctrl+shift+period + +[urgency_low] +# IMPORTANT: colors have to be defined in quotation marks. +# Otherwise the "#" and following would be interpreted as a comment. +frame_color = "#98C379" +foreground = "#98C379" +background = "#282C34" +#background = "#2B313C" +timeout = 4 + +[urgency_normal] +frame_color = "#61AFEF" +foreground = "#61AFEF" +background = "#282C34" +#background = "#2B313C" +timeout = 6 + +[urgency_critical] +frame_color = "#E06C75" +foreground = "#E06C75" +background = "#282C34" +#background = "#2B313C" +timeout = 8 + + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# Messages can be matched by "appname", "summary", "body", "icon", "category", +# "msg_urgency" and you can override the "timeout", "urgency", "foreground", +# "background", "new_icon" and "format". +# Shell-like globbing will get expanded. +# +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: if you don't want a notification to be displayed, set the format +# to "". +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# format = "" + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +# vim: ft=cfg diff --git a/dot_config/i3/config b/dot_config/i3/config @@ -1,88 +1,46 @@ +# This file has been auto-generated by i3-config-wizard(1). +# It will not be overwritten, so edit it as you like. +# +# Should you change your keyboard layout some time, delete +# this file and re-run i3-config-wizard(1). +# + # i3 config file (v4) -# Please see http://i3wm.org/docs/userguide.html for a complete reference! +# +# Please see https://i3wm.org/docs/userguide.html for a complete reference! -# Set mod key (Mod1=<Alt>, Mod4=<Super>) set $mod Mod4 -# set default desktop layout (default is tiling) -# workspace_layout tabbed <stacking|tabbed> - -# Configure border style <normal|1pixel|pixel xx|none|pixel> -default_border pixel 1 -default_floating_border normal - -# Hide borders -hide_edge_borders none - -# change borders -bindsym $mod+u border none -bindsym $mod+y border pixel 1 -bindsym $mod+n border normal - # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. -font xft:URWGothic-Book 11 +font pango:monospace 10 -# Use Mouse+$mod to drag floating windows -floating_modifier $mod +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +#font pango:DejaVu Sans Mono 8 -# start a terminal -bindsym $mod+Return exec kitty +# Before i3 v4.8, we used to recommend this one as the default: +# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +# The font above is very space-efficient, that is, it looks good, sharp and +# clear in small sizes. However, its unicode glyph coverage is limited, the old +# X core fonts rendering does not support right-to-left and this being a bitmap +# font, it doesn’t scale on retina/hidpi displays. -# other programs -bindsym $mod+o mode "$mode_open" -set $mode_open (k)eepassxc, (q)utebrowser -mode "$mode_open" { - bindsym k exec keepassxc, mode "default" - bindsym q exec qutebrowser, mode "default" +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod - # exit open mode: "Enter" or "Escape" - bindsym Return mode "default" - bindsym Escape mode "default" -} +# start a terminal +bindsym $mod+Return exec i3-sensible-terminal # kill focused window bindsym $mod+Shift+q kill -# start program launcher -bindsym $mod+d exec --no-startup-id dmenu_recency - -# launch categorized menu -bindsym $mod+z exec --no-startup-id morc_menu - -################################################################################################ -## sound-section - DO NOT EDIT if you wish to automatically upgrade Alsa -> Pulseaudio later! ## -################################################################################################ - -exec --no-startup-id volumeicon -bindsym $mod+Ctrl+m exec terminal -e 'alsamixer' -#exec --no-startup-id pulseaudio -#exec --no-startup-id pa-applet -#bindsym $mod+Ctrl+m exec pavucontrol - -################################################################################################ - -# Screen brightness controls -# bindsym XF86MonBrightnessUp exec "xbacklight -inc 10; notify-send 'brightness up'" -# bindsym XF86MonBrightnessDown exec "xbacklight -dec 10; notify-send 'brightness down'" - -# Start Applications -bindsym $mod+Ctrl+b exec terminal -e 'bmenu' -bindsym $mod+F2 exec palemoon -bindsym $mod+F3 exec pcmanfm -# bindsym $mod+F3 exec ranger -bindsym $mod+Shift+F3 exec pcmanfm_pkexec -bindsym $mod+F5 exec terminal -e 'mocp' -bindsym $mod+t exec --no-startup-id pkill compton -bindsym $mod+Ctrl+t exec --no-startup-id compton -b -bindsym $mod+Shift+d --release exec "killall dunst; exec notify-send 'restart dunst'" -bindsym Print exec --no-startup-id i3-scrot -bindsym $mod+Print --release exec --no-startup-id i3-scrot -w -bindsym $mod+Shift+Print --release exec --no-startup-id i3-scrot -s -# bindsym $mod+Shift+h exec xdg-open /usr/share/doc/manjaro/i3_help.pdf -bindsym $mod+Ctrl+x --release exec --no-startup-id xkill - -# focus_follows_mouse no +# start dmenu (a program launcher) +bindsym $mod+d exec dmenu_run +# There also is the (new) i3-dmenu-desktop which only displays applications +# shipping a .desktop file. It is a wrapper around dmenu, so you need that +# installed. +# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop # change focus bindsym $mod+h focus left @@ -108,17 +66,10 @@ bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right -# workspace back and forth (with/without active container) -workspace_auto_back_and_forth yes -bindsym $mod+b workspace back_and_forth -bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth - -# split orientation -#bindsym $mod+h split h;exec notify-send 'tile horizontally' +# toggle split orientation (horizontal/vertical) bindsym $mod+v split toggle;exec notify-send 'tile toggled' -#bindsym $mod+q split toggle -# toggle fullscreen mode for the focused container +# enter fullscreen mode for the focused container bindsym $mod+f fullscreen toggle # change container layout (stacked, tabbed, toggle split) @@ -130,37 +81,26 @@ bindsym $mod+e layout toggle split bindsym $mod+Shift+space floating toggle # change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle - -# toggle sticky -bindsym $mod+Shift+s sticky toggle +#bindsym $mod+space focus mode_toggle # focus the parent container bindsym $mod+a focus parent -# move the currently focused window to the scratchpad -bindsym $mod+Shift+minus move scratchpad - -# Show the next scratchpad window or hide the focused scratchpad window. -# If there are multiple scratchpad windows, this command cycles through them. -bindsym $mod+minus scratchpad show - -#navigate workspaces next / previous -bindsym $mod+Ctrl+Right workspace next -bindsym $mod+Ctrl+Left workspace prev - -# Workspace names -# to display names or symbols instead of plain workspace numbers you can use -# something like: set $ws1 1:mail -# set $ws2 2: -set $ws1 1 -set $ws2 2 -set $ws3 3 -set $ws4 4 -set $ws5 5 -set $ws6 6 -set $ws7 7 -set $ws8 8 +# focus the child container +#bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +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" # switch to workspace bindsym $mod+1 workspace $ws1 @@ -171,18 +111,10 @@ 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 -# Move focused container to workspace -bindsym $mod+Ctrl+1 move container to workspace $ws1 -bindsym $mod+Ctrl+2 move container to workspace $ws2 -bindsym $mod+Ctrl+3 move container to workspace $ws3 -bindsym $mod+Ctrl+4 move container to workspace $ws4 -bindsym $mod+Ctrl+5 move container to workspace $ws5 -bindsym $mod+Ctrl+6 move container to workspace $ws6 -bindsym $mod+Ctrl+7 move container to workspace $ws7 -bindsym $mod+Ctrl+8 move container to workspace $ws8 - -# Move to workspace with focused container +# move focused container to workspace bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1 bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2 bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3 @@ -191,240 +123,100 @@ bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5 bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6 bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7 bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8 - -# Open applications on specific workspaces -# assign [class="Thunderbird"] $ws1 -# assign [class="Pale moon"] $ws2 -# assign [class="Pcmanfm"] $ws3 -# assign [class="Skype"] $ws5 - -# Open specific applications in floating mode -for_window [title="alsamixer"] floating enable border pixel 1 -for_window [class="calamares"] floating enable border normal -for_window [class="Clipgrab"] floating enable -for_window [title="File Transfer*"] floating enable -for_window [class="fpakman"] floating enable -for_window [class="Galculator"] floating enable border pixel 1 -for_window [class="GParted"] floating enable border normal -for_window [title="i3_help"] floating enable sticky enable border normal -for_window [class="Lightdm-settings"] floating enable -for_window [class="Lxappearance"] floating enable sticky enable border normal -for_window [class="Manjaro-hello"] floating enable -for_window [class="Manjaro Settings Manager"] floating enable border normal -for_window [title="MuseScore: Play Panel"] floating enable -for_window [class="Nitrogen"] floating enable sticky enable border normal -for_window [class="Oblogout"] fullscreen enable -for_window [class="octopi"] floating enable -for_window [title="About Pale Moon"] floating enable -for_window [class="Pamac-manager"] floating enable -for_window [class="Pavucontrol"] floating enable -for_window [class="qt5ct"] floating enable sticky enable border normal -for_window [class="Qtconfig-qt4"] floating enable sticky enable border normal -for_window [class="Simple-scan"] floating enable border normal -for_window [class="(?i)System-config-printer.py"] floating enable border normal -for_window [class="Skype"] floating enable border normal -for_window [class="Timeset-gui"] floating enable border normal -for_window [class="(?i)virtualbox"] floating enable border normal -for_window [class="Xfburn"] floating enable - -# switch to workspace with urgent window automatically -for_window [urgent=latest] focus +bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9 +bindsym $mod+Shift+0 move container to workspace $ws10; workspace $ws10 # reload the configuration file bindsym $mod+Shift+c reload - # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) bindsym $mod+Shift+r restart - # exit i3 (logs you out of your X session) -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" - -# Set shut down, restart and locking features -bindsym $mod+0 mode "$mode_system" -set $mode_system (l)ock, (e)xit, switch_(u)ser, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown -mode "$mode_system" { - bindsym l exec --no-startup-id i3exit lock, mode "default" - bindsym s exec --no-startup-id i3exit suspend, mode "default" - bindsym u exec --no-startup-id i3exit switch_user, mode "default" - bindsym e exec --no-startup-id i3exit logout, mode "default" - bindsym h exec --no-startup-id i3exit hibernate, mode "default" - bindsym r exec --no-startup-id i3exit reboot, mode "default" - bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default" +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'" - # exit system mode: "Enter" or "Escape" - bindsym Return mode "default" - bindsym Escape mode "default" +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym h resize shrink width 5 px or 5 ppt + bindsym j resize grow height 5 px or 5 ppt + bindsym k resize shrink height 5 px or 5 ppt + bindsym l resize grow width 5 px or 5 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 or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" } -# Resize window (you can also use the mouse for that) bindsym $mod+r mode "resize" -mode "resize" { - # These bindings trigger as soon as you enter the resize mode - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym j resize shrink width 5 px or 5 ppt - bindsym k resize grow height 5 px or 5 ppt - bindsym l resize shrink height 5 px or 5 ppt - bindsym semicolon resize grow width 5 px or 5 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 - - # exit resize mode: Enter or Escape - bindsym Return mode "default" - bindsym Escape mode "default" -} -# Lock screen -bindsym $mod+9 exec --no-startup-id blurlock - -# Autostart applications -exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 -exec --no-startup-id nitrogen --restore; sleep 1; compton -b -#exec --no-startup-id manjaro-hello -exec --no-startup-id nm-applet -exec --no-startup-id xfce4-power-manager -exec --no-startup-id pamac-tray -exec --no-startup-id clipit -# exec --no-startup-id blueman-applet -# exec_always --no-startup-id sbxkb -exec --no-startup-id start_conky_maia -# exec --no-startup-id start_conky_green -exec --no-startup-id xautolock -time 10 -locker blurlock -exec_always --no-startup-id ff-theme-util -exec_always --no-startup-id fix_xcursor - -# Color palette used for the terminal ( ~/.Xresources file ) -# Colors are gathered based on the documentation: -# https://i3wm.org/docs/userguide.html#xresources -# Change the variable name at the place you want to match the color -# of your terminal like this: -# [example] -# If you want your bar to have the same background color as your -# terminal background change the line 362 from: -# background #14191D -# to: -# background $term_background -# Same logic applied to everything else. -set_from_resource $term_background background -set_from_resource $term_foreground foreground -set_from_resource $term_color0 color0 -set_from_resource $term_color1 color1 -set_from_resource $term_color2 color2 -set_from_resource $term_color3 color3 -set_from_resource $term_color4 color4 -set_from_resource $term_color5 color5 -set_from_resource $term_color6 color6 -set_from_resource $term_color7 color7 -set_from_resource $term_color8 color8 -set_from_resource $term_color9 color9 -set_from_resource $term_color10 color10 -set_from_resource $term_color11 color11 -set_from_resource $term_color12 color12 -set_from_resource $term_color13 color13 -set_from_resource $term_color14 color14 -set_from_resource $term_color15 color15 - -# Start i3bar to display a workspace bar (plus the system information i3status if available) +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) bar { - i3bar_command i3bar - status_command i3status - position bottom - -## please set your primary output first. Example: 'xrandr --output eDP1 --primary' -# tray_output primary -# tray_output eDP1 - - bindsym button4 nop - bindsym button5 nop -# font xft:URWGothic-Book 11 - strip_workspace_numbers yes - - colors { - background #222D31 - statusline #F9FAF9 - separator #454947 - -# border backgr. text - focused_workspace #F9FAF9 #16a085 #292F34 - active_workspace #595B5B #353836 #FDF6E3 - inactive_workspace #595B5B #222D31 #EEE8D5 - binding_mode #16a085 #2C2C2C #F9FAF9 - urgent_workspace #16a085 #FDF6E3 #E5201D - } + font pango:mono 10 + status_command i3blocks + position top + tray_output none } -# hide/unhide i3status bar -bindsym $mod+m bar mode toggle -# Theme colors -# class border backgr. text indic. child_border - client.focused #556064 #556064 #80FFF9 #FDF6E3 - client.focused_inactive #2F3D44 #2F3D44 #1ABC9C #454948 - client.unfocused #2F3D44 #2F3D44 #1ABC9C #454948 - client.urgent #CB4B16 #FDF6E3 #1ABC9C #268BD2 - client.placeholder #000000 #0c0c0c #ffffff #000000 +bindsym XF86AudioRaiseVolume exec amixer -q -D pulse sset Master unmute && amixer -q -D pulse sset Master 5%+ && pkill -RTMIN+10 i3blocks +bindsym XF86AudioLowerVolume exec amixer -q -D pulse sset Master unmute && amixer -q -D pulse sset Master 5%- && pkill -RTMIN+10 i3blocks +bindsym XF86AudioMute exec amixer -q -D pulse sset Master toggle && pkill -RTMIN+10 i3blocks - client.background #2B2C2B +for_window [class=".*"] border pixel 0 -############################# -### settings for i3-gaps: ### -############################# +exec --no-startup-id "setxkbmap -option 'caps:super' es" +exec --no-startup-id "xcape -e 'Super_L=Escape'" +exec --no-startup-id "numlockx" +exec --no-startup-id "mullvad connect" -# Set inner/outer gaps -gaps inner 14 -gaps outer -2 +for_window [class="^.*"] border pixel 2 +gaps inner 15 +smart_gaps on +smart_borders on -# Additionally, you can issue commands with the following syntax. This is useful to bind keys to changing the gap size. -# gaps inner|outer current|all set|plus|minus <px> -# gaps inner all set 10 -# gaps outer all plus 5 +exec --no-startup-id "xwallpaper --zoom $HOME/.config/i3/wallpaper.png" -# Smart gaps (gaps used if only more than one container on the workspace) -smart_gaps on +# Aquesta comanda ha de ser post setxkbmap +exec --no-startup-id "$HOME/.local/bin/,configure-monitors" -# Smart borders (draw borders around container only if it is not the only container on this workspace) -# on|no_gaps (on=always activate and no_gaps=only activate if the gap size to the edge of the screen is 0) -smart_borders on +bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 15 +bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 15 -# Press $mod+Shift+g to enter the gap mode. Choose o or i for modifying outer/inner gaps. Press one of + / - (in-/decrement for current workspace) or 0 (remove gaps for current workspace). If you also press Shift with these keys, the change will be global for all workspaces. -set $mode_gaps Gaps: (o) outer, (i) inner -set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global) -set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global) -bindsym $mod+Shift+g mode "$mode_gaps" - -mode "$mode_gaps" { - bindsym o mode "$mode_gaps_outer" - bindsym i mode "$mode_gaps_inner" - bindsym Return mode "default" - bindsym Escape mode "default" -} -mode "$mode_gaps_inner" { - bindsym plus gaps inner current plus 5 - bindsym minus gaps inner current minus 5 - bindsym 0 gaps inner current set 0 +bindsym $mod+space exec "$HOME/.local/bin/,toggle-kbmap" - bindsym Shift+plus gaps inner all plus 5 - bindsym Shift+minus gaps inner all minus 5 - bindsym Shift+0 gaps inner all set 0 +# open program shortcuts +bindsym $mod+o mode "$mode_open" +set $mode_open (f)irefox, (k)eepassxc +mode "$mode_open" { + bindsym k exec keepassxc, mode "default" + bindsym f exec firefox, mode "default" - bindsym Return mode "default" - bindsym Escape mode "default" + # exit open mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" } -mode "$mode_gaps_outer" { - bindsym plus gaps outer current plus 5 - bindsym minus gaps outer current minus 5 - bindsym 0 gaps outer current set 0 - bindsym Shift+plus gaps outer all plus 5 - bindsym Shift+minus gaps outer all minus 5 - bindsym Shift+0 gaps outer all set 0 +bindsym $mod+m mode "$mode_system" +set $mode_system (l)ock, (e)xit, (r)eboot, (s)hutdown +mode "$mode_system" { + bindsym l exec --no-startup-id i3exit lock, mode "default" + bindsym e exec --no-startup-id i3exit logout, mode "default" + bindsym r exec --no-startup-id i3exit reboot, mode "default" + bindsym s exec --no-startup-id i3exit shutdown, mode "default" - bindsym Return mode "default" - bindsym Escape mode "default" + # exit system mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" } diff --git a/dot_config/i3blocks/bin/executable_battery2 b/dot_config/i3blocks/bin/executable_battery2 @@ -0,0 +1,102 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 James Murphy +# Licensed under the GPL version 2 only +# +# A battery indicator blocklet script for i3blocks + +import re +from subprocess import check_output + +status = check_output(['acpi'], universal_newlines=True) + +if not status: + # stands for no battery found + fulltext = "<span color='red'><span font='FontAwesome'>\uf00d \uf240</span></span>" + percentleft = 100 +else: + # if there is more than one battery in one laptop, the percentage left is + # available for each battery separately, although state and remaining + # time for overall block is shown in the status of the first battery + batteries = status.split("\n") + state_batteries=[] + commasplitstatus_batteries=[] + percentleft_batteries=[] + time = "" + for battery in batteries: + if battery!='': + state_batteries.append(battery.split(": ")[1].split(", ")[0]) + commasplitstatus = battery.split(", ") + if not time: + time = commasplitstatus[-1].strip() + # check if it matches a time + time = re.match(r"(\d+):(\d+)", time) + if time: + time = ":".join(time.groups()) + timeleft = " ({})".format(time) + else: + timeleft = "" + + p = int(commasplitstatus[1].rstrip("%\n")) + if p>0: + percentleft_batteries.append(p) + commasplitstatus_batteries.append(commasplitstatus) + state = state_batteries[0] + commasplitstatus = commasplitstatus_batteries[0] + if percentleft_batteries: + percentleft = int(sum(percentleft_batteries)/len(percentleft_batteries)) + else: + percentleft = 0 + + # stands for charging + FA_LIGHTNING = "<span color='yellow'><span font='FontAwesome'>\uf0e7</span></span>" + + # stands for plugged in + FA_PLUG = "<span font='FontAwesome'>\uf1e6</span>" + + # stands for using battery + FA_BATTERY = "<span font='FontAwesome'>\uf240</span>" + + # stands for unknown status of battery + FA_QUESTION = "<span font='FontAwesome'>\uf128</span>" + + + if state == "Discharging": + fulltext = FA_BATTERY + " " + elif state == "Full": + fulltext = FA_PLUG + " " + timeleft = "" + elif state == "Unknown": + fulltext = FA_QUESTION + " " + FA_BATTERY + " " + timeleft = "" + else: + fulltext = FA_LIGHTNING + " " + FA_PLUG + " " + + def color(percent): + if percent < 10: + # exit code 33 will turn background red + return "#FFFFFF" + if percent < 20: + return "#FF3300" + if percent < 30: + return "#FF6600" + if percent < 40: + return "#FF9900" + if percent < 50: + return "#FFCC00" + if percent < 60: + return "#FFFF00" + if percent < 70: + return "#FFFF33" + if percent < 80: + return "#FFFF66" + return "#FFFFFF" + + form = '<span color="{}">{}%</span>' + fulltext += form.format(color(percentleft), percentleft) + fulltext += timeleft + +print(fulltext) +print(fulltext) +if percentleft < 10: + exit(33) diff --git a/dot_config/i3blocks/bin/executable_disk b/dot_config/i3blocks/bin/executable_disk @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +#echo -n "<span font='FontAwesome'> </span> "; df -h -l --output='used' "$HOME" | grep -E -o '[0-9]+G' +echo -n "<span font='FontAwesome'> </span> "; df -h -l --output='avail' "$HOME" | grep -E -o '[0-9]+G' diff --git a/dot_config/i3blocks/bin/executable_volume-pulseaudio b/dot_config/i3blocks/bin/executable_volume-pulseaudio @@ -0,0 +1,182 @@ +#!/bin/bash +# Displays the default device, volume, and mute status for i3blocks + +set -a + +AUDIO_HIGH_SYMBOL=${AUDIO_HIGH_SYMBOL:-"<span font='FontAwesome'></span>"} + +AUDIO_MED_THRESH=${AUDIO_MED_THRESH:-50} +AUDIO_MED_SYMBOL=${AUDIO_MED_SYMBOL:-"<span font='FontAwesome'></span>"} + +AUDIO_LOW_THRESH=${AUDIO_LOW_THRESH:-0} +AUDIO_LOW_SYMBOL=${AUDIO_LOW_SYMBOL:-"<span font='FontAwesome'></span>"} + +AUDIO_MUTED_SYMBOL=${AUDIO_MUTED_SYMBOL:-"<span font='FontAwesome'></span>"} + +AUDIO_DELTA=${AUDIO_DELTA:-5} + +DEFAULT_COLOR=${DEFAULT_COLOR:-"#ffffff"} +MUTED_COLOR=${MUTED_COLOR:-"#a0a0a0"} + +LONG_FORMAT=${LONG_FORMAT:-'${SYMB} ${VOL}%'} +SHORT_FORMAT=${SHORT_FORMAT:-'${SYMB} ${VOL}% [${INDEX}]'} +MUTED_FORMAT=${MUTED_FORMAT:-'${SYMB}'} +USE_ALSA_NAME=${USE_ALSA_NAME:-0} +USE_DESCRIPTION=${USE_DESCRIPTION:-0} + +SUBSCRIBE=${SUBSCRIBE:-0} + +MIXER=${MIXER:-""} +SCONTROL=${SCONTROL:-""} + +while getopts F:Sf:adH: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" ;; + 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, with exposed variables: +\${SYMB}, \${VOL}, \${INDEX}, \${NAME} +-S\tSubscribe to volume events (requires persistent block, always uses long format) +-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_DELTA +-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_DELTA%+ ;; + 5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%- ;; +esac + +function print_format { + echo "$1" | envsubst '${SYMB}${VOL}${INDEX}${NAME}' +} + +function print_block { + ACTIVE=$(pacmd list-sinks | grep "state\: RUNNING" -B4 -A7 | grep "index:\|name:\|volume: \(front\|mono\)\|muted:") + [ -z "$ACTIVE" ] && ACTIVE=$(pacmd list-sinks | grep "index:\|name:\|volume: \(front\|mono\)\|muted:" | grep -A3 '*') + for name in INDEX NAME VOL MUTED; do + read $name + done < <(echo "$ACTIVE") + 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 + SYMB=$AUDIO_HIGH_SYMBOL + [[ $VOL -le $AUDIO_MED_THRESH ]] && SYMB=$AUDIO_MED_SYMBOL + [[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMB=$AUDIO_LOW_SYMBOL + COLOR=$DEFAULT_COLOR + else + SYMB=$AUDIO_MUTED_SYMBOL + #COLOR=$MUTED_COLOR + COLOR=$DEFAULT_COLOR + fi + + if [[ $SUBSCRIBE == 1 ]] ; then + print_format "$LONG_FORMAT" + else + if [[ $MUTED =~ "no" ]] && [ $VOL != $AUDIO_LOW_THRESH ]; then + print_format "$LONG_FORMAT" + print_format "$SHORT_FORMAT" + else + print_format "$MUTED_FORMAT" + print_format "$MUTED_FORMAT" + fi + echo "$COLOR" + fi +} + +print_block +if [[ $SUBSCRIBE == 1 ]] ; then + while read -r EVENT; do + print_block + done < <(pactl subscribe | stdbuf -oL grep change) +fi diff --git a/dot_config/i3blocks/config b/dot_config/i3blocks/config @@ -0,0 +1,20 @@ +separator_block_width=30 +markup=pango + +[disk] +command=$HOME/.config/i3blocks/bin/disk +interval=30 + +[volume] +command=$HOME/.config/i3blocks/bin/volume-pulseaudio +interval=once +signal=10 + +[battery] +command=$HOME/.config/i3blocks/bin/battery2 +markup=pango +interval=30 + +[datetime] +command=date +"%a %d %b %H:%M" +interval=5