commit 8e313873c8e52586879e04c05934f15758377464 Author: JuliusFreudenberger Date: Tue Aug 31 14:18:45 2021 +0200 Add initial config diff --git a/alacritty/.config/alacritty/alacritty.yml b/alacritty/.config/alacritty/alacritty.yml new file mode 100644 index 0000000..92405ef --- /dev/null +++ b/alacritty/.config/alacritty/alacritty.yml @@ -0,0 +1,23 @@ +colors: + primary: + background: '#000000' + foreground: '#c0c0c0' + normal: + black: '#000000' + red: '#cd0000' + green: '#00cd00' + yellow: '#cdcd00' + blue: '#0000cd' + magenta: '#cd00cd' + cyan: '#00cdcd' + white: '#faebd7' + bright: + black: '#404040' + red: '#ff0000' + green: '#00ff00' + yellow: '#ffff00' + blue: '#0000ff' + magenta: '#ff00ff' + cyan: '#00ffff' + white: '#ffffff' + diff --git a/bash/.bash_profile b/bash/.bash_profile new file mode 100644 index 0000000..5545f00 --- /dev/null +++ b/bash/.bash_profile @@ -0,0 +1,5 @@ +# +# ~/.bash_profile +# + +[[ -f ~/.bashrc ]] && . ~/.bashrc diff --git a/bash/.bashrc b/bash/.bashrc new file mode 100644 index 0000000..54d0f96 --- /dev/null +++ b/bash/.bashrc @@ -0,0 +1,145 @@ +# +# ~/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# Make colorcoding available for everyone + +Black='\e[0;30m' # Black +Red='\e[0;31m' # Red +Green='\e[0;32m' # Green +Yellow='\e[0;33m' # Yellow +Blue='\e[0;34m' # Blue +Purple='\e[0;35m' # Purple +Cyan='\e[0;36m' # Cyan +White='\e[0;37m' # White + +# Bold +BBlack='\e[1;30m' # Black +BRed='\e[1;31m' # Red +BGreen='\e[1;32m' # Green +BYellow='\e[1;33m' # Yellow +BBlue='\e[1;34m' # Blue +BPurple='\e[1;35m' # Purple +BCyan='\e[1;36m' # Cyan +BWhite='\e[1;37m' # White + +# Background +On_Black='\e[40m' # Black +On_Red='\e[41m' # Red +On_Green='\e[42m' # Green +On_Yellow='\e[43m' # Yellow +On_Blue='\e[44m' # Blue +On_Purple='\e[45m' # Purple +On_Cyan='\e[46m' # Cyan +On_White='\e[47m' # White + +NC="\e[m" # Color Reset + + +# new alert text +ALERT=${BWhite}${On_Red} # Bold White on red background + +# mostly used alias functions + +alias cls="clear" +alias ..="cd .." +alias cd..="cd .." +alias ls="ls -CF --color=auto" +alias ll="ls -lisa --color=auto" +alias lsl="ls -lhFA | less" +alias home="cd ~" +alias df="df -ahiT --total" +alias mkdir="mkdir -pv" +alias userlist="cut -d: -f1 /etc/passwd" +alias fhere="find . -name " +alias free="free -mt" +#alias du="du -ach | sort -h" +alias ps="ps auxf" +alias psgrep="ps aux | grep -v grep | grep -i -e VSZ -e" +alias wget="wget -c" +alias histg="history | grep" +alias myip="curl http://ipecho.net/plain; echo" +alias logs="find /var/log -type f -exec file {} \; | grep 'text' | cut -d' ' -f1 | sed -e's/:$//g' | grep -v '[0-9]$' | xargs tail -f" +alias folders='find . -maxdepth 1 -type d -print0 | xargs -0 du -sk | sort -rn' +alias grep='grep --color=auto' + +alias cal='cal -wm3' +# Creates an archive (*.tar.gz) from given directory. +function maketar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; } + +# Create a ZIP archive of a file or folder. +function makezip() { zip -r "${1%%/}.zip" "$1" ; } + +function extract { + if [ -z "$1" ]; then + # display usage if no parameters given + echo "Usage: extract ." + else + if [ -f $1 ] ; then + # NAME=${1%.*} + # mkdir $NAME && cd $NAME + case $1 in + *.tar.bz2) tar xvjf ../$1 ;; + *.tar.gz) tar xvzf ../$1 ;; + *.tar.xz) tar xvJf ../$1 ;; + *.lzma) unlzma ../$1 ;; + *.bz2) bunzip2 ../$1 ;; + *.rar) unrar x -ad ../$1 ;; + *.gz) gunzip ../$1 ;; + *.tar) tar xvf ../$1 ;; + *.tbz2) tar xvjf ../$1 ;; + *.tgz) tar xvzf ../$1 ;; + *.zip) unzip ../$1 ;; + *.Z) uncompress ../$1 ;; + *.7z) 7z x ../$1 ;; + *.xz) unxz ../$1 ;; + *.exe) cabextract ../$1 ;; + *) echo "extract: '$1' - unknown archive method" ;; + esac + else + echo "$1 - file does not exist" + fi +fi +} + +# jump directorys upwards until it hits a directory with multiple folders +up(){ + local d="" + limit=$1 + for ((i=1 ; i <= limit ; i++)) + do + d=$d/.. + done + d=$(echo $d | sed 's/^\///') + if [ -z "$d" ]; then + d=.. + fi + cd $d +} + +# create an directory and directly cd into it +mcd () { + mkdir -p $1 + cd $1 +} + +# set PATH so it includes user's private bin directories +PATH="$HOME/.local/bin:$PATH" + +export PS1="\[\033[38;5;12m\][\[$(tput sgr0)\]\[\033[38;5;10m\]\u\[$(tput sgr0)\]\[\033[38;5;12m\]@\[$(tput sgr0)\]\[\033[38;5;7m\]\h\[$(tput sgr0)\]\[\033[38;5;12m\]]\[$(tput sgr0)\]\[\033[38;5;15m\]: \[$(tput sgr0)\]\[\033[38;5;7m\]\w\[$(tput sgr0)\]\[\033[38;5;12m\]>\[$(tput sgr0)\]\[\033[38;5;10m\]\\$\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]" + +[ -e "/etc/DIR_COLORS" ] && DIR_COLORS="/etc/DIR_COLORS" +[ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors" +[ -e "$DIR_COLORS" ] || DIR_COLORS="" +eval "`dircolors -b $DIR_COLORS`" + +alias calsync="vdirsyncer sync" +alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME' +alias vim=nvim + +export EDITOR=nvim +export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" + diff --git a/dunst/.config/dunst/dunstrc b/dunst/.config/dunst/dunstrc new file mode 100644 index 0000000..ea329fc --- /dev/null +++ b/dunst/.config/dunst/dunstrc @@ -0,0 +1,303 @@ +[global] + frame_width = 1 + frame_color = "#788388" + + font = Noto Sans 10 + + # Allow a small subset of html markup: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # If markup is not allowed, those tags will be stripped out of the + # message. + markup = yes + + # 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 = "%s %p\n%b" + + # Sort messages by urgency. + sort = yes + + # 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 = left + + # 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 = 5 + + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Split notifications into multiple lines if they don't fit into + # geometry. + word_wrap = no + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + + # 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 = "0x4-25+25" + + # Shrink window if it's smaller than the width. Will be ignored if + # width is 0. + shrink = yes + + # 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 = 15 + + # 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. + # default 120 + idle_threshold = 120 + + # 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 = mouse + + # 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 = 20 + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + # 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 = 0 + + # Draw a line of "separator_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 1 + + # Padding between text and separator. + # padding = 8 + padding = 8 + + # Horizontal padding. + horizontal_padding = 10 + + # 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 = #263238 + + # 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 = palemoon + + # Align icons left/right/off + icon_position = left + + # Paths to default icons. + icon_path = /usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/ + + # Limit icons size. + max_icon_size=128 + +[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 = mod1+space + + # Close all notifications. + # close_all = ctrl+shift+space + close_all = ctrl+mod1+space + + # Redisplay last message(s). + # On the US keyboard layout "grave" is normally above TAB and left + # of "1". + history = ctrl+mod4+h + + # Context menu. + context = ctrl+mod1+c + +[urgency_low] + # IMPORTANT: colors have to be defined in quotation marks. + # Otherwise the "#" and following would be interpreted as a comment. + background = "#263238" + foreground = "#556064" + timeout = 10 + +[urgency_normal] + background = "#263238" + foreground = "#F9FAF9" + timeout = 10 + +[urgency_critical] + background = "#D62929" + foreground = "#F9FAF9" + timeout = 0 + + +# 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 +# +#[Claws Mail] +# appname = claws-mail +# category = email.arrived +# urgency = normal +# background = "#2F899E" +# foreground = "#FFA247" +# +#[mute.sh] +# appname = mute +# category = mute.sound +# script = mute.sh +# +#[JDownloader] +# appname = JDownloader +# category = JD +# background = "#FFA247" +# foreground = "#FFFFFF" +# +#[newsbeuter] +# summary = *Feeds* +# background = "#A8EB41" +# foreground = "#FFFFFF" +# +[irc] + appname = weechat + timeout = 0 + background = "#0033bb" + foreground = "#dddddd" +# +[weechat hl] + appname = weechat + category = weechat.HL + background = "#FF5C47" + foreground = "#FFFFFF" +# +[weechat pn] + appname = weechat + category = weechat.PM + background = "#D53B84" + foreground = "#FFFFFF" +# +#[CMUS] +# appname = CMUS +# category = cmus +# background = "#6C4AB7" +# foreground = "#FFE756" +# +# +# background = "#30AB70" +# foreground = "#F67245" +# +# vim: ft=cfg + diff --git a/git/.gitconfig b/git/.gitconfig new file mode 100644 index 0000000..27effd2 --- /dev/null +++ b/git/.gitconfig @@ -0,0 +1,13 @@ +[alias] + status = st + st = status + co = checkout +[pull] + rebase = false +[init] + defaultBranch = main +[diff] + guitool = meld + tool = meld +[difftool] + prompt = false diff --git a/i3/.config/i3/config b/i3/.config/i3/config new file mode 100644 index 0000000..f2d400b --- /dev/null +++ b/i3/.config/i3/config @@ -0,0 +1,447 @@ +# i3 config file (v4) +# Please see http://i3wm.org/docs/userguide.html for a complete reference! + +# Set mod key (Mod1=, Mod4=) +set $mod Mod4 + +#set location for i3exit-helper script +set $i3exit /home/julius/.config/i3/i3exit + +set $screen_config /home/julius/.config/screen + +# set default desktop layout (default is tiling) +# workspace_layout tabbed + +# Configure border style +#new_window pixel 1 +new_float 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 + +# Use Mouse+$mod to drag floating windows +floating_modifier $mod + +# start a terminal +bindsym $mod+Return exec kitty + +# kill focused window +bindsym $mod+Shift+q kill + +# start program launcher +#bindsym $mod+d exec --no-startup-id dmenu_recency +bindsym $mod+d exec --no-startup-id rofi -show drun +bindsym $mod+Tab exec --no-startup-id rofi -show window +#bindsym $mod+Shift+p exec --no-startup-id bwmenu +bindsym $mod+Shift+p exec --no-startup-id rofi-rbw --action copy-password + +bindsym $mod+Shift+v exec --no-startup-id /home/julius/.local/bin/startvm.sh + +# Screen brightness controls +bindsym XF86MonBrightnessUp exec "brightnessctl s +10%" +#; notify-send 'brightness up'" +bindsym XF86MonBrightnessDown exec "brightnessctl s 10%-" +#; notify-send 'brightness down'" + +# volume controls +bindsym XF86AudioRaiseVolume exec amixer -q set Master 5%+ unmute +bindsym XF86AudioLowerVolume exec amixer -q set Master 5%- unmute +bindsym XF86AudioMute exec amixer -q set Master toggle +bindsym XF86AudioMicMute exec amixer -q set Capture toggle +bindsym $mod+c exec amixer -q set Capture toggle + +# media player controls +bindsym XF86AudioPlay exec playerctl -i firefox play-pause +bindsym $mod+ctrl+space exec playerctl -i firefox play-pause +bindsym $mod+z exec playerctl volume 5- +bindsym $mod+x exec playerctl volume 5+ +bindsym XF86AudioNext exec playerctl next +bindsym XF86Favorites exec playerctl next +bindsym XF86AudioPrev exec playerctl previous +bindsym XF86Tools exec playerctl previous + +# Start Applications +bindsym $mod+F2 exec firefox +bindsym $mod+Shift+F2 exec firefox --private-window +bindsym $mod+F3 exec nemo +# bindsym $mod+F3 exec ranger +bindsym $mod+t exec --no-startup-id pkill compton +bindsym $mod+F4 exec thunderbird +bindsym $mod+Ctrl+t exec --no-startup-id compton -b +bindsym $mod+Ctrl+Shift+d --release exec "killall dunst; exec notify-send 'restart dunst'" +bindsym Shift+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+Ctrl+x --release exec --no-startup-id xkill + +bindsym $mod+Shift+d mode "$mode_applications" +set $mode_applications (D)iscord, (S)ignal, (T)elegram, (N)extcloud, (M)usic, (B)luetooth +mode "$mode_applications" { + bindsym d exec flatpak run com.discordapp.Discord + bindsym s exec signal-desktop + bindsym t exec telegram-desktop + bindsym n exec nextcloud + bindsym m exec flatpak run com.spotify.Client + bindsym b exec blueman + + # exit mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# focus_follows_mouse no + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +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+g split horizontal;exec notify-send 'tile horizontally' +bindsym $mod+v split v;exec notify-send 'tile vertically' +bindsym $mod+q split toggle + +# toggle fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +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 + +# 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 +set $ws1 "1: Main" +set $ws2 "2: " +set $ws3 "3: " +set $ws4 "4: " +set $ws5 "5: " +set $ws6 "6: " +set $ws7 7 +set $ws8 8 + +# switch to 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 + +# Move focused container to 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 + +# Move to workspace with focused container +bindsym $mod+Ctrl+1 move container to workspace $ws1; workspace $ws1 +bindsym $mod+Ctrl+2 move container to workspace $ws2; workspace $ws2 +bindsym $mod+Ctrl+3 move container to workspace $ws3; workspace $ws3 +bindsym $mod+Ctrl+4 move container to workspace $ws4; workspace $ws4 +bindsym $mod+Ctrl+5 move container to workspace $ws5; workspace $ws5 +bindsym $mod+Ctrl+6 move container to workspace $ws6; workspace $ws6 +bindsym $mod+Ctrl+7 move container to workspace $ws7; workspace $ws7 +bindsym $mod+Ctrl+8 move container to workspace $ws8; workspace $ws8 + +# Open applications on specific workspaces +assign [class="Thunderbird"] $ws6 +assign [class="TelegramDesktop"] $ws5 +assign [class="discord"] $ws5 +assign [class="Signal"] $ws5 +assign [class="Slack"] $ws5 + +# Open specific applications in floating mode +for_window [class="Galculator"] floating enable border pixel 1 +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="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="Timeset-gui"] floating enable border normal +for_window [class="Gnome-calculator"] floating enable +for_window [class="Blueman-manager"] floating enable +for_window [class="Nm-connection-editor"] floating enable +for_window [class="zoom"] floating enable + +# 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 Shift+l exec --no-startup-id $i3exit slock, 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" + + # exit system mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+p mode "$mode_screen" +bindsym XF86Display mode "$mode_screen" +set $mode_screen (1) mobile, (2) 1920, (3) 1024, (4) 1280, (5) 1680, (Shift+2) double 1920 +mode "$mode_screen" { + bindsym 1 exec --no-startup-id autorandr mobile, mode "default" + bindsym 2 exec --no-startup-id autorandr 1920, mode "default" + bindsym 3 exec --no-startup-id autorandr 4:3, mode "default" + bindsym 4 exec --no-startup-id $screen_config/1280.sh, mode "default" + bindsym 5 exec --no-startup-id $screen_config/1680.sh, mode "default" + bindsym Shift+2 exec --no-startup-id $screen_config/double.sh, mode "default" + + bindsym c exec --no-startup-id autorandr -c && nitrogen --restore, mode "default" + bindsym Escape mode "default" + bindsym Return 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 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 + + # exit resize mode: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# Autostart applications +exec dunst +exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +exec --no-startup-id nitrogen --restore +#exec --no-startup-id wpa_gui -qt +exec --no-startup-id nm-applet +# exec --no-startup-id blueman-applet +exec redshift-gtk +exec --no-startup-id dockd --daemon +#exec light-locker +# 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) +bar { +# i3bar_command i3bar + status_command i3blocks -c ~/.config/i3/i3blocks.conf + position bottom + +## please set your primary output first. Example: 'xrandr --output eDP1 --primary' + tray_output primary + + bindsym button4 nop + bindsym button5 nop + + 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 + } +} + +# 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 + + client.background #2B2C2B + +############################# +### settings for i3-gaps: ### +############################# + +# Set inner/outer gaps +#gaps inner 14 +#gaps outer -2 + +# 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 +# gaps inner all set 10 +# gaps outer all plus 5 + +# Smart gaps (gaps used if only more than one container on the workspace) +# smart_gaps on + +# 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 + +# 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 Shift+plus gaps inner all plus 5 +# bindsym Shift+minus gaps inner all minus 5 +# bindsym Shift+0 gaps inner all set 0 +# +# 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 Return mode "default" +# bindsym Escape mode "default" +#} + + +# move workspaces to other RandR output +bindsym $mod+Control+h move workspace to output left +bindsym $mod+Control+j move workspace to output down +bindsym $mod+Control+k move workspace to output up +bindsym $mod+Control+l move workspace to output right +#bindsym $mod+Control+m move workspace to output primary + +# turn on numlock +exec --no-startup-id numlockx + +# change keymap +exec setxkbmap eu diff --git a/i3/.config/i3/i3blocks.conf b/i3/.config/i3/i3blocks.conf new file mode 100644 index 0000000..5b17bee --- /dev/null +++ b/i3/.config/i3/i3blocks.conf @@ -0,0 +1,205 @@ +# i3blocks config file +# +# Please see man i3blocks for a complete reference! +# The man page is also hosted at http://vivien.github.io/i3blocks +# +# List of valid properties: +# +# align +# color +# command +# full_text +# instance +# interval +# label +# min_width +# name +# separator +# separator_block_width +# short_text +# signal +# urgent + +# Global properties +# +# The top properties below are applied to every block, but can be overridden. +# Each block command defaults to the script name to avoid boilerplate. + +#command=/usr/lib/i3blocks/$BLOCK_NAME/$BLOCK_NAME +command=~/.config/i3/i3blocks/$BLOCK_NAME/$BLOCK_NAME +separator_block_width=15 +markup=none + +#[arch-update] +#interval=3600 +#label=UP: +#markup=pango + +# Volume indicator +# +# The first parameter sets the step (and units to display) +# The second parameter overrides the mixer selection +# See the script for details. +[volume] +#label=VOL +label= +instance=Master +#instance=PCM +interval=1 +signal=5 +separator=false + +[volume] +label= +instance=Capture +interval=1 + +[workadventure] +label= +interval=60 + +[wifi] +label= +instance=wlp4s0 +interval=10 +separator=false + +[ssid] +interval=10 + +#[openvpn2] +#label= +#interval=10 + +# Memory usage +# +# The type defaults to "mem" if the instance is not specified. +[memory] +#label=MEM +label= +separator=false +interval=30 + +#[memory] +#label=SWAP +#label= +#instance=swap +#separator=false +#interval=30 + +# Disk usage +# +# The directory defaults to $HOME if the instance is not specified. +# The script may be called with a optional argument to set the alert +# (defaults to 10 for 10%). +#[disk] +#label=HOME +#instance=/mnt/data +#interval=30 + +# Network interface monitoring +# +# If the instance is not specified, use the interface used for default route. +# The address can be forced to IPv4 or IPv6 with -4 or -6 switches. +#[iface] +#instance=wlo1 +#color=#00FF00 +#interval=10 +#separator=false + +# CPU usage +# +# The script may be called with -w and -c switches to specify thresholds, +# see the script for details. +[cpu_usage] +#label=CPU +label= +interval=10 +min_width= 100.00% +#separator=false + +#[load_average] +#interval=10 + +# Brightness indicator +[brightness] +#command=expr $(brightnessctl get) / 15 +interval=1 +label= +separator=false + +#[bandwidth] +#instance=wlo1 +#interval=5 + +# Battery indicator +# +# The battery instance defaults to 0. +[battery] +#label=BAT +label=⚡ +#instance=1 +interval=30 + +# Generic media player support +# +# This displays "ARTIST - SONG" if a music is playing. +# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others. +#[mediaplayer] +#instance=rhythmbox +#label= +#interval=5 +#signal=10 + +# [mediaplayer] +# instance=spotify +# label= +# interval=5 +# signal=10 + +[playerctl] +label= +interval=5 + +# Date Time +# +[time] +#command=date '+%Y-%m-%d %H:%M:%S' +command=date '+%d.%m.%Y %H:%M:%S' +label= +interval=1 + + +# OpenVPN support +# +# Support multiple VPN, with colors. +#[openvpn] +#command=/usr/lib/i3blocks/openvpn/openvpn -p '/run/openvpn@*.pid'; +#interval=20 +#instance=tun0 +#PID_FILE_FORMAT='/run/openvpn@*.pid' + +# Temperature +# +# Support multiple chips, though lm-sensors. +# The script may be called with -w and -c switches to specify thresholds, +# see the script for details. +#[temperature] +#label=TEMP +#interval=10 + +# Key indicators +# +# Add the following bindings to i3 config file: +# +# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks +# bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks +#[keyindicator] +#instance=CAPS +#interval=once +#signal=11 + +#[keyindicator] +#instance=NUM +#interval=once +#signal=11 diff --git a/i3/.config/i3/i3blocks/CONTRIBUTING.md b/i3/.config/i3/i3blocks/CONTRIBUTING.md new file mode 100644 index 0000000..086e127 --- /dev/null +++ b/i3/.config/i3/i3blocks/CONTRIBUTING.md @@ -0,0 +1,116 @@ +# How to contribute + +So you've written a blocklet for i3blocks and would like to share it with the +community, great! Let's just set a few ground rules in order to get your +blocklet included. + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", +"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be +interpreted as described in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt). + +# Directory guidelines + +1. A blocklet MUST be confined to a single directory and the name of the + directory MUST be relevant to the blocklet's purpose or core feature. +2. A blocklet MUST be human readable. +3. A blocklet MUST contain a `README.md` explaining what the blocklet does, + what its dependencies are, and any special instruction or setup required to + use it. +4. A suggested i3blocks configuration MUST be included in an `i3blocks.conf` + file or within the `README.md`. +5. Any non-obvious assumptions required to make the configuration work SHOULD + be included either in the `README.md` or as comments in the configuration. +6. A blocklet's suggested command SHOULD be of the form + `command=$SCRIPT_DIR/myscript [args...]` even + if the script is a single line. +7. The command file (`myscript` above) SHOULD be the entirety of the + executable part of your blocklet, i.e. your code is a single script. +8. The command file's name, SHOULD match the name of the + containing directory. E.g. `myscript/myscript` + is a good name, but `myscript/yourscript` is not. +9. A blocklet SHOULD NOT have a separate non `i3blocks.conf` configuration + file. Any extra configuration (e.g. default colors, paths, etc.) SHOULD be + contained in the command file near the top. +10. A blocklet MUST include at least one screenshot of what it looks like in + action. +11. A blocklet MAY require building, but if it does the build process SHOULD be + as simple as possible (preferably nothing more than running `make`) +12. A blocklet SHOULD include a `LICENSE` file. +13. A blocklet MAY include a `.gitignore` file. + +# Dependency guidelines + +1. Listing standard utilities as dependencies is OPTIONAL. +2. If a blocklet requires a specific minimum version of a program, that program + SHOULD be listed as a dependency, and the minimum version SHOULD be listed + as well. + +# Pull request guidelines + +1. Every commit being merged in a pull request MUST begin with the name of the + blocklet it concerns, .e.g. `myscript: update colors` +2. A contributor with write access MUST NOT merge any pull request that he or + she created, unless there are no other contributors with write access + currently active. +3. Commit messages SHOULD be written in imperative form. E.g. + `myscript: add option to configure colors`, instead of + `myscript: added option to configure colors`. +4. Commit message first lines SHOULD be 72 characters or less but descriptive, + and details MAY be added to subsequent lines. +5. Commit details SHOULD write `Fixes: [issue]` or `Closes: [issue]` if + the commit is meant to fix/close an issue on the issues page. +6. A pull request SHOULD contribute significant change to exactly one + blocklet. A bug fix or new command line option will usually be considered + a significant change. + +# Example workflow + +In case you have never made a pull request before, here is an example workflow. + +1. You write and test your blocklet called `myscript`. +2. You write a `README.md` and `i3blocks.conf` to go with your script, make a + `screenshot.png` and put `myscript`, `README.md`, `i3blocks.conf`, + `screenshot.png`, and your favorite `LICENSE` into a + directory called `myscript`. +3. You fork the i3blocks-contrib repository on github, and clone your fork of + i3blocks-contrib onto your computer with `git clone [your fork here]`. +4. You copy your `myscript` directory to the top level of the cloned + i3blocks-contrib directory and change to the top level directory. +5. You `git add myscript` to tell git to track your blocklet's directory, you + will need to do this before every commit. +6. You `git commit` and leave a commit message of the form + `myscript: add myscript, a short description of myscript` +7. Perhaps you make a few last minute changes, and add another commit. +8. You squash your commits into one with `git rebase -i` and follow the + instruction, leaving only your first commit and commits that were already + there unsquashed. +9. You push your changes to your fork on github with `git push`. +10. You navigate to vivien's i3blocks-contrib, click "pull requests" and + "New pull request". You click "compare across forks", then select the base + as vivien's i3blocks-contrib and the head fork as yours. You click + "Create pull request". +11. The community makes some comments and suggests some things to improve before + your blocklet is accepted. +12. You add and commit changes to your local copy, and then squash them as before, so + that there are only two commits besides those that were there when you first + forked, your initial commit and one representing all the changes made to + address community concerns. +13. You push to your remote fork of i3blocks-contrib, and the changes + automatically get incorporated into the pull request process. +14. A maintainer with write access to vivien's i3blocks-contrib decides your + script is ready to be merged and merges it in, possibly making minor changes + of their own in the process. + +Whenever you make a significant change to your blocklet or fix a bug, +squash your local commits since your last pull request and replace the commit +message with something of the form + + myscript: what has changed since last pull request + + More detailed description of changes, perhaps including: + Change 1 + Change 2 + Change 3 + +Then push to your remote fork, navigate to vivien's, and make a new pull +request. diff --git a/i3/.config/i3/i3blocks/ISSUE_TEMPLATE.md b/i3/.config/i3/i3blocks/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..354fdb8 --- /dev/null +++ b/i3/.config/i3/i3blocks/ISSUE_TEMPLATE.md @@ -0,0 +1,15 @@ +### Expected behavior + + +### Actual behavior + + +### i3blocks config relevant to blocklet(s) + + +### Output of blocklet(s) when run from command line + + +### Output of any relevant other commands that might help diagnostics + + diff --git a/i3/.config/i3/i3blocks/LICENSE.md b/i3/.config/i3/i3blocks/LICENSE.md new file mode 100644 index 0000000..324f7cf --- /dev/null +++ b/i3/.config/i3/i3blocks/LICENSE.md @@ -0,0 +1,692 @@ +This project is a repository project composed of many individual blocklet +projects. As such, we empower developers to license their blocklet source as +they see fit with one major caveat. This repository servers as the single +packaging source for most OS distributions. As such, we insist that any license +you choose meet both the +[Debian](http://www.debian.org/social_contract#guidelines) and +[Fedora](https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#License_of_Fedora_SPEC_Files) +free license specifications. For a handy chart, see +[Wikipedia](https://en.wikipedia.org/wiki/Comparison_of_free_and_open-source_software_licenses#Approvals). + +All blocklets are licensed individually. Consult the `LICENSE.md` contained +within each blocklet's directory for the licencing under which the contained +blocklet code is published. All blocklets without a `LICENSE.md` in their +directory, and all code within the parent of this repository are published +under the following license. + +``` + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +``` diff --git a/i3/.config/i3/i3blocks/README.md b/i3/.config/i3/i3blocks/README.md new file mode 100644 index 0000000..78c9d90 --- /dev/null +++ b/i3/.config/i3/i3blocks/README.md @@ -0,0 +1,30 @@ +# Community contributed blocklets + +This repository contains a set of scripts (a.k.a. *blocklets*) for +[i3blocks](https://github.com/vivien/i3blocks), contributed by the +community. + +It is officially maintained by a bench of active i3blocks crafters. + +Each release of this repository will be guaranteed to work against +a given [release](https://github.com/vivien/i3blocks/releases) of +i3blocks (a.k.a. *core*). + +contrib | core +------- | ---- +master | master + +You may want to take a look at the individual blocklet directories, +which contain descriptions, screenshots, and installation/configuration +instructions. +Note: configurations reference `$SCRIPT_DIR`, meaning the directory that you put +the script into. +You must change `$SCRIPT_DIR` appropriately to coincide with where you put +your scripts, for more info see the [FAQ](https://github.com/vivien/i3blocks-contrib/wiki/FAQ#blocklets-refer-to-script_dir-what-does-that-mean-how-can-i-use-it). + +Want to contribute? +Great! +Check the [contribution guidelines](https://github.com/vivien/i3blocks-contrib/blob/master/CONTRIBUTING.md) +in order to get started. + +Happy crafting! diff --git a/i3/.config/i3/i3blocks/afs/LICENSE.md b/i3/.config/i3/i3blocks/afs/LICENSE.md new file mode 100644 index 0000000..5f8b06f --- /dev/null +++ b/i3/.config/i3/i3blocks/afs/LICENSE.md @@ -0,0 +1,675 @@ +### GNU GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +### Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom +to share and change all versions of a program--to make sure it remains +free software for all its users. We, the Free Software Foundation, use +the GNU General Public License for most of our software; it applies +also to any other work released this way by its authors. You can apply +it to your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you +have certain responsibilities if you distribute copies of the +software, or if you modify it: responsibilities to respect the freedom +of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the +manufacturer can do so. This is fundamentally incompatible with the +aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for +individuals to use, which is precisely where it is most unacceptable. +Therefore, we have designed this version of the GPL to prohibit the +practice for those products. If such problems arise substantially in +other domains, we stand ready to extend this provision to those +domains in future versions of the GPL, as needed to protect the +freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish +to avoid the special danger that patents applied to a free program +could make it effectively proprietary. To prevent this, the GPL +assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +### TERMS AND CONDITIONS + +#### 0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds +of works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of +an exact copy. The resulting work is called a "modified version" of +the earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user +through a computer network, with no transfer of a copy, is not +conveying. + +An interactive user interface displays "Appropriate Legal Notices" to +the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +#### 1. Source Code. + +The "source code" for a work means the preferred form of the work for +making modifications to it. "Object code" means any non-source form of +a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can +regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same +work. + +#### 2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, +without conditions so long as your license otherwise remains in force. +You may convey covered works to others for the sole purpose of having +them make modifications exclusively for you, or provide you with +facilities for running those works, provided that you comply with the +terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for +you must do so exclusively on your behalf, under your direction and +control, on terms that prohibit them from making any copies of your +copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the +conditions stated below. Sublicensing is not allowed; section 10 makes +it unnecessary. + +#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such +circumvention is effected by exercising rights under this License with +respect to the covered work, and you disclaim any intention to limit +operation or modification of the work as a means of enforcing, against +the work's users, your or third parties' legal rights to forbid +circumvention of technological measures. + +#### 4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +#### 5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these +conditions: + +- a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. +- b) The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in section 4 + to "keep intact all notices". +- c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. +- d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +#### 6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of +sections 4 and 5, provided that you also convey the machine-readable +Corresponding Source under the terms of this License, in one of these +ways: + +- a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. +- b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the Corresponding + Source from a network server at no charge. +- c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. +- d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. +- e) Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the general + public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, +family, or household purposes, or (2) anything designed or sold for +incorporation into a dwelling. In determining whether a product is a +consumer product, doubtful cases shall be resolved in favor of +coverage. For a particular product received by a particular user, +"normally used" refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected +to use, the product. A product is a consumer product regardless of +whether the product has substantial commercial, industrial or +non-consumer uses, unless such uses represent the only significant +mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to +install and execute modified versions of a covered work in that User +Product from a modified version of its Corresponding Source. The +information must suffice to ensure that the continued functioning of +the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or +updates for a work that has been modified or installed by the +recipient, or for the User Product in which it has been modified or +installed. Access to a network may be denied when the modification +itself materially and adversely affects the operation of the network +or violates the rules and protocols for communication across the +network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +#### 7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders +of that material) supplement the terms of this License with terms: + +- a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or +- b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or +- c) Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or +- d) Limiting the use for publicity purposes of names of licensors + or authors of the material; or +- e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or +- f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions + of it) with contractual assumptions of liability to the recipient, + for any liability that these contractual assumptions directly + impose on those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; the +above requirements apply either way. + +#### 8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +#### 9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run +a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +#### 10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +#### 11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims owned +or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on +the non-exercise of one or more of the rights that are specifically +granted under this License. You may not convey a covered work if you +are a party to an arrangement with a third party that is in the +business of distributing software, under which you make payment to the +third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties +who would receive the covered work from you, a discriminatory patent +license (a) in connection with copies of the covered work conveyed by +you (or copies made from those copies), or (b) primarily for and in +connection with specific products or compilations that contain the +covered work, unless you entered into that arrangement, or that patent +license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +#### 12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under +this License and any other pertinent obligations, then as a +consequence you may not convey it at all. For example, if you agree to +terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could +satisfy both those terms and this License would be to refrain entirely +from conveying the Program. + +#### 13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +#### 14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies that a certain numbered version of the GNU General Public +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that numbered version or +of any later version published by the Free Software Foundation. If the +Program does not specify a version number of the GNU General Public +License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions +of the GNU General Public License can be used, that proxy's public +statement of acceptance of a version permanently authorizes you to +choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +#### 15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT +WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +#### 16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR +CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT +NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR +LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM +TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +#### 17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +### How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively state +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper +mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands \`show w' and \`show c' should show the +appropriate parts of the General Public License. Of course, your +program's commands might be different; for a GUI interface, you would +use an "about box". + +You should also get your employer (if you work as a programmer) or +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. For more information on this, and how to apply and follow +the GNU GPL, see . + +The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +GNU Lesser General Public License instead of this License. But first, +please read . diff --git a/i3/.config/i3/i3blocks/afs/README.md b/i3/.config/i3/i3blocks/afs/README.md new file mode 100644 index 0000000..8a25b5f --- /dev/null +++ b/i3/.config/i3/i3blocks/afs/README.md @@ -0,0 +1,42 @@ +# afs + +Show usage information for an [AFS](https://en.wikipedia.org/wiki/Andrew_File_System) directory. + +![](example.png) + +## Setup / Usage + +Suggested i3blocks configuration: + +``` +[afs] +command=$SCRIPT_DIR/afs -c 90 +label=AFS +instance=~/afs/ +markup=pango +interval=600 +``` + +### Options + +``` +usage: afs [-h] [-c CRITICAL] [-fg FG_COLOR] [-bg BG_COLOR] + +Get AFS quota and usage information. + +optional arguments: + -h, --help show this help message and exit + -c CRITICAL, --critical CRITICAL + Critical usage percentage. (default: 90) + -fg FG_COLOR, --fg-color FG_COLOR + Foreground color for critical usage. (default: + #FF0000) + -bg BG_COLOR, --bg-color BG_COLOR + Background color for critical usage. (default: None) +``` + +## Dependencies + +- `fs` command suite shipped with the AFS client software +- python3 + diff --git a/i3/.config/i3/i3blocks/afs/afs b/i3/.config/i3/i3blocks/afs/afs new file mode 100755 index 0000000..009aea1 --- /dev/null +++ b/i3/.config/i3/i3blocks/afs/afs @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +# Show usage information for an AFS directory. + +# Copyright 2017 Johannes Lange +# +# 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 . + +import argparse +import os +import subprocess as sp + +parser = argparse.ArgumentParser( + description='Get AFS quota and usage information.', + formatter_class=argparse.ArgumentDefaultsHelpFormatter, +) +parser.add_argument('-c', '--critical', type=int, default=90, + help='Critical usage percentage.') +parser.add_argument('-fg', '--fg-color', type=str, default="#FF0000", + help='Foreground color for critical usage.') +parser.add_argument('-bg', '--bg-color', type=str, default=None, + help='Background color for critical usage.') +args = parser.parse_args() + +# set the afs directory to be checked +if 'BLOCK_INSTANCE' in os.environ: + directory = os.environ['BLOCK_INSTANCE'] +else: + directory = '~/afs/' # some default + +# expand environment variables etc. +directory = os.path.expandvars(directory) +directory = os.path.expanduser(directory) + +fs_output = sp.check_output(['fs', 'lq', '-human', directory], + universal_newlines=True) +# second line contains the information +fs_output = fs_output.split('\n')[1] +quota, used, percentage = fs_output.split()[1:4] +percentage = int(percentage.split('%')[0]) + +output = '%s/%s (%i%%)' % (used, quota, percentage) + +if percentage >= args.critical: + if args.bg_color: + output = "%s" %\ + (args.fg_color, args.bg_color, output) + else: + output = "%s" % (args.fg_color, output) + +print(output) diff --git a/i3/.config/i3/i3blocks/afs/example.png b/i3/.config/i3/i3blocks/afs/example.png new file mode 100644 index 0000000..23d82f0 Binary files /dev/null and b/i3/.config/i3/i3blocks/afs/example.png differ diff --git a/i3/.config/i3/i3blocks/apt-upgrades/LICENSE b/i3/.config/i3/i3blocks/apt-upgrades/LICENSE new file mode 100644 index 0000000..8cdb845 --- /dev/null +++ b/i3/.config/i3/i3blocks/apt-upgrades/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/i3/.config/i3/i3blocks/apt-upgrades/README.md b/i3/.config/i3/i3blocks/apt-upgrades/README.md new file mode 100644 index 0000000..1feddda --- /dev/null +++ b/i3/.config/i3/i3blocks/apt-upgrades/README.md @@ -0,0 +1,53 @@ +# apt-upgrades + +Show the number of pending system upgrades. + +![](apt-upgrades.png) + +# Requirements + +Dependencies: aptitude, bash + +Suggested: fonts-font-awesome + +# Suggested usage + +Copy the `i3blocks.conf` section into your i3blocks configuration. +We assume you use `signal=1` but you can choose another signal number if you prefer. +Create apt/dpkg hooks to signal the script. +For example, create `/etc/apt/apt.conf.d/80i3blocks` with contents + +``` +APT::Update::Post-Invoke { "pkill -RTMIN+1 i3blocks || true"; }; +DPkg::Post-Invoke { "pkill -RTMIN+1 i3blocks || true"; }; +``` +**Warning**: make sure to +```ShellSession +sudo chown root:root /etc/apt/apt.conf.d/80i3blocks +sudo chmod 644 /etc/apt/apt.conf.d/80i3blocks +``` +so that only the root user may modify +`80i3blocks`. This is necessary because apt has root privileges when upgrading the system, +and therefore commands in `80i3blocks` will be executed with root privileges. + +You may also combine this script with a cron job that calls `apt-get update` periodically for +a more "popup upgrade reminder" feeling. + +# Simple usage + +Instead of using `signal=1` in the configuration, you can use `interval=3600` +to have the script execute every hour. +This method avoids the usage of apt/dpkg hooks. + +# Options + +``` +Usage: apt-upgrades [-s pending_symbol] [-o] [-c pending_color] [-N|-n nonpending_color] [-h] +Options: +-s Specify a refresh symbol. Default: "\uf021 " +-o Show refresh symbol only, but no numbers. +-c Color when upgrade is pending. Default: #00FF00 +-n Color when no upgrade is pending. Default: #FFFFFF +-N Only display text if upgrade is pending (supercedes -n) +-h Show this help text +``` diff --git a/i3/.config/i3/i3blocks/apt-upgrades/apt-upgrades b/i3/.config/i3/i3blocks/apt-upgrades/apt-upgrades new file mode 100755 index 0000000..3ca2b5e --- /dev/null +++ b/i3/.config/i3/i3blocks/apt-upgrades/apt-upgrades @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2015 James Murphy +# Licensed under the terms of the GNU GPL v2 only. +# +# i3blocks blocklet script to display pending system upgrades + +# FontAwesome refresh symbol, change if you do not want to install FontAwesome +PENDING_SYMBOL="\uf021 " + +# By default, show both the symbol and the numbers +SYMBOL_ONLY=0 + +# By default, show something when no upgrades are pending +ALWAYS_PRINT=1 + +# Colors for when there is/isn't a pending upgrade +PENDING_COLOR="#00FF00" +NONPENDING_COLOR="#FFFFFF" + +while getopts s:oc:n:Nh opt; do + case "$opt" in + s) PENDING_SYMBOL="$OPTARG" ;; + o) SYMBOL_ONLY=1 ;; + c) PENDING_COLOR="$OPTARG" ;; + n) NONPENDING_COLOR="$OPTARG" ;; + N) ALWAYS_PRINT=0 ;; + h) printf \ +"Usage: apt-upgrades [-s pending_symbol] [-o] [-c pending_color] [-N|-n nonpending_color] [-h] +Options: +-s\tSpecify a refresh symbol. Default: \"\\\\uf021 \" +-o\tShow refresh symbol only, but no numbers. +-c\tColor when upgrade is pending. Default: #00FF00 +-n\tColor when no upgrade is pending. Default: #FFFFFF +-N\tOnly display text if upgrade is pending (supercedes -n) +-h\tShow this help text\n" && exit 0;; + esac +done + +read upgraded new removed held < <( +aptitude full-upgrade --simulate --assume-yes |\ + grep -m1 '^[0-9]\+ packages upgraded,' |\ + tr -cd '0-9 ' |\ + tr ' ' '\n' |\ + grep '[0-9]\+' |\ + xargs echo) + +if [[ $upgraded != 0 ]] || [[ $new != 0 ]] || [[ $removed != 0 ]] || [[ $held != 0 ]]; then + color="$PENDING_COLOR" + if [[ $SYMBOL_ONLY == 1 ]]; then + echo -e "$PENDING_SYMBOL" + echo -e "$PENDING_SYMBOL" + else + echo -e "$PENDING_SYMBOL$upgraded/$new/$removed/$held" + echo -e "$PENDING_SYMBOL$upgraded/$new/$removed/$held" + fi + echo $color +elif [[ $ALWAYS_PRINT == 1 ]]; then + color="$NONPENDING_COLOR" + echo -e "$PENDING_SYMBOL$upgraded/$new/$removed/$held" + echo -e "$PENDING_SYMBOL$upgraded/$new/$removed/$held" + echo $color +fi + diff --git a/i3/.config/i3/i3blocks/apt-upgrades/apt-upgrades.png b/i3/.config/i3/i3blocks/apt-upgrades/apt-upgrades.png new file mode 100644 index 0000000..df28339 Binary files /dev/null and b/i3/.config/i3/i3blocks/apt-upgrades/apt-upgrades.png differ diff --git a/i3/.config/i3/i3blocks/apt-upgrades/i3blocks.conf b/i3/.config/i3/i3blocks/apt-upgrades/i3blocks.conf new file mode 100644 index 0000000..4eb926e --- /dev/null +++ b/i3/.config/i3/i3blocks/apt-upgrades/i3blocks.conf @@ -0,0 +1,4 @@ +[apt-upgrades] +command=$SCRIPT_DIR/apt-upgrades +signal=1 +interval=once diff --git a/i3/.config/i3/i3blocks/arch-update/LICENSE.md b/i3/.config/i3/i3blocks/arch-update/LICENSE.md new file mode 100755 index 0000000..660ee4e --- /dev/null +++ b/i3/.config/i3/i3blocks/arch-update/LICENSE.md @@ -0,0 +1,225 @@ +GNU GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. http://fsf.org/ + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. +TERMS AND CONDITIONS +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based on the Program. + +To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. +1. Source Code. + +The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. + +A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. +2. Basic Permissions. + +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. +8. Termination. + +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see http://www.gnu.org/licenses/. + +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read http://www.gnu.org/philosophy/why-not-lgpl.html. diff --git a/i3/.config/i3/i3blocks/arch-update/README.md b/i3/.config/i3/i3blocks/arch-update/README.md new file mode 100755 index 0000000..f95d2c6 --- /dev/null +++ b/i3/.config/i3/i3blocks/arch-update/README.md @@ -0,0 +1,46 @@ +# arch-update + +Be always on top of your available updates with this blocklet. Optionally show AUR updates with the help of yaourt. Colorize the outputs for if your system is up to date or you got available updates. + +![](screenshot.png) + +![](screenshot2.png) + +# Dependencies + +* Arch Linux or another arch based distro +* python3 + +# Optional Dependencies + +* yaourt for aur updates +* fontawesome for awesome labels + +# Installation + +* Copy the arch-update.py script into your directory of choice, e.g. ~/.i3blocks/ +* Give it execution permission (`chmod +x arch-update.py`) +* Add the following blocket to your i3blocks.conf: + +```ini +[arch-update] +command=$SCRIPT_DIR/arch-update.py #run arch-update.py -h for options +label=Updates: +interval=3600 +markup=pango +``` +Another advanced example with fontawesome label, AUR updates included, watched packages, and custom colors for both messages: +```ini +[pacman-updates] +label= +command=~/.config/i3blocks/scripts/arch-update.py -a -b "#5fff5f" -u "#FFFF85" -w "^linux.*" "^pacman.*" +markup=pango +interval= 3600 +``` +# Configuration +- `-q`/`--quiet`: do not produce output if system is up to date +- `-w`/`--watch`: Explicitly watch for specified packages. Listed elements are treated as regular expressions for matching. +- `-b`/`--base_color`: set the base color of the output (when your system is up to date) +- `-u`/`--updates_available_color`: set the color of the output when updates are available +- `-a`/`--aur`: activate AUR update support +For the latest options call `$SCRIPT_DIR/arch-update.py -h`. diff --git a/i3/.config/i3/i3blocks/arch-update/arch-update.py b/i3/.config/i3/i3blocks/arch-update/arch-update.py new file mode 100755 index 0000000..01e29be --- /dev/null +++ b/i3/.config/i3/i3blocks/arch-update/arch-update.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2017 Marcel Patzwahl +# Licensed under the terms of the GNU GPL v3 only. +# +# i3blocks blocklet script to see the available updates of pacman and the AUR +import subprocess +from subprocess import check_output +import argparse +import re + + +def create_argparse(): + parser = argparse.ArgumentParser(description='Check for pacman updates') + parser.add_argument( + '-b', + '--base_color', + default='green', + help='base color of the output(default=green)' + ) + parser.add_argument( + '-u', + '--updates_available_color', + default='yellow', + help='color of the output, when updates are available(default=yellow)' + ) + parser.add_argument( + '-a', + '--aur', + action='store_true', + help='Include AUR packages. Attn: Yaourt must be installed' + ) + parser.add_argument( + '-q', + '--quiet', + action = 'store_true', + help = 'Do not produce output when system is up to date' + ) + parser.add_argument( + '-w', + '--watch', + nargs='*', + default=[], + help='Explicitly watch for specified packages. ' + 'Listed elements are treated as regular expressions for matching.' + ) + return parser.parse_args() + + +def get_updates(): + output = check_output(['checkupdates']).decode('utf-8') + if not output: + return [] + + updates = [line.split(' ')[0] + for line in output.split('\n') + if line] + + return updates + + +def get_aur_updates(): + output = '' + try: + output = check_output(['yaourt', '-Qua']).decode('utf-8') + except subprocess.CalledProcessError as exc: + # yaourt exits with 1 and no output if no updates are available. + # we ignore this case and go on + if not (exc.returncode == 1 and not exc.output): + raise exc + if not output: + return [] + + aur_updates = [line.split(' ')[0] + for line in output.split('\n') + if line.startswith('aur/')] + + return aur_updates + + +def matching_updates(updates, watch_list): + matches = set() + for u in updates: + for w in watch_list: + if re.match(w, u): + matches.add(u) + + return matches + + +message = "{1}" +args = create_argparse() + +updates = get_updates() +if args.aur: + updates += get_aur_updates() + +update_count = len(updates) +if update_count > 0: + info = str(update_count) + ' updates available' + matches = matching_updates(updates, args.watch) + if matches: + info += ' [{0}]'.format(', '.join(matches)) + print(message.format(args.updates_available_color, info)) +elif not args.quiet: + print(message.format(args.base_color, 'system up to date')) diff --git a/i3/.config/i3/i3blocks/arch-update/screenshot.png b/i3/.config/i3/i3blocks/arch-update/screenshot.png new file mode 100755 index 0000000..e4de85d Binary files /dev/null and b/i3/.config/i3/i3blocks/arch-update/screenshot.png differ diff --git a/i3/.config/i3/i3blocks/arch-update/screenshot2.png b/i3/.config/i3/i3blocks/arch-update/screenshot2.png new file mode 100755 index 0000000..0942798 Binary files /dev/null and b/i3/.config/i3/i3blocks/arch-update/screenshot2.png differ diff --git a/i3/.config/i3/i3blocks/bandwidth/README.md b/i3/.config/i3/i3blocks/bandwidth/README.md new file mode 100644 index 0000000..98d4dd6 --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth/README.md @@ -0,0 +1,14 @@ +# bandwidth + +Show bandwidth information + +![](bandwidth.png) + +# Config + +``` +[bandwidth] +command=$SCRIPT_DIR/bandwidth +#instance=eth0 +interval=5 +``` diff --git a/i3/.config/i3/i3blocks/bandwidth/bandwidth b/i3/.config/i3/i3blocks/bandwidth/bandwidth new file mode 100755 index 0000000..c69a22c --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth/bandwidth @@ -0,0 +1,107 @@ +#!/bin/bash +# Copyright (C) 2012 Stefan Breunig +# Copyright (C) 2014 kaueraal +# Copyright (C) 2015 Thiago Perrotta + +# 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 . + +# Get custom IN and OUT labels if provided by command line arguments +while [[ $# -gt 1 ]]; do + key="$1" + case "$key" in + -i|--inlabel) + INLABEL="$2" + shift;; + -o|--outlabel) + OUTLABEL="$2" + shift;; + esac + shift +done + +[[ -z $INLABEL ]] && INLABEL="IN " +[[ -z $OUTLABEL ]] && OUTLABEL="OUT " + +# Use the provided interface, otherwise the device used for the default route. +if [[ -n $BLOCK_INSTANCE ]]; then + INTERFACE=$BLOCK_INSTANCE +else + INTERFACE=$(ip route | awk '/^default/ { print $5 ; exit }') +fi + +# Issue #36 compliant. +if ! [ -e "/sys/class/net/${INTERFACE}/operstate" ] || ! [ "`cat /sys/class/net/${INTERFACE}/operstate`" = "up" ] +then + echo "$INTERFACE down" + echo "$INTERFACE down" + echo "#FF0000" + exit 0 +fi + +# path to store the old results in +path="/dev/shm/$(basename $0)-${INTERFACE}" + +# grabbing data for each adapter. +read rx < "/sys/class/net/${INTERFACE}/statistics/rx_bytes" +read tx < "/sys/class/net/${INTERFACE}/statistics/tx_bytes" + +# get time +time=$(date +%s) + +# write current data if file does not exist. Do not exit, this will cause +# problems if this file is sourced instead of executed as another process. +if ! [[ -f "${path}" ]]; then + echo "${time} ${rx} ${tx}" > "${path}" + chmod 0666 "${path}" +fi + +# read previous state and update data storage +read old < "${path}" +echo "${time} ${rx} ${tx}" > "${path}" + +# parse old data and calc time passed +old=(${old//;/ }) +time_diff=$(( $time - ${old[0]} )) + +# sanity check: has a positive amount of time passed +[[ "${time_diff}" -gt 0 ]] || exit + +# calc bytes transferred, and their rate in byte/s +rx_diff=$(( $rx - ${old[1]} )) +tx_diff=$(( $tx - ${old[2]} )) +rx_rate=$(( $rx_diff / $time_diff )) +tx_rate=$(( $tx_diff / $time_diff )) + +# shift by 10 bytes to get KiB/s. If the value is larger than +# 1024^2 = 1048576, then display MiB/s instead + +# incoming +echo -n "$INLABEL" +rx_kib=$(( $rx_rate >> 10 )) +if hash bc 2>/dev/null && [[ "$rx_rate" -gt 1048576 ]]; then + printf '%sM' "`echo "scale=1; $rx_kib / 1024" | bc`" +else + echo -n "${rx_kib}K" +fi + +echo -n " " + +# outgoing +echo -n "$OUTLABEL" +tx_kib=$(( $tx_rate >> 10 )) +if hash bc 2>/dev/null && [[ "$tx_rate" -gt 1048576 ]]; then + printf '%sM' "`echo "scale=1; $tx_kib / 1024" | bc`" +else + echo -n "${tx_kib}K" +fi diff --git a/i3/.config/i3/i3blocks/bandwidth/bandwidth.png b/i3/.config/i3/i3blocks/bandwidth/bandwidth.png new file mode 100644 index 0000000..2552abd Binary files /dev/null and b/i3/.config/i3/i3blocks/bandwidth/bandwidth.png differ diff --git a/i3/.config/i3/i3blocks/bandwidth/i3blocks.conf b/i3/.config/i3/i3blocks/bandwidth/i3blocks.conf new file mode 100644 index 0000000..d021d99 --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth/i3blocks.conf @@ -0,0 +1,4 @@ +[bandwidth] +command=$SCRIPT_DIR/bandwidth +#instance=eth0 +interval=5 diff --git a/i3/.config/i3/i3blocks/bandwidth2/.gitignore b/i3/.config/i3/i3blocks/bandwidth2/.gitignore new file mode 100644 index 0000000..0c1a301 --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth2/.gitignore @@ -0,0 +1 @@ +bandwidth2 diff --git a/i3/.config/i3/i3blocks/bandwidth2/Makefile b/i3/.config/i3/i3blocks/bandwidth2/Makefile new file mode 100644 index 0000000..ef5c58c --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth2/Makefile @@ -0,0 +1,6 @@ +P=bandwidth2 +OBJECTS= +CFLAGS=-g -Wall -Werror -O2 -std=c11 +LDLIBS= + +$(P): $(OBJECTS) diff --git a/i3/.config/i3/i3blocks/bandwidth2/README.md b/i3/.config/i3/i3blocks/bandwidth2/README.md new file mode 100644 index 0000000..164ccbe --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth2/README.md @@ -0,0 +1,41 @@ +# bandwidth2 + +Monitor bandwidth usage. +This is a C version of the bandwidth blocklet. + +![](bandwidth2.png) + +It comes with some other features though: +* Automatically estimate what unit (K,M,G,T) to use depending on the value. You can still choose between bits and bytes. +* By default sum all the network interfaces (except lo) instead of only default route interface. +* Warning and critical colors as an option. + +## Build + +``` +make +``` + +### Example Blocklet +```ini +[bandwidth] +label= +command=$SCRIPT_DIR/bandwidth2 -w 307200:30720 -c 512000:51200 +interval=persist +markup=pango +``` + +## Options + +``` +Usage: ./bandwidth2 [-b|B] [-t seconds] [-i interface] [-w Bytes:Bytes] [-c Bytes:Bytes] [-h] + +-b use bits/s +-B use Bytes/s (default) +-t seconds refresh time (default is 1) +-i interface network interface to monitor. If not specified, check all interfaces. +-w Bytes:Bytes Set warning (color orange) for Rx:Tx bandwidth. (default: none) +-c Bytes:Bytes Set critical (color red) for Rx:Tx bandwidth. (default: none) +-h this help + +``` diff --git a/i3/.config/i3/i3blocks/bandwidth2/bandwidth2.c b/i3/.config/i3/i3blocks/bandwidth2/bandwidth2.c new file mode 100644 index 0000000..45b0b43 --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth2/bandwidth2.c @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include + +#define RED "#FF7373" +#define ORANGE "#FFA500" + +typedef unsigned long long int ulli; + +enum { + STATE_OK, + STATE_WARNING, + STATE_CRITICAL, + STATE_UNKNOWN, +}; + +void usage(char *argv[]) +{ + printf("Usage: %s [-b|B] [-t seconds] [-i interface] [-w Bytes:Bytes] [-c Bytes:Bytes] [-h]\n", argv[0]); + printf("\n"); + printf("-b \t\tuse bits/s\n"); + printf("-B \t\tuse Bytes/s (default)\n"); + printf("-t seconds\trefresh time (default is 1)\n"); + printf("-i interface\tnetwork interface to monitor. If not specified, check all interfaces.\n"); + printf("-w Bytes:Bytes\tSet warning (color orange) for Rx:Tx bandwidth. (default: none)\n"); + printf("-c Bytes:Bytes\tSet critical (color red) for Rx:Tx bandwidth. (default: none)\n"); + printf("-h \t\tthis help\n"); + printf("\n"); +} + +void get_values(char *const iface, time_t * const s, ulli * const received, ulli * const sent) +{ + FILE *f; + + f = fopen("/proc/net/dev", "r"); + if (!f) { + fprintf(stderr, "Can't open /proc/net/dev\n"); + exit(STATE_UNKNOWN); + } + + ulli temp_r, temp_s; + char line[BUFSIZ]; + char ifname[BUFSIZ]; + + *received = 0; + *sent = 0; + while (fgets(line, BUFSIZ - 1, f) != NULL) { + if (sscanf(line, "%s %llu %*u %*u %*u %*u %*u %*u %*u %llu", ifname, &temp_r, &temp_s) == 3) { + if (iface && strcmp(iface, ifname) != 0) { + continue; + } + + if (strcmp(ifname, "lo:") == 0) + continue; + + *received = *received + temp_r; + *sent = *sent + temp_s; + } + } + + fclose(f); + + *s = time(NULL); + if (!s) { + fprintf(stderr, "Can't get Epoch time\n"); + exit(STATE_UNKNOWN); + } +} + +void display(int const unit, double b, int const warning, int const critical) +{ + if (critical != 0 && b > critical) { + printf("", RED); + } else if (warning != 0 && b > warning) { + printf("", ORANGE); + } else { + printf(""); + } + + if (unit == 'b') + b = b * 8; + + if (b < 1024) { + printf("%5.1lf %c/s", b, unit); + } else if (b < 1024 * 1024) { + printf("%5.1lf K%c/s", b / 1024, unit); + } else if (b < 1024 * 1024 * 1024) { + printf("%5.1lf M%c/s", b / (1024 * 1024), unit); + } else { + printf("%5.1lf G%c/s", b / (1024 * 1024 * 1024), unit); + } + printf(""); +} + +int main(int argc, char *argv[]) +{ + int c, unit = 'B', t = 1; + char *iface = NULL; + int warningrx = 0, warningtx = 0, criticalrx = 0, criticaltx = 0; + while (c = getopt(argc, argv, "bBht:i:w:c:"), c != -1) { + switch (c) { + case 'b': + case 'B': + unit = c; + break; + case 't': + t = atoi(optarg); + break; + case 'i': + iface = strcat(optarg, ":"); + break; + case 'w': + sscanf(optarg, "%d:%d", &warningrx, &warningtx); + break; + case 'c': + sscanf(optarg, "%d:%d", &criticalrx, &criticaltx); + break; + case 'h': + usage(argv); + return STATE_UNKNOWN; + } + } + + time_t s, s_old; + ulli received, sent, received_old, sent_old; + double rx, tx; + + get_values(iface, &s_old, &received_old, &sent_old); + + while (1) { + sleep(t); + get_values(iface, &s, &received, &sent); + + rx = (received - received_old) / (float)(s - s_old); + tx = (sent - sent_old) / (float)(s - s_old); + display(unit, rx, warningrx, criticalrx); + printf(" "); + display(unit, tx, warningtx, criticaltx); + fflush(stdout); + s_old = s; + received_old = received; + sent_old = sent; + } + + return STATE_OK; +} diff --git a/i3/.config/i3/i3blocks/bandwidth2/bandwidth2.png b/i3/.config/i3/i3blocks/bandwidth2/bandwidth2.png new file mode 100644 index 0000000..76bdd14 Binary files /dev/null and b/i3/.config/i3/i3blocks/bandwidth2/bandwidth2.png differ diff --git a/i3/.config/i3/i3blocks/bandwidth3/LICENSE b/i3/.config/i3/i3blocks/bandwidth3/LICENSE new file mode 100644 index 0000000..8cdb845 --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth3/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/i3/.config/i3/i3blocks/bandwidth3/README.md b/i3/.config/i3/i3blocks/bandwidth3/README.md new file mode 100644 index 0000000..3f31d6f --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth3/README.md @@ -0,0 +1,46 @@ +# bandwidth3 + +Monitor bandwidth usage. + +![](bandwidth3.png) + +# Usage + +The default configuration uses + +``` +printf " %-5.1f/%5.1f %s/s\n", rx, wx, unit; +``` + +as the default print command. The `%-5.1f` and `%5.1f` indicate that +the speeds will be accurate to one decimal, and right/left padded to be at least +five characters. +The reason this is the default is to prevent the length of the block from +changing and shifting all of your blocklets. +Modify the printf command using the `-p` option to fit your needs if this default +is not acceptable to you. + +Note that the interface will be guessed using `ip route` but it can also be specified +using the `-i` switch or using `$BLOCK_INSTANCE`, with the former taking precedence +over the latter. On the fly interface switching is not supported, if you change +your default interface, simply issue `i3-msg restart` and the script will pick +up on the new default. However, the block will wait until a default interface +is found upon starting, so no restart is needed if you start i3 and then connect +to wifi later. + +# Options + +``` +Usage: bandwidth3 [-i interface] [-t time] [-u unit] [-p printf_command] [-l] [-h] +Options: +-i Network interface to measure. Default determined using `ip route`. +-t Time interval in seconds between measurements. Default: 3 +-u Units to measure bytes in. Default: Mb + Allowed units: Kb, KB, Mb, MB, Gb, GB, Tb, TB + Units may have optional it/its/yte/ytes on the end, e.g. Mbits, KByte +-p Awk command to be called after a measurement is made. + Default: printf " %-5.1f/%5.1f %s/s\n", rx, wx, unit; + Exposed variables: rx, wx, tx, unit, iface +-l List available interfaces in /proc/net/dev +-h Show this help text +``` diff --git a/i3/.config/i3/i3blocks/bandwidth3/bandwidth3 b/i3/.config/i3/i3blocks/bandwidth3/bandwidth3 new file mode 100755 index 0000000..7547b03 --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth3/bandwidth3 @@ -0,0 +1,103 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2015 James Murphy +# Licensed under the terms of the GNU GPL v2 only. +# +# i3blocks blocklet script to monitor bandwidth usage + +iface="${BLOCK_INSTANCE}" +dt=3 +unit=Mb +label=" " # down arrow up arrow +printf_command="printf \"${label}%-5.1f/%5.1f %s/s\n\", rx, wx, unit;" + +function default_interface { + ip route | awk '/^default via/ {print $5; exit}' +} + +function check_proc_net_dev { + if [ ! -f "/proc/net/dev" ]; then + echo "/proc/net/dev not found" + exit 1 + fi +} + +function list_interfaces { + check_proc_net_dev + echo "Interfaces in /proc/net/dev:" + grep -o "^[^:]\\+:" /proc/net/dev | tr -d " :" +} + +while getopts i:t:u:p:lh opt; do + case "$opt" in + i) iface="$OPTARG" ;; + t) dt="$OPTARG" ;; + u) unit="$OPTARG" ;; + p) printf_command="$OPTARG" ;; + l) list_interfaces && exit 0 ;; + h) printf \ +"Usage: bandwidth3 [-i interface] [-t time] [-u unit] [-p printf_command] [-l] [-h] +Options: +-i\tNetwork interface to measure. Default determined using \`ip route\`. +-t\tTime interval in seconds between measurements. Default: 3 +-u\tUnits to measure bytes in. Default: Mb +\tAllowed units: Kb, KB, Mb, MB, Gb, GB, Tb, TB +\tUnits may have optional it/its/yte/ytes on the end, e.g. Mbits, KByte +-p\tAwk command to be called after a measurement is made. +\tDefault: printf \" %%-5.1f/%%5.1f %%s/s\\\\n\", rx, wx, unit; +\tExposed variables: rx, wx, tx, unit, iface +-l\tList available interfaces in /proc/net/dev +-h\tShow this help text +" && exit 0;; + esac +done + +check_proc_net_dev + +iface=$(default_interface) +while [ -z "$iface" ]; do + echo No default interface + sleep "$dt" + iface=$(default_interface) +done + +case "$unit" in + Kb|Kbit|Kbits) bytes_per_unit=$((1024 / 8));; + KB|KByte|KBytes) bytes_per_unit=$((1024));; + Mb|Mbit|Mbits) bytes_per_unit=$((1024 * 1024 / 8));; + MB|MByte|MBytes) bytes_per_unit=$((1024 * 1024));; + Gb|Gbit|Gbits) bytes_per_unit=$((1024 * 1024 * 1024 / 8));; + GB|GByte|GBytes) bytes_per_unit=$((1024 * 1024 * 1024));; + Tb|Tbit|Tbits) bytes_per_unit=$((1024 * 1024 * 1024 * 1024 / 8));; + TB|TByte|TBytes) bytes_per_unit=$((1024 * 1024 * 1024 * 1024));; + *) echo Bad unit "$unit" && exit 1;; +esac + +scalar=$((bytes_per_unit * dt)) +init_line=$(cat /proc/net/dev | grep "^[ ]*$iface:") +if [ -z "$init_line" ]; then + echo Interface not found in /proc/net/dev: "$iface" + exit 1 +fi + +init_received=$(awk '{print $2}' <<< $init_line) +init_sent=$(awk '{print $10}' <<< $init_line) + +(while true; do cat /proc/net/dev; sleep "$dt"; done) |\ + stdbuf -oL grep "^[ ]*$iface:" |\ + awk -v scalar="$scalar" -v unit="$unit" -v iface="$iface" ' +BEGIN{old_received='"$init_received"';old_sent='"$init_sent"'} +{ + received=$2 + sent=$10 + rx=(received-old_received)/scalar; + wx=(sent-old_sent)/scalar; + tx=rx+wr; + old_received=received; + old_sent=sent; + if(rx >= 0 && wx >= 0){ + '"$printf_command"'; + fflush(stdout); + } +} +' diff --git a/i3/.config/i3/i3blocks/bandwidth3/bandwidth3.png b/i3/.config/i3/i3blocks/bandwidth3/bandwidth3.png new file mode 100644 index 0000000..fc4b009 Binary files /dev/null and b/i3/.config/i3/i3blocks/bandwidth3/bandwidth3.png differ diff --git a/i3/.config/i3/i3blocks/bandwidth3/i3blocks.conf b/i3/.config/i3/i3blocks/bandwidth3/i3blocks.conf new file mode 100644 index 0000000..12d9837 --- /dev/null +++ b/i3/.config/i3/i3blocks/bandwidth3/i3blocks.conf @@ -0,0 +1,4 @@ +[bandwidth3] +command=$SCRIPT_DIR/bandwidth3 +interval=persist +markup=pango diff --git a/i3/.config/i3/i3blocks/battery/README.md b/i3/.config/i3/i3blocks/battery/README.md new file mode 100644 index 0000000..12665bd --- /dev/null +++ b/i3/.config/i3/i3blocks/battery/README.md @@ -0,0 +1,20 @@ +# battery + +Show battery info. + +![](battery.png) + +# Dependencies + +* `acpi` + +# Config + +``` +[battery] +command=$SCRIPT_DIR/battery +label=BAT +#label=⚡ +#instance=1 +interval=30 +``` diff --git a/i3/.config/i3/i3blocks/battery/battery b/i3/.config/i3/i3blocks/battery/battery new file mode 100755 index 0000000..c2e72f8 --- /dev/null +++ b/i3/.config/i3/i3blocks/battery/battery @@ -0,0 +1,89 @@ +#!/usr/bin/env perl +# +# Copyright 2014 Pierre Mavro +# Copyright 2014 Vivien Didelot +# +# 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 $ac_adapt; +my $full_text; +my $short_text; +my $bat_number = $ENV{BLOCK_INSTANCE} || 0; + +# read the first line of the "acpi" command output +open (ACPI, "acpi -b | grep 'Battery $bat_number' |") or die; +$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'; +} elsif ($status eq 'Unknown') { + open (AC_ADAPTER, "acpi -a |") or die; + $ac_adapt = ; + close(AC_ADAPTER); + + if ($ac_adapt =~ /: ([\w-]+)/) { + $ac_adapt = $1; + + if ($ac_adapt eq 'on-line') { + $full_text .= ' CHR'; + } elsif ($ac_adapt eq 'off-line') { + $full_text .= ' DIS'; + } + } +} + +$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); diff --git a/i3/.config/i3/i3blocks/battery/battery.png b/i3/.config/i3/i3blocks/battery/battery.png new file mode 100644 index 0000000..3bf89ba Binary files /dev/null and b/i3/.config/i3/i3blocks/battery/battery.png differ diff --git a/i3/.config/i3/i3blocks/battery/i3blocks.conf b/i3/.config/i3/i3blocks/battery/i3blocks.conf new file mode 100644 index 0000000..0c20e63 --- /dev/null +++ b/i3/.config/i3/i3blocks/battery/i3blocks.conf @@ -0,0 +1,6 @@ +[battery] +command=$SCRIPT_DIR/battery +label=BAT +#label=⚡ +#instance=1 +interval=30 diff --git a/i3/.config/i3/i3blocks/battery2/LICENSE b/i3/.config/i3/i3blocks/battery2/LICENSE new file mode 100644 index 0000000..8cdb845 --- /dev/null +++ b/i3/.config/i3/i3blocks/battery2/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/i3/.config/i3/i3blocks/battery2/README.md b/i3/.config/i3/i3blocks/battery2/README.md new file mode 100644 index 0000000..6a286b7 --- /dev/null +++ b/i3/.config/i3/i3blocks/battery2/README.md @@ -0,0 +1,28 @@ +# battery2 + +Show the current status of your battery. + +![](images/full.png) + +![](images/charging.png) + +![](images/unplugged.png) + +![](images/unknown.png) + +![](images/nobattery.png) + +# Dependencies + +fonts-font-awesome, acpi, python3 + +# Installation + +To use with i3blocks, copy the blocklet configuration in the given `i3blocks.conf` into your i3blocks configuration file, the recommended config is + +```INI +[battery2] +command=$SCRIPT_DIR/battery2 +markup=pango +interval=30 +``` diff --git a/i3/.config/i3/i3blocks/battery2/battery2 b/i3/.config/i3/i3blocks/battery2/battery2 new file mode 100755 index 0000000..b23dfdd --- /dev/null +++ b/i3/.config/i3/i3blocks/battery2/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 = "\uf00d \uf240" + 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 = "\uf0e7" + + # stands for plugged in + FA_PLUG = "\uf1e6" + + # stands for using battery + FA_BATTERY = "\uf240" + + # stands for unknown status of battery + FA_QUESTION = "\uf128" + + + 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 = '{}%' + fulltext += form.format(color(percentleft), percentleft) + fulltext += timeleft + +print(fulltext) +print(fulltext) +if percentleft < 10: + exit(33) diff --git a/i3/.config/i3/i3blocks/battery2/i3blocks.conf b/i3/.config/i3/i3blocks/battery2/i3blocks.conf new file mode 100644 index 0000000..74aacd4 --- /dev/null +++ b/i3/.config/i3/i3blocks/battery2/i3blocks.conf @@ -0,0 +1,4 @@ +[battery2] +command=$SCRIPT_DIR/battery2 +markup=pango +interval=30 diff --git a/i3/.config/i3/i3blocks/battery2/images/charging.png b/i3/.config/i3/i3blocks/battery2/images/charging.png new file mode 100644 index 0000000..bf616f1 Binary files /dev/null and b/i3/.config/i3/i3blocks/battery2/images/charging.png differ diff --git a/i3/.config/i3/i3blocks/battery2/images/full.png b/i3/.config/i3/i3blocks/battery2/images/full.png new file mode 100644 index 0000000..f585743 Binary files /dev/null and b/i3/.config/i3/i3blocks/battery2/images/full.png differ diff --git a/i3/.config/i3/i3blocks/battery2/images/nobattery.png b/i3/.config/i3/i3blocks/battery2/images/nobattery.png new file mode 100644 index 0000000..be7ad1b Binary files /dev/null and b/i3/.config/i3/i3blocks/battery2/images/nobattery.png differ diff --git a/i3/.config/i3/i3blocks/battery2/images/unknown.png b/i3/.config/i3/i3blocks/battery2/images/unknown.png new file mode 100644 index 0000000..fa03c69 Binary files /dev/null and b/i3/.config/i3/i3blocks/battery2/images/unknown.png differ diff --git a/i3/.config/i3/i3blocks/battery2/images/unplugged.png b/i3/.config/i3/i3blocks/battery2/images/unplugged.png new file mode 100644 index 0000000..3b8e02e Binary files /dev/null and b/i3/.config/i3/i3blocks/battery2/images/unplugged.png differ diff --git a/i3/.config/i3/i3blocks/batterybar/LICENSE b/i3/.config/i3/i3blocks/batterybar/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/i3/.config/i3/i3blocks/batterybar/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/i3/.config/i3/i3blocks/batterybar/README.md b/i3/.config/i3/i3blocks/batterybar/README.md new file mode 100644 index 0000000..8e25979 --- /dev/null +++ b/i3/.config/i3/i3blocks/batterybar/README.md @@ -0,0 +1,31 @@ +# batterybar + +Display the battery level in a set of five unicode squares (U+25A0). + +![](screenshot.png) + +It also changes color for more accuracy and to distinguish between charging, +discharging, charged, and AC statuses. + +You can also specify your own set of colors. + +Left-clicking briefly shows the battery level in percent. + +# Dependencies + +* acpi + +# Installation + +* Copy the batterybar script into your directory of choice, e.g. ~/.i3blocks/ +* Give it execution permission (`chmod +x batterybar`) +* Add the following blocket to your i3blocks.conf: + +```ini +[batterybar] +command=$SCRIPT_DIR/batterybar #run batterybar -h for options +label=bat: +interval=5 +markup=pango +min_width=bat: ■■■■■ +``` diff --git a/i3/.config/i3/i3blocks/batterybar/batterybar b/i3/.config/i3/i3blocks/batterybar/batterybar new file mode 100755 index 0000000..e0b17c1 --- /dev/null +++ b/i3/.config/i3/i3blocks/batterybar/batterybar @@ -0,0 +1,136 @@ +#!/usr/bin/env bash +# batterybar; displays battery percentage as a bar on i3blocks +# +# Copyright 2015 Keftaa +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. +# +# +readarray -t output <<< $(acpi battery) +battery_count=${#output[@]} + +for line in "${output[@]}"; +do + percentages+=($(echo "$line" | grep -o -m1 '[0-9]\{1,3\}%' | tr -d '%')) + statuses+=($(echo "$line" | egrep -o -m1 'Discharging|Charging|AC|Full|Unknown')) + remaining=$(echo "$line" | egrep -o -m1 '[0-9][0-9]:[0-9][0-9]') + if [[ -n $remaining ]]; then + remainings+=(" ($remaining)") + else + remainings+=("") + fi +done + +squares="■" + +#There are 8 colors that reflect the current battery percentage when +#discharging +dis_colors=("#FF0027" "#FF3B05" "#FFB923" "#FFD000" "#E4FF00" "#ADFF00" + "#6DFF00" "#10BA00") +charging_color="#00AFE3" +full_color="#FFFFFF" +ac_color="#535353" + + +while getopts 1:2:3:4:5:6:7:8:c:f:a:h opt; do + case "$opt" in + 1) dis_colors[0]="$OPTARG";; + 2) dis_colors[1]="$OPTARG";; + 3) dis_colors[2]="$OPTARG";; + 4) dis_colors[3]="$OPTARG";; + 5) dis_colors[4]="$OPTARG";; + 6) dis_colors[5]="$OPTARG";; + 7) dis_colors[6]="$OPTARG";; + 8) dis_colors[7]="$OPTARG";; + c) charging_color="$OPTARG";; + f) full_color="$OPTARG";; + a) ac_color="$OPTARG";; + h) printf "Usage: batterybar [OPTION] color + When discharging, there are 8 [1-8] levels colors. + You can specify custom colors, for example: + + batterybar -1 red -2 \"#F6F6F6\" -8 green + + You can also specify the colors for the charging, AC and + charged states: + + batterybar -c green -f white -a \"#EEEEEE\"\n"; + exit 0; + esac +done + +end=$(($battery_count - 1)) +for i in $(seq 0 $end); +do + if (( percentages[$i] > 0 && percentages[$i] < 20 )); then + squares="■" + elif (( percentages[$i] >= 20 && percentages[$i] < 40 )); then + squares="■■" + elif (( percentages[$i] >= 40 && percentages[$i] < 60 )); then + squares="■■■" + elif (( percentages[$i] >= 60 && percentages[$i] < 80 )); then + squares="■■■■" + elif (( percentages[$i] >=80 )); then + squares="■■■■■" + fi + + if [[ "${statuses[$i]}" = "Unknown" ]]; then + squares="?$squares" + fi + + case "${statuses[$i]}" in + "Charging") + color="$charging_color" + ;; + "Full") + color="$full_color" + ;; + "AC") + color="$ac_color" + ;; + "Discharging"|"Unknown") + if (( percentages[$i] >= 0 && percentages[$i] < 10 )); then + color="${dis_colors[0]}" + elif (( percentages[$i] >= 10 && percentages[$i] < 20 )); then + color="${dis_colors[1]}" + elif (( percentages[$i] >= 20 && percentages[$i] < 30 )); then + color="${dis_colors[2]}" + elif (( percentages[$i] >= 30 && percentages[$i] < 40 )); then + color="${dis_colors[3]}" + elif (( percentages[$i] >= 40 && percentages[$i] < 60 )); then + color="${dis_colors[4]}" + elif (( percentages[$i] >= 60 && percentages[$i] < 70 )); then + color="${dis_colors[5]}" + elif (( percentages[$i] >= 70 && percentages[$i] < 80 )); then + color="${dis_colors[6]}" + elif (( percentages[$i] >= 80 )); then + color="${dis_colors[7]}" + fi + ;; + esac + + # Print Battery number if there is more than one + if (( $end > 0 )) ; then + message="$message $(($i + 1)):" + fi + + if [[ "$BLOCK_BUTTON" -eq 1 ]]; then + message="$message ${statuses[$i]} ${percentages[$i]}%${remainings[i]}" + fi + message="$message $squares" +done + +echo $message diff --git a/i3/.config/i3/i3blocks/batterybar/screenshot.png b/i3/.config/i3/i3blocks/batterybar/screenshot.png new file mode 100644 index 0000000..d55c221 Binary files /dev/null and b/i3/.config/i3/i3blocks/batterybar/screenshot.png differ diff --git a/i3/.config/i3/i3blocks/brightness/brightness b/i3/.config/i3/i3blocks/brightness/brightness new file mode 100755 index 0000000..3435dd4 --- /dev/null +++ b/i3/.config/i3/i3blocks/brightness/brightness @@ -0,0 +1,5 @@ +echo $(expr $(brightnessctl get) / $(expr $(brightnessctl max) / 100)) +case $BLOCK_BUTTON in + 4) brightnessctl set +10% ;; + 5) brightnessctl set 10%- ;; +esac diff --git a/i3/.config/i3/i3blocks/config.example b/i3/.config/i3/i3blocks/config.example new file mode 100644 index 0000000..ea66dd2 --- /dev/null +++ b/i3/.config/i3/i3blocks/config.example @@ -0,0 +1,156 @@ +# i3blocks config file +# +# Please see man i3blocks for a complete reference! +# The man page is also hosted at http://vivien.github.io/i3blocks +# +# List of valid properties: +# +# align +# color +# command +# full_text +# instance +# interval +# label +# min_width +# name +# separator +# separator_block_width +# short_text +# signal +# urgent + +# Global properties +# +# The top properties below are applied to every block, but can be overridden. +# Each block command defaults to the script name to avoid boilerplate. +# Change $SCRIPT_DIR to the location of your scripts! +command=$SCRIPT_DIR/$BLOCK_NAME +separator_block_width=15 +markup=none + +# Volume indicator +# +# The first parameter sets the step (and units to display) +# The second parameter overrides the mixer selection +# See the script for details. +[volume] +label=VOL +#label=♪ +instance=Master +#instance=PCM +interval=once +signal=10 + +# Memory usage +# +# The type defaults to "mem" if the instance is not specified. +[memory] +label=MEM +separator=false +interval=30 + +[memory] +label=SWAP +instance=swap +separator=false +interval=30 + +# Disk usage +# +# The directory defaults to $HOME if the instance is not specified. +# The script may be called with a optional argument to set the alert +# (defaults to 10 for 10%). +[disk] +label=HOME +#instance=/mnt/data +interval=30 + +# Network interface monitoring +# +# If the instance is not specified, use the interface used for default route. +# The address can be forced to IPv4 or IPv6 with -4 or -6 switches. +[iface] +#instance=wlan0 +color=#00FF00 +interval=10 +separator=false + +[wifi] +#instance=wlp3s0 +label=wifi: +interval=10 +separator=false + +[bandwidth] +#instance=eth0 +interval=5 + +# CPU usage +# +# The script may be called with -w and -c switches to specify thresholds, +# see the script for details. +[cpu_usage] +label=CPU +interval=10 +min_width=CPU: 100.00% +#separator=false + +[load_average] +label=LOAD +interval=10 + +# Battery indicator +# +# The battery instance defaults to 0. +[battery] +label=BAT +#label=⚡ +#instance=1 +interval=30 + +# Date Time +# +[time] +command=date '+%Y-%m-%d %H:%M:%S' +interval=5 + +# Generic media player support +# +# This displays "ARTIST - SONG" if a music is playing. +# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others. +#[mediaplayer] +#instance=spotify +#interval=5 +#signal=10 + +# OpenVPN support +# +# Support multiple VPN, with colors. +#[openvpn] +#interval=20 + +# Temperature +# +# Support multiple chips, though lm-sensors. +# The script may be called with -w and -c switches to specify thresholds, +# see the script for details. +#[temperature] +#label=TEMP +#interval=10 + +# Key indicators +# +# Add the following bindings to i3 config file: +# +# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks +# bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks +#[keyindicator] +#instance=CAPS +#interval=once +#signal=11 + +#[keyindicator] +#instance=NUM +#interval=once +#signal=11 diff --git a/i3/.config/i3/i3blocks/cpu_usage/README.md b/i3/.config/i3/i3blocks/cpu_usage/README.md new file mode 100644 index 0000000..d35d154 --- /dev/null +++ b/i3/.config/i3/i3blocks/cpu_usage/README.md @@ -0,0 +1,19 @@ +# cpu_usage + +Show CPU usage. + +![](cpu_usage.png) + +# Dependencies + +* `mpstat` + +# Config + +``` +[cpu_usage] +command=$SCRIPT_DIR/cpu_usage +label=CPU +interval=10 +#min_width=CPU: 100.00% +``` diff --git a/i3/.config/i3/i3blocks/cpu_usage/cpu_usage b/i3/.config/i3/i3blocks/cpu_usage/cpu_usage new file mode 100755 index 0000000..bca35d4 --- /dev/null +++ b/i3/.config/i3/i3blocks/cpu_usage/cpu_usage @@ -0,0 +1,59 @@ +#!/usr/bin/env perl +# +# Copyright 2014 Pierre Mavro +# Copyright 2014 Vivien Didelot +# Copyright 2014 Andreas Guldstrand +# +# 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; +my $decimals = 2; + +sub help { + print "Usage: cpu_usage [-w ] [-c ] [-d ]\n"; + print "-w : warning threshold to become yellow\n"; + print "-c : critical threshold to become red\n"; + print "-d : Use decimals for percentage (default is $decimals) \n"; + exit 0; +} + +GetOptions("help|h" => \&help, + "w=i" => \$t_warn, + "c=i" => \$t_crit, + "d=i" => \$decimals, +); + +# 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 () { + if (/^.*\s+(\d+\.\d+)[\s\x00]?$/) { + $cpu_usage = 100 - $1; # 100% - %idle + last; + } +} +close(MPSTAT); + +$cpu_usage eq -1 and die 'Can\'t find CPU information'; + +# Print short_text, full_text +printf "%.${decimals}f%%\n", $cpu_usage; +printf "%.${decimals}f%%\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; diff --git a/i3/.config/i3/i3blocks/cpu_usage/cpu_usage.png b/i3/.config/i3/i3blocks/cpu_usage/cpu_usage.png new file mode 100644 index 0000000..6b6f577 Binary files /dev/null and b/i3/.config/i3/i3blocks/cpu_usage/cpu_usage.png differ diff --git a/i3/.config/i3/i3blocks/cpu_usage/i3blocks.conf b/i3/.config/i3/i3blocks/cpu_usage/i3blocks.conf new file mode 100644 index 0000000..12319dd --- /dev/null +++ b/i3/.config/i3/i3blocks/cpu_usage/i3blocks.conf @@ -0,0 +1,5 @@ +[cpu_usage] +command=$SCRIPT_DIR/cpu_usage +label=CPU +interval=10 +#min_width=CPU: 100.00% diff --git a/i3/.config/i3/i3blocks/disk-io/LICENSE b/i3/.config/i3/i3blocks/disk-io/LICENSE new file mode 100644 index 0000000..8cdb845 --- /dev/null +++ b/i3/.config/i3/i3blocks/disk-io/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/i3/.config/i3/i3blocks/disk-io/README.md b/i3/.config/i3/i3blocks/disk-io/README.md new file mode 100644 index 0000000..9da86ea --- /dev/null +++ b/i3/.config/i3/i3blocks/disk-io/README.md @@ -0,0 +1,37 @@ +# disk-io + +Monitor disk reads and writes. + +![](disk-io-1.png) + +![](disk-io-2.png) + +# Dependencies + +iostat (sysstat package), fontawesome for the  hard disk icon (fonts-font-awesome package) + +# Options + +The default output is "read / write (k|M)B/s". +If `-R` is not used, the `$BLOCK_INSTANCE` variable, if specified, will be the chosen regex to match against devices. +This allows watching specific devices by e.g. setting `instance=/^sda/` +or `instance=/^sd[ab]/`. + +``` +Usage: disk-io [-t time] [-w width] [-p kB_precision] [-P MB_precision] [-R regex] [-s separator] [-S] [-T threshold [-C warn_color]] [-k|-M] [-l] [-h] +Options: +-L Label to put in front of the text. Default: +-t Time interval in seconds between measurements. Default: 5 +-w The width of printed floats. Default: 4 +-p The precision of kB/s floats. Default: 0 +-P The precision of MB/s floats. Default: 1 +-R Regex that devices must match. Default: /^(s|h)d[a-zA-Z]+/ +-s Separator to put between rates. Default: / +-S Short units, omit B/s in kB/s and MB/s. +-T Rate in kB/s to exceed to trigger a warning. Default: not enabled +-C Color to change the blocklet to warn the user. Default: #FF0000 +-l List devices that iostat reports +-M Do not switch between MB/s and kB/s, use only MB/s +-k Do not switch between MB/s and kB/s, use only kB/s +-h Show this help text +``` diff --git a/i3/.config/i3/i3blocks/disk-io/disk-io b/i3/.config/i3/i3blocks/disk-io/disk-io new file mode 100755 index 0000000..14ccc14 --- /dev/null +++ b/i3/.config/i3/i3blocks/disk-io/disk-io @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2016 James Murphy +# Licensed under the terms of the GNU GPL v2 only. +# +# i3blocks blocklet script to monitor disk io + +label="" +dt=5 +MB_only=0 +kB_only=0 +width=4 +MB_precision=1 +kB_precision=0 +regex="${BLOCK_INSTANCE:-/^(s|h)d[a-zA-Z]+/}" +threshold=0 +warn_color="#FF0000" +sep="/" +unit_suffix="B/s" + +function list_devices { + echo "Devices iostat reports that match our regex:" + iostat | awk '$1~/^(s|h)d[a-zA-Z]+/{print $1}' +} + +while getopts L:t:w:p:P:R:s:ST:C:lLMmKkh opt; do + case "$opt" in + L) label="$OPTARG" ;; + t) dt="$OPTARG" ;; + w) width="$OPTARG" ;; + p) kB_precision="$OPTARG" ;; + P) MB_precision="$OPTARG" ;; + R) regex="$OPTARG" ;; + s) sep="$OPTARG" ;; + S) unit_suffix="" ;; + T) threshold="$OPTARG" ;; + C) warn_color="$OPTARG" ;; + l) list_devices; exit 0 ;; + M|m) MB_only=1 ;; + K|k) kB_only=1 ;; + h) printf \ +"Usage: disk-io [-t time] [-w width] [-p kB_precision] [-P MB_precision] [-R regex] [-s separator] [-S] [-T threshold [-C warn_color]] [-k|-M] [-l] [-h] +Options: +-L\tLabel to put in front of the text. Default: $label +-t\tTime interval in seconds between measurements. Default: $dt +-w\tThe width of printed floats. Default: $width +-p\tThe precision of kB/s floats. Default: $kB_precision +-P\tThe precision of MB/s floats. Default: $MB_precision +-R\tRegex that devices must match. Default: $regex +-s\tSeparator to put between rates. Default: $sep +-S\tShort units, omit B/s in kB/s and MB/s. +-T\tRate in kB/s to exceed to trigger a warning. Default: not enabled +-C\tColor to change the blocklet to warn the user. Default: $warn_color +-l\tList devices that iostat reports +-M\tDo not switch between MB/s and kB/s, use only MB/s +-k\tDo not switch between MB/s and kB/s, use only kB/s +-h\tShow this help text +" && exit 0;; + esac +done + +iostat -dyz "$dt" | awk -v sep="$sep" " + BEGIN { + rx = wx = 0; + } + { + if(\$0 == \"\") { + if ($threshold > 0 && (rx >= $threshold || wx >= $threshold)) { + printf \"\"; + } + printf \"$label\"; + if(!$kB_only && ($MB_only || rx >= 1024 || wx >= 1024)) { + printf \"%-$width.${MB_precision}f%s%$width.${MB_precision}f M$unit_suffix\", rx/1024, sep, wx/1024; + } + else { + printf \"%-$width.${kB_precision}f%s%$width.${kB_precision}f k$unit_suffix\", rx, sep, wx; + } + if ($threshold > 0 && (rx >= $threshold || wx >= $threshold)) { + printf \"\"; + } + printf \"\n\"; + fflush(stdout); + } + else if(\$1~/^Device:?/) { + rx = wx = 0; + } + else if(\$1~$regex) { + rx += \$3; + wx += \$4; + } + }" diff --git a/i3/.config/i3/i3blocks/disk-io/disk-io-1.png b/i3/.config/i3/i3blocks/disk-io/disk-io-1.png new file mode 100644 index 0000000..373e1cc Binary files /dev/null and b/i3/.config/i3/i3blocks/disk-io/disk-io-1.png differ diff --git a/i3/.config/i3/i3blocks/disk-io/disk-io-2.png b/i3/.config/i3/i3blocks/disk-io/disk-io-2.png new file mode 100644 index 0000000..f73ed5d Binary files /dev/null and b/i3/.config/i3/i3blocks/disk-io/disk-io-2.png differ diff --git a/i3/.config/i3/i3blocks/disk-io/i3blocks.conf b/i3/.config/i3/i3blocks/disk-io/i3blocks.conf new file mode 100644 index 0000000..e9a16aa --- /dev/null +++ b/i3/.config/i3/i3blocks/disk-io/i3blocks.conf @@ -0,0 +1,7 @@ +[disk-io] +label= +command=$SCRIPT_DIR/disk-io +#command=$SCRIPT_DIR/disk-io -w 3 -M -P 0 +interval=persist +markup=pango +#instance=/^sda/ diff --git a/i3/.config/i3/i3blocks/disk/README.md b/i3/.config/i3/i3blocks/disk/README.md new file mode 100644 index 0000000..59c5ade --- /dev/null +++ b/i3/.config/i3/i3blocks/disk/README.md @@ -0,0 +1,18 @@ +# disk + +Show disk usage. The directory defaults to $HOME if the instance is not +specified. The script may be called with an optional argument to set the +alert (defaults to 10 for 10%). +The script also accepts the flag `-n` to allow checking the disk usage of network devices, +which is disabled by default. + + +# Config + +``` +[disk] +command=$SCRIPT_DIR/disk +label=HOME +#instance=/mnt/data +interval=30 +``` diff --git a/i3/.config/i3/i3blocks/disk/disk b/i3/.config/i3/i3blocks/disk/disk new file mode 100755 index 0000000..35ec924 --- /dev/null +++ b/i3/.config/i3/i3blocks/disk/disk @@ -0,0 +1,46 @@ +#!/bin/sh +# Copyright (C) 2014 Julien Bonjean + +# 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 . + +DIR="${BLOCK_INSTANCE:-$HOME}" +ALERT_LOW="${1:-10}" # color will turn red under this value (default: 10%) + +LOCAL_FLAG="-l" +if [ "$1" = "-n" ] || [ "$2" = "-n" ]; then + LOCAL_FLAG="" +fi + +df -h -P $LOCAL_FLAG "$DIR" | 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" + } +} +' diff --git a/i3/.config/i3/i3blocks/disk/disk.png b/i3/.config/i3/i3blocks/disk/disk.png new file mode 100644 index 0000000..76d7ddf Binary files /dev/null and b/i3/.config/i3/i3blocks/disk/disk.png differ diff --git a/i3/.config/i3/i3blocks/disk/i3blocks.conf b/i3/.config/i3/i3blocks/disk/i3blocks.conf new file mode 100644 index 0000000..535b9e6 --- /dev/null +++ b/i3/.config/i3/i3blocks/disk/i3blocks.conf @@ -0,0 +1,5 @@ +[disk] +command=$SCRIPT_DIR/disk +label=HOME +#instance=/mnt/data +interval=30 diff --git a/i3/.config/i3/i3blocks/email/COPYING b/i3/.config/i3/i3blocks/email/COPYING new file mode 100644 index 0000000..d9a3335 --- /dev/null +++ b/i3/.config/i3/i3blocks/email/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + i3blocks-email + Copyright (C) 2016 Антон Карманов + + 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + i3blocks-email Copyright (C) 2016 Антон Карманов + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/i3/.config/i3/i3blocks/email/README.md b/i3/.config/i3/i3blocks/email/README.md new file mode 100644 index 0000000..d5b8f77 --- /dev/null +++ b/i3/.config/i3/i3blocks/email/README.md @@ -0,0 +1,100 @@ +# email + +Show the count of new messages in your +email box using IMAP. +Left button mouse click opens custom URL. + +![message](email.png) + +# Dependencies + +Python 3, [python-keyring](https://pypi.python.org/pypi/keyring) (optional), +gnome-keyring (if pyton-keyring using, also you able to use any other +compatible backend) + +**Packages names in Debian based distros**: +python3, python3-keyring, gnome-keyring + +**Packages names in Arch Linux**: +python, python-keyring, gnome-keyring + + +Alternatively you can get python-keyring with +[pip](https://pypi.python.org/pypi/pip): + +```shell +$ pip install keyring +``` + +# Usage + +There are two ways to set up email blocklet. You able to specify options in +**"Settings"** section inside [email](email) file. And if you not allowed to +edit email file, or if you want to use multiple instances of email block, you +could make config file for each instance in **~/.config/i3blocks-email/** +directory. + +Now keep in mind, that there are also two ways to specify your mailbox password. +One way is to past it between apostrophes in PASS line in blocklet or config +file. **It is not secure and it is recommended for debugging only!** + +Another way is to use a system keyring. In this way you should keep PASS empty +as is. To add your password to keyring run: + +```shell +$ $SCRIPT_DIR/email --add $USER +``` +where $USER is your mailbox login. + +**python-keyring and compatible backend should be installed and be in $PATH.** + +You also able to delete key with: +```shell +$ $SCRIPT_DIR/email --remove $USER +``` + + +Now add a section to your i3blocks.conf like following: +```INI +[email] +command=$SCRIPT_DIR/email +interval=300 +min_width=messages: 99 +``` + +If you want to use instance mechanism of i3blocks, you should make config file +in directory **~/.config/i3blocks-email/** with following structure: +```INI +[MAIL] + +HOST: imap.mail_server.com +PORT: 993 +USER: my_mailbox@mail_server.com +PASS: +URL: https://www.mail_server.com + +``` + +The [MAIL] header should exist. Any options are optional and replace the same +options inside [email](email). +The minimal config file is: +```INI +[MAIL] + +HOST: imap.mail_server.com +USER: my_mailbox@mail_server.com +``` + +When config files is created, add an instance option with name of config file +to your i3blocks.conf. Let's imagine, that we have the +~/.config/i3blocks-email/my\_mailbox\_config file, then email section should be: +```ini +[email] +command=$SCRIPT_DIR/email +instance=my_mailbox_config +interval=60 +min_width=messages: 99 +``` + +After configuring blocklet restart your window manager. +New block should appear in the i3bar. diff --git a/i3/.config/i3/i3blocks/email/email b/i3/.config/i3/i3blocks/email/email new file mode 100755 index 0000000..cff8ed5 --- /dev/null +++ b/i3/.config/i3/i3blocks/email/email @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright © 2016 Anton Karmanov + +# 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 . + +import configparser +import subprocess +import argparse +import imaplib +from getpass import getpass +import os +try: + import keyring + keyring_loaded = True +except ImportError: + keyring_loaded = False + +# _Settings____________________________________________________________________ + +config = { + 'HOST': 'imap.mail_server.com', + 'PORT': 993, + 'USER': 'my_mailbox@mail_server.com', + 'PASS': '', + 'URL': 'https://www.mail_server.com' +} +# _____________________________________________________________________________ + + +def get_args(): + parser = argparse.ArgumentParser( + description='In interactive mode you able to manage your keys.' + ) + parser.add_argument( + '-a', '--add', type=str, help='add key to keyring' + ) + parser.add_argument( + '-r', '--remove', type=str, help='remove key from keyring' + ) + args = parser.parse_args() + if args.add: + match = False + while not match: + pass_1 = getpass('Type password : ') + pass_2 = getpass('Type password again: ') + if pass_1 == pass_2: + match = True + keyring.set_password('i3blocks-email', args.add, pass_1) + else: + print('\nPasswords do not match!\n') + return(True) + elif args.remove: + ack = input( + 'Are you sure want to delete key for {}? '.format(args.remove) + ) + if ack.lower() in ('y', 'yes'): + keyring.delete_password('i3blocks-email', args.remove) + else: + print('Cancel.') + return(True) + return(False) + + +def parse_instance(): + INSTANCE = '' + try: + INSTANCE = os.environ['BLOCK_INSTANCE'] + except KeyError: + pass + finally: + if len(INSTANCE): + parse_config(INSTANCE) + + +def parse_config(INSTANCE): + global config + HOME = os.environ['HOME'] + config_file = configparser.ConfigParser() + CONFIG_PATH = HOME + '/.config/i3blocks-email/' + INSTANCE + config_file.read(CONFIG_PATH) + for ITEM in config_file['MAIL']: + ITEM = ITEM.upper() + config[ITEM] = config_file['MAIL'][ITEM] + + +def get_PASS(): + return(keyring.get_password('i3blocks-email', config['USER'])) + + +def block_event(): + try: + event = os.environ['BLOCK_BUTTON'] + except KeyError: + event = '0' + if event == '1': + NULL = open(os.devnull, 'w') + subprocess.Popen(['xdg-open', config['URL']], stdout=NULL) + + +def serf(): + box = imaplib.IMAP4_SSL(host=config['HOST'], port=config['PORT']) + box.login(config['USER'], config['PASS']) + box.select() + result, ids = box.search(None, 'UNSEEN') + box.logout() + return(len(ids[0].split())) + + +def printer(new_count): + print(new_count) + print(new_count) + if new_count > 0: + print('#00ff00') + else: + print('#ededed') + +if (keyring_loaded and not get_args()) or not keyring_loaded: + parse_instance() + block_event() + if not config['PASS']: + config['PASS'] = get_PASS() + printer(serf()) diff --git a/i3/.config/i3/i3blocks/email/email.png b/i3/.config/i3/i3blocks/email/email.png new file mode 100644 index 0000000..96c5423 Binary files /dev/null and b/i3/.config/i3/i3blocks/email/email.png differ diff --git a/i3/.config/i3/i3blocks/iface/README.md b/i3/.config/i3/i3blocks/iface/README.md new file mode 100644 index 0000000..3e50ed6 --- /dev/null +++ b/i3/.config/i3/i3blocks/iface/README.md @@ -0,0 +1,19 @@ +# iface + +Show network interface status. +If the instance is not specified, it uses the interface for the default route. +The address can be forced to IPv4 or IPv6 with -4 or -6 switches. + +![](iface-up.png) +![](iface-down.png) + +# Config + +``` +[iface] +command=$SCRIPT_DIR/iface +#label=wlan0: +#instance=wlan0 +color=#00FF00 +interval=10 +``` diff --git a/i3/.config/i3/i3blocks/iface/i3blocks.conf b/i3/.config/i3/i3blocks/iface/i3blocks.conf new file mode 100644 index 0000000..cd7cda9 --- /dev/null +++ b/i3/.config/i3/i3blocks/iface/i3blocks.conf @@ -0,0 +1,6 @@ +[iface] +command=$SCRIPT_DIR/iface +#label=wlan0: +#instance=wlan0 +color=#00FF00 +interval=10 diff --git a/i3/.config/i3/i3blocks/iface/iface b/i3/.config/i3/i3blocks/iface/iface new file mode 100755 index 0000000..7014979 --- /dev/null +++ b/i3/.config/i3/i3blocks/iface/iface @@ -0,0 +1,61 @@ +#!/bin/bash +# Copyright (C) 2014 Julien Bonjean +# Copyright (C) 2014 Alexander Keller + +# 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 . + +#------------------------------------------------------------------------ + +# Use the provided interface, otherwise the device used for the default route. +if [[ -n $BLOCK_INSTANCE ]]; then + IF=$BLOCK_INSTANCE +else + IF=$(ip route | awk '/^default/ { print $5 ; exit }') +fi + +#------------------------------------------------------------------------ + +# As per #36 -- It is transparent: e.g. if the machine has no battery or wireless +# connection (think desktop), the corresponding block should not be displayed. +[[ ! -d /sys/class/net/${IF} ]] && exit + +#------------------------------------------------------------------------ + +if [[ "$(cat /sys/class/net/$IF/operstate)" = 'down' ]]; then + echo down # full text + echo down # short text + echo \#FF0000 # color + exit +fi + +case $1 in + -4) + AF=inet ;; + -6) + AF=inet6 ;; + *) + AF=inet6? ;; +esac + +# if no interface is found, use the first device with a global scope +IPADDR=$(ip addr show $IF | perl -n -e "/$AF ([^\/]+).* scope global/ && print \$1 and exit") + +case $BLOCK_BUTTON in + 3) echo -n "$IPADDR" | xclip -q -se c ;; +esac + +#------------------------------------------------------------------------ + +echo "$IPADDR" # full text +echo "$IPADDR" # short text diff --git a/i3/.config/i3/i3blocks/iface/iface-down.png b/i3/.config/i3/i3blocks/iface/iface-down.png new file mode 100644 index 0000000..33a0a72 Binary files /dev/null and b/i3/.config/i3/i3blocks/iface/iface-down.png differ diff --git a/i3/.config/i3/i3blocks/iface/iface-up.png b/i3/.config/i3/i3blocks/iface/iface-up.png new file mode 100644 index 0000000..4ffade6 Binary files /dev/null and b/i3/.config/i3/i3blocks/iface/iface-up.png differ diff --git a/i3/.config/i3/i3blocks/kbdd_layout/LICENSE.md b/i3/.config/i3/i3blocks/kbdd_layout/LICENSE.md new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/i3/.config/i3/i3blocks/kbdd_layout/LICENSE.md @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/i3/.config/i3/i3blocks/kbdd_layout/README.md b/i3/.config/i3/i3blocks/kbdd_layout/README.md new file mode 100644 index 0000000..ebd3cbe --- /dev/null +++ b/i3/.config/i3/i3blocks/kbdd_layout/README.md @@ -0,0 +1,30 @@ +# kbdd_layout + +Show keyboard layout using dbus and [kbdd](https://github.com/qnikst/kbdd). + +![view of block](block.png) + +kbdd is a useful daemon made for lightweight window managers. +It works with xkb and remembers layouts for each window. + +# Requirements + +Dependencies: kbdd (typically in package of the same name). + +You can set your keyboard configuration e.g. with + +``` +exec --no-startup-id "setxkbmap -layout us,ru -option 'grp:ctrl_alt_toggle'" +``` + +in your i3 config. +The blocklet must be restarted if you execute another setxkbmap command, +or it may give incorrect results. + +# Config + +```ini +[kbdd_layout] +command=$SCRIPT_DIR/kbdd_layout +interval=persist +``` diff --git a/i3/.config/i3/i3blocks/kbdd_layout/block.png b/i3/.config/i3/i3blocks/kbdd_layout/block.png new file mode 100644 index 0000000..be66e3f Binary files /dev/null and b/i3/.config/i3/i3blocks/kbdd_layout/block.png differ diff --git a/i3/.config/i3/i3blocks/kbdd_layout/kbdd_layout b/i3/.config/i3/i3blocks/kbdd_layout/kbdd_layout new file mode 100755 index 0000000..96fd4b6 --- /dev/null +++ b/i3/.config/i3/i3blocks/kbdd_layout/kbdd_layout @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# +# kbdd_layout is a script that parse layout with kbdd in real time +# Copyright (C) 2016 Anton Karmanov +# +# 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 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 . + +# In case user is restarting block after making layout changes +# e.g. via setxkbmap, reload kbdd +killall kbdd 2>/dev/null +kbdd >/dev/null || exit 1 + +# Get initial state of layout +N=$( dbus-send --print-reply=literal --dest=ru.gentoo.KbddService\ + /ru/gentoo/KbddService ru.gentoo.kbdd.getCurrentLayout 2>/dev/null |\ + sed -un 's/^.*uint32 //p' ) + +# In case dbus service wasn't available yet, poll until service is ready +while [[ -z "$N" ]]; do + sleep .1 + N=$( dbus-send --print-reply=literal --dest=ru.gentoo.KbddService\ + /ru/gentoo/KbddService ru.gentoo.kbdd.getCurrentLayout 2>/dev/null |\ + sed -un 's/^.*uint32 //p' ) +done +echo $( dbus-send --print-reply=literal --dest=ru.gentoo.KbddService \ + /ru/gentoo/KbddService ru.gentoo.kbdd.getLayoutName uint32:$N ) + +# Parse dbus output +dbus-monitor "interface='ru.gentoo.kbdd',member='layoutNameChanged'" |\ + sed -un '0~2p' | sed -un 's:.*string "\(.*\)".*:\1:p' | sed -u '/:/d' diff --git a/i3/.config/i3/i3blocks/key_layout/README.md b/i3/.config/i3/i3blocks/key_layout/README.md new file mode 100644 index 0000000..fe87b0e --- /dev/null +++ b/i3/.config/i3/i3blocks/key_layout/README.md @@ -0,0 +1,18 @@ +# key_layout + +Display the current keyboard layout using setxkbmap. + +![](key_layout.png) + +![](key_layout_variant.png) + +# Installation + +Use the following in your i3blocks config: + +```ini +[key_layout] +label=Layout +interval=30 +command=$SCRIPT_DIR/key_layout +``` diff --git a/i3/.config/i3/i3blocks/key_layout/key_layout b/i3/.config/i3/i3blocks/key_layout/key_layout new file mode 100755 index 0000000..a861534 --- /dev/null +++ b/i3/.config/i3/i3blocks/key_layout/key_layout @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Copyright 2016 Patrick Haun +# Edited: Denis Kadyshev +# +# 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 . + +setxkbmap -query | awk ' + BEGIN{layout="";variant=""} + /^layout/{layout=$2} + /^variant/{variant=" ("$2")"} + END{printf("%s%s",layout,variant)}' diff --git a/i3/.config/i3/i3blocks/key_layout/key_layout.png b/i3/.config/i3/i3blocks/key_layout/key_layout.png new file mode 100644 index 0000000..d6e2104 Binary files /dev/null and b/i3/.config/i3/i3blocks/key_layout/key_layout.png differ diff --git a/i3/.config/i3/i3blocks/key_layout/key_layout_variant.png b/i3/.config/i3/i3blocks/key_layout/key_layout_variant.png new file mode 100644 index 0000000..a5a7bf1 Binary files /dev/null and b/i3/.config/i3/i3blocks/key_layout/key_layout_variant.png differ diff --git a/i3/.config/i3/i3blocks/keyindicator/README.md b/i3/.config/i3/i3blocks/keyindicator/README.md new file mode 100644 index 0000000..eb6cdee --- /dev/null +++ b/i3/.config/i3/i3blocks/keyindicator/README.md @@ -0,0 +1,48 @@ +# keyindicator + +Show the status of capslock or numlock. + +![](keyindicator-active.png) + +![](keyindicator-inactive.png) + +# Installation + +Add the following bindings to i3 config file: + +``` +bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks +bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks +``` + +Use the following in your i3blocks config file: + +``` ini +[keyindicator] +command=$SCRIPT_DIR/keyindicator +instance=CAPS +markup=pango +interval=once +signal=11 + +[keyindicator] +command=$SCRIPT_DIR/keyindicator +instance=NUM +markup=pango +interval=once +signal=11 +``` + +# Options + +``` +Usage: keyindicator [-c ] [-C ] [-b ] [-B ] [--hide] + -c : hex color to use when indicator is on + -C : hex color to use when indicator is off + -b : hex color to use when indicator is on + -B : hex color to use when indicator is off + --hide: don't output anything when indicator is off + +Note: environment variable $BLOCK_INSTANCE should be one of: + CAPS, NUM (default is CAPS). +``` diff --git a/i3/.config/i3/i3blocks/keyindicator/keyindicator b/i3/.config/i3/i3blocks/keyindicator/keyindicator new file mode 100755 index 0000000..199a7ea --- /dev/null +++ b/i3/.config/i3/i3blocks/keyindicator/keyindicator @@ -0,0 +1,89 @@ +#!/usr/bin/env perl +# +# Copyright 2014 Marcelo Cerri +# +# 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 . + +use strict; +use warnings; +use utf8; +use Getopt::Long; +use File::Basename; + +# Default values +my $indicator = $ENV{BLOCK_INSTANCE} || "CAPS"; +my $color_on = "#00FF00"; +my $color_off = "#222222"; +my $bg_color_on; +my $bg_color_off; +my $hide = 0; + +sub help { + my $program = basename($0); + printf "Usage: %s [-c ] [-C ] [-b ] [-B ] [--hide]\n", $program; + printf " -c : hex color to use when indicator is on\n"; + printf " -C : hex color to use when indicator is off\n"; + printf " -b : hex color to use when indicator is on\n"; + printf " -B : hex color to use when indicator is off\n"; + printf " --hide: don't output anything when indicator is off\n"; + printf "\n"; + printf "Note: environment variable \$BLOCK_INSTANCE should be one of:\n"; + printf " CAPS, NUM (default is CAPS).\n"; + exit 0; +} + +Getopt::Long::config qw(no_ignore_case); +GetOptions("help|h" => \&help, + "c=s" => \$color_on, + "C=s" => \$color_off, + "b=s" => \$bg_color_on, + "B=s" => \$bg_color_off, + "hide" => \$hide) or exit 1; + +# Key mapping +my %indicators = ( + CAPS => 0x00000001, + NUM => 0x00000002, +); + +# Retrieve key flags +my $mask = 0; +open(XSET, "xset -q |") or die; +while () { + if (/LED mask:\s*([0-9a-f]+)/) { + $mask = hex $1; + last; + } +} +close(XSET); + +# Determine if indicator is on or off +my $indicator_status = ($indicators{$indicator} || 0) & $mask; + +# Exit if --hide and indicator is off +if ($hide and !$indicator_status) { + exit 0 +} + +# Output +my $fg_color = $indicator_status ? $color_on : $color_off; +my $bg_color = $indicator_status ? $bg_color_on : $bg_color_off; + +if (defined $bg_color) { + printf "%s\n", $fg_color, $bg_color, $indicator; +} else { + printf "%s\n", $fg_color, $indicator; +} + +exit 0 diff --git a/i3/.config/i3/i3blocks/keyindicator/keyindicator-active.png b/i3/.config/i3/i3blocks/keyindicator/keyindicator-active.png new file mode 100644 index 0000000..2023bbf Binary files /dev/null and b/i3/.config/i3/i3blocks/keyindicator/keyindicator-active.png differ diff --git a/i3/.config/i3/i3blocks/keyindicator/keyindicator-inactive.png b/i3/.config/i3/i3blocks/keyindicator/keyindicator-inactive.png new file mode 100644 index 0000000..5076ca0 Binary files /dev/null and b/i3/.config/i3/i3blocks/keyindicator/keyindicator-inactive.png differ diff --git a/i3/.config/i3/i3blocks/load_average/README.md b/i3/.config/i3/i3blocks/load_average/README.md new file mode 100644 index 0000000..7d7f632 --- /dev/null +++ b/i3/.config/i3/i3blocks/load_average/README.md @@ -0,0 +1,13 @@ +# load_average + +Show the system 1 minute load average. + +![](load_average.png) + +# Config + +``` +[load_average] +command=$SCRIPT_DIR/load_average +interval=10 +``` diff --git a/i3/.config/i3/i3blocks/load_average/i3blocks.conf b/i3/.config/i3/i3blocks/load_average/i3blocks.conf new file mode 100644 index 0000000..d979ec5 --- /dev/null +++ b/i3/.config/i3/i3blocks/load_average/i3blocks.conf @@ -0,0 +1,3 @@ +[load_average] +command=$SCRIPT_DIR/load_average +interval=10 diff --git a/i3/.config/i3/i3blocks/load_average/load_average b/i3/.config/i3/i3blocks/load_average/load_average new file mode 100755 index 0000000..37a5c71 --- /dev/null +++ b/i3/.config/i3/i3blocks/load_average/load_average @@ -0,0 +1,34 @@ +#!/bin/sh +# Copyright (C) 2014 Julien Bonjean + +# 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 . + +load="$(cut -d ' ' -f1 /proc/loadavg)" +cpus="$(nproc)" + +# full text +echo "$load" + +# short text +echo "$load" + +# color if load is too high +awk -v cpus=$cpus -v cpuload=$load ' + BEGIN { + if (cpus <= cpuload) { + print "#FF0000"; + exit 33; + } + } +' diff --git a/i3/.config/i3/i3blocks/load_average/load_average.png b/i3/.config/i3/i3blocks/load_average/load_average.png new file mode 100644 index 0000000..8d575bf Binary files /dev/null and b/i3/.config/i3/i3blocks/load_average/load_average.png differ diff --git a/i3/.config/i3/i3blocks/mediaplayer/README.md b/i3/.config/i3/i3blocks/mediaplayer/README.md new file mode 100644 index 0000000..921d94e --- /dev/null +++ b/i3/.config/i3/i3blocks/mediaplayer/README.md @@ -0,0 +1,36 @@ +# mediaplayer + +Generic media player status/controls. + +![Example screenshot](mediaplayer.png) + +This displays "ARTIST - SONG" if music is playing. By +left-clicking/right-clicking the displayed text, it will play the previous/next +song. Middle-clicking will pause/unpause the song. + +Supported players are: +- spotify, vlc, audacious, xmms2, mplayer and others that +use MPRIS DBus Interface Specification +- mpd +- cmus +- rhythmbox + +mpd is supported through mpc (music player client). + +For MPRIS support you need to have playerctl binary in your path. +See: https://github.com/acrisci/playerctl + +If you leave the instance empty it will try to find an +active player used on it's own. + +# Installation + +Add the following to your i3blocks config: + +``` ini +[mediaplayer] +command=$SCRIPT_DIR/mediaplayer +instance=spotify +interval=5 +signal=10 +``` diff --git a/i3/.config/i3/i3blocks/mediaplayer/mediaplayer b/i3/.config/i3/i3blocks/mediaplayer/mediaplayer new file mode 100755 index 0000000..718e335 --- /dev/null +++ b/i3/.config/i3/i3blocks/mediaplayer/mediaplayer @@ -0,0 +1,154 @@ +#!/usr/bin/env perl +# Copyright (C) 2014 Tony Crisci +# Copyright (C) 2015 Thiago Perrotta + +# 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 . + +# Requires playerctl binary to be in your path (except cmus) +# See: https://github.com/acrisci/playerctl + +# Set instance=NAME in the i3blocks configuration to specify a music player +# (playerctl will attempt to connect to org.mpris.MediaPlayer2.[NAME] on your +# DBus session). + +use Time::HiRes qw(usleep); +use Env qw(BLOCK_INSTANCE); + +use constant DELAY => 50; # Delay in ms to let network-based players (spotify) reflect new data. +use constant SPOTIFY_STR => 'spotify'; + +my @metadata = (); +my $player_arg = ""; + +if ($BLOCK_INSTANCE) { + $player_arg = "--player='$BLOCK_INSTANCE'"; +} + +sub buttons { + my $method = shift; + + if($method eq 'mpd') { + if ($ENV{'BLOCK_BUTTON'} == 1) { + system("mpc prev"); + } elsif ($ENV{'BLOCK_BUTTON'} == 2) { + system("mpc toggle"); + } elsif ($ENV{'BLOCK_BUTTON'} == 3) { + system("mpc next"); + } elsif ($ENV{'BLOCK_BUTTON'} == 4) { + system("mpc volume +10"); + } elsif ($ENV{'BLOCK_BUTTON'} == 5) { + system("mpc volume -10"); + } + } elsif ($method eq 'cmus') { + if ($ENV{'BLOCK_BUTTON'} == 1) { + system("cmus-remote --prev"); + } elsif ($ENV{'BLOCK_BUTTON'} == 2) { + system("cmus-remote --pause"); + } elsif ($ENV{'BLOCK_BUTTON'} == 3) { + system("cmus-remote --next"); + } + } elsif ($method eq 'playerctl') { + if ($ENV{'BLOCK_BUTTON'} == 1) { + system("playerctl $player_arg previous"); + usleep(DELAY * 1000) if $BLOCK_INSTANCE eq SPOTIFY_STR; + } elsif ($ENV{'BLOCK_BUTTON'} == 2) { + system("playerctl $player_arg play-pause"); + } elsif ($ENV{'BLOCK_BUTTON'} == 3) { + system("playerctl $player_arg next"); + usleep(DELAY * 1000) if $BLOCK_INSTANCE eq SPOTIFY_STR; + } elsif ($ENV{'BLOCK_BUTTON'} == 4) { + system("playerctl $player_arg volume 0.01+"); + } elsif ($ENV{'BLOCK_BUTTON'} == 5) { + system("playerctl $player_arg volume 0.01-"); + } + } elsif ($method eq 'rhythmbox') { + if ($ENV{'BLOCK_BUTTON'} == 1) { + system("rhythmbox-client --previous"); + } elsif ($ENV{'BLOCK_BUTTON'} == 2) { + system("rhythmbox-client --play-pause"); + } elsif ($ENV{'BLOCK_BUTTON'} == 3) { + system("rhythmbox-client --next"); + } + } +} + +sub cmus { + my @cmus = split /^/, qx(cmus-remote -Q); + if ($? == 0) { + foreach my $line (@cmus) { + my @data = split /\s/, $line; + if (shift @data eq 'tag') { + my $key = shift @data; + my $value = join ' ', @data; + + @metadata[0] = $value if $key eq 'artist'; + @metadata[1] = $value if $key eq 'title'; + } + } + + if (@metadata) { + buttons('cmus'); + + # metadata found so we are done + print(join ' - ', @metadata); + exit 0; + } + } +} + +sub mpd { + my $data = qx(mpc current); + if (not $data eq '') { + buttons("mpd"); + print($data); + exit 0; + } +} + +sub playerctl { + buttons('playerctl'); + + my $artist = qx(playerctl $player_arg metadata artist); + # exit status will be nonzero when playerctl cannot find your player + exit(0) if $? || $artist eq '(null)'; + + push(@metadata, $artist) if $artist; + + my $title = qx(playerctl $player_arg metadata title); + exit(0) if $? || $title eq '(null)'; + + push(@metadata, $title) if $title; + + print(join(" - ", @metadata)) if @metadata; +} + +sub rhythmbox { + buttons('rhythmbox'); + + my $data = qx(rhythmbox-client --print-playing --no-start); + print($data); +} + +if ($player_arg eq '' or $player_arg =~ /mpd/) { + mpd; +} +elsif ($player_arg =~ /cmus/) { + cmus; +} +elsif ($player_arg =~ /rhythmbox/) { + rhythmbox; +} +else { + playerctl; +} diff --git a/i3/.config/i3/i3blocks/mediaplayer/mediaplayer.png b/i3/.config/i3/i3blocks/mediaplayer/mediaplayer.png new file mode 100644 index 0000000..40e89fa Binary files /dev/null and b/i3/.config/i3/i3blocks/mediaplayer/mediaplayer.png differ diff --git a/i3/.config/i3/i3blocks/memory/README.md b/i3/.config/i3/i3blocks/memory/README.md new file mode 100644 index 0000000..4578dd1 --- /dev/null +++ b/i3/.config/i3/i3blocks/memory/README.md @@ -0,0 +1,20 @@ +# memory + +Show memory usage. Accepts instance "mem" or "swap". + +![](memory.png) + +# Config + +``` +[memory] +command=$SCRIPT_DIR/memory +label=MEM +interval=30 + +#[memory] +#command=$SCRIPT_DIR/memory +#label=SWAP +#instance=swap +#interval=30 +``` diff --git a/i3/.config/i3/i3blocks/memory/i3blocks.conf b/i3/.config/i3/i3blocks/memory/i3blocks.conf new file mode 100644 index 0000000..0a86f04 --- /dev/null +++ b/i3/.config/i3/i3blocks/memory/i3blocks.conf @@ -0,0 +1,11 @@ +[memory] +command=$SCRIPT_DIR/memory +label=MEM +interval=30 + +#[memory] +#command=$SCRIPT_DIR/memory +#label=SWAP +#instance=swap +#interval=30 + diff --git a/i3/.config/i3/i3blocks/memory/memory b/i3/.config/i3/i3blocks/memory/memory new file mode 100755 index 0000000..2dfaca3 --- /dev/null +++ b/i3/.config/i3/i3blocks/memory/memory @@ -0,0 +1,69 @@ +#!/bin/sh +# Copyright (C) 2014 Julien Bonjean + +# 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 . + +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 { + if (type == "swap") { + free=swap_free/1024/1024 + used=(swap_total-swap_free)/1024/1024 + total=swap_total/1024/1024 + } else { + free=mem_free/1024/1024 + used=(mem_total-mem_free)/1024/1024 + total=mem_total/1024/1024 + } + + pct=0 + if (total > 0) { + pct=used/total*100 + } + + # full text + printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct) + + # short text + printf("%.f%%\n", pct) + + # color + if (pct > 90) { + print("#FF0000\n") + } else if (pct > 80) { + print("#FFAE00\n") + } else if (pct > 70) { + print("#FFF600\n") + } +} +' /proc/meminfo diff --git a/i3/.config/i3/i3blocks/memory/memory.png b/i3/.config/i3/i3blocks/memory/memory.png new file mode 100644 index 0000000..c918a05 Binary files /dev/null and b/i3/.config/i3/i3blocks/memory/memory.png differ diff --git a/i3/.config/i3/i3blocks/monitor_manager/LICENSE b/i3/.config/i3/i3blocks/monitor_manager/LICENSE new file mode 100644 index 0000000..8cdb845 --- /dev/null +++ b/i3/.config/i3/i3blocks/monitor_manager/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/i3/.config/i3/i3blocks/monitor_manager/README.md b/i3/.config/i3/i3blocks/monitor_manager/README.md new file mode 100644 index 0000000..950909c --- /dev/null +++ b/i3/.config/i3/i3blocks/monitor_manager/README.md @@ -0,0 +1,27 @@ +# monitor_manager + +Quickly manage your monitors. +This script supports: on/off, blank/unblank, +extend, clone, set primary, change output mode, +rotate, reflect, adjust brightness. + +![](monitor_manager.png) + +# Dependencies + +python3, python3-tk, xrandr, fontawesome (fonts-font-awesome package), arandr suggested but not required. + +# Usage + +Add the following to your i3blocks config: + +``` +[monitors] +command=$SCRIPT_DIR/monitor_manager +interval=once +``` + +There are also some options that can be tinkered with at the top of the file. +The `SHOW_*` variables can be set to `False` in order to hide those components. +E.g. if you don't care about reflection, set `SHOW_REFLECTION = False` and the +button for reflection will not appear. diff --git a/i3/.config/i3/i3blocks/monitor_manager/monitor_manager b/i3/.config/i3/i3blocks/monitor_manager/monitor_manager new file mode 100755 index 0000000..9ed5530 --- /dev/null +++ b/i3/.config/i3/i3blocks/monitor_manager/monitor_manager @@ -0,0 +1,720 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2016 James Murphy +# Licensed under the GPL version 2 only +# +# monitor_manager is an i3blocks blocklet script to quickly manage your +# connected output devices + + +from tkinter import * +from tkinter import messagebox +from shutil import which +import tkinter.font as font +from subprocess import call, check_output, CalledProcessError +import re +import os + +DESKTOP_SYMBOL = "\uf108" + +UP_ARROW = "\uf062" +DOWN_ARROW = "\uf063" +UNBLANKED_SYMBOL = "\uf06e" +BLANKED_SYMBOL = "\uf070" +NOT_CLONED_SYMBOL = "\uf096" +PRIMARY_SYMBOL = "\uf005" +SECONDARY_SYMBOL = "\uf006" +CLONED_SYMBOL = "\uf24d" +ROTATION_NORMAL = "\uf151" +ROTATION_LEFT = "\uf191" +ROTATION_RIGHT = "\uf152" +ROTATION_INVERTED = "\uf150" +REFLECTION_NORMAL = "\uf176" +REFLECTION_X = "\uf07e" +REFLECTION_Y = "\uf07d" +REFLECTION_XY = "\uf047" +TOGGLE_ON = "\uf205" +TOGGLE_OFF = "\uf204" +APPLY_SYMBOL = "\uf00c" +CANCEL_SYMBOL = "\uf00d" +ARANDR_SYMBOL = "\uf085" +REFRESH_SYMBOL = "\uf021" + +SHOW_ON_OFF = True +SHOW_NAMES = True +SHOW_PRIMARY = True +SHOW_MODE = True +SHOW_BLANKED = True +SHOW_DUPLICATE = True +SHOW_ROTATION = True +SHOW_REFLECTION = True +SHOW_BRIGHTNESS = True +SHOW_BRIGHTNESS_VALUE = False +SHOW_UP_DOWN = True + +FONTAWESOME_FONT_FAMILY = "FontAwesome" +FONTAWESOME_FONT_SIZE = 11 +FONTAWESOME_FONT = (FONTAWESOME_FONT_FAMILY, FONTAWESOME_FONT_SIZE) +DEFAULT_FONT_FAMILY = "DejaVu Sans Mono" +DEFAULT_FONT_SIZE = 11 +DEFAULT_FONT = (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE) + +BRIGHTNESS_SLIDER_HANDLE_LENGTH = 20 +BRIGHTNESS_SLIDER_WIDTH = 15 +BRIGHTNESS_SLIDER_LENGTH = 50 + +WINDOW_CLOSE_TO_BOUNDARY_BUFFER = 20 + +class Output: + def __init__(self, name=None, w=None, h=None, x=None, y=None, rate=None, + active=False, primary=False, sameAs=None, blanked=False, rotation="normal", + reflection="normal", brightness=1.0): + self.name = name + self.w = w + self.h = h + self.x = x + self.y = y + self.rate = rate + self.active = active + self.primary = primary + self.sameAs = sameAs + self.blanked = blanked + self.modes = [] + self.currentModeIndex = None + self.preferredModeIndex = None + self.row = None + self.rotation = rotation + self.reflection = reflection + self.brightness = brightness + + def setPreferredMode(self): + if self.preferredModeIndex != None: + self.setMode(self.preferredModeIndex) + elif self.modes != None: + self.setMode(0) + + def setMode(self, index): + self.w, self.h, self.rate = self.modes[index] + self.currentModeIndex = index + + def realOutputs(): + outputs = [] + xrandrText = check_output(["xrandr","--verbose"],universal_newlines=True) + outputBlocks = re.split(r'\n(?=\S)', xrandrText, re.MULTILINE) + infoPattern = re.compile( + r'^(\S+)' # output name + ' connected ' # must be connected + '(primary )?' # check if primary output + '((\d+)x(\d+)\+(\d+)\+(\d+) )?' # width x height + xoffset + yoffset + '(\(\S+\) )?' # mode code (0x4a) + '(normal|left|inverted|right)? ?' # rotation + '(X axis|Y axis|X and Y axis)?') # reflection + brightnessPattern = re.compile(r'^\tBrightness: ([\d.]+)', re.MULTILINE) + modePattern = re.compile(r'^ (\d+)x(\d+)[^\n]*?\n +h:[^\n]*?\n +v:[^\n]*?([\d.]+)Hz$', re.MULTILINE) + for outputBlock in outputBlocks: + output = Output() + infoMatch = infoPattern.match(outputBlock) + if infoMatch: + output.name = infoMatch.group(1) + if infoMatch.group(2): + output.primary = True + if infoMatch.group(3): + output.active = True + output.w, output.h, output.x, output.y = map(int,infoMatch.group(4, 5, 6, 7)) + if infoMatch.group(9): + output.rotation = infoMatch.group(9) + if output.rotation in ["left", "right"]: + output.w, output.h = output.h, output.w + if infoMatch.group(10): + if infoMatch.group(10) == "X axis": + output.reflection = "x" + elif infoMatch.group(10) == "Y axis": + output.reflection = "y" + elif infoMatch.group(10) == "X and Y axis": + output.reflection = "xy" + else: + output.reflection = "normal" + else: + output.reflection = "normal" + brightnessMatch = brightnessPattern.search(outputBlock) + if brightnessMatch: + try: + brightness = float(brightnessMatch.group(1)) + output.brightness = brightness + if abs(brightness) < 1e-09: + output.blanked = True + except ValueError: + pass + modeMatches = modePattern.finditer(outputBlock) + for i, modeMatch in enumerate(modeMatches): + if "*current" in modeMatch.group(0): + output.currentModeIndex = i + output.rate = modeMatch.group(3) + if "+preferred" in modeMatch.group(0): + output.preferredModeIndex = i + output.modes.append(modeMatch.group(1,2,3)) + outputs.append(output) + outputs.sort(key=lambda m: m.x if m.x != None else -1) + prev = None + for output in outputs: + if prev != None and output.active and prev.active and output.x == prev.x: + output.sameAs = prev.name + else: + prev = output + + return outputs + + def modestr(mode): + return "{}x{}@{}".format(*mode) + + def status(self): + if self.active: + if self.sameAs == None or self.sameAs == self.name: + if self.w and self.h and self.rate: + return "{}x{}@{}".format(self.w, self.h, self.rate) + else: + return "auto" + else: + return "duplicate {}".format(self.sameAs) + else: + return "Inactive" + + + def __str__(self): + return "{} {}x{}+{}+{} active:{}, primary:{}\nmodes:{}\ncurrentIndex:{} preferredIndex:{}".format( + self.name, self.w, self.h, self.x, self.y, self.active, self.primary, self.modes, self.currentModeIndex, self.preferredModeIndex) + +class MonitorManager(): + def __init__(self, root): + self.root = root + self.root.withdraw() + self.root.resizable(0,0) + self.root.wm_title("Monitor Manager") + self.frame = None + self.outputs = [] + self.hardRefreshList() + style = {'relief':FLAT, 'padx':1, 'pady':1, 'anchor':'w', 'font':FONTAWESOME_FONT} + + self.infoLabel = Label(self.root, text="", **style) + self.infoLabel.config(font=DEFAULT_FONT) + + self.bottomRow = [] + + self.applyButton = Button(self.root, text=APPLY_SYMBOL, **style) + self.bottomRow.append(self.applyButton) + + self.refreshButton = Button(self.root, text=REFRESH_SYMBOL, **style) + self.bottomRow.append(self.refreshButton) + + if which("arandr"): + self.arandrButton = Button(self.root, text=ARANDR_SYMBOL, **style) + self.bottomRow.append(self.arandrButton) + else: + self.arandrButton = None + + self.cancelButton = Button(self.root, text=CANCEL_SYMBOL, **style) + self.bottomRow.append(self.cancelButton) + + self.infoLabel.grid(row=1,column=0, columnspan=len(self.bottomRow)) + self.gridRow(2, self.bottomRow) + + self.moveToMouse() + self.root.deiconify() + + def registerBindings(self): + self.root.bind("", self.handleApply) + self.root.bind("", self.handleCancel) + + self.applyButton.bind("", self.handleApply) + self.setInfo(self.applyButton, "Apply changes") + + self.refreshButton.bind("", self.hardRefreshList) + self.setInfo(self.refreshButton, "Refresh list") + + if self.arandrButton: + self.arandrButton.bind("", self.handleArandr) + self.setInfo(self.arandrButton, "Launch aRandR") + + self.cancelButton.bind("", self.handleCancel) + self.setInfo(self.cancelButton, "Cancel") + + for toggleButton in self.toggleButtons: + toggleButton.bind("", self.toggleActive) + toggleButton.bind("", self.handleUp) + toggleButton.bind("", self.handleDown) + self.setInfo(toggleButton, "Turn output on/off") + + for primaryButton in self.primaryButtons: + primaryButton.bind("", self.setPrimary) + self.setInfo(primaryButton, "Set primary output") + + for blankedButton in self.blankedButtons: + blankedButton.bind("", self.toggleBlanked) + self.setInfo(blankedButton, "Show/hide output") + + for duplicateButton in self.duplicateButtons: + duplicateButton.bind("", self.toggleDuplicate) + self.setInfo(duplicateButton, "Duplicate another output") + + for rotateButton in self.rotateButtons: + rotateButton.bind("", self.cycleRotation) + self.setInfo(rotateButton, "Rotate output") + + for reflectButton in self.reflectButtons: + reflectButton.bind("", self.cycleReflection) + self.setInfo(reflectButton, "Reflect output") + + for brightnessSlider in self.brightnessSliders: + brightnessSlider.bind("", self.updateBrightness) + self.setInfo(brightnessSlider, "Adjust brightness") + + for upButton in self.upButtons: + upButton.bind("", self.handleUp) + upButton.bind("", self.handleUp) + upButton.bind("", self.handleDown) + self.setInfo(upButton, "Move up") + + for downButton in self.downButtons: + downButton.bind("", self.handleDown) + downButton.bind("", self.handleUp) + downButton.bind("", self.handleDown) + self.setInfo(downButton, "Move down") + + def gridRow(self, row, widgets): + column = 0 + for w in widgets: + w.grid(row=row, column=column) + column += 1 + + def moveToMouse(self): + root = self.root + root.update_idletasks() + width = root.winfo_reqwidth() + height = root.winfo_reqheight() + x = root.winfo_pointerx() - width//2 + y = root.winfo_pointery() - height//2 + screen_width = root.winfo_screenwidth() + screen_height = root.winfo_screenheight() + if x+width > screen_width - WINDOW_CLOSE_TO_BOUNDARY_BUFFER: + x = screen_width - WINDOW_CLOSE_TO_BOUNDARY_BUFFER - width + elif x < WINDOW_CLOSE_TO_BOUNDARY_BUFFER: + x = WINDOW_CLOSE_TO_BOUNDARY_BUFFER + if y+height > screen_height - WINDOW_CLOSE_TO_BOUNDARY_BUFFER: + y = screen_height - WINDOW_CLOSE_TO_BOUNDARY_BUFFER - height + elif y < WINDOW_CLOSE_TO_BOUNDARY_BUFFER: + y = WINDOW_CLOSE_TO_BOUNDARY_BUFFER + + root.geometry('+{}+{}'.format(x, y)) + + def setInfo(self, widget, info): + widget.bind("", lambda e: self.infoLabel.config(text=info, fg="black")) + widget.bind("", lambda e: self.infoLabel.config(text="")) + + def handleApply(self, e=None): + self.root.after_idle(self.doHandleApply) + + def doHandleApply(self): + if not self.getUserConfirmationIfDangerousConfiguration(): + return + command = ["xrandr"] + if not self.existsPrimary(): + command += ["--noprimary"] + partition = self.sameAsPartition() + prevFirstActive = None + for p in partition: + firstActive = None + for output in p: + command += ["--output", output.name] + if output.active: + if firstActive == None: + firstActive = output + else: + command += ["--same-as", firstActive.name] + if output.primary: + command += ["--primary"] + if prevFirstActive != None: + command += ["--right-of", prevFirstActive.name] + if output.w != None and output.h != None and output.rate != None: + command += ["--mode", "{}x{}".format(output.w,output.h)] + command += ["--rate", output.rate ] + else: + command += ["--auto"] + command += ["--brightness", str(output.brightness)] + command += ["--rotate", output.rotation] + command += ["--reflect", output.reflection] + else: + command += ["--off"] + if firstActive: + prevFirstActive = firstActive + self.root.after_idle(lambda: self.executeXrandrCommand(command)) + + def executeXrandrCommand(self, command): + try: + check_output(command, universal_newlines=True) + except CalledProcessError as err: + self.infoLabel.config(text="xrandr returned nonzero exit status {}".format(err.returncode), fg="red") + + def getUserConfirmationIfDangerousConfiguration(self): + result = "yes" + if all(map(lambda o: o.blanked or not o.active, self.outputs)): + result = messagebox.askquestion("All blanked or off", + "All ouputs are set to be turned off or blanked, continue?", + icon="warning") + return result == "yes" + + def sameAsPartition(self): + partition = [] + for output in self.outputs: + place = None + for p in partition: + if place != None: + break; + for o in p: + if place == None and (output.sameAs == o.name or o.sameAs == output.name): + place = p + break; + if place: + place.append(output) + else: + partition.append([output]) + return partition + + + def handleCancel(self, e=None): + self.root.destroy() + + def handleArandr(self, e=None): + call(["i3-msg", "-q", "exec", "arandr"]) + self.root.destroy() + + def handleUp(self, e): + row = e.widget.output.row + if row > 0: + self.swapOutputRows(row-1, row) + self.softRefreshList() + + def handleDown(self, e): + row = e.widget.output.row + n = len(self.outputs) + if row + 1 < n: + self.swapOutputRows(row, row+1) + self.softRefreshList() + + def swapOutputRows(self, row1, row2): + outputs = self.outputs + outputs[row1],outputs[row2] = outputs[row2],outputs[row1] + outputs[row1].row = row1 + outputs[row2].row = row2 + for widget in self.frame.grid_slaves(row=row2): + widget.output = outputs[row2] + for widget in self.frame.grid_slaves(row=row1): + widget.output = outputs[row1] + + def setPrimary(self, e): + output = e.widget.output + output.primary = not output.primary + for otherOutput in self.outputs: + if otherOutput != output: + otherOutput.primary = False + self.softRefreshList() + + def existsPrimary(self): + for output in self.outputs: + if output.primary: + return True + return False + + def toggleActive(self, e): + output = e.widget.output + output.active = not output.active + if output.active: + output.setPreferredMode() + else: + for otherOutput in self.outputs: + if otherOutput.sameAs == output.name: + otherOutput.sameAs = None + self.softRefreshList() + + def toggleBlanked(self, e): + output = e.widget.output + if output.blanked: + output.blanked = False + output.brightness = 1.0 + else: + output.blanked = True + output.brightness = 0.0 + self.softRefreshList() + + def updateBrightness(self, e): + output = e.widget.output + output.brightness = .01 * e.widget.get() + output.blanked = False + if abs(output.brightness) < 1e-09: + output.blanked = True + self.softRefreshList() + + def cycleRotation(self, e): + output = e.widget.output + if output.rotation == "normal": + output.rotation = "right" + elif output.rotation == "right": + output.rotation = "inverted" + elif output.rotation == "inverted": + output.rotation = "left" + else: + output.rotation = "normal" + self.softRefreshList() + + def rotationSymbol(self, rotation): + return { + "normal": ROTATION_NORMAL, + "left": ROTATION_LEFT, + "right": ROTATION_RIGHT, + "inverted": ROTATION_INVERTED, + }[rotation] + + def cycleReflection(self, e): + output = e.widget.output + if output.reflection == "normal": + output.reflection = "x" + elif output.reflection == "x": + output.reflection = "y" + elif output.reflection == "y": + output.reflection = "xy" + else: + output.reflection = "normal" + self.softRefreshList() + + def reflectionSymbol(self, reflection): + return { + "normal": REFLECTION_NORMAL, + "x": REFLECTION_X, + "y": REFLECTION_Y, + "xy": REFLECTION_XY, + }[reflection] + + def toggleDuplicate(self, e): + duplicateButton = e.widget + optionMenu = duplicateButton.statusOptionMenu + output = optionMenu.output + if output.sameAs != None: + output.sameAs = None + self.setMenuToOutput(optionMenu, output) + else: + self.setMenuToDuplicate(optionMenu) + self.softRefreshList() + + def getDuplicableOutputsFor(self, output): + return [o for o in self.outputs if o != output and o.sameAs == None] + + def softRefreshList(self, e=None): + for widget in set().union(self.nameLabels, self.primaryButtons, + self.statusOptionMenus, self.blankedButtons, + self.duplicateButtons, self.rotateButtons, self.reflectButtons, + self.brightnessSliders, self.upButtons, self.downButtons): + widget.config(fg="gray" if not widget.output.active else "black") + + for widget in self.toggleButtons: + widget.config(text=TOGGLE_ON if widget.output.active else TOGGLE_OFF) + + for widget in self.nameLabels: + widget.config(text=widget.output.name) + + for widget in self.primaryButtons: + widget.config(text=PRIMARY_SYMBOL if widget.output.primary else SECONDARY_SYMBOL) + if not widget.output.primary: + widget.config(fg="gray") + + for widget in self.statusOptionMenus: + widget.config(text=widget.output.status()) + if widget.output.sameAs != None: + self.setMenuToDuplicate(widget) + self.setInfo(widget, "Select output to duplicate") + else: + self.setMenuToOutput(widget, widget.output) + self.setInfo(widget, "Select output mode") + + for widget in self.blankedButtons: + widget.config(text=BLANKED_SYMBOL if widget.output.blanked else UNBLANKED_SYMBOL) + + for widget in self.duplicateButtons: + widget.config(text=CLONED_SYMBOL if widget.output.sameAs else NOT_CLONED_SYMBOL) + + for widget in self.rotateButtons: + widget.config(text=self.rotationSymbol(widget.output.rotation)) + + for widget in self.reflectButtons: + widget.config(text=self.reflectionSymbol(widget.output.reflection)) + + for widget in self.brightnessSliders: + widget.set(int(100*widget.output.brightness)) + + def hardRefreshList(self, e=None): + self.outputs = Output.realOutputs() + self.root.after_idle(self.populateGrid) + + def populateGrid(self): + oldFrame = self.frame + self.frame = Frame(self.root) + self.frame.grid(row=0, column=0, columnspan=len(self.bottomRow)) + self.toggleButtons = [] + self.nameLabels = [] + self.primaryButtons = [] + self.statusOptionMenus = [] + self.blankedButtons = [] + self.duplicateButtons = [] + self.rotateButtons = [] + self.reflectButtons = [] + self.brightnessSliders = [] + self.upButtons = [] + self.downButtons = [] + for row, output in enumerate(self.outputs): + self.makeLabelRow(output, row) + self.registerBindings() + if oldFrame: + oldFrame.destroy() + + def makeLabelRow(self, output, row): + output.row = row + style = {'relief':FLAT, 'padx':1, 'pady':1, 'anchor':'w'} + widgets = [] + + toggleButton = Button(self.frame, font=FONTAWESOME_FONT, **style) + toggleButton.output = output + self.toggleButtons.append(toggleButton) + if SHOW_ON_OFF: + widgets.append(toggleButton) + + nameLabel = Label(self.frame, font=DEFAULT_FONT) + nameLabel.output = output + self.nameLabels.append(nameLabel) + if SHOW_NAMES: + widgets.append(nameLabel) + + primaryButton = Button(self.frame, font=FONTAWESOME_FONT, **style) + primaryButton.output = output + self.primaryButtons.append(primaryButton) + if not output.primary: + primaryButton.config(fg="gray") + if SHOW_PRIMARY: + widgets.append(primaryButton) + + var = StringVar(self.frame) + statusOptionMenu = OptionMenu(self.frame, var, None) + statusOptionMenu.output = output + statusOptionMenu.var = var + statusOptionMenu.config(relief=FLAT) + self.statusOptionMenus.append(statusOptionMenu) + if SHOW_MODE or SHOW_DUPLICATE: + widgets.append(statusOptionMenu) + + blankedButton = Button(self.frame, font=FONTAWESOME_FONT, **style) + blankedButton.output = output + self.blankedButtons.append(blankedButton) + if SHOW_BLANKED: + widgets.append(blankedButton) + + duplicateButton = Button(self.frame, font=FONTAWESOME_FONT, **style) + duplicateButton.statusOptionMenu = statusOptionMenu + duplicateButton.output = output + self.duplicateButtons.append(duplicateButton) + if SHOW_DUPLICATE: + widgets.append(duplicateButton) + + rotateButton = Button(self.frame, font=FONTAWESOME_FONT, **style) + rotateButton.output = output + self.rotateButtons.append(rotateButton) + if SHOW_ROTATION: + widgets.append(rotateButton) + + reflectButton = Button(self.frame, font=FONTAWESOME_FONT, **style) + reflectButton.output = output + self.reflectButtons.append(reflectButton) + if SHOW_REFLECTION: + widgets.append(reflectButton) + + brightnessSlider = Scale(self.frame, orient="horizontal", from_=0, to=100, + length=BRIGHTNESS_SLIDER_LENGTH, showvalue=SHOW_BRIGHTNESS_VALUE, + sliderlength=BRIGHTNESS_SLIDER_HANDLE_LENGTH, + width=BRIGHTNESS_SLIDER_WIDTH, font=FONTAWESOME_FONT) + brightnessSlider.output = output + self.brightnessSliders.append(brightnessSlider) + if SHOW_BRIGHTNESS: + widgets.append(brightnessSlider) + + upButton = Button(self.frame, text=UP_ARROW, font=FONTAWESOME_FONT, **style) + upButton.output = output + self.upButtons.append(upButton) + if SHOW_UP_DOWN: + widgets.append(upButton) + + downButton = Button(self.frame, text=DOWN_ARROW, font=FONTAWESOME_FONT, **style) + downButton.output = output + self.downButtons.append(downButton) + if SHOW_UP_DOWN: + widgets.append(downButton) + + for widget in widgets: + widget.output = output + self.gridRow(row, widgets) + self.softRefreshList() + + def setMenuToOutput(self, optionMenu, output): + menu = optionMenu["menu"] + var = optionMenu.var + modes = output.modes + menu.delete(0, END) + for i, mode in enumerate(modes): + label = Output.modestr(mode) + menu.add_command(label=label, command=setLabelAndOutputModeFunc(var,label,output,i)) + if output.currentModeIndex != None: + var.set(Output.modestr(modes[output.currentModeIndex])) + elif output.preferredModeIndex != None: + var.set(Output.modestr(modes[output.preferredModeIndex])) + elif len(modes) > 0: + var.set(Output.modestr(modes[0])) + + def setMenuToDuplicate(self, optionMenu): + menu = optionMenu["menu"] + var = optionMenu.var + output = optionMenu.output + menu.delete(0, END) + duplicables = self.getDuplicableOutputsFor(output) + defaultIndex = 0 + for i,otherOutput in enumerate(duplicables): + label = otherOutput.name + menu.add_command(label=label, command=setLabelAndSameAsFunc(var,label,output)) + if label == output.sameAs: + defaultIndex = i + if len(duplicables) > 0: + var.set(menu.entrycget(defaultIndex, "label")) + output.sameAs = menu.entrycget(defaultIndex, "label") + else: + var.set("None") + + def handleFocusOut(self, event): + self.root.destroy() + +def setLabelAndOutputModeFunc(var, label, output, i): + def func(): + var.set(label) + output.setMode(i) + return func + +def setLabelAndSameAsFunc(var, sameAs, output): + def func(): + var.set(sameAs) + output.sameAs = sameAs + return func + +if os.environ.get('BLOCK_BUTTON') == "1": + if os.fork() != 0: + root = Tk() + if DEFAULT_FONT_FAMILY and DEFAULT_FONT_SIZE: + font.nametofont("TkDefaultFont").config(family=DEFAULT_FONT_FAMILY, size=DEFAULT_FONT_SIZE) + manager = MonitorManager(root) + root.mainloop() + else: + print(DESKTOP_SYMBOL) +else: + print(DESKTOP_SYMBOL) diff --git a/i3/.config/i3/i3blocks/monitor_manager/monitor_manager.png b/i3/.config/i3/i3blocks/monitor_manager/monitor_manager.png new file mode 100644 index 0000000..34d0a3c Binary files /dev/null and b/i3/.config/i3/i3blocks/monitor_manager/monitor_manager.png differ diff --git a/i3/.config/i3/i3blocks/monitor_manager/monitor_manager.py b/i3/.config/i3/i3blocks/monitor_manager/monitor_manager.py new file mode 120000 index 0000000..831e97e --- /dev/null +++ b/i3/.config/i3/i3blocks/monitor_manager/monitor_manager.py @@ -0,0 +1 @@ +monitor_manager \ No newline at end of file diff --git a/i3/.config/i3/i3blocks/openvpn/README.md b/i3/.config/i3/i3blocks/openvpn/README.md new file mode 100644 index 0000000..dd4a9ef --- /dev/null +++ b/i3/.config/i3/i3blocks/openvpn/README.md @@ -0,0 +1,24 @@ +# openvpn + +Support multiple VPN, with colors. + +# Usage + +Add the following to your i3blocks config: + +``` ini +[openvpn] +command=$SCRIPT_DIR/openvpn +interval=20 +``` + +Note: devices in configuration file should be named with their number (ex: tun0, tap1), +as dynamic devices are not supported. +Also make sure that your openvpn config filename ends in `.conf`. + +# Options + +``` +Usage: openvpn [-p pid_file_format] +-p : format string to glob all pid files (default '/run/openvpn/*.pid') +``` diff --git a/i3/.config/i3/i3blocks/openvpn/openvpn b/i3/.config/i3/i3blocks/openvpn/openvpn new file mode 100755 index 0000000..e995ba4 --- /dev/null +++ b/i3/.config/i3/i3blocks/openvpn/openvpn @@ -0,0 +1,158 @@ +#!/usr/bin/env perl +# Made by Pierre Mavro/Deimosfr +# Minor contribution by Thor K. H. +# Licensed under the terms of the GNU GPL v3, or any later version. +# Version: 0.3 + +# Usage: +# 1. The configuration name of OpenVPN should be familiar for you (home,work...) +# 2. The device name in your configuration file should be fully named (tun0,tap1...not only tun or tap) +# 3. When you launch one or multiple OpenVPN connexion, be sure the PID file is written in the correct folder (ex: --writepid /run/openvpn/home.pid) + +use strict; +use warnings; +use utf8; +use Getopt::Long; + +my $openvpn_enabled='/dev/shm/openvpn_i3blocks_enabled'; +my $openvpn_disabled='/dev/shm/openvpn_i3blocks_disabled'; + +# Print output +sub print_output { + my $ref_pid_files = shift; + my @pid_files = @$ref_pid_files; + my $change=0; + + # Total pid files + my $total_pid = @pid_files; + if ($total_pid == 0) { + print "down\n"x2; + # Delete OpenVPN i3blocks temp files + if (-f $openvpn_enabled) { + unlink $openvpn_enabled or die "Can't delete $openvpn_enabled\n"; + # Colorize if VPN has just went down + print '#FF0000\n'; + } + unless (-f $openvpn_disabled) { + open(my $shm, '>', $openvpn_disabled) or die "Can't write $openvpn_disabled\n"; + } + exit(0); + } + + # Check if interface device is present + my $vpn_found=0; + my $pid; + my $cmd_line; + my @config_name; + my @config_path; + my $interface; + my $config_prefix; + my $current_config_path; + my $current_config_name; + foreach (@pid_files) { + # Get current PID + $pid=0; + open(PID, '<', $_); + while() { + chomp $_; + $pid = $_; + } + close(PID); + # Check if PID has been found + if ($pid ==0) { + print "Can't get PID $_: $!\n"; + } + + # Check if PID is still alive + $cmd_line='/proc/'.$pid.'/cmdline'; + if (-f $cmd_line) { + # Get config name + open(CMD_LINE, '<', $cmd_line); + while() { + chomp $_; + $config_prefix = ""; + if ($_ =~ /--cd\x{00}(.*?)\x{00}/) { + $config_prefix = $1; + } + if ($_ =~ /--config\x{00}(.*?\.conf)\x{00}/) { + # Get interface from config file + $current_config_path = $1; + # Remove unwanted escape chars + $interface = 'null'; + # Get configuration name + if ($current_config_path =~ /(\w+).conf/) { + $current_config_name=$1; + } else { + $current_config_name='unknown'; + } + + $current_config_path = "$config_prefix/$current_config_path"; + + # Get OpenVPN interface device name + open(CONFIG, '<', $current_config_path) or die "Can't read config file '$current_config_path': $!\n"; + while() { + chomp $_; + if ($_ =~ /dev\s+(\w+)/) { + $interface=$1; + last; + } + } + close(CONFIG); + # check if interface exist + unless ($interface eq 'null') { + if (-d "/sys/class/net/$interface") { + push @config_name, $current_config_name; + $vpn_found=1; + # Write enabled file + unless (-f $openvpn_enabled) { + open(my $shm, '>', $openvpn_enabled) or die "Can't write $openvpn_enabled\n"; + $change=1; + } + } + } + } + } + close(CMD_LINE); + } + } + + # Check if PID found + my $names; + my $short_status; + if ($vpn_found == 1) { + $names = join('/', @config_name); + $short_status='up'; + } else { + $short_status='down'; + $names = $short_status; + } + + print "$names\n"; + print "$short_status\n"; + + # Print color if there were changes + print "#00FF00\n" if ($change == 1); + + exit(0); +} + +sub check_opts { + # Vars + my $pid_file_format='/run/openvpn/*.pid'; + + # Set options + GetOptions( "help|h" => \&help, + "p=s" => \$pid_file_format); + + my @pid_file=glob $pid_file_format; + print_output(\@pid_file); +} + +sub help { + print "Usage: openvpn [-p pid_file_format]\n"; + print "-p : format string to glob all pid files (default '/run/openvpn/*.pid)'\n"; + print "Note: devices in configuration file should be named with their number (ex: tun0, tap1)\n"; + exit(1); +} + +&check_opts; diff --git a/i3/.config/i3/i3blocks/openvpn2/openvpn2 b/i3/.config/i3/i3blocks/openvpn2/openvpn2 new file mode 100755 index 0000000..4f2658a --- /dev/null +++ b/i3/.config/i3/i3blocks/openvpn2/openvpn2 @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +#OUTPUT=$(ps aux -o args=ovpn| grep ovpn | head -n 1 | cut -s -d' ' -f 26 | cut -d'.' -f 1) +OUTPUT=$(ps a -o args | grep ovpn | head -n 1 | cut -s -d' ' -f 3 | cut -d'.' -f 1) +if [ $(echo $OUTPUT | wc -w) -gt 0 ] ; then + echo $OUTPUT + echo " " +else + exit 1 +fi + diff --git a/i3/.config/i3/i3blocks/playerctl/playerctl b/i3/.config/i3/i3blocks/playerctl/playerctl new file mode 100755 index 0000000..8288830 --- /dev/null +++ b/i3/.config/i3/i3blocks/playerctl/playerctl @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +#playerctl metadata --player=spotify &> /dev/null +playerctl -i firefox metadata &> /dev/null +if [ $? != 0 ]; then + exit +fi + +#ALBUM=$(playerctl metadata --player=spotify --format "{{album}}") +#TITLE=$(playerctl metadata --player=spotify --format "{{title}}") +#ARTIST=$(playerctl metadata --player=spotify --format "{{artist}}") + +ALBUM=$(playerctl -i firefox metadata --format "{{album}}") +TITLE=$(playerctl -i firefox metadata --format "{{title}}") +ARTIST=$(playerctl -i firefox metadata --format "{{artist}}") + +#FULL_OUTPUT=$(playerctl metadata --player=spotify --format "{{ artist }} - {{ title }} - {{album}}") +FULL_OUTPUT=$(playerctl -i firefox metadata --format "{{ artist }} - {{ title }} - {{album}}") +SHORT_OUTPUT="${ARTIST::40} - ${TITLE::40}" + +if [ "$ALBUM" = "$TITLE" ]; then + echo $SHORT_OUTPUT +else + echo $FULL_OUTPUT +fi +echo $SHORT_OUTPUT + +case $BLOCK_BUTTON in + 3) playerctl -i firefox play-pause;; +esac diff --git a/i3/.config/i3/i3blocks/rofi-calendar/README.md b/i3/.config/i3/i3blocks/rofi-calendar/README.md new file mode 100755 index 0000000..abfa3e7 --- /dev/null +++ b/i3/.config/i3/i3blocks/rofi-calendar/README.md @@ -0,0 +1,26 @@ +# rofi-calendar + +Have a minimal calendar pop up in rofi when clicking the date blocklet + +![](screenshot.png) + +![](screenshot2.png) + +# Dependencies + +* rofi +* cal from util-linux package, supporting --color=always +# Installation + +* Copy the script into your directory of choice, e.g. ~/.i3blocks/blocklets +* Give it execution permission (`chmod +x rofi-calendar`) +* Edit rofi launch options in the script to fit your needs +* Add the following blocklet to your i3blocks.conf: + +```ini +[rofi-calendar] +command=$SCRIPT_DIR/rofi-calendar +label= +interval=3600 +``` + diff --git a/i3/.config/i3/i3blocks/rofi-calendar/rofi-calendar b/i3/.config/i3/i3blocks/rofi-calendar/rofi-calendar new file mode 100755 index 0000000..1409561 --- /dev/null +++ b/i3/.config/i3/i3blocks/rofi-calendar/rofi-calendar @@ -0,0 +1,27 @@ +#! /bin/sh + +blockdate=$(date '+%a. %d. %b. %Y') + +case "$BLOCK_BUTTON" in + 1|2|3) date=$(date '+%A, %d. %B') +export TERM=xterm +cal --color=always \ + | sed 's/\x1b\[[7;]*m/\\/g' \ + | sed 's/\x1b\[[27;]*m/\<\/u\>\<\/b\>/g' \ + | tail -n +2 \ + | rofi \ + -dmenu \ + -markup-rows \ + -no-fullscreen \ + -font "Monospace 6" \ + -hide-scrollbar \ + -bw 2 \ + -m -3 \ + -theme-str '#window {anchor:southeast; location: northwest;}' \ + -eh 1 \ + -width -22 \ + -no-custom \ + -p "$date" > /dev/null + esac +echo $blockdate +date '+%d.%m.%Y' diff --git a/i3/.config/i3/i3blocks/rofi-calendar/screenshot.png b/i3/.config/i3/i3blocks/rofi-calendar/screenshot.png new file mode 100644 index 0000000..1516eb1 Binary files /dev/null and b/i3/.config/i3/i3blocks/rofi-calendar/screenshot.png differ diff --git a/i3/.config/i3/i3blocks/rofi-calendar/screenshot2.png b/i3/.config/i3/i3blocks/rofi-calendar/screenshot2.png new file mode 100644 index 0000000..5963bea Binary files /dev/null and b/i3/.config/i3/i3blocks/rofi-calendar/screenshot2.png differ diff --git a/i3/.config/i3/i3blocks/shutdown_menu/README.md b/i3/.config/i3/i3blocks/shutdown_menu/README.md new file mode 100644 index 0000000..73f32fe --- /dev/null +++ b/i3/.config/i3/i3blocks/shutdown_menu/README.md @@ -0,0 +1,49 @@ +# shutdown_menu + +Use rofi or zenity to change the system's runstate thanks to systemd. + +The script can be used to shutdown, reboot, logout, lock etc. +It is inspired from an example in [i3pystatus' Wiki][i3pystatus]. + +![](rofi.png) + +![](zenity.png) + +# Requirements + +- `systemd`, +- `rofi` or `zenity`, +- shell with associative array support. + +# Usage + +For now, configuration has to be done by modifying the first part of the +script. A custom lock script can be provided, as well as any `rofi`/`zenity` +option. + +Since `rofi` and `zenity` have mouse support, this can be integrated in +i3blocks with a clickable block. It can also be used directly from i3, for +instance: + +``` +bindsym Control+Mod1+Delete exec $SCRIPTDIR/shutdown_menu +``` + +If you want to enable confirmations (e.g. before shutting down): + +``` +$SCRIPTDIR/shutdown_menu -c; echo Quit +``` + +If you have both `rofi` and `zenity`, and want to choose the preferred launcher: + +``` +$SCRIPTDIR/shutdown_menu -p rofi; echo Quit +``` + +As for the i3blocks label to use, we recommend FontAwesome's +[power-off][power-off] icon. + + +[i3pystatus]: https://github.com/enkore/i3pystatus/wiki/Shutdown-Menu +[power-off]: http://fontawesome.io/icon/power-off diff --git a/i3/.config/i3/i3blocks/shutdown_menu/i3blocks.conf b/i3/.config/i3/i3blocks/shutdown_menu/i3blocks.conf new file mode 100644 index 0000000..0d0be93 --- /dev/null +++ b/i3/.config/i3/i3blocks/shutdown_menu/i3blocks.conf @@ -0,0 +1,5 @@ +[shutdown_menu] +full_text=Quit +# If you are using FontAwesome, we recommend the power-off icon: +# http://fontawesome.io/icon/power-off/ +command=$SCRIPT_DIR/shutdown_menu -c; echo Quit diff --git a/i3/.config/i3/i3blocks/shutdown_menu/rofi.png b/i3/.config/i3/i3blocks/shutdown_menu/rofi.png new file mode 100644 index 0000000..a4068bc Binary files /dev/null and b/i3/.config/i3/i3blocks/shutdown_menu/rofi.png differ diff --git a/i3/.config/i3/i3blocks/shutdown_menu/shutdown_menu b/i3/.config/i3/i3blocks/shutdown_menu/shutdown_menu new file mode 100755 index 0000000..0d8019f --- /dev/null +++ b/i3/.config/i3/i3blocks/shutdown_menu/shutdown_menu @@ -0,0 +1,185 @@ +#!/usr/bin/env bash +# +# Use rofi/zenity to change system runstate thanks to systemd. +# +# Note: this currently relies on associative array support in the shell. +# +# Inspired from i3pystatus wiki: +# https://github.com/enkore/i3pystatus/wiki/Shutdown-Menu +# +# Copyright 2015 Benjamin Chrétien +# +# 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 . + +####################################################################### +# BEGIN CONFIG # +####################################################################### + +# Use a custom lock script +#LOCKSCRIPT="i3lock-extra -m pixelize" + +# Colors: FG (foreground), BG (background), HL (highlighted) +FG_COLOR="#bbbbbb" +BG_COLOR="#111111" +HLFG_COLOR="#111111" +HLBG_COLOR="#bbbbbb" +BORDER_COLOR="#222222" + +# Options not related to colors +ROFI_TEXT="Menu:" +ROFI_OPTIONS=(-width -11 -location 3 -hide-scrollbar -bw 2) + +# Zenity options +ZENITY_TITLE="Menu" +ZENITY_TEXT="Action:" +ZENITY_OPTIONS=(--column= --hide-header) + +####################################################################### +# END CONFIG # +####################################################################### + +# Whether to ask for user's confirmation +enable_confirmation=false + +# Preferred launcher if both are available +preferred_launcher="rofi" + +usage="$(basename "$0") [-h] [-c] [-p name] -- display a menu for shutdown, reboot, lock etc. + +where: + -h show this help text + -c ask for user confirmation + -p preferred launcher (rofi or zenity) + +This script depends on: + - systemd, + - i3, + - rofi or zenity." + +# Check whether the user-defined launcher is valid +launcher_list=(rofi zenity) +function check_launcher() { + if [[ ! "${launcher_list[@]}" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]]; then + echo "Supported launchers: ${launcher_list[*]}" + exit 1 + else + # Get array with unique elements and preferred launcher first + # Note: uniq expects a sorted list, so we cannot use it + i=1 + launcher_list=($(for l in "$1" "${launcher_list[@]}"; do printf "%i %s\n" "$i" "$l"; let i+=1; done \ + | sort -uk2 | sort -nk1 | cut -d' ' -f2- | tr '\n' ' ')) + fi +} + +# Parse CLI arguments +while getopts "hcp:" option; do + case "${option}" in + h) echo "${usage}" + exit 0 + ;; + c) enable_confirmation=true + ;; + p) preferred_launcher="${OPTARG}" + check_launcher "${preferred_launcher}" + ;; + *) exit 1 + ;; + esac +done + +# Check whether a command exists +function command_exists() { + command -v "$1" &> /dev/null 2>&1 +} + +# systemctl required +if ! command_exists systemctl ; then + exit 1 +fi + +# menu defined as an associative array +typeset -A menu + +# Menu with keys/commands +menu=( + [Shutdown]="systemctl poweroff" + [Reboot]="systemctl reboot" + [Hibernate]="systemctl hibernate" + [Suspend]="systemctl suspend" + [Halt]="systemctl halt" + [Lock]="${LOCKSCRIPT:-i3lock --color=${BG_COLOR#"#"}}" + [Logout]="i3-msg exit" + [Cancel]="" +) +menu_nrows=${#menu[@]} + +# Menu entries that may trigger a confirmation message +menu_confirm="Shutdown Reboot Hibernate Suspend Halt Logout" + +launcher_exe="" +launcher_options="" +rofi_colors="" + +function prepare_launcher() { + if [[ "$1" == "rofi" ]]; then + rofi_colors=(-bc "${BORDER_COLOR}" -bg "${BG_COLOR}" -fg "${FG_COLOR}" \ + -hlfg "${HLFG_COLOR}" -hlbg "${HLBG_COLOR}") + launcher_exe="rofi" + launcher_options=(-dmenu -i -lines "${menu_nrows}" -p "${ROFI_TEXT}" \ + "${rofi_colors}" "${ROFI_OPTIONS[@]}") + elif [[ "$1" == "zenity" ]]; then + launcher_exe="zenity" + launcher_options=(--list --title="${ZENITY_TITLE}" --text="${ZENITY_TEXT}" \ + "${ZENITY_OPTIONS[@]}") + fi +} + +for l in "${launcher_list[@]}"; do + if command_exists "${l}" ; then + prepare_launcher "${l}" + break + fi +done + +# No launcher available +if [[ -z "${launcher_exe}" ]]; then + exit 1 +fi + +launcher=(${launcher_exe} "${launcher_options[@]}") +selection="$(printf '%s\n' "${!menu[@]}" | sort | "${launcher[@]}")" + +function ask_confirmation() { + if [ "${launcher_exe}" == "rofi" ]; then + confirmed=$(echo -e "Yes\nNo" | rofi -dmenu -i -lines 2 -p "${selection}?" \ + "${rofi_colors}" "${ROFI_OPTIONS[@]}") + [ "${confirmed}" == "Yes" ] && confirmed=0 + elif [ "${launcher_exe}" == "zenity" ]; then + zenity --question --text "Are you sure you want to ${selection,,}?" + confirmed=$? + fi + + if [ "${confirmed}" == 0 ]; then + i3-msg -q "exec ${menu[${selection}]}" + fi +} + +if [[ $? -eq 0 && ! -z ${selection} ]]; then + if [[ "${enable_confirmation}" = true && \ + ${menu_confirm} =~ (^|[[:space:]])"${selection}"($|[[:space:]]) ]]; then + ask_confirmation + else + i3-msg -q "exec ${menu[${selection}]}" + fi +fi diff --git a/i3/.config/i3/i3blocks/shutdown_menu/zenity.png b/i3/.config/i3/i3blocks/shutdown_menu/zenity.png new file mode 100644 index 0000000..7d7620b Binary files /dev/null and b/i3/.config/i3/i3blocks/shutdown_menu/zenity.png differ diff --git a/i3/.config/i3/i3blocks/ssid/ssid b/i3/.config/i3/i3blocks/ssid/ssid new file mode 100755 index 0000000..1995aaa --- /dev/null +++ b/i3/.config/i3/i3blocks/ssid/ssid @@ -0,0 +1,5 @@ +#!/bin/sh +#echo $(iwgetid -r) +#echo $(iwgetid -r | cut -c -7) +echo $(nmcli --fields GENERAL.CONNECTION device show wlp4s0 | cut -d':' -f 2) +echo "" diff --git a/i3/.config/i3/i3blocks/tahoe-lafs/LICENSE b/i3/.config/i3/i3blocks/tahoe-lafs/LICENSE new file mode 100644 index 0000000..8cdb845 --- /dev/null +++ b/i3/.config/i3/i3blocks/tahoe-lafs/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/i3/.config/i3/i3blocks/tahoe-lafs/README.md b/i3/.config/i3/i3blocks/tahoe-lafs/README.md new file mode 100644 index 0000000..2717944 --- /dev/null +++ b/i3/.config/i3/i3blocks/tahoe-lafs/README.md @@ -0,0 +1,22 @@ +# tahoe-lafs + +Check on the status of your tahoe-lafs grid. + +![](tahoe-lafs.png) + +# Requirements + +Dependencies: bash, curl, jq, tahoe-lafs (unless using a remote node) + +# Usage + +Copy the `i3blocks.conf` section into your i3blocks configuration. +The `node.url` of a node in the grid you want the status of should be set as the `instance` +variable to the blocklet. + +``` +[tahoe-lafs] +command=$SCRIPT_DIR/tahoe-lafs +instance=localhost:3456 +interval=3600 +``` diff --git a/i3/.config/i3/i3blocks/tahoe-lafs/i3blocks.conf b/i3/.config/i3/i3blocks/tahoe-lafs/i3blocks.conf new file mode 100644 index 0000000..4c4b29d --- /dev/null +++ b/i3/.config/i3/i3blocks/tahoe-lafs/i3blocks.conf @@ -0,0 +1,4 @@ +[tahoe-lafs] +command=$SCRIPT_DIR/tahoe-lafs +instance=localhost:3456 +interval=3600 diff --git a/i3/.config/i3/i3blocks/tahoe-lafs/tahoe-lafs b/i3/.config/i3/i3blocks/tahoe-lafs/tahoe-lafs new file mode 100755 index 0000000..1457c80 --- /dev/null +++ b/i3/.config/i3/i3blocks/tahoe-lafs/tahoe-lafs @@ -0,0 +1,22 @@ +#!/bin/bash + +NODE_URL=${BLOCK_INSTANCE%/} +DISK_AVAIL=$(curl -s "$NODE_URL/statistics?t=json" 2>/dev/null| jq -r '.stats."storage_server.disk_avail"') + +if [[ -n "$DISK_AVAIL" ]] && [[ "$DISK_AVAIL" != "null" ]]; then + DISK_AVAIL=$(echo "$DISK_AVAIL" | awk ' + { + GB=$1/1024/1024/1024 + if(GB<1000){ + printf "%.1fG\n", GB + } + else{ + printf "%.1fT\n", GB/1024 + } + }') + echo "tahoe: $DISK_AVAIL" +else + echo "tahoe down" + echo "tahoe down" + echo "#FF0000" +fi diff --git a/i3/.config/i3/i3blocks/tahoe-lafs/tahoe-lafs.png b/i3/.config/i3/i3blocks/tahoe-lafs/tahoe-lafs.png new file mode 100644 index 0000000..cfa4d44 Binary files /dev/null and b/i3/.config/i3/i3blocks/tahoe-lafs/tahoe-lafs.png differ diff --git a/i3/.config/i3/i3blocks/temperature/README.md b/i3/.config/i3/i3blocks/temperature/README.md new file mode 100644 index 0000000..5dcc6b7 --- /dev/null +++ b/i3/.config/i3/i3blocks/temperature/README.md @@ -0,0 +1,25 @@ +# temperature + +Show system temperatures. + +![](temperature.png) + +# Dependencies + +* `lm-sensors` + +# Usage + +The script may be called with `-w` and `-c` switches to specify +thresholds, see the script for details. + +# Installation + +Add the following to your i3blocks config: + +``` ini +[temperature] +command=$SCRIPT_DIR/temperature +label=TEMP +interval=10 +``` diff --git a/i3/.config/i3/i3blocks/temperature/temperature b/i3/.config/i3/i3blocks/temperature/temperature new file mode 100755 index 0000000..482499c --- /dev/null +++ b/i3/.config/i3/i3blocks/temperature/temperature @@ -0,0 +1,69 @@ +#!/usr/bin/env perl +# Copyright 2014 Pierre Mavro +# Copyright 2014 Vivien Didelot +# Copyright 2014 Andreas Guldstrand +# Copyright 2014 Benjamin Chretien + +# 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 . + +use strict; +use warnings; +use utf8; +use Getopt::Long; + +binmode(STDOUT, ":utf8"); + +# default values +my $t_warn = 70; +my $t_crit = 90; +my $chip = ""; +my $temperature = -9999; + +sub help { + print "Usage: temperature [-w ] [-c ] [--chip ]\n"; + print "-w : warning threshold to become yellow\n"; + print "-c : critical threshold to become red\n"; + print "--chip : sensor chip\n"; + exit 0; +} + +GetOptions("help|h" => \&help, + "w=i" => \$t_warn, + "c=i" => \$t_crit, + "chip=s" => \$chip); + +# Get chip temperature +open (SENSORS, "sensors -u $chip |") or die; +while () { + if (/^\s+temp1_input:\s+[\+]*([\-]*\d+\.\d)/) { + $temperature = $1; + last; + } +} +close(SENSORS); + +$temperature eq -9999 and die 'Cannot find temperature'; + +# Print short_text, full_text +print "$temperature°C\n" x2; + +# Print color, if needed +if ($temperature >= $t_crit) { + print "#FF0000\n"; + exit 33; +} elsif ($temperature >= $t_warn) { + print "#FFFC00\n"; +} + +exit 0; diff --git a/i3/.config/i3/i3blocks/temperature/temperature.png b/i3/.config/i3/i3blocks/temperature/temperature.png new file mode 100644 index 0000000..1f46fb3 Binary files /dev/null and b/i3/.config/i3/i3blocks/temperature/temperature.png differ diff --git a/i3/.config/i3/i3blocks/time/LICENSE b/i3/.config/i3/i3blocks/time/LICENSE new file mode 100644 index 0000000..8cdb845 --- /dev/null +++ b/i3/.config/i3/i3blocks/time/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/i3/.config/i3/i3blocks/time/README.md b/i3/.config/i3/i3blocks/time/README.md new file mode 100644 index 0000000..72498e1 --- /dev/null +++ b/i3/.config/i3/i3blocks/time/README.md @@ -0,0 +1,48 @@ +# time + +Shows the current time and changes displayed timezone on click. + +![](time.png) + +# Dependencies + +perl + +# Installation + +To use with i3blocks, copy the below configuration into your i3blocks configuration file + +```INI +[time] +instance=%Y-%m-%d %H:%M +command=$SCRIPT_DIR/time [/path/to/tz/file] +interval=1 +``` + +Instance is an optional time format string. See [strftime](https://linux.die.net/man/3/strftime). +If `/path/to/tz/file` is omitted, the script uses `$HOME/.tz` by default. + +# Configuration + +In the script there are two hashes that control the timezones used and the way they are displayed. + +This hash defines the timezones that are switched to when clicking (ie. clicking when displaying Europe/London switches to Brazil/East) +```perl +my %tzmap = ( + "" => $default_tz, + $default_tz => "Brazil/East", + "Brazil/East" => "Australia/Brisbane", + "Australia/Brisbane" => "Asia/Calcutta", + "Asia/Calcutta" => $default_tz, + ); +``` + +This hash defines how each timezone should be displayed (e.g. Australia/Brisbane displays as "AU") +```perl +my %display_map = ( + $default_tz => "Home", + "Brazil/East" => "Brazil", + "Australia/Brisbane" => "AU", + "Asia/Calcutta" => "Hyderabad", +); +``` diff --git a/i3/.config/i3/i3blocks/time/time b/i3/.config/i3/i3blocks/time/time new file mode 100755 index 0000000..e265f3d --- /dev/null +++ b/i3/.config/i3/i3blocks/time/time @@ -0,0 +1,82 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use POSIX qw/strftime/; + +my $click = $ENV{BLOCK_BUTTON} || 0; +my $format = $ENV{BLOCK_INSTANCE}; +my $tz_file = shift || "$ENV{HOME}/.tz"; + +my $current_tz; +my $default_tz = get_default_tz(); +if ($click == 1) { + $current_tz = get_tz(); + + # List of timezones. Make sure the list loops back to itself. + # Entries must be present in /usr/share/zoneinfo (Olson DB). + my %tzmap = ( + "" => $default_tz, + $default_tz => "Brazil/East", + "Brazil/East" => "Australia/Brisbane", + "Australia/Brisbane" => "Asia/Calcutta", + "Asia/Calcutta" => $default_tz, + ); + + if (exists $tzmap{$current_tz}) { + set_tz($tzmap{$current_tz}); + $current_tz = $tzmap{$current_tz}; + } +} + +# How each timezone will be displayed in the bar. +my %display_map = ( + $default_tz => "Home", + "Brazil/East" => "Brazil", + "Australia/Brisbane" => "AU", + "Asia/Calcutta" => "Hyderabad", +); + +$ENV{TZ} = $current_tz || get_tz(); +my $tz_display = $display_map{$ENV{TZ}} || $ENV{TZ}; + +my $time = $format ? strftime($format, localtime()) : localtime(); +print "$time ($tz_display)"; + + +sub get_tz { + my $current_tz; + + if (-f "$ENV{HOME}/.tz") { + open my $fh, '<', $tz_file; + $current_tz = <$fh>; + chomp $current_tz; + close $fh; + } + + return $current_tz || get_default_tz(); +} + +sub set_tz { + my $tz = shift; + + open my $fh, '>', $tz_file; + print $fh $tz; + close $fh; +} + +sub get_default_tz { + my $tz = "Europe/London"; + + if (-f "/etc/timezone") { + open my $fh, '<', "/etc/timezone"; + $tz = <$fh>; + chomp $tz; + close $fh; + } elsif (-l "/etc/localtime") { + $tz = readlink "/etc/localtime"; + $tz = (split /zoneinfo\//, $tz)[-1]; + } + + return $tz; +} diff --git a/i3/.config/i3/i3blocks/time/time.png b/i3/.config/i3/i3blocks/time/time.png new file mode 100644 index 0000000..3658465 Binary files /dev/null and b/i3/.config/i3/i3blocks/time/time.png differ diff --git a/i3/.config/i3/i3blocks/usb/LICENSE b/i3/.config/i3/i3blocks/usb/LICENSE new file mode 100644 index 0000000..8cdb845 --- /dev/null +++ b/i3/.config/i3/i3blocks/usb/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/i3/.config/i3/i3blocks/usb/README.md b/i3/.config/i3/i3blocks/usb/README.md new file mode 100644 index 0000000..58e5d11 --- /dev/null +++ b/i3/.config/i3/i3blocks/usb/README.md @@ -0,0 +1,93 @@ +# usb + +Output connected usb storage device info. +Supports usb mass storage devices, including those with multiple partitions, +including LUKS partitions. + +![](images/1.png) + +![](images/2.png) + +![](images/3.png) + +![](images/4.png) + + +# Requirements + +Dependencies: udev, python3, util-linux ( >= 2.23 ) + +Suggested: fonts-font-awesome + +# Installation + +To use with i3blocks, put `usb` somewhere convenient. +We will assume it is at `$SCRIPT_DIR/usb`. +Copy the blocklet configuration in the given `i3blocks.conf` into your +i3blocks configuration file. +The recommended i3blocks config is + +```INI +[usb] +command=$SCRIPT_DIR/usb +markup=pango +signal=1 +interval=10 +``` + +To update the blocklet on plug/unplug device events you can add + + SUBSYSTEMS=="usb", RUN+="/usr/bin/pkill -RTMIN+1 i3blocks" + +in `/etc/udev/rules.d/70-persistent-usb.rules`. +You may need to create the file. +Then call + +```ShellSession +sudo udevadm control --reload-rules +``` + +to activate the new rules. +If you do not care about updating the blocklet on plug/unplug, +the script works fine on just an interval and you can ignore the udev rule and +delete `signal=1` in the config. + +Now restart your i3 in place with + +```ShellSession +i3-msg restart +``` + +Try plugging in a usb device to make sure everything works. + +# Configuration + +Configuration can be done either by editing the top portion of `usb`, or by +specifying command line flags. +Run with `--help` for more information. +You will find several options that you can configure. +Probably the most useful to you will be the `-i` (ignore) flag or the `ignore` +and `fastIgnore` functions in `usb`. +These allow you to ignore devices, e.g. those that are always plugged in. +The `-i` flag can be specified multiple times and if a device does not begin +with "/" it is assumed to be in /dev/. +E.g. +`command=$SCRIPT_DIR/usb -i sda1 -i sda2 -i mapper/sda6_crypt` +will ignore /dev/sda1, /dev/sda2, and /dev/mapper/sda6_crypt. +If you decide not to install FontAwesome, +then you will probably want to change the `LOCKED_INDICATOR` and +`UNLOCKED_INDICATOR` variables, as these use unicode symbols provided by +FontAwesome (and not many other fonts). +You do not need to restart i3 after making a change to the config. + +# Bugs + +Please report bugs and suggestions to the issues page. +Contributions are always welcome. +A common way a bug will manifest is that you will get no output in your bar. +If this happens, try running `python3 $SCRIPT_DIR/usb` from the command +line to get some insight into why nothing is displayed. +You will probably see a python stack trace. +Make sure to include this in your bug report, along with the output of any +other commands that you may think are relevant (the stack trace may contain +the exact system call that failed). diff --git a/i3/.config/i3/i3blocks/usb/i3blocks.conf b/i3/.config/i3/i3blocks/usb/i3blocks.conf new file mode 100644 index 0000000..e3aec74 --- /dev/null +++ b/i3/.config/i3/i3blocks/usb/i3blocks.conf @@ -0,0 +1,5 @@ +[usb] +command=$SCRIPT_DIR/usb +markup=pango +signal=1 +interval=10 diff --git a/i3/.config/i3/i3blocks/usb/images/1.png b/i3/.config/i3/i3blocks/usb/images/1.png new file mode 100644 index 0000000..e1b70e5 Binary files /dev/null and b/i3/.config/i3/i3blocks/usb/images/1.png differ diff --git a/i3/.config/i3/i3blocks/usb/images/2.png b/i3/.config/i3/i3blocks/usb/images/2.png new file mode 100644 index 0000000..81ead8c Binary files /dev/null and b/i3/.config/i3/i3blocks/usb/images/2.png differ diff --git a/i3/.config/i3/i3blocks/usb/images/3.png b/i3/.config/i3/i3blocks/usb/images/3.png new file mode 100644 index 0000000..be93c6b Binary files /dev/null and b/i3/.config/i3/i3blocks/usb/images/3.png differ diff --git a/i3/.config/i3/i3blocks/usb/images/4.png b/i3/.config/i3/i3blocks/usb/images/4.png new file mode 100644 index 0000000..98f3523 Binary files /dev/null and b/i3/.config/i3/i3blocks/usb/images/4.png differ diff --git a/i3/.config/i3/i3blocks/usb/usb b/i3/.config/i3/i3blocks/usb/usb new file mode 100755 index 0000000..d3574aa --- /dev/null +++ b/i3/.config/i3/i3blocks/usb/usb @@ -0,0 +1,345 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2015 James Murphy +# Licensed under the terms of the GNU GPL v2 only. +# +# i3blocks blocklet script to output connected usb storage device info. + +############################################################################### +# BEGIN CONFIG +# Most of these can be specified as command line options, run with --help for +# more information. +# You may edit any of the following entries. DO NOT delete any of them, else +# the main script will have unpredictable behavior. +############################################################################### + +# Color options, can be a color name or #RRGGBB +INFO_TEXT_COLOR = "white" +MOUNTED_COLOR = "green" +PLUGGED_COLOR = "gray" +LOCKED_COLOR = "gray" +UNLOCKED_NOT_MOUNTED_COLOR = "yellow" +PARTITIONLESS_COLOR = "red" + +# Default texts +PARTITIONLESS_TEXT = "no partitions" +SEPARATOR = " | " + +# Indicate whether an encrypted partition is locked/unlocked, "" is allowed. +LOCKED_INDICATOR = "\uf023 " +UNLOCKED_INDICATOR = "\uf09c " + +# Shows instead of space available when a partition is mounted readonly +READONLY_INDICATOR = "ro" + +# Maximum length of a filesystem label to display. Use None to disable +# truncation, a positive integer to right truncate to that many characters, or +# a negative integer to left truncate to that many characters. Setting this +# option to 0 will disable the displaying of filesystem labels. +TRUNCATE_FS_LABELS = None + +# Edit this function to ignore certain devices (e.g. those that are always +# plugged in). +# The dictionary udev_attributes_dict contains all the attributes given by +# udevadm info --query=propery --name=$path +def ignore(path, udev_attributes_dict): + # E.g. how to ignore devices whose device name begins with /dev/sda + #if udev_attributes_dict["DEVNAME"].startswith("/dev/sda"): + # return True + return False + +# Edit this function to ignore devices before the udev attributes are +# computed in order to save time and memory. +def fastIgnore(path): + # E.g. how to to ignore devices whose path begins with /dev/sda + #if path.startswith("/dev/sda"): + # return True + + # E.g. how to ignore a fixed set of paths + #if path in [ "/dev/path1", "/dev/path2", "/dev/path3" ]: + # return True + return False + +############################################################################### +# END CONFIG +# DO NOT EDIT ANYTHING AFTER THIS POINT UNLESS YOU KNOW WHAT YOU ARE DOING +############################################################################### + +from subprocess import check_output +import argparse + +def pangoEscape(text): + return text.replace("&", "&").replace("<", "<").replace(">", ">") + +def getLeafDevicePaths(): + lines = check_output(['lsblk', '-spndo', 'NAME'], universal_newlines=True) + lines = lines.split("\n") + lines = filter(None, lines) + return lines + +def getKernelName(path): + return check_output(['lsblk', '-ndso', 'KNAME', path], + universal_newlines=True).rstrip("\n") + +def getDeviceType(path): + return check_output(['lsblk', '-no', 'TYPE', path], + universal_newlines=True).strip() + +def getFSType(path): + global attributeMaps + return attributeMaps[path].get("ID_FS_TYPE") + +def isLUKSPartition(path): + return getFSType(path) == "crypto_LUKS" + +def isSwapPartition(path): + return getFSType(path) == "swap" + +def getFSLabel(path): + global attributeMaps + label = attributeMaps[path].get("ID_FS_LABEL_ENC", "") + if label: + label = label.encode().decode("unicode-escape") + if type(TRUNCATE_FS_LABELS) == int: + if TRUNCATE_FS_LABELS >= 0: + label = label[:TRUNCATE_FS_LABELS] + elif TRUNCATE_FS_LABELS < 0: + label = label[TRUNCATE_FS_LABELS:] + return label + +def getFSOptions(path): + lines = check_output(['findmnt', '-no', 'FS-OPTIONS', path], + universal_newlines=True).strip() + lines = lines.split(",") + return lines + +def isReadOnly(path): + return "ro" in getFSOptions(path) + +def isExtendedPartitionMarker(path): + global attributeMaps + MARKERS = ["0xf", "0x5"] + return attributeMaps[path].get("ID_PART_ENTRY_TYPE") in MARKERS + +def getMountPoint(path): + return check_output(['lsblk', '-ndo', 'MOUNTPOINT', path], + universal_newlines=True).rstrip("\n") + +def getSpaceAvailable(path): + lines = check_output(['df', '-h', '--output=avail', path], + universal_newlines=True) + lines = lines.split("\n") + if len(lines) != 3: + return "" + else: + return lines[1].strip() + +def getLockedCryptOutput(path): + form = "[{}{}]" + kname = pangoEscape(getKernelName(path)) + output = form.format(LOCKED_COLOR, LOCKED_INDICATOR, kname) + return output + +def getParentKernelName(path): + lines = check_output(['lsblk', '-nso', 'KNAME', path], + universal_newlines=True) + lines = lines.split("\n") + if len(lines) > 2: + return lines[1].rstrip("\n") + else: + return "" + +def getUnlockedCryptOutput(path): + mountPoint = getMountPoint(path) + if mountPoint: + color = MOUNTED_COLOR + if isReadOnly(path): + spaceAvail = READONLY_INDICATOR + else: + spaceAvail = pangoEscape(getSpaceAvailable(path)) + mountPoint = "{}:".format(pangoEscape(mountPoint)) + else: + color = UNLOCKED_NOT_MOUNTED_COLOR + spaceAvail = "" + kernelName = pangoEscape(getKernelName(path)) + parentKernelName = pangoEscape(getParentKernelName(path)) + + block = "[{}{}:{}]" + block = block.format(color, UNLOCKED_INDICATOR, parentKernelName, kernelName) + + label = pangoEscape(getFSLabel(path)) + if label: + label = '"{}"'.format(label) + + items = [block, label, mountPoint, spaceAvail] + return " ".join(filter(None, items)) + +def getSwapOutput(path): + return "" + +def getUnencryptedPartitionOutput(path): + mountPoint = getMountPoint(path) + if mountPoint: + color = MOUNTED_COLOR + if isReadOnly(path): + spaceAvail = READONLY_INDICATOR + else: + spaceAvail = pangoEscape(getSpaceAvailable(path)) + mountPoint = "{}:".format(pangoEscape(mountPoint)) + else: + color = PLUGGED_COLOR + spaceAvail = "" + kernelName = pangoEscape(getKernelName(path)) + + block = "[{}]" + block = block.format(color, kernelName) + + label = pangoEscape(getFSLabel(path)) + if label: + label = '"{}"'.format(label) + + items = [block, label, mountPoint, spaceAvail] + return " ".join(filter(None, items)) + +def getDiskWithNoPartitionsOutput(path): + form = "[{}] {}" + kernelName = pangoEscape(getKernelName(path)) + return form.format(PARTITIONLESS_COLOR, kernelName, PARTITIONLESS_TEXT) + +def getOutput(path): + if isSwapPartition(path): + return getSwapOutput(path) + t = getDeviceType(path) + if t == "part": + if isExtendedPartitionMarker(path): + return "" + elif isLUKSPartition(path): + return getLockedCryptOutput(path) + else: + return getUnencryptedPartitionOutput(path) + elif t == "disk": + return getDiskWithNoPartitionsOutput(path) + elif t == "crypt": + return getUnlockedCryptOutput(path) + elif t == "rom" : + return "" + +def makeAttributeMap(path): + attributeMap = {} + lines = check_output( + ['udevadm','info','--query=property','--name={}'.format(path)], + universal_newlines=True) + lines = lines.split("\n") + for line in lines: + if line: + key, val = line.split("=", maxsplit=1) + attributeMap[key] = val + return attributeMap + +def getAttributeMaps(paths): + return {path : makeAttributeMap(path) for path in paths} + +def parseArguments(): + parser = argparse.ArgumentParser(prog="usb.py", + description="i3blocks blocklet script to output connected" + " usb storage device info") + parser.add_argument("--info-text-color", nargs=1, + help="Set the info text color. " + "Default: {}".format(INFO_TEXT_COLOR)) + parser.add_argument("--mounted-color", nargs=1, + help="Set the color of mounted devices. " + "Default: {}".format(MOUNTED_COLOR)) + parser.add_argument("--plugged-color", nargs=1, + help="Set the color of plugged devices. " + "Default: {}".format(PLUGGED_COLOR)) + parser.add_argument("--locked-color", nargs=1, + help="Set the color of locked crypt devices. " + "Default: {}".format(LOCKED_COLOR)) + parser.add_argument("--unlocked-not-mounted-color", nargs=1, + help="Set the color of unlocked not mounted crypt devices. " + "Default: {}".format(UNLOCKED_NOT_MOUNTED_COLOR)) + parser.add_argument("--partitionless-color", nargs=1, + help="Set the color of devicees with no partitions. " + "Defaut: {}".format(PARTITIONLESS_COLOR)) + parser.add_argument("--partitionless-text", nargs=1, + help="Set the text to display for a device with no partitions. " + "Default: {}".format(PARTITIONLESS_TEXT)) + parser.add_argument("--separator", nargs=1, + help="Set the separator between devices. " + "Default: {}".format(SEPARATOR)) + parser.add_argument("--locked-indicator", nargs=1, + help="Set the indicator to use for a locked crypt device. " + "Default: {}".format(LOCKED_INDICATOR)) + parser.add_argument("--unlocked-indicator", nargs=1, + help="Set the indicator to use for an unlocked crypt device. " + "Default: {}".format(UNLOCKED_INDICATOR)) + parser.add_argument("--readonly-indicator", nargs=1, + help="Set the indicator to use for a readonly device. " + "Default: {}".format(READONLY_INDICATOR)) + parser.add_argument("--truncate-fs-labels", type=int, nargs=1, + help="Trucate device labels to a certain number of characters, must be" + "an integer." + "Default: {}".format(TRUNCATE_FS_LABELS)) + parser.add_argument("-i", "--ignore", action="append", + help="Ignore a device by path. " + "If path doesn't begin with / then it is assumed to be in /dev/") + args = parser.parse_args() + setParsedArgs(args) + +def setParsedArgs(args): + if args.info_text_color != None: + global INFO_TEXT_COLOR + INFO_TEXT_COLOR = args.info_text_color[0] + if args.mounted_color != None: + global MOUNTED_COLOR + MOUNTED_COLOR = args.mounted_color[0] + if args.plugged_color != None: + global PLUGGED_COLOR + PLUGGED_COLOR = args.plugged_color[0] + if args.locked_color != None: + global LOCKED_COLOR + LOCKED_COLOR = args.locked_color[0] + if args.unlocked_not_mounted_color != None: + global UNLOCKED_NOT_MOUNTED_COLOR + UNLOCKED_NOT_MOUNTED_COLOR = args.unlocked_not_mounted_color[0] + if args.partitionless_color != None: + global PARTITIONLESS_COLOR + PARTITIONLESS_COLOR = args.partitionless_color[0] + if args.partitionless_text != None: + global PARTITIONLESS_TEXT + PARTITIONLESS_TEXT = args.partitionless_text[0] + if args.separator != None: + global SEPARATOR + SEPARATOR = args.separator[0] + if args.locked_indicator != None: + global LOCKED_INDICATOR + LOCKED_INDICATOR = args.locked_indicator[0] + if args.unlocked_indicator != None: + global UNLOCKED_INDICATOR + UNLOCKED_INDICATOR = args.unlocked_indicator[0] + if args.readonly_indicator != None: + global READONLY_INDICATOR + READONLY_INDICATOR = args.readonly_indicator[0] + if args.truncate_fs_labels != None: + global TRUNCATE_FS_LABELS + TRUNCATE_FS_LABELS = args.truncate_fs_labels[0] + if args.ignore != None: + args.ignore = list(map(lambda p: + p if p.startswith("/") else "/dev/{}".format(p), args.ignore)) + global fastIgnore + oldFastIgnore = fastIgnore + def newFastIgnore(path): + return oldFastIgnore(path) or path in args.ignore + fastIgnore = newFastIgnore + +parseArguments() +leaves = getLeafDevicePaths() +leaves = [path for path in leaves if not fastIgnore(path)] +attributeMaps = getAttributeMaps(leaves) +leaves = (path for path in leaves if not ignore(path, attributeMaps[path])) +outputs = filter(None, map(getOutput, leaves)) +output = SEPARATOR.join(outputs) +if output: + output = "{}".format(INFO_TEXT_COLOR, output) +print(output) +print(output) diff --git a/i3/.config/i3/i3blocks/usb/usb.py b/i3/.config/i3/i3blocks/usb/usb.py new file mode 120000 index 0000000..014b030 --- /dev/null +++ b/i3/.config/i3/i3blocks/usb/usb.py @@ -0,0 +1 @@ +usb \ No newline at end of file diff --git a/i3/.config/i3/i3blocks/volume-pulseaudio/LICENSE b/i3/.config/i3/i3blocks/volume-pulseaudio/LICENSE new file mode 100644 index 0000000..8cdb845 --- /dev/null +++ b/i3/.config/i3/i3blocks/volume-pulseaudio/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/i3/.config/i3/i3blocks/volume-pulseaudio/README.md b/i3/.config/i3/i3blocks/volume-pulseaudio/README.md new file mode 100644 index 0000000..0014534 --- /dev/null +++ b/i3/.config/i3/i3blocks/volume-pulseaudio/README.md @@ -0,0 +1,56 @@ +# volume-pulseaudio + +Display the system volume and +optionally the default playback device and index. +Offers controls for these via clicks. + +![](volume-pulseaudio-high.png) +![](volume-pulseaudio-med.png) +![](volume-pulseaudio-low.png) +![](volume-pulseaudio-mute.png) + +# Dependencies + +pulseaudio, alsa (alsa-utils package), fontawesome (fonts-font-awesome package) for the speaker symbols + +# Usage + +Left/right clicks change default playback device, middle click mutes, scrolling +adjusts volume. If your keyboard has audio buttons, it is suggested to add the +the following to your i3 config + +``` +# change volume or toggle mute +bindsym XF86AudioRaiseVolume exec amixer -q -D pulse sset Master 5%+ && pkill -RTMIN+1 i3blocks +bindsym XF86AudioLowerVolume exec amixer -q -D pulse sset Master 5%- && pkill -RTMIN+1 i3blocks +bindsym XF86AudioMute exec amixer -q -D pulse sset Master toggle && pkill -RTMIN+1 i3blocks +``` + +where the number `1` in `-RTMIN+1` can be replaced to another signal number, +as long as it agrees what you put for `signal=` in your i3blocks config. + +# Options + +``` +Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a] [-H symb] [-M symb] + [-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-h] +Options: +-F, -f Output format (-F long format, -f short format) to use, amongst: + 0 symb vol [index:name] (default long) + 1 symb vol [name] + 2 symb vol [index] (default short) + 3 symb vol +-S Subscribe to volume events (requires persistent block, always uses long format) +-p Omit the percent sign (%) in volume +-a Use ALSA name if possible +-d Use device description instead of name if possible +-H Symbol to use when audio level is high. Default: ' ' +-M Symbol to use when audio level is medium. Default: ' ' +-L Symbol to use when audio level is low. Default: ' ' +-X Symbol to use when audio is muted. Default: ' ' +-T Threshold for medium audio level. Default: 50 +-t Threshold for low audio level. Default: 0 +-C Color for non-muted audio. Default: #ffffff +-c Color for muted audio. Default: #a0a0a0 +-h Show this help text +``` diff --git a/i3/.config/i3/i3blocks/volume-pulseaudio/i3blocks.conf b/i3/.config/i3/i3blocks/volume-pulseaudio/i3blocks.conf new file mode 100644 index 0000000..011fc1a --- /dev/null +++ b/i3/.config/i3/i3blocks/volume-pulseaudio/i3blocks.conf @@ -0,0 +1,10 @@ +#if you prefer automatic updating +[volume-pulseaudio] +command=$SCRIPT_DIR/volume-pulseaudio -Sa +interval=persist + +#if you prefer updating only when signaled +[volume-pulseaudio] +command=$SCRIPT_DIR/volume-pulseaudio -a +interval=once +signal=1 diff --git a/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio b/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio new file mode 100755 index 0000000..31f40de --- /dev/null +++ b/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio @@ -0,0 +1,162 @@ +#!/bin/bash +# Displays the default device, volume, and mute status for i3blocks + +AUDIO_HIGH_SYMBOL=' ' + +AUDIO_MED_THRESH=50 +AUDIO_MED_SYMBOL=' ' + +AUDIO_LOW_THRESH=0 +AUDIO_LOW_SYMBOL=' ' + +AUDIO_MUTED_SYMBOL=' ' + +AUDIO_INTERVAL=5 + +DEFAULT_COLOR="#ffffff" +MUTED_COLOR="#a0a0a0" + +LONG_FORMAT=0 +SHORT_FORMAT=2 +USE_PERCENT=1 +USE_ALSA_NAME=0 +USE_DESCRIPTION=0 + +SUBSCRIBE=0 + +while getopts F:Sf:padH:M:L:X:T:t:C:c:i:h opt; do + case "$opt" in + S) SUBSCRIBE=1 ;; + F) LONG_FORMAT="$OPTARG" ;; + f) SHORT_FORMAT="$OPTARG" ;; + p) USE_PERCENT=0 ;; + a) USE_ALSA_NAME=1 ;; + d) USE_DESCRIPTION=1 ;; + H) AUDIO_HIGH_SYMBOL="$OPTARG" ;; + M) AUDIO_MED_SYMBOL="$OPTARG" ;; + L) AUDIO_LOW_SYMBOL="$OPTARG" ;; + X) AUDIO_MUTED_SYMBOL="$OPTARG" ;; + T) AUDIO_MED_THRESH="$OPTARG" ;; + t) AUDIO_LOW_THRESH="$OPTARG" ;; + C) DEFAULT_COLOR="$OPTARG" ;; + c) MUTED_COLOR="$OPTARG" ;; + i) AUDIO_INTERVAL="$OPTARG" ;; + 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] [-h] +Options: +-F, -f\tOutput format (-F long format, -f short format) to use, amongst: +\t0\t symb vol [index:name]\t (default long) +\t1\t symb vol [name] +\t2\t symb vol [index]\t (default short) +\t3\t symb vol +-S\tSubscribe to volume events (requires persistent block, always uses long format) +-p\tOmit the percent sign (%%) in volume +-a\tUse ALSA name if possible +-d\tUse device description instead of name if possible +-H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL' +-M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL' +-L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL' +-X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL' +-T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH +-t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH +-C\tColor for non-muted audio. Default: $DEFAULT_COLOR +-c\tColor for muted audio. Default: $MUTED_COLOR +-i\tInterval size of volume increase/decrease. Default: $AUDIO_INTERVAL +-h\tShow this help text +" && exit 0;; + esac +done + +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 pulse sset Master toggle ;; + 3) set_default_playback_device_next -1 ;; + 4) amixer -q -D pulse sset Master $AUDIO_INTERVAL%+ ;; + 5) amixer -q -D pulse sset Master $AUDIO_INTERVAL%- ;; +esac + +function print_format { + PERCENT="%" + [[ $USE_PERCENT == 0 ]] && PERCENT="" + case "$1" in + 1) echo "$SYMBOL$VOL$PERCENT [$NAME]" ;; + 2) echo "$SYMBOL$VOL$PERCENT [$INDEX]";; + 3) echo "$SYMBOL$VOL$PERCENT" ;; + *) echo "$SYMBOL$VOL$PERCENT [$INDEX:$NAME]" ;; + esac +} + +function print_block { + for name in INDEX NAME VOL MUTED; do + read $name + done < <(pacmd list-sinks | grep "index:\|name:\|volume: front\|muted:" | grep -A3 '*') + INDEX=$(echo "$INDEX" | grep -o '[0-9]\+') + VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 ) + VOL="${VOL%?}" + + NAME=$(echo "$NAME" | sed \ +'s/.*<.*\.\(.*\)>.*/\1/; t;'\ +'s/.*<\(.*\)>.*/\1/; t;'\ +'s/.*/unknown/') + + if [[ $USE_ALSA_NAME == 1 ]] ; then + ALSA_NAME=$(pacmd list-sinks |\ +awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\ +grep "alsa.name\|alsa.mixer_name" |\ +head -n1 |\ +sed 's/.*= "\(.*\)".*/\1/') + NAME=${ALSA_NAME:-$NAME} + elif [[ $USE_DESCRIPTION == 1 ]] ; then + DESCRIPTION=$(pacmd list-sinks |\ +awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\ +grep "device.description" |\ +head -n1 |\ +sed 's/.*= "\(.*\)".*/\1/') + NAME=${DESCRIPTION:-$NAME} + fi + + if [[ $MUTED =~ "no" ]] ; then + SYMBOL=$AUDIO_HIGH_SYMBOL + [[ $VOL -le $AUDIO_MED_THRESH ]] && SYMBOL=$AUDIO_MED_SYMBOL + [[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMBOL=$AUDIO_LOW_SYMBOL + COLOR=$DEFAULT_COLOR + else + SYMBOL=$AUDIO_MUTED_SYMBOL + COLOR=$MUTED_COLOR + fi + + if [[ $SUBSCRIBE == 1 ]] ; then + print_format "$LONG_FORMAT" + else + print_format "$LONG_FORMAT" + print_format "$SHORT_FORMAT" + 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/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-high.png b/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-high.png new file mode 100644 index 0000000..fe2ad82 Binary files /dev/null and b/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-high.png differ diff --git a/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-low.png b/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-low.png new file mode 100644 index 0000000..44989c3 Binary files /dev/null and b/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-low.png differ diff --git a/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-med.png b/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-med.png new file mode 100644 index 0000000..71ec846 Binary files /dev/null and b/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-med.png differ diff --git a/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-mute.png b/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-mute.png new file mode 100644 index 0000000..060009a Binary files /dev/null and b/i3/.config/i3/i3blocks/volume-pulseaudio/volume-pulseaudio-mute.png differ diff --git a/i3/.config/i3/i3blocks/volume/README.md b/i3/.config/i3/i3blocks/volume/README.md new file mode 100644 index 0000000..b741236 --- /dev/null +++ b/i3/.config/i3/i3blocks/volume/README.md @@ -0,0 +1,38 @@ +# volume + +Shows the current system volume. The first parameter sets the step (and units +to display). The second parameter overrides the mixer selection. +See the script for details. + +Scrolling on the block changes the volume. Right clicking toggles mute. + +![](volume.png) + +# Usage + +This block can be run on an interval or by signal. To run the block using a +signal, it is recommended to add the following to your i3 config. + +``` +# change volume or toggle mute +bindsym XF86AudioRaiseVolume exec amixer -q -D pulse sset Master 5%+ && pkill -RTMIN+10 i3blocks +bindsym XF86AudioLowerVolume exec 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 +``` + +where the number `10` in `-RTMIN+10` can be replaced to another signal number, +as long as it agrees what you put for `signal=` in your i3blocks config. + + +# Config + +``` +[volume] +command=$SCRIPT_DIR/volume +label=VOL +#label=♪ +instance=Master +#instance=PCM +interval=once +signal=10 +``` diff --git a/i3/.config/i3/i3blocks/volume/i3blocks.conf b/i3/.config/i3/i3blocks/volume/i3blocks.conf new file mode 100644 index 0000000..741dcea --- /dev/null +++ b/i3/.config/i3/i3blocks/volume/i3blocks.conf @@ -0,0 +1,8 @@ +[volume] +command=$SCRIPT_DIR/volume +label=VOL +#label=♪ +instance=Master +#instance=PCM +interval=once +signal=10 diff --git a/i3/.config/i3/i3blocks/volume/volume b/i3/.config/i3/i3blocks/volume/volume new file mode 100755 index 0000000..86515b0 --- /dev/null +++ b/i3/.config/i3/i3blocks/volume/volume @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +# Copyright (C) 2014 Julien Bonjean +# Copyright (C) 2014 Alexander Keller + +# 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 . + +#------------------------------------------------------------------------ + +# 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}+ unmute ;; # scroll up, increase + 5) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease +esac + +OUTPUT=$(volume | format) +echo $OUTPUT +echo $OUTPUT + +if [ "$OUTPUT" = "MUTE" ]; then + echo "#FF0000" +fi diff --git a/i3/.config/i3/i3blocks/volume/volume.png b/i3/.config/i3/i3blocks/volume/volume.png new file mode 100644 index 0000000..2eba45e Binary files /dev/null and b/i3/.config/i3/i3blocks/volume/volume.png differ diff --git a/i3/.config/i3/i3blocks/wifi/README.md b/i3/.config/i3/i3blocks/wifi/README.md new file mode 100644 index 0000000..10f9e24 --- /dev/null +++ b/i3/.config/i3/i3blocks/wifi/README.md @@ -0,0 +1,16 @@ +# wifi + +Show the strength of your wifi connection. +If no instance is specified, wlan0 is used. + +![](wifi.png) + +# Config + +``` +[wifi] +command=$SCRIPT_DIR/wifi +label=wifi: +#instance=wlp3s0 +interval=60 +``` diff --git a/i3/.config/i3/i3blocks/wifi/i3blocks.conf b/i3/.config/i3/i3blocks/wifi/i3blocks.conf new file mode 100644 index 0000000..41e8162 --- /dev/null +++ b/i3/.config/i3/i3blocks/wifi/i3blocks.conf @@ -0,0 +1,5 @@ +[wifi] +command=$SCRIPT_DIR/wifi +label=wifi: +#instance=wlp3s0 +interval=60 diff --git a/i3/.config/i3/i3blocks/wifi/wifi b/i3/.config/i3/i3blocks/wifi/wifi new file mode 100755 index 0000000..dc21ee8 --- /dev/null +++ b/i3/.config/i3/i3blocks/wifi/wifi @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# Copyright (C) 2014 Alexander Keller + +# 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 . + +#------------------------------------------------------------------------ + +INTERFACE="${BLOCK_INSTANCE:-wlan0}" + +#------------------------------------------------------------------------ + +# As per #36 -- It is transparent: e.g. if the machine has no battery or wireless +# connection (think desktop), the corresponding block should not be displayed. +[[ ! -d /sys/class/net/${INTERFACE}/wireless ]] || + [[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && exit + +#------------------------------------------------------------------------ + +QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }') + +#------------------------------------------------------------------------ + +echo $QUALITY% # full text +echo $QUALITY% # short text + +# color +if [[ $QUALITY -ge 80 ]]; then + echo "#00FF00" +elif [[ $QUALITY -ge 60 ]]; then + echo "#FFF600" +elif [[ $QUALITY -ge 40 ]]; then + echo "#FFAE00" +else + echo "#FF0000" +fi diff --git a/i3/.config/i3/i3blocks/wifi/wifi.png b/i3/.config/i3/i3blocks/wifi/wifi.png new file mode 100644 index 0000000..5549de6 Binary files /dev/null and b/i3/.config/i3/i3blocks/wifi/wifi.png differ diff --git a/i3/.config/i3/i3blocks/wlan-dbm/README.md b/i3/.config/i3/i3blocks/wlan-dbm/README.md new file mode 100644 index 0000000..f568ef9 --- /dev/null +++ b/i3/.config/i3/i3blocks/wlan-dbm/README.md @@ -0,0 +1,24 @@ +# wlan-dbm + +Show wifi interface link quality in dBm or percent. + +![](wlan-dbm.png) + +# Usage + +The desired interface to monitor can be specified in the usual `block_instance` directive. +If it's missing, the script will fallback to `wlan0`. +The block uses dBm by default, but you may pass a `-p` flag to the script +to use percent. +Note, however, that percent is just an estimate that may not accurately predict +whether you have a good signal. + +# Dependencies + +* `iw` + +# Config + + [wlan-dbm] + command=$SCRIPT_DIR/wlan-dbm + instance=wlan0 diff --git a/i3/.config/i3/i3blocks/wlan-dbm/wlan-dbm b/i3/.config/i3/i3blocks/wlan-dbm/wlan-dbm new file mode 100755 index 0000000..d736898 --- /dev/null +++ b/i3/.config/i3/i3blocks/wlan-dbm/wlan-dbm @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# +# i3blocks blocklet script to display wifi signal in dBm + +IFACE="${BLOCK_INSTANCE:-wlan0}" +USE_PERCENT=0 + +IW=$(which iw || echo "/sbin/iw") + +if [[ ! -x $IW ]]; then + echo "No iw binary was found on the system." 1>2 + exit 1 +fi + +while getopts p opt; do + case "$opt" in + p) USE_PERCENT=1 ;; + esac +done + +dbm=$($IW dev "$IFACE" link | grep 'dBm$' | grep -Eoe '-[0-9]{2}') + +[[ -n "$dbm" ]] || exit 1 + +if [[ $USE_PERCENT -eq 0 ]]; then + echo "$dbm" dBm + echo "$dbm" +else + if [[ "$dbm" -le -100 ]]; then + quality=0 + elif [[ $dbm -ge -50 ]]; then + quality=100 + else + quality=$((2 * (dbm + 100))) + fi + echo "$quality%" + echo "$quality%" +fi + +if [[ $dbm -ge -55 ]]; then + echo "#00FF00" +elif [[ $dbm -ge -60 ]]; then + echo "#CCFF00" +elif [[ $dbm -ge -70 ]]; then + echo "#FFFF00" +elif [[ $dbm -ge -80 ]]; then + echo "#FFAA00" +else + echo "#FF0000" +fi diff --git a/i3/.config/i3/i3blocks/wlan-dbm/wlan-dbm.png b/i3/.config/i3/i3blocks/wlan-dbm/wlan-dbm.png new file mode 100644 index 0000000..df10fb8 Binary files /dev/null and b/i3/.config/i3/i3blocks/wlan-dbm/wlan-dbm.png differ diff --git a/i3/.config/i3/i3blocks/workadventure/workadventure b/i3/.config/i3/i3blocks/workadventure/workadventure new file mode 100755 index 0000000..ca0e5e9 --- /dev/null +++ b/i3/.config/i3/i3blocks/workadventure/workadventure @@ -0,0 +1,2 @@ +curl -s https://api.fachschaft-it.de/metrics | grep -Ei ".*clients.*floor[0-9]" | awk '{printf "%d ", $2}' | awk '{sub(/\|$/,"");print}' +echo diff --git a/i3/.config/i3/i3exit b/i3/.config/i3/i3exit new file mode 100755 index 0000000..51e211a --- /dev/null +++ b/i3/.config/i3/i3exit @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +case "$1" in + lock) + i3lock -B 10 --pass-media-keys --pass-screen-keys + ;; + switch_user) + dm-tool lock + ;; + logout) + i3-msg exit + ;; + suspend) + systemctl suspend + ;; + hibernate) + systemctl hibernate + ;; + reboot) + systemctl reboot + ;; + shutdown) + systemctl poweroff + ;; + *) + echo "Usage: $0 [lock|logout|suspend|hibernate|reboot|shutdown]" + exit 2 +esac + +exit 0 diff --git a/kitty/.config/kitty/kitty.conf b/kitty/.config/kitty/kitty.conf new file mode 100644 index 0000000..ab19fc1 --- /dev/null +++ b/kitty/.config/kitty/kitty.conf @@ -0,0 +1,1509 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +#: Fonts {{{ + +#: kitty has very powerful font management. You can configure +#: individual font faces and even specify special fonts for particular +#: characters. + +# font_family monospace +# bold_font auto +# italic_font auto +# bold_italic_font auto + +#: You can specify different fonts for the bold/italic/bold-italic +#: variants. To get a full list of supported fonts use the `kitty +#: list-fonts` command. By default they are derived automatically, by +#: the OSes font system. Setting them manually is useful for font +#: families that have many weight variants like Book, Medium, Thick, +#: etc. For example:: + +#: font_family Operator Mono Book +#: bold_font Operator Mono Medium +#: italic_font Operator Mono Book Italic +#: bold_italic_font Operator Mono Medium Italic + +font_size 13.0 + +#: Font size (in pts) + +# force_ltr no + +#: kitty does not support BIDI (bidirectional text), however, for RTL +#: scripts, words are automatically displayed in RTL. That is to say, +#: in an RTL script, the words "HELLO WORLD" display in kitty as +#: "WORLD HELLO", and if you try to select a substring of an RTL- +#: shaped string, you will get the character that would be there had +#: the the string been LTR. For example, assuming the Hebrew word +#: ירושלים, selecting the character that on the screen appears to be ם +#: actually writes into the selection buffer the character י. kitty's +#: default behavior is useful in conjunction with a filter to reverse +#: the word order, however, if you wish to manipulate RTL glyphs, it +#: can be very challenging to work with, so this option is provided to +#: turn it off. Furthermore, this option can be used with the command +#: line program GNU FriBidi +#: to get BIDI +#: support, because it will force kitty to always treat the text as +#: LTR, which FriBidi expects for terminals. + +# adjust_line_height 0 +# adjust_column_width 0 + +#: Change the size of each character cell kitty renders. You can use +#: either numbers, which are interpreted as pixels or percentages +#: (number followed by %), which are interpreted as percentages of the +#: unmodified values. You can use negative pixels or percentages less +#: than 100% to reduce sizes (but this might cause rendering +#: artifacts). + +# adjust_baseline 0 + +#: Adjust the vertical alignment of text (the height in the cell at +#: which text is positioned). You can use either numbers, which are +#: interpreted as pixels or a percentages (number followed by %), +#: which are interpreted as the percentage of the line height. A +#: positive value moves the baseline up, and a negative value moves +#: them down. The underline and strikethrough positions are adjusted +#: accordingly. + +# symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols + +#: Map the specified unicode codepoints to a particular font. Useful +#: if you need special rendering for some symbols, such as for +#: Powerline. Avoids the need for patched fonts. Each unicode code +#: point is specified in the form U+. You +#: can specify multiple code points, separated by commas and ranges +#: separated by hyphens. symbol_map itself can be specified multiple +#: times. Syntax is:: + +#: symbol_map codepoints Font Family Name + +# disable_ligatures never + +#: Choose how you want to handle multi-character ligatures. The +#: default is to always render them. You can tell kitty to not render +#: them when the cursor is over them by using cursor to make editing +#: easier, or have kitty never render them at all by using always, if +#: you don't like them. The ligature strategy can be set per-window +#: either using the kitty remote control facility or by defining +#: shortcuts for it in kitty.conf, for example:: + +#: map alt+1 disable_ligatures_in active always +#: map alt+2 disable_ligatures_in all never +#: map alt+3 disable_ligatures_in tab cursor + +#: Note that this refers to programming ligatures, typically +#: implemented using the calt OpenType feature. For disabling general +#: ligatures, use the font_features setting. + +# font_features none + +#: Choose exactly which OpenType features to enable or disable. This +#: is useful as some fonts might have features worthwhile in a +#: terminal. For example, Fira Code Retina includes a discretionary +#: feature, zero, which in that font changes the appearance of the +#: zero (0), to make it more easily distinguishable from Ø. Fira Code +#: Retina also includes other discretionary features known as +#: Stylistic Sets which have the tags ss01 through ss20. + +#: For the exact syntax to use for individual features, see the +#: Harfbuzz documentation . + +#: Note that this code is indexed by PostScript name, and not the font +#: family. This allows you to define very precise feature settings; +#: e.g. you can disable a feature in the italic font but not in the +#: regular font. + +#: On Linux, these are read from the FontConfig database first and +#: then this, setting is applied, so they can be configured in a +#: single, central place. + +#: To get the PostScript name for a font, use kitty + list-fonts +#: --psnames: + +#: .. code-block:: sh + +#: $ kitty + list-fonts --psnames | grep Fira +#: Fira Code +#: Fira Code Bold (FiraCode-Bold) +#: Fira Code Light (FiraCode-Light) +#: Fira Code Medium (FiraCode-Medium) +#: Fira Code Regular (FiraCode-Regular) +#: Fira Code Retina (FiraCode-Retina) + +#: The part in brackets is the PostScript name. + +#: Enable alternate zero and oldstyle numerals:: + +#: font_features FiraCode-Retina +zero +onum + +#: Enable only alternate zero:: + +#: font_features FiraCode-Retina +zero + +#: Disable the normal ligatures, but keep the calt feature which (in +#: this font) breaks up monotony:: + +#: font_features TT2020StyleB-Regular -liga +calt + +#: In conjunction with force_ltr, you may want to disable Arabic +#: shaping entirely, and only look at their isolated forms if they +#: show up in a document. You can do this with e.g.:: + +#: font_features UnifontMedium +isol -medi -fina -init + +# box_drawing_scale 0.001, 1, 1.5, 2 + +#: Change the sizes of the lines used for the box drawing unicode +#: characters These values are in pts. They will be scaled by the +#: monitor DPI to arrive at a pixel value. There must be four values +#: corresponding to thin, normal, thick, and very thick lines. + +#: }}} + +#: Cursor customization {{{ + +# cursor #cccccc + +#: Default cursor color + +# cursor_text_color #111111 + +#: Choose the color of text under the cursor. If you want it rendered +#: with the background color of the cell underneath instead, use the +#: special keyword: background + +# cursor_shape block + +#: The cursor shape can be one of (block, beam, underline). Note that +#: when reloading the config this will be changed only if the cursor +#: shape has not been set by the program running in the terminal. + +# cursor_beam_thickness 1.5 + +#: Defines the thickness of the beam cursor (in pts) + +# cursor_underline_thickness 2.0 + +#: Defines the thickness of the underline cursor (in pts) + +# cursor_blink_interval -1 + +#: The interval (in seconds) at which to blink the cursor. Set to zero +#: to disable blinking. Negative values mean use system default. Note +#: that numbers smaller than repaint_delay will be limited to +#: repaint_delay. + +# cursor_stop_blinking_after 15.0 + +#: Stop blinking cursor after the specified number of seconds of +#: keyboard inactivity. Set to zero to never stop blinking. + +#: }}} + +#: Scrollback {{{ + +# scrollback_lines 2000 + +#: Number of lines of history to keep in memory for scrolling back. +#: Memory is allocated on demand. Negative numbers are (effectively) +#: infinite scrollback. Note that using very large scrollback is not +#: recommended as it can slow down performance of the terminal and +#: also use large amounts of RAM. Instead, consider using +#: scrollback_pager_history_size. Note that on config reload if this +#: is changed it will only affect newly created windows, not existing +#: ones. + +# scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER + +#: Program with which to view scrollback in a new window. The +#: scrollback buffer is passed as STDIN to this program. If you change +#: it, make sure the program you use can handle ANSI escape sequences +#: for colors and text formatting. INPUT_LINE_NUMBER in the command +#: line above will be replaced by an integer representing which line +#: should be at the top of the screen. Similarly CURSOR_LINE and +#: CURSOR_COLUMN will be replaced by the current cursor position. + +# scrollback_pager_history_size 0 + +#: Separate scrollback history size, used only for browsing the +#: scrollback buffer (in MB). This separate buffer is not available +#: for interactive scrolling but will be piped to the pager program +#: when viewing scrollback buffer in a separate window. The current +#: implementation stores the data in UTF-8, so approximatively 10000 +#: lines per megabyte at 100 chars per line, for pure ASCII text, +#: unformatted text. A value of zero or less disables this feature. +#: The maximum allowed size is 4GB. Note that on config reload if this +#: is changed it will only affect newly created windows, not existing +#: ones. + +# scrollback_fill_enlarged_window no + +#: Fill new space with lines from the scrollback buffer after +#: enlarging a window. + +# wheel_scroll_multiplier 5.0 + +#: Modify the amount scrolled by the mouse wheel. Note this is only +#: used for low precision scrolling devices, not for high precision +#: scrolling on platforms such as macOS and Wayland. Use negative +#: numbers to change scroll direction. + +# touch_scroll_multiplier 1.0 + +#: Modify the amount scrolled by a touchpad. Note this is only used +#: for high precision scrolling devices on platforms such as macOS and +#: Wayland. Use negative numbers to change scroll direction. + +#: }}} + +#: Mouse {{{ + +# mouse_hide_wait 3.0 + +#: Hide mouse cursor after the specified number of seconds of the +#: mouse not being used. Set to zero to disable mouse cursor hiding. +#: Set to a negative value to hide the mouse cursor immediately when +#: typing text. Disabled by default on macOS as getting it to work +#: robustly with the ever-changing sea of bugs that is Cocoa is too +#: much effort. + +# url_color #0087bd +# url_style curly + +#: The color and style for highlighting URLs on mouse-over. url_style +#: can be one of: none, single, double, curly + +# open_url_with default + +#: The program with which to open URLs that are clicked on. The +#: special value default means to use the operating system's default +#: URL handler. + +# url_prefixes http https file ftp gemini irc gopher mailto news git + +#: The set of URL prefixes to look for when detecting a URL under the +#: mouse cursor. + +# detect_urls yes + +#: Detect URLs under the mouse. Detected URLs are highlighted with an +#: underline and the mouse cursor becomes a hand over them. Even if +#: this option is disabled, URLs are still clickable. + +# url_excluded_characters + +#: Additional characters to be disallowed from URLs, when detecting +#: URLs under the mouse cursor. By default, all characters legal in +#: URLs are allowed. + +# copy_on_select no + +#: Copy to clipboard or a private buffer on select. With this set to +#: clipboard, simply selecting text with the mouse will cause the text +#: to be copied to clipboard. Useful on platforms such as macOS that +#: do not have the concept of primary selections. You can instead +#: specify a name such as a1 to copy to a private kitty buffer +#: instead. Map a shortcut with the paste_from_buffer action to paste +#: from this private buffer. For example:: + +#: map cmd+shift+v paste_from_buffer a1 + +#: Note that copying to the clipboard is a security risk, as all +#: programs, including websites open in your browser can read the +#: contents of the system clipboard. + +# strip_trailing_spaces never + +#: Remove spaces at the end of lines when copying to clipboard. A +#: value of smart will do it when using normal selections, but not +#: rectangle selections. always will always do it. + +# select_by_word_characters @-./_~?&=%+# + +#: Characters considered part of a word when double clicking. In +#: addition to these characters any character that is marked as an +#: alphanumeric character in the unicode database will be matched. + +# click_interval -1.0 + +#: The interval between successive clicks to detect double/triple +#: clicks (in seconds). Negative numbers will use the system default +#: instead, if available, or fallback to 0.5. + +# focus_follows_mouse no + +#: Set the active window to the window under the mouse when moving the +#: mouse around + +# pointer_shape_when_grabbed arrow + +#: The shape of the mouse pointer when the program running in the +#: terminal grabs the mouse. Valid values are: arrow, beam and hand + +# default_pointer_shape beam + +#: The default shape of the mouse pointer. Valid values are: arrow, +#: beam and hand + +# pointer_shape_when_dragging beam + +#: The default shape of the mouse pointer when dragging across text. +#: Valid values are: arrow, beam and hand + +#: Mouse actions {{{ + +#: Mouse buttons can be remapped to perform arbitrary actions. The +#: syntax for doing so is: + +#: .. code-block:: none + +#: mouse_map button-name event-type modes action + +#: Where ``button-name`` is one of ``left``, ``middle``, ``right`` or +#: ``b1 ... b8`` with added keyboard modifiers, for example: +#: ``ctrl+shift+left`` refers to holding the ctrl+shift keys while +#: clicking with the left mouse button. The number ``b1 ... b8`` can +#: be used to refer to upto eight buttons on a mouse. + +#: ``event-type`` is one ``press``, ``release``, ``doublepress``, +#: ``triplepress``, ``click`` and ``doubleclick``. ``modes`` +#: indicates whether the action is performed when the mouse is grabbed +#: by the program running in the terminal, or not. It can have one or +#: more or the values, ``grabbed,ungrabbed``. ``grabbed`` refers to +#: when the program running in the terminal has requested mouse +#: events. Note that the click and double click events have a delay of +#: click_interval to disambiguate from double and triple presses. + +#: You can run kitty with the kitty --debug-input command line option +#: to see mouse events. See the builtin actions below to get a sense +#: of what is possible. + +#: If you want to unmap an action map it to ``no-op``. For example, to +#: disable opening of URLs with a plain click:: + +#: mouse_map left click ungrabbed no-op + +#: .. note:: +#: Once a selection is started, releasing the button that started it will +#: automatically end it and no release event will be dispatched. + +# clear_all_mouse_actions no + +#: You can have kitty remove all mouse actions seen up to this point. +#: Useful, for instance, to remove the default mouse actions. + +# mouse_map left click ungrabbed mouse_click_url_or_select +# mouse_map shift+left click grabbed,ungrabbed mouse_click_url_or_select +# mouse_map ctrl+shift+left release grabbed,ungrabbed mouse_click_url + +#: Variant with ctrl+shift is present because the simple click based +#: version has an unavoidable delay of click_interval, to disambiguate +#: clicks from double clicks. + +# mouse_map ctrl+shift+left press grabbed discard_event + +#: Prevent this press event from being sent to the program that has +#: grabbed the mouse, as the corresponding release event is used to +#: open a URL. + +# mouse_map middle release ungrabbed paste_from_selection +# mouse_map left press ungrabbed mouse_selection normal +# mouse_map ctrl+alt+left press ungrabbed mouse_selection rectangle +# mouse_map left doublepress ungrabbed mouse_selection word +# mouse_map left triplepress ungrabbed mouse_selection line + +#: Select the entire line + +# mouse_map ctrl+alt+left triplepress ungrabbed mouse_selection line_from_point + +#: Select from the clicked point to the end of the line + +# mouse_map right press ungrabbed mouse_selection extend + +#: If you want only the end of the selection to be moved instead of +#: the nearest boundary, use move-end instead of extend. + +# mouse_map shift+middle release ungrabbed,grabbed paste_selection +# mouse_map shift+left press ungrabbed,grabbed mouse_selection normal +# mouse_map shift+ctrl+alt+left press ungrabbed,grabbed mouse_selection rectangle +# mouse_map shift+left doublepress ungrabbed,grabbed mouse_selection word +# mouse_map shift+left triplepress ungrabbed,grabbed mouse_selection line + +#: Select the entire line + +# mouse_map shift+ctrl+alt+left triplepress ungrabbed,grabbed mouse_selection line_from_point + +#: Select from the clicked point to the end of the line + +# mouse_map shift+right press ungrabbed,grabbed mouse_selection extend +#: }}} + +#: }}} + +#: Performance tuning {{{ + +# repaint_delay 10 + +#: Delay (in milliseconds) between screen updates. Decreasing it, +#: increases frames-per-second (FPS) at the cost of more CPU usage. +#: The default value yields ~100 FPS which is more than sufficient for +#: most uses. Note that to actually achieve 100 FPS you have to either +#: set sync_to_monitor to no or use a monitor with a high refresh +#: rate. Also, to minimize latency when there is pending input to be +#: processed, repaint_delay is ignored. + +# input_delay 3 + +#: Delay (in milliseconds) before input from the program running in +#: the terminal is processed. Note that decreasing it will increase +#: responsiveness, but also increase CPU usage and might cause flicker +#: in full screen programs that redraw the entire screen on each loop, +#: because kitty is so fast that partial screen updates will be drawn. + +# sync_to_monitor yes + +#: Sync screen updates to the refresh rate of the monitor. This +#: prevents tearing (https://en.wikipedia.org/wiki/Screen_tearing) +#: when scrolling. However, it limits the rendering speed to the +#: refresh rate of your monitor. With a very high speed mouse/high +#: keyboard repeat rate, you may notice some slight input latency. If +#: so, set this to no. + +#: }}} + +#: Terminal bell {{{ + +# enable_audio_bell yes + +#: Enable/disable the audio bell. Useful in environments that require +#: silence. + +# visual_bell_duration 0.0 + +#: Visual bell duration. Flash the screen when a bell occurs for the +#: specified number of seconds. Set to zero to disable. + +# window_alert_on_bell yes + +#: Request window attention on bell. Makes the dock icon bounce on +#: macOS or the taskbar flash on linux. + +# bell_on_tab yes + +#: Show a bell symbol on the tab if a bell occurs in one of the +#: windows in the tab and the window is not the currently focused +#: window + +# command_on_bell none + +#: Program to run when a bell occurs. The environment variable +#: KITTY_CHILD_CMDLINE can be used to get the program running in the +#: window in which the bell occurred. + +#: }}} + +#: Window layout {{{ + +# remember_window_size yes +# initial_window_width 640 +# initial_window_height 400 + +#: If enabled, the window size will be remembered so that new +#: instances of kitty will have the same size as the previous +#: instance. If disabled, the window will initially have size +#: configured by initial_window_width/height, in pixels. You can use a +#: suffix of "c" on the width/height values to have them interpreted +#: as number of cells instead of pixels. + +# enabled_layouts * + +#: The enabled window layouts. A comma separated list of layout names. +#: The special value all means all layouts. The first listed layout +#: will be used as the startup layout. Default configuration is all +#: layouts in alphabetical order. For a list of available layouts, see +#: the https://sw.kovidgoyal.net/kitty/overview/#layouts. + +# window_resize_step_cells 2 +# window_resize_step_lines 2 + +#: The step size (in units of cell width/cell height) to use when +#: resizing windows. The cells value is used for horizontal resizing +#: and the lines value for vertical resizing. + +# window_border_width 0.5pt + +#: The width of window borders. Can be either in pixels (px) or pts +#: (pt). Values in pts will be rounded to the nearest number of pixels +#: based on screen resolution. If not specified the unit is assumed to +#: be pts. Note that borders are displayed only when more than one +#: window is visible. They are meant to separate multiple windows. + +# draw_minimal_borders yes + +#: Draw only the minimum borders needed. This means that only the +#: minimum needed borders for inactive windows are drawn. That is only +#: the borders that separate the inactive window from a neighbor. Note +#: that setting a non-zero window margin overrides this and causes all +#: borders to be drawn. + +# window_margin_width 0 + +#: The window margin (in pts) (blank area outside the border). A +#: single value sets all four sides. Two values set the vertical and +#: horizontal sides. Three values set top, horizontal and bottom. Four +#: values set top, right, bottom and left. + +# single_window_margin_width -1 + +#: The window margin (in pts) to use when only a single window is +#: visible. Negative values will cause the value of +#: window_margin_width to be used instead. A single value sets all +#: four sides. Two values set the vertical and horizontal sides. Three +#: values set top, horizontal and bottom. Four values set top, right, +#: bottom and left. + +# window_padding_width 0 + +#: The window padding (in pts) (blank area between the text and the +#: window border). A single value sets all four sides. Two values set +#: the vertical and horizontal sides. Three values set top, horizontal +#: and bottom. Four values set top, right, bottom and left. + +# placement_strategy center + +#: When the window size is not an exact multiple of the cell size, the +#: cell area of the terminal window will have some extra padding on +#: the sides. You can control how that padding is distributed with +#: this option. Using a value of center means the cell area will be +#: placed centrally. A value of top-left means the padding will be on +#: only the bottom and right edges. + +# active_border_color #00ff00 + +#: The color for the border of the active window. Set this to none to +#: not draw borders around the active window. + +# inactive_border_color #cccccc + +#: The color for the border of inactive windows + +# bell_border_color #ff5a00 + +#: The color for the border of inactive windows in which a bell has +#: occurred + +# inactive_text_alpha 1.0 + +#: Fade the text in inactive windows by the specified amount (a number +#: between zero and one, with zero being fully faded). + +# hide_window_decorations no + +#: Hide the window decorations (title-bar and window borders) with +#: yes. On macOS, titlebar-only can be used to only hide the titlebar. +#: Whether this works and exactly what effect it has depends on the +#: window manager/operating system. Note that the effects of changing +#: this setting when reloading config are undefined. + +# resize_debounce_time 0.1 + +#: The time (in seconds) to wait before redrawing the screen when a +#: resize event is received. On platforms such as macOS, where the +#: operating system sends events corresponding to the start and end of +#: a resize, this number is ignored. + +# resize_draw_strategy static + +#: Choose how kitty draws a window while a resize is in progress. A +#: value of static means draw the current window contents, mostly +#: unchanged. A value of scale means draw the current window contents +#: scaled. A value of blank means draw a blank window. A value of size +#: means show the window size in cells. + +# resize_in_steps no + +#: Resize the OS window in steps as large as the cells, instead of +#: with the usual pixel accuracy. Combined with an +#: initial_window_width and initial_window_height in number of cells, +#: this option can be used to keep the margins as small as possible +#: when resizing the OS window. Note that this does not currently work +#: on Wayland. + +# confirm_os_window_close 0 + +#: Ask for confirmation when closing an OS window or a tab that has at +#: least this number of kitty windows in it. A value of zero disables +#: confirmation. This confirmation also applies to requests to quit +#: the entire application (all OS windows, via the quit action). + +#: }}} + +#: Tab bar {{{ + +# tab_bar_edge bottom + +#: Which edge to show the tab bar on, top or bottom + +# tab_bar_margin_width 0.0 + +#: The margin to the left and right of the tab bar (in pts) + +# tab_bar_margin_height 0.0 0.0 + +#: The margin above and below the tab bar (in pts). The first number +#: is the margin between the edge of the OS Window and the tab bar and +#: the second number is the margin between the tab bar and the +#: contents of the current tab. + +# tab_bar_style fade + +#: The tab bar style, can be one of: + +#: fade +#: Each tab's edges fade into the background color (see tab_fade) +#: slant +#: Tabs look like the tabs in a physical file +#: separator +#: Tabs are separated by a configurable separator (see tab_separator) +#: powerline +#: Tabs are shown as a continuous line with "fancy" separators (see tab_powerline_style) +#: hidden +#: The tab bar is hidden. If you use this, you might want to create a mapping +#: for the https://sw.kovidgoyal.net/kitty/actions/#select-tab action which presents you with a list +#: of tabs and allows for easy switching to a tab. + +# tab_bar_min_tabs 2 + +#: The minimum number of tabs that must exist before the tab bar is +#: shown + +# tab_switch_strategy previous + +#: The algorithm to use when switching to a tab when the current tab +#: is closed. The default of previous will switch to the last used +#: tab. A value of left will switch to the tab to the left of the +#: closed tab. A value of right will switch to the tab to the right of +#: the closed tab. A value of last will switch to the right-most tab. + +# tab_fade 0.25 0.5 0.75 1 + +#: Control how each tab fades into the background when using fade for +#: the tab_bar_style. Each number is an alpha (between zero and one) +#: that controls how much the corresponding cell fades into the +#: background, with zero being no fade and one being full fade. You +#: can change the number of cells used by adding/removing entries to +#: this list. + +# tab_separator " ┇" + +#: The separator between tabs in the tab bar when using separator as +#: the tab_bar_style. + +# tab_powerline_style angled + +#: The powerline separator style between tabs in the tab bar when +#: using powerline as the tab_bar_style, can be one of: angled, +#: slanted, or round. + +# tab_activity_symbol none + +#: Some text or a unicode symbol to show on the tab if a window in the +#: tab that does not have focus has some activity. If you want to use +#: leading or trailing spaces surround the text with quotes. + +# tab_title_template "{title}" + +#: A template to render the tab title. The default just renders the +#: title. If you wish to include the tab-index as well, use something +#: like: {index}: {title}. Useful if you have shortcuts mapped for +#: goto_tab N. If you prefer to see the index as a superscript, use +#: {sup.index}. In addition you can use {layout_name} for the current +#: layout name, {num_windows} for the number of windows in the tab and +#: {num_window_groups} for the number of window groups (not counting +#: overlay windows) in the tab. Note that formatting is done by +#: Python's string formatting machinery, so you can use, for instance, +#: {layout_name[:2].upper()} to show only the first two letters of the +#: layout name, upper-cased. If you want to style the text, you can +#: use styling directives, for example: +#: {fmt.fg.red}red{fmt.fg.default}normal{fmt.bg._00FF00}green +#: bg{fmt.bg.normal}. Similarly, for bold and italic: +#: {fmt.bold}bold{fmt.nobold}normal{fmt.italic}italic{fmt.noitalic}. + +# active_tab_title_template none + +#: Template to use for active tabs, if not specified falls back to +#: tab_title_template. + +# active_tab_foreground #000 +# active_tab_background #eee +# active_tab_font_style bold-italic +# inactive_tab_foreground #444 +# inactive_tab_background #999 +# inactive_tab_font_style normal + +#: Tab bar colors and styles + +# tab_bar_background none + +#: Background color for the tab bar. Defaults to using the terminal +#: background color. + +#: }}} + +#: Color scheme {{{ + +# foreground #dddddd +# background #000000 + +#: The foreground and background colors + +# background_opacity 1.0 + +#: The opacity of the background. A number between 0 and 1, where 1 is +#: opaque and 0 is fully transparent. This will only work if +#: supported by the OS (for instance, when using a compositor under +#: X11). Note that it only sets the background color's opacity in +#: cells that have the same background color as the default terminal +#: background. This is so that things like the status bar in vim, +#: powerline prompts, etc. still look good. But it means that if you +#: use a color theme with a background color in your editor, it will +#: not be rendered as transparent. Instead you should change the +#: default background color in your kitty config and not use a +#: background color in the editor color scheme. Or use the escape +#: codes to set the terminals default colors in a shell script to +#: launch your editor. Be aware that using a value less than 1.0 is a +#: (possibly significant) performance hit. If you want to dynamically +#: change transparency of windows set dynamic_background_opacity to +#: yes (this is off by default as it has a performance cost). Changing +#: this setting when reloading the config will only work if +#: dynamic_background_opacity was enabled in the original config. + +# background_image none + +#: Path to a background image. Must be in PNG format. + +# background_image_layout tiled + +#: Whether to tile or scale the background image. + +# background_image_linear no + +#: When background image is scaled, whether linear interpolation +#: should be used. + +# dynamic_background_opacity no + +#: Allow changing of the background_opacity dynamically, using either +#: keyboard shortcuts (increase_background_opacity and +#: decrease_background_opacity) or the remote control facility. +#: Changing this setting by reloading the config is not supported. + +# background_tint 0.0 + +#: How much to tint the background image by the background color. The +#: tint is applied only under the text area, not margin/borders. Makes +#: it easier to read the text. Tinting is done using the current +#: background color for each window. This setting applies only if +#: background_opacity is set and transparent windows are supported or +#: background_image is set. + +# dim_opacity 0.75 + +#: How much to dim text that has the DIM/FAINT attribute set. One +#: means no dimming and zero means fully dimmed (i.e. invisible). + +# selection_foreground #000000 + +#: The foreground for text selected with the mouse. A value of none +#: means to leave the color unchanged. + +# selection_background #fffacd + +#: The background for text selected with the mouse. + +#: The color table {{{ + +#: The 256 terminal colors. There are 8 basic colors, each color has a +#: dull and bright version, for the first 16 colors. You can set the +#: remaining 240 colors as color16 to color255. + +# color0 #000000 +# color8 #767676 + +#: black + +# color1 #cc0403 +# color9 #f2201f + +#: red + +# color2 #19cb00 +# color10 #23fd00 + +#: green + +# color3 #cecb00 +# color11 #fffd00 + +#: yellow + +# color4 #0d73cc +# color12 #1a8fff + +#: blue + +# color5 #cb1ed1 +# color13 #fd28ff + +#: magenta + +# color6 #0dcdcd +# color14 #14ffff + +#: cyan + +# color7 #dddddd +# color15 #ffffff + +#: white + +# mark1_foreground black + +#: Color for marks of type 1 + +# mark1_background #98d3cb + +#: Color for marks of type 1 (light steel blue) + +# mark2_foreground black + +#: Color for marks of type 2 + +# mark2_background #f2dcd3 + +#: Color for marks of type 1 (beige) + +# mark3_foreground black + +#: Color for marks of type 3 + +# mark3_background #f274bc + +#: Color for marks of type 3 (violet) + +#: }}} + +#: }}} + +#: Advanced {{{ + +# shell . + +#: The shell program to execute. The default value of . means to use +#: whatever shell is set as the default shell for the current user. +#: Note that on macOS if you change this, you might need to add +#: --login and --interactive to ensure that the shell starts in +#: interactive mode and reads its startup rc files. + +# editor . + +#: The terminal editor (such as ``vim`` or ``nano``) to use when +#: editing the kitty config file or similar tasks. + +#: The default value of . means to use the environment variables +#: VISUAL and EDITOR in that order. If these variables aren't set, +#: kitty will run your shell (``$SHELL -l -i -c env``) to see if your +#: shell config files set VISUAL or EDITOR. If that doesn't work, +#: kitty will cycle through various known editors (``vim``, ``emacs``, +#: etc) and take the first one that exists on your system. + +# close_on_child_death no + +#: Close the window when the child process (shell) exits. If no (the +#: default), the terminal will remain open when the child exits as +#: long as there are still processes outputting to the terminal (for +#: example disowned or backgrounded processes). If yes, the window +#: will close as soon as the child process exits. Note that setting it +#: to yes means that any background processes still using the terminal +#: can fail silently because their stdout/stderr/stdin no longer work. + +# allow_remote_control no + +#: Allow other programs to control kitty. If you turn this on other +#: programs can control all aspects of kitty, including sending text +#: to kitty windows, opening new windows, closing windows, reading the +#: content of windows, etc. Note that this even works over ssh +#: connections. You can chose to either allow any program running +#: within kitty to control it, with yes or only programs that connect +#: to the socket specified with the kitty --listen-on command line +#: option, if you use the value socket-only. The latter is useful if +#: you want to prevent programs running on a remote computer over ssh +#: from controlling kitty. Reloading the config will not affect this +#: setting. + +# listen_on none + +#: Tell kitty to listen to the specified unix/tcp socket for remote +#: control connections. Note that this will apply to all kitty +#: instances. It can be overridden by the kitty --listen-on command +#: line flag. This option accepts only UNIX sockets, such as +#: unix:${TEMP}/mykitty or (on Linux) unix:@mykitty. Environment +#: variables are expanded. If {kitty_pid} is present then it is +#: replaced by the PID of the kitty process, otherwise the PID of the +#: kitty process is appended to the value, with a hyphen. This option +#: is ignored unless you also set allow_remote_control to enable +#: remote control. See the help for kitty --listen-on for more +#: details. Changing this option by reloading the config is not +#: supported. + +# env + +#: Specify environment variables to set in all child processes. Note +#: that environment variables are expanded recursively, so if you +#: use:: + +#: env MYVAR1=a +#: env MYVAR2=${MYVAR1}/${HOME}/b + +#: The value of MYVAR2 will be a//b. + +# update_check_interval 24 + +#: Periodically check if an update to kitty is available. If an update +#: is found a system notification is displayed informing you of the +#: available update. The default is to check every 24 hrs, set to zero +#: to disable. Changing this option by reloading the config is not +#: supported. + +# startup_session none + +#: Path to a session file to use for all kitty instances. Can be +#: overridden by using the kitty --session command line option for +#: individual instances. See +#: https://sw.kovidgoyal.net/kitty/overview/#startup-sessions in the +#: kitty documentation for details. Note that relative paths are +#: interpreted with respect to the kitty config directory. Environment +#: variables in the path are expanded. Changing this option by +#: reloading the config is not supported. + +# clipboard_control write-clipboard write-primary + +#: Allow programs running in kitty to read and write from the +#: clipboard. You can control exactly which actions are allowed. The +#: set of possible actions is: write-clipboard read-clipboard write- +#: primary read-primary. The default is to allow writing to the +#: clipboard and primary selection. Note that enabling the read +#: functionality is a security risk as it means that any program, even +#: one running on a remote server via SSH can read your clipboard. See +#: also clipboard_max_size. + +# clipboard_max_size 64 + +#: The maximum size (in MB) of data from programs running in kitty +#: that will be stored for writing to the system clipboard. See also +#: clipboard_control. A value of zero means no size limit is applied. + +# allow_hyperlinks yes + +#: Process hyperlink (OSC 8) escape sequences. If disabled OSC 8 +#: escape sequences are ignored. Otherwise they become clickable +#: links, that you can click by holding down ctrl+shift and clicking +#: with the mouse. The special value of ``ask`` means that kitty will +#: ask before opening the link. + +# term xterm-kitty + +#: The value of the TERM environment variable to set. Changing this +#: can break many terminal programs, only change it if you know what +#: you are doing, not because you read some advice on Stack Overflow +#: to change it. The TERM variable is used by various programs to get +#: information about the capabilities and behavior of the terminal. If +#: you change it, depending on what programs you run, and how +#: different the terminal you are changing it to is, various things +#: from key-presses, to colors, to various advanced features may not +#: work. Changing this option by reloading the config will only affect +#: newly created windows. + +#: }}} + +#: OS specific tweaks {{{ + +# wayland_titlebar_color system + +#: Change the color of the kitty window's titlebar on Wayland systems +#: with client side window decorations such as GNOME. A value of +#: system means to use the default system color, a value of background +#: means to use the background color of the currently active window +#: and finally you can use an arbitrary color, such as #12af59 or red. + +# macos_titlebar_color system + +#: Change the color of the kitty window's titlebar on macOS. A value +#: of system means to use the default system color, a value of +#: background means to use the background color of the currently +#: active window and finally you can use an arbitrary color, such as +#: #12af59 or red. WARNING: This option works by using a hack, as +#: there is no proper Cocoa API for it. It sets the background color +#: of the entire window and makes the titlebar transparent. As such it +#: is incompatible with background_opacity. If you want to use both, +#: you are probably better off just hiding the titlebar with +#: hide_window_decorations. + +# macos_option_as_alt no + +#: Use the option key as an alt key. With this set to no, kitty will +#: use the macOS native Option+Key = unicode character behavior. This +#: will break any Alt+key keyboard shortcuts in your terminal +#: programs, but you can use the macOS unicode input technique. You +#: can use the values: left, right, or both to use only the left, +#: right or both Option keys as Alt, instead. Changing this setting by +#: reloading the config is not supported. + +# macos_hide_from_tasks no + +#: Hide the kitty window from running tasks (⌘+Tab) on macOS. Changing +#: this setting by reloading the config is not supported. + +# macos_quit_when_last_window_closed no + +#: Have kitty quit when all the top-level windows are closed. By +#: default, kitty will stay running, even with no open windows, as is +#: the expected behavior on macOS. + +# macos_window_resizable yes + +#: Disable this if you want kitty top-level (OS) windows to not be +#: resizable on macOS. Changing this setting by reloading the config +#: will only affect newly created windows. + +# macos_thicken_font 0 + +#: Draw an extra border around the font with the given width, to +#: increase legibility at small font sizes. For example, a value of +#: 0.75 will result in rendering that looks similar to sub-pixel +#: antialiasing at common font sizes. + +# macos_traditional_fullscreen no + +#: Use the traditional full-screen transition, that is faster, but +#: less pretty. + +# macos_show_window_title_in all + +#: Show or hide the window title in the macOS window or menu-bar. A +#: value of window will show the title of the currently active window +#: at the top of the macOS window. A value of menubar will show the +#: title of the currently active window in the macOS menu-bar, making +#: use of otherwise wasted space. all will show the title everywhere +#: and none hides the title in the window and the menu-bar. + +# macos_custom_beam_cursor no + +#: Enable/disable custom mouse cursor for macOS that is easier to see +#: on both light and dark backgrounds. WARNING: this might make your +#: mouse cursor invisible on dual GPU machines. Changing this setting +#: by reloading the config is not supported. + +# linux_display_server auto + +#: Choose between Wayland and X11 backends. By default, an appropriate +#: backend based on the system state is chosen automatically. Set it +#: to x11 or wayland to force the choice. Changing this setting by +#: reloading the config is not supported. + +#: }}} + +#: Keyboard shortcuts {{{ + +#: Keys are identified simply by their lowercase unicode characters. +#: For example: ``a`` for the A key, ``[`` for the left square bracket +#: key, etc. For functional keys, such as ``Enter or Escape`` the +#: names are present at https://sw.kovidgoyal.net/kitty/keyboard- +#: protocol/#functional-key-definitions. For a list of modifier names, +#: see: GLFW mods + +#: On Linux you can also use XKB key names to bind keys that are not +#: supported by GLFW. See XKB keys +#: for a list of key names. The name to use is the part +#: after the XKB_KEY_ prefix. Note that you can only use an XKB key +#: name for keys that are not known as GLFW keys. + +#: Finally, you can use raw system key codes to map keys, again only +#: for keys that are not known as GLFW keys. To see the system key +#: code for a key, start kitty with the kitty --debug-input option. +#: Then kitty will output some debug text for every key event. In that +#: text look for ``native_code`` the value of that becomes the key +#: name in the shortcut. For example: + +#: .. code-block:: none + +#: on_key_input: glfw key: 65 native_code: 0x61 action: PRESS mods: 0x0 text: 'a' + +#: Here, the key name for the A key is 0x61 and you can use it with:: + +#: map ctrl+0x61 something + +#: to map ctrl+a to something. + +#: You can use the special action no_op to unmap a keyboard shortcut +#: that is assigned in the default configuration:: + +#: map kitty_mod+space no_op + +#: You can combine multiple actions to be triggered by a single +#: shortcut, using the syntax below:: + +#: map key combine action1 action2 action3 ... + +#: For example:: + +#: map kitty_mod+e combine : new_window : next_layout + +#: this will create a new window and switch to the next available +#: layout + +#: You can use multi-key shortcuts using the syntax shown below:: + +#: map key1>key2>key3 action + +#: For example:: + +#: map ctrl+f>2 set_font_size 20 + +#: The full list of actions that can be mapped to key presses is +#: available here . + +# kitty_mod ctrl+shift + +#: The value of kitty_mod is used as the modifier for all default +#: shortcuts, you can change it in your kitty.conf to change the +#: modifiers for all the default shortcuts. + +# clear_all_shortcuts no + +#: You can have kitty remove all shortcut definition seen up to this +#: point. Useful, for instance, to remove the default shortcuts. + +# kitten_alias hints hints --hints-offset=0 + +#: You can create aliases for kitten names, this allows overriding the +#: defaults for kitten options and can also be used to shorten +#: repeated mappings of the same kitten with a specific group of +#: options. For example, the above alias changes the default value of +#: kitty +kitten hints --hints-offset to zero for all mappings, +#: including the builtin ones. + +#: Clipboard {{{ + +# map kitty_mod+c copy_to_clipboard + +#: There is also a copy_or_interrupt action that can be optionally +#: mapped to Ctrl+c. It will copy only if there is a selection and +#: send an interrupt otherwise. Similarly, copy_and_clear_or_interrupt +#: will copy and clear the selection or send an interrupt if there is +#: no selection. + +# map kitty_mod+v paste_from_clipboard +# map kitty_mod+s paste_from_selection +# map kitty_mod+o pass_selection_to_program + +#: You can also pass the contents of the current selection to any +#: program using pass_selection_to_program. By default, the system's +#: open program is used, but you can specify your own, the selection +#: will be passed as a command line argument to the program, for +#: example:: + +#: map kitty_mod+o pass_selection_to_program firefox + +#: You can pass the current selection to a terminal program running in +#: a new kitty window, by using the @selection placeholder:: + +#: map kitty_mod+y new_window less @selection + +#: }}} + +#: Scrolling {{{ + +# map kitty_mod+up scroll_line_up +# map kitty_mod+down scroll_line_down +# map kitty_mod+page_up scroll_page_up +# map kitty_mod+page_down scroll_page_down +# map kitty_mod+home scroll_home +# map kitty_mod+end scroll_end +# map kitty_mod+h show_scrollback + +#: You can pipe the contents of the current screen + history buffer as +#: STDIN to an arbitrary program using the ``launch`` function. For +#: example, the following opens the scrollback buffer in less in an +#: overlay window:: + +#: map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting --type=overlay less +G -R + +#: For more details on piping screen and buffer contents to external +#: programs, see launch. + +#: }}} + +#: Window management {{{ + +# map kitty_mod+enter new_window + +#: You can open a new window running an arbitrary program, for +#: example:: + +#: map kitty_mod+y launch mutt + +#: You can open a new window with the current working directory set to +#: the working directory of the current window using:: + +#: map ctrl+alt+enter launch --cwd=current + +#: You can open a new window that is allowed to control kitty via the +#: kitty remote control facility by prefixing the command line with @. +#: Any programs running in that window will be allowed to control +#: kitty. For example:: + +#: map ctrl+enter launch --allow-remote-control some_program + +#: You can open a new window next to the currently active window or as +#: the first window, with:: + +#: map ctrl+n launch --location=neighbor some_program +#: map ctrl+f launch --location=first some_program + +#: For more details, see launch. + +# map kitty_mod+n new_os_window + +#: Works like new_window above, except that it opens a top level OS +#: kitty window. In particular you can use new_os_window_with_cwd to +#: open a window with the current working directory. + +# map kitty_mod+w close_window +# map kitty_mod+] next_window +# map kitty_mod+[ previous_window +# map kitty_mod+f move_window_forward +# map kitty_mod+b move_window_backward +# map kitty_mod+` move_window_to_top +# map kitty_mod+r start_resizing_window +# map kitty_mod+1 first_window +# map kitty_mod+2 second_window +# map kitty_mod+3 third_window +# map kitty_mod+4 fourth_window +# map kitty_mod+5 fifth_window +# map kitty_mod+6 sixth_window +# map kitty_mod+7 seventh_window +# map kitty_mod+8 eighth_window +# map kitty_mod+9 ninth_window +# map kitty_mod+0 tenth_window +#: }}} + +#: Tab management {{{ + +# map kitty_mod+right next_tab +# map kitty_mod+left previous_tab +# map kitty_mod+t new_tab +# map kitty_mod+q close_tab +# map shift+cmd+w close_os_window +# map kitty_mod+. move_tab_forward +# map kitty_mod+, move_tab_backward +# map kitty_mod+alt+t set_tab_title + +#: You can also create shortcuts to go to specific tabs, with 1 being +#: the first tab, 2 the second tab and -1 being the previously active +#: tab, and any number larger than the last tab being the last tab:: + +#: map ctrl+alt+1 goto_tab 1 +#: map ctrl+alt+2 goto_tab 2 + +#: Just as with new_window above, you can also pass the name of +#: arbitrary commands to run when using new_tab and use +#: new_tab_with_cwd. Finally, if you want the new tab to open next to +#: the current tab rather than at the end of the tabs list, use:: + +#: map ctrl+t new_tab !neighbor [optional cmd to run] +#: }}} + +#: Layout management {{{ + +# map kitty_mod+l next_layout + +#: You can also create shortcuts to switch to specific layouts:: + +#: map ctrl+alt+t goto_layout tall +#: map ctrl+alt+s goto_layout stack + +#: Similarly, to switch back to the previous layout:: + +#: map ctrl+alt+p last_used_layout + +#: There is also a toggle layout function that switches to the named +#: layout or back to the previous layout if in the named layout. +#: Useful to temporarily "zoom" the active window by switching to the +#: stack layout:: + +#: map ctrl+alt+z toggle_layout stack +#: }}} + +#: Font sizes {{{ + +#: You can change the font size for all top-level kitty OS windows at +#: a time or only the current one. + +# map kitty_mod+equal change_font_size all +2.0 +# map kitty_mod+minus change_font_size all -2.0 +# map kitty_mod+backspace change_font_size all 0 + +#: To setup shortcuts for specific font sizes:: + +#: map kitty_mod+f6 change_font_size all 10.0 + +#: To setup shortcuts to change only the current OS window's font +#: size:: + +#: map kitty_mod+f6 change_font_size current 10.0 +#: }}} + +#: Select and act on visible text {{{ + +#: Use the hints kitten to select text and either pass it to an +#: external program or insert it into the terminal or copy it to the +#: clipboard. + +# map kitty_mod+e open_url_with_hints + +#: Open a currently visible URL using the keyboard. The program used +#: to open the URL is specified in open_url_with. + +# map kitty_mod+p>f kitten hints --type path --program - + +#: Select a path/filename and insert it into the terminal. Useful, for +#: instance to run git commands on a filename output from a previous +#: git command. + +# map kitty_mod+p>shift+f kitten hints --type path + +#: Select a path/filename and open it with the default open program. + +# map kitty_mod+p>l kitten hints --type line --program - + +#: Select a line of text and insert it into the terminal. Use for the +#: output of things like: ls -1 + +# map kitty_mod+p>w kitten hints --type word --program - + +#: Select words and insert into terminal. + +# map kitty_mod+p>h kitten hints --type hash --program - + +#: Select something that looks like a hash and insert it into the +#: terminal. Useful with git, which uses sha1 hashes to identify +#: commits + +# map kitty_mod+p>n kitten hints --type linenum + +#: Select something that looks like filename:linenum and open it in +#: vim at the specified line number. + +# map kitty_mod+p>y kitten hints --type hyperlink + +#: Select a hyperlink (i.e. a URL that has been marked as such by the +#: terminal program, for example, by ls --hyperlink=auto). + + +#: The hints kitten has many more modes of operation that you can map +#: to different shortcuts. For a full description see kittens/hints. +#: }}} + +#: Miscellaneous {{{ + +# map kitty_mod+f11 toggle_fullscreen +# map kitty_mod+f10 toggle_maximized +# map kitty_mod+u kitten unicode_input +# map kitty_mod+f2 edit_config_file +# map kitty_mod+escape kitty_shell window + +#: Open the kitty shell in a new window/tab/overlay/os_window to +#: control kitty using commands. + +# map kitty_mod+a>m set_background_opacity +0.1 +# map kitty_mod+a>l set_background_opacity -0.1 +# map kitty_mod+a>1 set_background_opacity 1 +# map kitty_mod+a>d set_background_opacity default +# map kitty_mod+delete clear_terminal reset active + +#: You can create shortcuts to clear/reset the terminal. For example:: + +#: # Reset the terminal +#: map kitty_mod+f9 clear_terminal reset active +#: # Clear the terminal screen by erasing all contents +#: map kitty_mod+f10 clear_terminal clear active +#: # Clear the terminal scrollback by erasing it +#: map kitty_mod+f11 clear_terminal scrollback active +#: # Scroll the contents of the screen into the scrollback +#: map kitty_mod+f12 clear_terminal scroll active + +#: If you want to operate on all windows instead of just the current +#: one, use all instead of active. + +#: It is also possible to remap Ctrl+L to both scroll the current +#: screen contents into the scrollback buffer and clear the screen, +#: instead of just clearing the screen, for example, for ZSH add the +#: following to ~/.zshrc: + +#: .. code-block:: sh + +#: scroll-and-clear-screen() { +#: printf '\n%.0s' {1..$LINES} +#: zle clear-screen +#: } +#: zle -N scroll-and-clear-screen +#: bindkey '^l' scroll-and-clear-screen + +# map kitty_mod+f5 load_config_file + +#: Reload kitty.conf, applying any changes since the last time it was +#: loaded. Note that a handful of settings cannot be dynamically +#: changed and require a full restart of kitty. You can also map a +#: keybinding to load a different config file, for example:: + +#: map f5 load_config /path/to/alternative/kitty.conf + +#: Note that all setting from the original kitty.conf are discarded, +#: in other words the new conf settings *replace* the old ones. + +# map kitty_mod+f6 debug_config + +#: Show details about exactly what configuration kitty is running with +#: and its host environment. Useful for debugging issues. + + +#: You can tell kitty to send arbitrary (UTF-8) encoded text to the +#: client program when pressing specified shortcut keys. For example:: + +#: map ctrl+alt+a send_text all Special text + +#: This will send "Special text" when you press the ctrl+alt+a key +#: combination. The text to be sent is a python string literal so you +#: can use escapes like \x1b to send control codes or \u21fb to send +#: unicode characters (or you can just input the unicode characters +#: directly as UTF-8 text). The first argument to send_text is the +#: keyboard modes in which to activate the shortcut. The possible +#: values are normal or application or kitty or a comma separated +#: combination of them. The special keyword all means all modes. The +#: modes normal and application refer to the DECCKM cursor key mode +#: for terminals, and kitty refers to the special kitty extended +#: keyboard protocol. + +#: Another example, that outputs a word and then moves the cursor to +#: the start of the line (same as pressing the Home key):: + +#: map ctrl+alt+a send_text normal Word\x1b[H +#: map ctrl+alt+a send_text application Word\x1bOH + +#: }}} + +#: }}} diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim new file mode 100644 index 0000000..958dd91 --- /dev/null +++ b/nvim/.config/nvim/init.vim @@ -0,0 +1,21 @@ +set number +set relativenumber +set termguicolors +set expandtab +set shiftwidth=2 + +:augroup numbertoggle +: autocmd! +: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber +: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber +:augroup END + +if empty(glob('~/.config/nvim/autoload/plug.vim')) + silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall +endif +call plug#begin(stdpath('config') . '/plugged') +Plug 'airblade/vim-gitgutter' +Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && npm install' } +Plug 'neoclide/coc.nvim', {'branch': 'release'} +call plug#end() diff --git a/paru/.config/paru/paru.conf b/paru/.config/paru/paru.conf new file mode 100644 index 0000000..c43eea7 --- /dev/null +++ b/paru/.config/paru/paru.conf @@ -0,0 +1,36 @@ +# +# $PARU_CONF +# /etc/paru.conf +# ~/.config/paru/paru.conf +# +# See the paru.conf(5) manpage for options + +# +# GENERAL OPTIONS +# +[options] +PgpFetch +Devel +Provides +DevelSuffixes = -git -cvs -svn -bzr -darcs -always +BottomUp +BatchInstall +#RemoveMake +#SudoLoop +#UseAsk +#CombinedUpgrade +#CleanAfter +#UpgradeMenu +NewsOnUpgrade + +#LocalRepo +#Chroot +#MovePkgs + +# +# Binary OPTIONS +# +#[bin] +#FileManager = vifm +#MFlags = --skippgpcheck +#Sudo = doas diff --git a/redshift/.config/redshift/redshift.conf b/redshift/.config/redshift/redshift.conf new file mode 100644 index 0000000..18edd09 --- /dev/null +++ b/redshift/.config/redshift/redshift.conf @@ -0,0 +1,6 @@ +[redshift] + +location-provider=manual +[manual] +lat=48.740556 +lon=9.310833 diff --git a/rofi/.config/rofi/config.rasi b/rofi/.config/rofi/config.rasi new file mode 100644 index 0000000..9d1ebb8 --- /dev/null +++ b/rofi/.config/rofi/config.rasi @@ -0,0 +1,139 @@ +configuration { + modi: "window,run,ssh,drun"; +/* width: 50;*/ +/* lines: 15;*/ +/* columns: 1;*/ +/* font: "mono 12";*/ +/* bw: 1;*/ +/* location: 0;*/ +/* padding: 5;*/ +/* yoffset: 0;*/ +/* xoffset: 0;*/ +/* fixed-num-lines: true;*/ + show-icons: true; + terminal: "kitty"; +/* ssh-client: "ssh";*/ + ssh-command: "{terminal} -e \"{ssh-client} {host}\""; +/* run-command: "{cmd}";*/ +/* run-list-command: "";*/ +/* run-shell-command: "{terminal} -e {cmd}";*/ +/* window-command: "xkill -id {window}";*/ +/* window-match-fields: "all";*/ +/* drun-icon-theme: ;*/ +/* drun-match-fields: "name,generic,exec,categories";*/ +/* disable-history: false;*/ +/* sort: false;*/ +/* levenshtein-sort: false;*/ +/* case-sensitive: false;*/ +/* cycle: true;*/ +/* sidebar-mode: false;*/ +/* eh: 1;*/ +/* auto-select: false;*/ +/* parse-hosts: false;*/ +/* parse-known-hosts: true;*/ +/* combi-modi: "window,run";*/ +/* matching: "normal";*/ +/* tokenize: true;*/ +/* m: "-5";*/ +/* line-margin: 2;*/ +/* line-padding: 1;*/ +/* filter: ;*/ +/* separator-style: "dash";*/ +/* hide-scrollbar: false;*/ +/* fullscreen: false;*/ +/* fake-transparency: false;*/ +/* dpi: -1;*/ +/* threads: 0;*/ +/* scrollbar-width: 8;*/ +/* scroll-method: 0;*/ +/* fake-background: "screenshot";*/ +/* window-format: "{w} {i}{c} {t}";*/ +/* click-to-exit: true;*/ +/* show-match: true;*/ + theme: "dark_theme"; +/* color-normal: ;*/ +/* color-urgent: ;*/ +/* color-active: ;*/ +/* color-window: ;*/ +/* max-history-size: 25;*/ +/* combi-hide-mode-prefix: false;*/ +/* pid: "/run/user/1000/rofi.pid";*/ + display-window: "window: "; +/* display-windowcd: ;*/ + display-run: "run: " ; + display-ssh: "ssh: "; + display-drun: "program: "; +/* display-combi: ;*/ +/* display-keys: ;*/ +/* kb-primary-paste: "Control+V,Shift+Insert";*/ +/* kb-secondary-paste: "Control+v,Insert";*/ +/* kb-clear-line: "Control+w";*/ +/* kb-move-front: "Control+a";*/ +/* kb-move-end: "Control+e";*/ +/* kb-move-word-back: "Alt+b";*/ +/* kb-move-word-forward: "Alt+f";*/ +/* kb-move-char-back: "Left,Control+b";*/ +/* kb-move-char-forward: "Right,Control+f";*/ +/* kb-remove-word-back: "Control+Alt+h,Control+BackSpace";*/ +/* kb-remove-word-forward: "Control+Alt+d";*/ +/* kb-remove-char-forward: "Delete,Control+d";*/ +/* kb-remove-char-back: "BackSpace,Control+h";*/ +/* kb-remove-to-eol: "Control+k";*/ +/* kb-remove-to-sol: "Control+u";*/ +/* kb-accept-entry: "Control+j,Control+m,Return,KP_Enter";*/ +/* kb-accept-custom: "Control+Return";*/ +/* kb-accept-alt: "Shift+Return";*/ +/* kb-delete-entry: "Shift+Delete";*/ +/* kb-mode-next: "Shift+Right,Control+Tab";*/ +/* kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab";*/ +/* kb-row-left: "Control+Page_Up";*/ +/* kb-row-right: "Control+Page_Down";*/ +/* kb-row-up: "Up,Control+p,ISO_Left_Tab";*/ +/* kb-row-down: "Down,Control+n";*/ +/* kb-row-tab: "Tab";*/ +/* kb-page-prev: "Page_Up";*/ +/* kb-page-next: "Page_Down";*/ +/* kb-row-first: "Home,KP_Home";*/ +/* kb-row-last: "End,KP_End";*/ +/* kb-row-select: "Control+space";*/ +/* kb-screenshot: "Alt+S";*/ +/* kb-toggle-case-sensitivity: "grave,dead_grave";*/ +/* kb-toggle-sort: "Alt+grave";*/ +/* kb-cancel: "Escape,Control+g,Control+bracketleft";*/ +/* kb-custom-1: "Alt+1";*/ +/* kb-custom-2: "Alt+2";*/ +/* kb-custom-3: "Alt+3";*/ +/* kb-custom-4: "Alt+4";*/ +/* kb-custom-5: "Alt+5";*/ +/* kb-custom-6: "Alt+6";*/ +/* kb-custom-7: "Alt+7";*/ +/* kb-custom-8: "Alt+8";*/ +/* kb-custom-9: "Alt+9";*/ +/* kb-custom-10: "Alt+0";*/ +/* kb-custom-11: "Alt+exclam";*/ +/* kb-custom-12: "Alt+at";*/ +/* kb-custom-13: "Alt+numbersign";*/ +/* kb-custom-14: "Alt+dollar";*/ +/* kb-custom-15: "Alt+percent";*/ +/* kb-custom-16: "Alt+dead_circumflex";*/ +/* kb-custom-17: "Alt+ampersand";*/ +/* kb-custom-18: "Alt+asterisk";*/ +/* kb-custom-19: "Alt+parenleft";*/ +/* kb-select-1: "Super+1";*/ +/* kb-select-2: "Super+2";*/ +/* kb-select-3: "Super+3";*/ +/* kb-select-4: "Super+4";*/ +/* kb-select-5: "Super+5";*/ +/* kb-select-6: "Super+6";*/ +/* kb-select-7: "Super+7";*/ +/* kb-select-8: "Super+8";*/ +/* kb-select-9: "Super+9";*/ +/* kb-select-10: "Super+0";*/ +/* ml-row-left: "ScrollLeft";*/ +/* ml-row-right: "ScrollRight";*/ +/* ml-row-up: "ScrollUp";*/ +/* ml-row-down: "ScrollDown";*/ +/* me-select-entry: "MousePrimary";*/ +/* me-accept-entry: "MouseDPrimary";*/ +/* me-accept-custom: "Control+MouseDPrimary";*/ +} diff --git a/rofi/.config/rofi/dark_theme.rasi b/rofi/.config/rofi/dark_theme.rasi new file mode 100644 index 0000000..3fb111b --- /dev/null +++ b/rofi/.config/rofi/dark_theme.rasi @@ -0,0 +1,138 @@ +/******************************************************************************* + * ROFI Color theme + * User: Rasi + * Copyright: Rasmus Steinke + *******************************************************************************/ + +* { + selected-normal-foreground: rgba ( 255, 255, 255, 100 % ); + foreground: rgba ( 193, 193, 193, 100 % ); + normal-foreground: @foreground; + alternate-normal-background: rgba ( 39, 50, 56, 100 % ); + red: rgba ( 220, 50, 47, 100 % ); + selected-urgent-foreground: rgba ( 255, 24, 68, 100 % ); + blue: rgba ( 38, 139, 210, 100 % ); + urgent-foreground: rgba ( 255, 24, 68, 100 % ); + alternate-urgent-background: rgba ( 39, 50, 56, 100 % ); + active-foreground: rgba ( 128, 203, 196, 100 % ); + lightbg: rgba ( 238, 232, 213, 100 % ); + selected-active-foreground: rgba ( 128, 203, 196, 100 % ); + alternate-active-background: rgba ( 39, 50, 56, 100 % ); + background: rgba ( 39, 50, 56, 100 % ); + bordercolor: rgba ( 39, 50, 56, 100 % ); + alternate-normal-foreground: @foreground; + normal-background: rgba ( 39, 50, 56, 100 % ); + lightfg: rgba ( 88, 104, 117, 100 % ); + selected-normal-background: rgba ( 57, 66, 73, 100 % ); + border-color: @foreground; + spacing: 2; + separatorcolor: rgba ( 30, 37, 41, 100 % ); + urgent-background: rgba ( 39, 50, 56, 100 % ); + selected-urgent-background: rgba ( 57, 66, 73, 100 % ); + alternate-urgent-foreground: @urgent-foreground; + background-color: rgba ( 0, 0, 0, 0 % ); + alternate-active-foreground: @active-foreground; + active-background: rgba ( 39, 50, 56, 100 % ); + selected-active-background: rgba ( 57, 66, 73, 100 % ); +} +#window { + background-color: @background; + border: 1; + padding: 5; +} +#mainbox { + border: 0; + padding: 0; +} +#message { + border: 1px dash 0px 0px ; + border-color: @separatorcolor; + padding: 1px ; +} +#textbox { + text-color: @foreground; +} +#listview { + fixed-height: 0; + border: 2px dash 0px 0px ; + border-color: @separatorcolor; + spacing: 2px ; + scrollbar: true; + padding: 2px 0px 0px ; +} +#element { + border: 0; + padding: 1px ; +} +#element.normal.normal { + background-color: @normal-background; + text-color: @normal-foreground; +} +#element.normal.urgent { + background-color: @urgent-background; + text-color: @urgent-foreground; +} +#element.normal.active { + background-color: @active-background; + text-color: @active-foreground; +} +#element.selected.normal { + background-color: @selected-normal-background; + text-color: @selected-normal-foreground; +} +#element.selected.urgent { + background-color: @selected-urgent-background; + text-color: @selected-urgent-foreground; +} +#element.selected.active { + background-color: @selected-active-background; + text-color: @selected-active-foreground; +} +#element.alternate.normal { + background-color: @alternate-normal-background; + text-color: @alternate-normal-foreground; +} +#element.alternate.urgent { + background-color: @alternate-urgent-background; + text-color: @alternate-urgent-foreground; +} +#element.alternate.active { + background-color: @alternate-active-background; + text-color: @alternate-active-foreground; +} +#scrollbar { + width: 4px ; + border: 0; + handle-width: 8px ; + padding: 0; +} +#sidebar { + border: 2px dash 0px 0px ; + border-color: @separatorcolor; +} +#button.selected { + background-color: @selected-normal-background; + text-color: @selected-normal-foreground; +} +#inputbar { + spacing: 0; + text-color: @normal-foreground; + padding: 1px ; +} +#case-indicator { + spacing: 0; + text-color: @normal-foreground; +} +#entry { + spacing: 0; + text-color: @normal-foreground; +} +#prompt { + spacing: 0; + text-color: @normal-foreground; +} + +element-text { + background-color: inherit; + text-color: inherit; +} diff --git a/sakura/.config/sakura/sakura.conf b/sakura/.config/sakura/sakura.conf new file mode 100644 index 0000000..129dcc0 --- /dev/null +++ b/sakura/.config/sakura/sakura.conf @@ -0,0 +1,78 @@ +[sakura] +colorset1_fore=rgb(192,192,192) +colorset1_back=rgb(0,0,0) +colorset1_curs=rgb(255,255,255) +colorset1_key=F1 +colorset2_fore=rgb(192,192,192) +colorset2_back=rgb(0,0,0) +colorset2_curs=rgb(255,255,255) +colorset2_key=F2 +colorset3_fore=rgb(192,192,192) +colorset3_back=rgb(0,0,0) +colorset3_curs=rgb(255,255,255) +colorset3_key=F3 +colorset4_fore=rgb(192,192,192) +colorset4_back=rgb(0,0,0) +colorset4_curs=rgb(255,255,255) +colorset4_key=F4 +colorset5_fore=rgb(192,192,192) +colorset5_back=rgb(0,0,0) +colorset5_curs=rgb(255,255,255) +colorset5_key=F5 +colorset6_fore=rgb(192,192,192) +colorset6_back=rgb(0,0,0) +colorset6_curs=rgb(255,255,255) +colorset6_key=F6 +last_colorset=3 +scroll_lines=4096 +font=Source Code Pro 15 +show_always_first_tab=No +scrollbar=false +closebutton=true +tabs_on_bottom=false +less_questions=false +disable_numbered_tabswitch=false +use_fading=false +scrollable_tabs=true +urgent_bell=Yes +audible_bell=No +blinking_cursor=No +stop_tab_cycling_at_end_tabs=No +allow_bold=Yes +cursor_type=VTE_CURSOR_SHAPE_BLOCK +word_chars=-,./?%&#_~: +palette=6 +add_tab_accelerator=5 +del_tab_accelerator=5 +switch_tab_accelerator=4 +move_tab_accelerator=5 +copy_accelerator=5 +scrollbar_accelerator=5 +open_url_accelerator=5 +font_size_accelerator=4 +set_tab_name_accelerator=5 +search_accelerator=5 +add_tab_key=T +del_tab_key=W +prev_tab_key=Left +next_tab_key=Right +copy_key=C +paste_key=V +scrollbar_key=S +set_tab_name_key=N +search_key=F +increase_font_size_key=plus +decrease_font_size_key=minus +fullscreen_key=F11 +set_colorset_accelerator=5 +icon_file=terminal-tango.svg +colorset1_scheme=1 +colorset2_scheme=1 +colorset3_scheme=1 +colorset4_scheme=1 +colorset5_scheme=1 +colorset6_scheme=1 +copy_on_select=false +paste_button=2 +menu_button=3 +bold_is_bright=false diff --git a/screen-config/.config/screen/1024.sh b/screen-config/.config/screen/1024.sh new file mode 100755 index 0000000..5245b9a --- /dev/null +++ b/screen-config/.config/screen/1024.sh @@ -0,0 +1,2 @@ +#!/bin/sh +xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x1024 --rotate normal --output HDMI1 --mode 1280x1024 --pos 320x0 --rotate normal --output VIRTUAL1 --off diff --git a/screen-config/.config/screen/1280.sh b/screen-config/.config/screen/1280.sh new file mode 100755 index 0000000..073399a --- /dev/null +++ b/screen-config/.config/screen/1280.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x1024 --rotate normal --output HDMI1 --mode 1280x1024 --pos 248x0 --rotate normal --output VIRTUAL1 --off diff --git a/screen-config/.config/screen/1680.sh b/screen-config/.config/screen/1680.sh new file mode 100755 index 0000000..7483cc1 --- /dev/null +++ b/screen-config/.config/screen/1680.sh @@ -0,0 +1,2 @@ +#!/bin/sh +xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x1050 --rotate normal --output HDMI1 --mode 1680x1050 --pos 120x0 --rotate normal --output VIRTUAL1 --off diff --git a/screen-config/.config/screen/1920.sh b/screen-config/.config/screen/1920.sh new file mode 100755 index 0000000..6d04398 --- /dev/null +++ b/screen-config/.config/screen/1920.sh @@ -0,0 +1,2 @@ +#!/bin/sh +xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x1080 --rotate normal --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off diff --git a/screen-config/.config/screen/double.sh b/screen-config/.config/screen/double.sh new file mode 100755 index 0000000..66827f9 --- /dev/null +++ b/screen-config/.config/screen/double.sh @@ -0,0 +1,2 @@ +#!/bin/sh +xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off diff --git a/screen-config/.config/screen/mobile.sh b/screen-config/.config/screen/mobile.sh new file mode 100755 index 0000000..ad03985 --- /dev/null +++ b/screen-config/.config/screen/mobile.sh @@ -0,0 +1,2 @@ +#!/bin/sh +xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI1 --off --output VIRTUAL1 --off diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc new file mode 100644 index 0000000..c2c37dc --- /dev/null +++ b/zsh/.config/zsh/.zshrc @@ -0,0 +1,45 @@ +# Plugins +source $ZDOTDIR/zsh-git-prompt/zshrc.sh +source $ZDOTDIR/window-title-bar.sh +source $ZDOTDIR/git-aliases.sh +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh +# The following lines were added by compinstall + +zstyle ':completion:*' completer _complete _ignored +zstyle ':completion:*' list-colors '' +zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=* r:|=*' +zstyle ':completion:*' menu select=long +zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s +zstyle :compinstall filename '/home/julius/.config/zsh/.zshrc' + +autoload -Uz compinit +compinit +# End of lines added by compinstall +# Lines configured by zsh-newuser-install +HISTFILE=~/.histfile +HISTSIZE=1000 +SAVEHIST=1000 +setopt autocd extendedglob nomatch notify +unsetopt beep +bindkey -v +# End of lines configured by zsh-newuser-install + +bindkey '^R' history-incremental-search-backward +# Commands beginning with space are excluded from the history +setopt hist_ignore_space + +# set PATH so it includes user's private bin directories +PATH="$HOME/.local/bin:$PATH" + +# Aliases +alias grep='grep --color=auto' +alias wget='wget -c' +alias mkdir='mkdir -pv' +alias ls='ls -CF --color=auto' +alias vim=nvim +# Exports +export EDITOR=nvim +export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" +export PROMPT="%F{12}[%f%F{10}%n%f%F{12}@%f%F{white}%m%f%F{12}]%f%F{white}:%f %F{white}%~%f%F{12}>%b$(git_super_status)%f%F{10}%(!.#.$)%f " +PROMPT='%F{12}[%F{10}%n%F{12}@%F{white}%m%F{12}]%F{white}: %~%F{12}>$(git_super_status)%F{10}%(!.#.$)%f ' diff --git a/zsh/.config/zsh/git-aliases.sh b/zsh/.config/zsh/git-aliases.sh new file mode 100644 index 0000000..2e15d32 --- /dev/null +++ b/zsh/.config/zsh/git-aliases.sh @@ -0,0 +1,7 @@ +#!/bin/zsh + +alias Gst="git status" +alias Gco="git checkout" +alias Gd="git diff" +alias Gds="git diff --staged" +alias Gc="git commit" diff --git a/zsh/.config/zsh/window-title-bar.sh b/zsh/.config/zsh/window-title-bar.sh new file mode 100644 index 0000000..c10675d --- /dev/null +++ b/zsh/.config/zsh/window-title-bar.sh @@ -0,0 +1,19 @@ +#!/bin/zsh + +if [[ "${TERM}" != "" && "${TERM}" == "alacritty" ]] +then + precmd() + { + # output on which level (%L) this shell is running on. + # append the current directory (%~), substitute home directories with a tilde. + # "\a" bell (man 1 echo) + # "print" must be used here; echo cannot handle prompt expansions (%L) + print -Pn "\e]0;$(id --user --name)@$(hostname): zsh[%L] %~\a" + } + + preexec() + { + # output current executed command with parameters + echo -en "\e]0;$(id --user --name)@$(hostname): ${1}\a" + } +fi diff --git a/zsh/.zshenv b/zsh/.zshenv new file mode 100644 index 0000000..1601f21 --- /dev/null +++ b/zsh/.zshenv @@ -0,0 +1 @@ +export ZDOTDIR=$HOME/.config/zsh