diff --git a/.gitmodules b/.gitmodules index 4a82b5f..20e4656 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "common/.config/awesome/plugins/nice"] path = common/.config/awesome/plugins/nice url = https://github.com/AlphaKeks/awesome-wm-nice +[submodule "common/.config/awesome/plugins/udisks2"] + path = common/.config/awesome/plugins/udisks2 + url = https://github.com/mireq/awesome-udisks2-mount diff --git a/README.md b/README.md index bda666b..424eb9f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Dotfiles ## Ben's Amazing Dotfile Installer + +NOTE THIS ONLY WORKS IF THE USERNAME IS benk + The only prerequisite for Ben's Amazing Dotfile Installer is to install nodejs `node bootstrap.js [--os[-o] ubuntu/arch] [--host[-h] host/laptop]` diff --git a/arch.os b/arch.os index 8c2f53e..a496b89 100755 --- a/arch.os +++ b/arch.os @@ -5,8 +5,8 @@ yay -S neovim-git nvm wezterm ranger ripgrep zsh zsh-vi-mode curl exa sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" # WM Deps -yay -S awesome-git -yay -S picom-pijulis-git +yay -S awesome-git i3 ttf-material-design-icons ttf-unifont polybar +yay -S picom-ftlabs-git yay -S i3exit arc-icon-theme ttf-twemoji xorg-xbacklight xidlehook sysstat i3blocks mpris-ctl flameshot perl rofi mkdir -p ~/.local/share/fonts diff --git a/common/.config/awesome/ben/keymaps.lua b/common/.config/awesome/ben/keymaps.lua index 21948e0..8c7dfd2 100644 --- a/common/.config/awesome/ben/keymaps.lua +++ b/common/.config/awesome/ben/keymaps.lua @@ -267,6 +267,7 @@ awful.keyboard.append_global_keybindings({ client.focus:move_to_tag(tag) end end), + awful.key({}, "XF86MonBrightnessUp", function() awful.spawn("brightnessctl s +5%", false) diff --git a/common/.config/awesome/plugins/udisks2 b/common/.config/awesome/plugins/udisks2 new file mode 160000 index 0000000..55301d1 --- /dev/null +++ b/common/.config/awesome/plugins/udisks2 @@ -0,0 +1 @@ +Subproject commit 55301d16e25aecd938c2b476924ac4af81a7eab0 diff --git a/common/.config/awesome/rc.lua b/common/.config/awesome/rc.lua index 8e519bb..ffd34b1 100644 --- a/common/.config/awesome/rc.lua +++ b/common/.config/awesome/rc.lua @@ -43,36 +43,5 @@ require("ben.autostart") require("ben.volume") require("ben.backlight") --- bling -local bling = require("plugins.bling") --- fancy titlebars -local nice = require("plugins.nice") -nice({ - titlebar_color = Ben.colors.crust, - titlebar_height = 20, - titlebar_font = Ben.fonts.small, - button_size = 14, - mb_resize = nice.MB_MIDDLE, - titlebar_radius = 0, - mb_contextmenu = nice.MB_RIGHT, - titlebar_items = { - left = {}, - middle = "title", - right = { "maximize", "close" }, - }, - maximize_color = Ben.colors.green, - close_color = Ben.colors.red, -}) - --- fix annoying fullscreen stuff -client.connect_signal("property::fullscreen", function(c) - if c.fullscreen then - awful.titlebar.hide(c) - c.border_width = 0 --c.fullscreen and 0 or beautiful.border_width - c:geometry(c.screen.geometry) - else - awful.titlebar.show(c) - end -end) diff --git a/common/.config/i3/catppuccin-macchiato b/common/.config/i3/catppuccin-macchiato new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/common/.config/i3/catppuccin-macchiato @@ -0,0 +1 @@ + diff --git a/common/.config/i3/config b/common/.config/i3/config new file mode 100644 index 0000000..e471a77 --- /dev/null +++ b/common/.config/i3/config @@ -0,0 +1,253 @@ +# i3 config file (v4) +set $rosewater #f4dbd6 +set $flamingo #f0c6c6 +set $pink #f5bde6 +set $mauve #c6a0f6 +set $red #ed8796 +set $maroon #ee99a0 +set $peach #f5a97f +set $green #a6da95 +set $teal #8bd5ca +set $sky #91d7e3 +set $sapphire #7dc4e4 +set $blue #8aadf4 +set $lavender #b7bdf8 +set $text #cad3f5 +set $subtext1 #b8c0e0 +set $subtext0 #a5adcb +set $overlay2 #939ab7 +set $overlay1 #8087a2 +set $overlay0 #6e738d +set $surface2 #5b6078 +set $surface1 #494d64 +set $surface0 #363a4f +set $base #24273a +set $mantle #1e2030 +set $crust #181926 + +# Theme colors +client.focused $pink $pink $base $blue $blue +client.focused_inactive $pink $pink $base $blue $blue +client.unfocused $base $surface0 $overlay2 $surface0 $surface0 +client.urgent $red $red $base $red $red +client.placeholder $overlay0 $base $text $overlay0 $overlay0 +client.background $base + +# Set mod key (Mod1=, Mod4=) +set $mod Mod4 +floating_modifier $mod + +default_border none +default_floating_border normal + +exec_always --no-startup-id $HOME/.config/i3/i3-chrome-tab-dragging.py +# remember to install this on the aur! +exec --no-startup-id alternating_layouts.py + +font xft:DejaVu Sans Mono 12 + +bindsym $mod+Return exec wezterm +bindsym $mod+Shift+q kill +bindsym $mod+d exec --no-startup-id rofi -show drun +bindsym $mod+z exec --no-startup-id morc_menu +bindsym $mod+Print --release exec --no-startup-id i3-scrot -w +bindsym $mod+Ctrl+x --release exec --no-startup-id xkill +bindsym Print exec flameshot gui + +# Screen brightness controls +bindsym XF86MonBrightnessUp exec "brightnessctl set +5%; notify-send 'brightness up'" +bindsym XF86MonBrightnessDown exec "brightnessctl set 5-%; notify-send 'brightness down'" + +# Audio Controls +bindsym XF86AudioPlay exec "mpris-ctl pp && mpris-ctl --player inactive pp" +bindsym XF86AudioNext exec "mpris-ctl --player active next" +bindsym XF86AudioPrev exec "mpris-ctl --player active prev" +#bindsym XF86AudioPlay exec "playerctl play-pause" +#bindsym XF86AudioNext exec "playerctl next" +#bindsym XF86AudioPrev exec "playerctl previous" + +focus_follows_mouse yes + +# 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 + +bindsym $mod+q split toggle +bindsym $mod+f fullscreen toggle +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split +bindsym $mod+Shift+space floating toggle +bindsym $mod+space focus mode_toggle +bindsym $mod+Shift+s sticky toggle +bindsym $mod+a focus parent + +# scratchpad (todo learn what this is) +bindsym $mod+Shift+minus move scratchpad +bindsym $mod+minus scratchpad show + +# Workspace names +set $ws1 1 +set $ws2 2 +set $ws3 3 +set $ws4 4 +set $ws5 5 +set $ws6 6 +set $ws7 7 +set $ws8 8 +set $ws9 9 + +# 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 +bindsym $mod+9 workspace $ws9 + +# Move focused container to workspace +bindsym $mod+Ctrl+1 move container to workspace $ws1 +bindsym $mod+Ctrl+2 move container to workspace $ws2 +bindsym $mod+Ctrl+3 move container to workspace $ws3 +bindsym $mod+Ctrl+4 move container to workspace $ws4 +bindsym $mod+Ctrl+5 move container to workspace $ws5 +bindsym $mod+Ctrl+6 move container to workspace $ws6 +bindsym $mod+Ctrl+7 move container to workspace $ws7 +bindsym $mod+Ctrl+8 move container to workspace $ws8 +bindsym $mod+Ctrl+9 move container to workspace $ws9 + +# Move to workspace with focused container +bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2 +bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3 +bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4 +bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6 +bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7 +bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8 +bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9 + +# resize focused window +bindsym $mod+Shift+h resize shrink width 5 px or 5 pp9t +bindsym $mod+Shift+j resize grow height 5 px or 5 ppt +bindsym $mod+Shift+k resize shrink height 5 px or 5 ppt +bindsym $mod+Shift+l resize grow width 5 px or 5 ppt + +# focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# move focused window +bindsym $mod+Ctrl+h move left +bindsym $mod+Ctrl+j move down +bindsym $mod+Ctrl+k move up +bindsym $mod+Ctrl+l move right + +# move workspace amongst screens +bindsym $mod+Ctrl+Shift+h move workspace to output left +bindsym $mod+Ctrl+Shift+l move workspace to output right +bindsym $mod+Ctrl+Shift+k move workspace to output up +bindsym $mod+Ctrl+Shift+j move workspace to output down + + +# Open applications on specific workspaces +assign [class="discord"] $ws4 + +# Open specific applications in floating mode +for_window [title="alsamixer"] floating enable border pixel 1 +for_window [class="Clipgrab"] floating enable +for_window [class="Galculator"] floating enable border pixel 1 +for_window [class="GParted"] floating enable border normal +for_window [class="Lxappearance"] floating enable sticky enable border normal +for_window [class="Nitrogen"] floating enable sticky enable border normal +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="Aeon"] floating enable, sticky enable +for_window [class="Inferno v3.0.1_alpha"] floating enable, sticky enable + +# switch to workspace with urgent window automatically +for_window [urgent=latest] focus + +# reload the config file +bindsym $mod+Shift+c reload +bindsym $mod+Shift+r restart + +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +# Set shut down, restart and locking features +bindsym $mod+0 mode "$mode_system" +set $mode_system (l)ock, (e)xit, switch_(u)ser, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown +mode "$mode_system" { + bindsym l exec --no-startup-id i3exit lock, mode "default" + bindsym s exec --no-startup-id i3exit suspend, mode "default" + bindsym u exec --no-startup-id i3exit switch_user, mode "default" + bindsym e exec --no-startup-id i3exit logout, mode "default" + bindsym h exec --no-startup-id i3exit hibernate, mode "default" + bindsym r exec --no-startup-id i3exit reboot, mode "default" + bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default" + + # exit system mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# Autostart applications +exec --no-startup-id nitrogen --restore +exec --no-startup-id nm-applet +exec --no-startup-id xfce4-power-manager +exec --no-startup-id clipit +exec --no-startup-id xidlehook --not-when-fullscreen --not-when-audio --timer 600 'blurlock' '' +exec_always --no-startup-id ff-theme-util +exec_always --no-startup-id fix_xcursor +exec --no-startup-id volumeicon +exec --no-startup-id mpris-proxy +exec --no-startup-id pa-applet + +exec_always killall -q picom ; picom -b --config $HOME/.config/picom.conf + +# hide/unhide i3status bar +bindsym $mod+m bar mode toggle + +gaps inner 10 +gaps outer -1 + +smart_gaps on +smart_borders on + +# Hide title bar +default_border pixel 0 +default_floating_border pixel 0 +for_window [class="^.*"] border pixel 0 + +# Enable and disable gaps +bindsym $mod+Shift+n gaps inner all set 0; gaps outer all set 0 +bindsym $mod+n gaps inner all set 7; gaps outer all set -1 + +bar { + status_command SCRIPT_DIR=~/.config/i3blocks/scripts i3blocks -c ~/.config/i3blocks/config + position bottom + separator_symbol "│" + + tray_output primary + tray_padding 4 + + font pango:DejaVu Sans Mono Nerd Font 12 + + colors { + background $base + statusline $text + separator $rosewater + # border bg text + focused_workspace $pink $pink $base + inactive_workspace $surface0 $surface0 $overlay0 + urgent_workspace $red $red $base + } +} + diff --git a/common/.i3/i3-chrome-tab-dragging.py b/common/.config/i3/i3-chrome-tab-dragging.py similarity index 100% rename from common/.i3/i3-chrome-tab-dragging.py rename to common/.config/i3/i3-chrome-tab-dragging.py diff --git a/common/.config/i3blocks/config b/common/.config/i3blocks/config index 416ca01..cf1c6e5 100644 --- a/common/.config/i3blocks/config +++ b/common/.config/i3blocks/config @@ -1,24 +1,63 @@ -[NOW_PLAYING] -command=mpris-ctl info '🎶 %player_name: %track_name - %artist_name' +separator_block_width=18 + +[title] +command=$SCRIPT_DIR/i3-focusedwindow/i3-focusedwindow interval=1 -color=#1DB954 +separator=false -[DISK] -command=df -h / | awk '/\//{ printf(" 💾 %sB \n", $4) }' -interval=10 -color=#C9E3DB - -[CPU] -full_text= CPU: 0.00% @ +00.0°C -command=~/.config/i3blocks/cpu/cpu_info.sh -interval=2 -color=#0071C5 - -[MEM] -command=free -h | awk '/Mem:/ { printf(" %5s/%s \n", $3, $2) }' +[spotify] +label= +command=python3 $SCRIPT_DIR/spotify/spotify.py +seperator=false interval=5 -color=#FEC925 +color=#c6a0f6 -[TIME_DATE] +[memory] +label=󰍛 +command=$SCRIPT_DIR/memory/memory +interval=30 +color=#f4dbd6 + +[cpu_usage] +label= +command=$SCRIPT_DIR/cpu_usage/cpu_usage +interval=10 +#color=#8bd5ca +#T_WARN=50 +#T_CRIT=80 +#DECIMALS=2 +#COLOR_NORMAL=#EBDBB2 +#COLOR_WARN=#FFFC00 +#COLOR_CRIT=#FF0000 + +[jas] +label=󰃟 +command=$SCRIPT_DIR/jas/jas +markup="pango" +interval=once +signal=10 +#STEP_SIZE=5 +color=#eed49f + +[baterkos] +label= +command=$SCRIPT_DIR/battery/battery +interval=10 +color=#b7bdf8 + +[volume] +label=󰕾 +command=$SCRIPT_DIR/volume/volume +#label=VOL +interval=5 +signal=10 +markup=pango +color=#f5bde6 + +[time] +label= command=date +" %a, %d %b - %H:%M:%S" +min_width=100 +align=center +seperator=false interval=1 diff --git a/common/.config/i3blocks/scripts/battery/README.md b/common/.config/i3blocks/scripts/battery/README.md new file mode 100755 index 0000000..5f14bdb --- /dev/null +++ b/common/.config/i3blocks/scripts/battery/README.md @@ -0,0 +1,20 @@ +# battery + +Show battery info. + +![](battery.png) + +# Dependencies + +* `acpi` + +# Config + +``` +[battery] +command=$SCRIPT_DIR/battery +interval=30 +LABEL=BAT +#LABEL=⚡ +#BAT_NUMBER=0 +``` diff --git a/common/.config/i3blocks/scripts/battery/battery b/common/.config/i3blocks/scripts/battery/battery new file mode 100755 index 0000000..2fb8cd6 --- /dev/null +++ b/common/.config/i3blocks/scripts/battery/battery @@ -0,0 +1,94 @@ +#!/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{BAT_NUMBER} || 0; +my $label = $ENV{LABEL} || ""; + +# read the first line of the "acpi" command output +open (ACPI, "acpi -b 2>/dev/null| grep 'Battery $bat_number' |") or die; +$acpi = ; +close(ACPI); + +# fail on unexpected output +if (not defined($acpi)) { + # don't print anything to stderr if there is no battery + exit(0); +} +elsif ($acpi !~ /: ([\w\s]+), (\d+)%/) { + die "$acpi\n"; +} + +$status = $1; +$percent = $2; +$full_text = "$label$percent%"; + +if ($status eq 'Discharging') { + $full_text .= ' 󱐋'; +} elsif ($status eq 'Charging') { + $full_text .= ' '; +} 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 .= ' 󱐋'; + } elsif ($ac_adapt eq 'off-line') { + $full_text .= ' '; + } + } +} + +$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 "#ed8796\n"; + } elsif ($percent < 40) { + print "#ee99a0\n"; + } elsif ($percent < 60) { + print "#f5a97f\n"; + } elsif ($percent < 85) { + print "#a6da958\n"; + } + + if ($percent < 5) { + exit(33); + } +} + +exit(0); diff --git a/common/.config/i3blocks/scripts/battery/battery.png b/common/.config/i3blocks/scripts/battery/battery.png new file mode 100755 index 0000000..3bf89ba Binary files /dev/null and b/common/.config/i3blocks/scripts/battery/battery.png differ diff --git a/common/.config/i3blocks/scripts/battery/i3blocks.conf b/common/.config/i3blocks/scripts/battery/i3blocks.conf new file mode 100755 index 0000000..18b3968 --- /dev/null +++ b/common/.config/i3blocks/scripts/battery/i3blocks.conf @@ -0,0 +1,6 @@ +[battery] +command=$SCRIPT_DIR/battery +interval=30 +LABEL=BAT +#LABEL=⚡ +#BAT_NUMBER=0 diff --git a/common/.config/i3blocks/battery/battery_info.sh b/common/.config/i3blocks/scripts/battery_better/battery_info.sh similarity index 100% rename from common/.config/i3blocks/battery/battery_info.sh rename to common/.config/i3blocks/scripts/battery_better/battery_info.sh diff --git a/common/.config/i3blocks/cpu/cpu_info.sh b/common/.config/i3blocks/scripts/cpu/cpu_info.sh similarity index 100% rename from common/.config/i3blocks/cpu/cpu_info.sh rename to common/.config/i3blocks/scripts/cpu/cpu_info.sh diff --git a/common/.config/i3blocks/scripts/cpu_usage/README.md b/common/.config/i3blocks/scripts/cpu_usage/README.md new file mode 100755 index 0000000..9077c5d --- /dev/null +++ b/common/.config/i3blocks/scripts/cpu_usage/README.md @@ -0,0 +1,25 @@ +# cpu_usage + +Show CPU usage. + +![](cpu_usage.png) + +# Dependencies + +* `mpstat` + +# Config + +``` +[cpu_usage] +command=$SCRIPT_DIR/cpu_usage +interval=10 +LABEL=CPU +#min_width=CPU: 100.00% +#T_WARN=50 +#T_CRIT=80 +#DECIMALS=2 +#COLOR_NORMAL=#EBDBB2 +#COLOR_WARN=#FFFC00 +#COLOR_CRIT=#FF0000 +``` diff --git a/common/.config/i3blocks/scripts/cpu_usage/cpu_usage b/common/.config/i3blocks/scripts/cpu_usage/cpu_usage new file mode 100755 index 0000000..0dd93fc --- /dev/null +++ b/common/.config/i3blocks/scripts/cpu_usage/cpu_usage @@ -0,0 +1,66 @@ +#!/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 = $ENV{T_WARN} // 50; +my $t_crit = $ENV{T_CRIT} // 80; +my $cpu_usage = -1; +my $decimals = $ENV{DECIMALS} // 2; +my $label = $ENV{LABEL} // ""; +my $color_normal = $ENV{COLOR_NORMAL} // "#8bd5ca"; +my $color_warn = $ENV{COLOR_WARN} // "#f5a97f"; +my $color_crit = $ENV{COLOR_CRIT} // "#ed8796"; + +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 +print "${label}"; +printf "%.${decimals}f%%\n", $cpu_usage; +print "${label}"; +printf "%.${decimals}f%%\n", $cpu_usage; + +# Print color, if needed +if ($cpu_usage >= $t_crit) { + print "${color_crit}\n"; +} elsif ($cpu_usage >= $t_warn) { + print "${color_warn}\n"; +} else { + print "${color_normal}\n"; +} + +exit 0; diff --git a/common/.config/i3blocks/scripts/cpu_usage/cpu_usage.png b/common/.config/i3blocks/scripts/cpu_usage/cpu_usage.png new file mode 100755 index 0000000..6b6f577 Binary files /dev/null and b/common/.config/i3blocks/scripts/cpu_usage/cpu_usage.png differ diff --git a/common/.config/i3blocks/scripts/cpu_usage/i3blocks.conf b/common/.config/i3blocks/scripts/cpu_usage/i3blocks.conf new file mode 100755 index 0000000..8936c2f --- /dev/null +++ b/common/.config/i3blocks/scripts/cpu_usage/i3blocks.conf @@ -0,0 +1,11 @@ +[cpu_usage] +command=$SCRIPT_DIR/cpu_usage +interval=10 +LABEL=CPU +#min_width=CPU: 100.00% +#T_WARN=50 +#T_CRIT=80 +#DECIMALS=2 +#COLOR_NORMAL=#EBDBB2 +#COLOR_WARN=#FFFC00 +#COLOR_CRIT=#FF0000 diff --git a/common/.config/i3blocks/scripts/dunst/LICENSE b/common/.config/i3blocks/scripts/dunst/LICENSE new file mode 100755 index 0000000..1f63886 --- /dev/null +++ b/common/.config/i3blocks/scripts/dunst/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jessey White-Cinis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/common/.config/i3blocks/scripts/dunst/README.md b/common/.config/i3blocks/scripts/dunst/README.md new file mode 100755 index 0000000..a222560 --- /dev/null +++ b/common/.config/i3blocks/scripts/dunst/README.md @@ -0,0 +1,32 @@ +# dunst + +Creates a do-not-disturb button for muting [dunst](https://dunst-project.org/) notifications. + +![](dunst.gif) + + +# Dependencies + +- [dunst](https://dunst-project.org/) +- [Font Awesome](https://fontawesome.com) for the [bell](https://fontawesome.com/icons/bell?style=solid) and [bell-slash](https://fontawesome.com/icons/bell-slash?style=solid) icons + + +# Usage + +Clicking the bell icon will toggle dunst notifications from being displayed. + +This is accomplished using the `dunstctl` command. + + +# Config + +```INI +[dunst] +command=$SCRIPT_DIR/dunst +interval=once +format=json +markup=pango +#min_width=50 +#align=center +``` + diff --git a/common/.config/i3blocks/scripts/dunst/dunst b/common/.config/i3blocks/scripts/dunst/dunst new file mode 100755 index 0000000..915acb3 --- /dev/null +++ b/common/.config/i3blocks/scripts/dunst/dunst @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +""" +A do-not-disturb button for muting Dunst notifications in i3 using i3blocks + +Mute is handled using the `dunstctl` command. +""" + +__author__ = "Jessey White-Cinis " +__copyright__ = "Copyright (c) 2019 Jessey White-Cinis" +__license__ = "MIT" +__version__ = "1.1.0" + +import os +import subprocess as sp +import json + +def mute_toggle(): + '''Toggle dunst notifications''' + sp.run(["dunstctl", "set-paused", "toggle"], check=True) + +def clicked(): + '''Returns True if the button was clicked''' + button = os.environ.get("BLOCK_BUTTON", None) + return bool(button) + +def muted(): + '''Returns True if Dunst is muted''' + output = sp.check_output(('dunstctl', 'is-paused')) + return u'true' == output.strip().decode("UTF-8") + +if clicked(): + # toggle button click to turn mute on and off + mute_toggle() + +if muted(): + RTN = {"full_text":"\uf1f6"} +else: + RTN = {"full_text":"\uf0f3"} + +print(json.dumps(RTN)) diff --git a/common/.config/i3blocks/scripts/dunst/dunst.gif b/common/.config/i3blocks/scripts/dunst/dunst.gif new file mode 100755 index 0000000..7c8918a Binary files /dev/null and b/common/.config/i3blocks/scripts/dunst/dunst.gif differ diff --git a/common/.config/i3blocks/scripts/dunst/i3blocks.conf b/common/.config/i3blocks/scripts/dunst/i3blocks.conf new file mode 100755 index 0000000..8f2107f --- /dev/null +++ b/common/.config/i3blocks/scripts/dunst/i3blocks.conf @@ -0,0 +1,9 @@ +[dunst] +command=$SCRIPT_DIR/dunst +markup=pango +interval=once +format=json +#min_width=50 +#align=center +#DUNST_MUTE=off + diff --git a/common/.config/i3blocks/gpu/gpu_info.sh b/common/.config/i3blocks/scripts/gpu/gpu_info.sh similarity index 100% rename from common/.config/i3blocks/gpu/gpu_info.sh rename to common/.config/i3blocks/scripts/gpu/gpu_info.sh diff --git a/common/.config/i3blocks/scripts/i3-focusedwindow/README.md b/common/.config/i3blocks/scripts/i3-focusedwindow/README.md new file mode 100755 index 0000000..54339f7 --- /dev/null +++ b/common/.config/i3blocks/scripts/i3-focusedwindow/README.md @@ -0,0 +1,28 @@ +# i3 Focused window + +Displays title of focused window in i3Wm + +![Demo](i3-focusedwindow.png) + +# Requirements + +Dependencies: `xprop`, `awk` + +# Command line arguments + +```bash +i3-focusedwindow [maximum length to display] +``` + +Blank for unlimited length, i.e. output line can occupy all available space. + +# Installation + +The recommended i3blocks config is + +```INI +[i3-focusedwindow] +label=[]= +command=$SCRIPT_DIR/i3-focusedwindow 20 +interval=persist +``` diff --git a/common/.config/i3blocks/scripts/i3-focusedwindow/i3-focusedwindow b/common/.config/i3blocks/scripts/i3-focusedwindow/i3-focusedwindow new file mode 100755 index 0000000..27304e3 --- /dev/null +++ b/common/.config/i3blocks/scripts/i3-focusedwindow/i3-focusedwindow @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Author: Kn + +while : +do + ID=$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}') + if [[ $1 ]] + then + TITLE=$(xprop -id $ID -len $1 | awk '/_NET_WM_NAME/{$1=$2="";print}' | cut -d'"' -f2) + echo "$TITLE" + else + TITLE=$(xprop -id $ID | awk '/_NET_WM_NAME/{$1=$2="";print}' | cut -d'"' -f2) + echo "$TITLE" + fi +done diff --git a/common/.config/i3blocks/scripts/i3-focusedwindow/i3-focusedwindow.png b/common/.config/i3blocks/scripts/i3-focusedwindow/i3-focusedwindow.png new file mode 100755 index 0000000..ad1efd2 Binary files /dev/null and b/common/.config/i3blocks/scripts/i3-focusedwindow/i3-focusedwindow.png differ diff --git a/common/.config/i3blocks/scripts/jas/jas b/common/.config/i3blocks/scripts/jas/jas new file mode 100755 index 0000000..4052ca8 --- /dev/null +++ b/common/.config/i3blocks/scripts/jas/jas @@ -0,0 +1,61 @@ +#!/bin/bash + +# FROM https://github.com/nashamri/i3blocks/blob/master/brightness + +# One of the following: xrandr, xbacklight, kernel +METHOD="xbacklight" +METHOD="brightnessctl" + +# Left click +if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then +brightnessctl s 10%+ +# Right click +elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then +brightnessctl s 10%- +fi >/dev/null 2>&1 + +URGENT_VALUE=10 + +if [[ "${METHOD}" = "xrandr" ]]; then + device="${BLOCK_INSTANCE:-primary}" + xrandrOutput=$(xrandr --verbose) + + if [[ "${device}" = "primary" ]]; then + device=$(echo "${xrandrOutput}" | grep 'primary' | head -n 1 | awk -F ' ' '{print $1}') + fi + + curBrightness=$(echo "${xrandrOutput}" | grep "${device}" -A 5 | grep -i "Brightness" | awk -F ':' '{print $2}') +elif [[ "${METHOD}" = "kernel" ]]; then + device="${BLOCK_INSTANCE:-intel_backlight}" + maxBrightness=$(cat /sys/class/backlight/${device}/max_brightness) + curBrightness=$(cat /sys/class/backlight/${device}/brightness) +elif [[ "${METHOD}" = "xbacklight" ]]; then + curBrightness=$(xbacklight -get) +elif [[ "${METHOD}" = "brightnessctl" ]]; then + curBrightness=$(brightnessctl -m i|awk -F, '{print $4}') + curBrightness=${curBrightness%%%} +fi + +if [[ "${curBrightness}" -le 0 ]]; then + brightnessctl s 10% +fi + +if [[ "${METHOD}" = "xrandr" ]]; then + percent=$(echo "scale=0;${curBrightness} * 100" | bc -l) +elif [[ "${METHOD}" = "kernel" ]]; then + percent=$(echo "scale=0;${curBrightness} / ${maxBrightness} * 100" | bc -l) +elif [[ "${METHOD}" = "xbacklight" ]]; then + percent=$(echo "scale=0;${curBrightness}" | bc -l) +elif [[ "${METHOD}" = "brightnessctl" ]]; then + percent=${curBrightness} +fi + +percent=${percent%.*} + +echo "${percent}%" +echo "${percent}%" +echo "" + +if [[ "${percent}" -le "${URGENT_VALUE}" ]]; then + exit 33 +fi diff --git a/common/.config/i3blocks/scripts/mediaplayer/README.md b/common/.config/i3blocks/scripts/mediaplayer/README.md new file mode 100755 index 0000000..ae81911 --- /dev/null +++ b/common/.config/i3blocks/scripts/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 the playerctl binary in your path. +See: https://github.com/acrisci/playerctl + +If you leave the instance empty playerctl will try to find an +active MPRIS-compatible player on its own. + +# Installation + +Add the following to your i3blocks config: + +``` ini +[mediaplayer] +command=$SCRIPT_DIR/mediaplayer +instance=spotify +interval=5 +signal=10 +``` diff --git a/common/.config/i3blocks/scripts/mediaplayer/mediaplayer b/common/.config/i3blocks/scripts/mediaplayer/mediaplayer new file mode 100755 index 0000000..7259080 --- /dev/null +++ b/common/.config/i3blocks/scripts/mediaplayer/mediaplayer @@ -0,0 +1,159 @@ +#!/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 . + +# For all media players except mpd/cmus/rhythmbox, MPRIS support should be +# enabled and the playerctl binary should be in your path. +# 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). If instance is empty, playerctl will connect to the first +# supported media player it finds. + +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 &>/dev/null"); + } elsif ($ENV{'BLOCK_BUTTON'} == 2) { + system("mpc toggle &>/dev/null"); + } elsif ($ENV{'BLOCK_BUTTON'} == 3) { + system("mpc next &>/dev/null"); + } elsif ($ENV{'BLOCK_BUTTON'} == 4) { + system("mpc volume +10 &>/dev/null"); + } elsif ($ENV{'BLOCK_BUTTON'} == 5) { + system("mpc volume -10 &>/dev/null"); + } + } 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); + print("\n"); + 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 2>/dev/null); + chomp $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 =~ /mpd/) { + mpd; +} +elsif ($player_arg =~ /cmus/) { + cmus; +} +elsif ($player_arg =~ /rhythmbox/) { + rhythmbox; +} +else { + playerctl; +} +print("\n"); diff --git a/common/.config/i3blocks/scripts/mediaplayer/mediaplayer.png b/common/.config/i3blocks/scripts/mediaplayer/mediaplayer.png new file mode 100755 index 0000000..40e89fa Binary files /dev/null and b/common/.config/i3blocks/scripts/mediaplayer/mediaplayer.png differ diff --git a/common/.config/i3blocks/scripts/memory/README.md b/common/.config/i3blocks/scripts/memory/README.md new file mode 100755 index 0000000..4578dd1 --- /dev/null +++ b/common/.config/i3blocks/scripts/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/common/.config/i3blocks/scripts/memory/i3blocks.conf b/common/.config/i3blocks/scripts/memory/i3blocks.conf new file mode 100755 index 0000000..0a86f04 --- /dev/null +++ b/common/.config/i3blocks/scripts/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/common/.config/i3blocks/scripts/memory/memory b/common/.config/i3blocks/scripts/memory/memory new file mode 100755 index 0000000..fd814e0 --- /dev/null +++ b/common/.config/i3blocks/scripts/memory/memory @@ -0,0 +1,73 @@ +#!/usr/bin/env 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}" +PERCENT="${PERCENT:-true}" + +awk -v type=$TYPE -v percent=$PERCENT ' +/^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 + if (percent == "true" ) { + printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct) + } else { + printf("%.1fG/%.1fG\n", used, total) + } + # short text + printf("%.f%%\n", pct) + + # color + if (pct > 90) { + print("#FF0000") + } else if (pct > 80) { + print("#FFAE00") + } else if (pct > 70) { + print("#FFF600") + } +} +' /proc/meminfo diff --git a/common/.config/i3blocks/scripts/memory/memory.png b/common/.config/i3blocks/scripts/memory/memory.png new file mode 100755 index 0000000..c918a05 Binary files /dev/null and b/common/.config/i3blocks/scripts/memory/memory.png differ diff --git a/common/.config/i3blocks/scripts/rofi-calendar/README.md b/common/.config/i3blocks/scripts/rofi-calendar/README.md new file mode 100755 index 0000000..e5671eb --- /dev/null +++ b/common/.config/i3blocks/scripts/rofi-calendar/README.md @@ -0,0 +1,34 @@ +# rofi-calendar + +Have a minimal calendar pop up in rofi when clicking the date blocklet (right click to show next month) + +![](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 +interval=3600 +#BAR_POSITION=bottom +#WEEK_START=monday +#DATEFTM=+%a %d %b %Y +#SHORTFMT=+%d/%m/%Y +#LABEL= +#FONT=Monospace 10 +#LEFTCLICK_PREV_MONTH=false +#PREV_MONTH_TEXT=« previous month « +#NEXT_MONTH_TEXT=» next month » +#ROFI_CONFIG_FILE=/dev/null +``` diff --git a/common/.config/i3blocks/scripts/rofi-calendar/rofi-calendar b/common/.config/i3blocks/scripts/rofi-calendar/rofi-calendar new file mode 100755 index 0000000..d33bac4 --- /dev/null +++ b/common/.config/i3blocks/scripts/rofi-calendar/rofi-calendar @@ -0,0 +1,143 @@ +#! /usr/bin/env bash + +###### Variables ###### +DATEFTM="${DATEFTM:-+%a %d %b %Y}" +SHORTFMT="${SHORTFMT:-+%d/%m/%Y}" +LABEL="${LABEL:- }" +FONT="${FONT:-Monospace 10}" +LEFTCLICK_PREV_MONTH=${LEFTCLICK_PREV_MONTH:-false} +PREV_MONTH_TEXT="${PREV_MONTH_TEXT:-« previous month «}" +NEXT_MONTH_TEXT="${NEXT_MONTH_TEXT:-» next month »}" +ROFI_CONFIG_FILE="${ROFI_CONFIG_FILE:-/dev/null}" +BAR_POSITION="${BAR_POSITION:-bottom}" +WEEK_START="${WEEK_START:-monday}" +###### Variables ###### + + +###### Functions ###### +# get current date and set today header +get_current_date() { + year=$(date '+%Y') + month=$(date '+%m') + day=$(date '+%d') +} +# print the selected month +print_month() { + mnt=$1 + yr=$2 + cal --color=always --$WEEK_START $mnt $yr \ + | sed -e 's/\x1b\[[7;]*m/\\/g' \ + -e 's/\x1b\[[27;]*m/\<\/u\>\<\/b\>/g' \ + -e '/^ *$/d' \ + | tail -n +2 + echo $PREV_MONTH_TEXT$'\n'$NEXT_MONTH_TEXT +} +# increment year and/or month appropriately based on month increment +increment_month() { + # pick increment and define/update delta + incr=$1 + (( delta += incr )) + # for non-current month + if (( incr != 0 )); then + # add the increment + month=$(( 10#$month + incr )) + # normalize month and compute year + if (( month > 0 )); then + (( month -= 1 )) + (( year += month/12 )) + (( month %= 12 )) + (( month += 1 )) + else + (( year += month/12 - 1 )) + (( month %= 12 )) + (( month += 12 )) + fi + fi + # adjust header + if (( delta == 0 )); then + # today's month => show dd/mm/yyyy + header=$(date "$DATEFTM") + else + # not today's month => show mm/yyyy + header=$(cal $month $year | sed -n '1s/^ *\(.*[^ ]\) *$/\1/p') + fi +} +###### Functions ###### + + +###### Main body ###### +get_current_date + +# handle the click +# variables: +# current_row: set means today row is highlighted +# current_row: not set means... +# bias_row == 0: `next month` row is highlighted +# bias_row == -1: `prev month` row is highlighted +# selected: contains the selected row (next or prev month) +# month_page: the month to be printed +case "$BLOCK_BUTTON" in + 1) + if [[ $LEFTCLICK_PREV_MONTH == true ]]; then + increment_month -1 + bias_row=-1 + else + increment_month 0 + current_row= + fi + ;; + 2) + increment_month 0 + current_row= + ;; + 3) + increment_month +1 + bias_row=0 + ;; +esac + +# rofi pop up +case "$BLOCK_BUTTON" in + 1|2|3) + # as long as prev/next is selected (and the first time also) + while [[ "${selected+xxx}" != "xxx" ]] || [[ $selected =~ ($PREV_MONTH_TEXT|$NEXT_MONTH_TEXT) ]]; do + IFS= + month_page=$(print_month $month $year) + if [[ "${current_row+xxx}" = "xxx" ]]; then + current_row=$(( $(echo $month_page | grep -n ${day#0} | head -n 1 | cut -d: -f1) - 1 )) + else + current_row=$(( $(echo $month_page | wc -l) - 1)) + fi + + # check bar position and adjust anchor accordingly + if [[ $BAR_POSITION = "top" ]]; then + anchor="northeast" + else + anchor="southeast" + fi + + # open rofi and read the selected row + # (add the following option to rofi command with proper config file, if needed) + selected="$(echo $month_page \ + | rofi \ + -dmenu \ + -markup-rows \ + -font $FONT \ + -m -3 \ + -theme-str 'window {width: 10%; anchor: '"$anchor"'; location: northwest;}' \ + -theme-str 'listview {lines: '"$(echo $month_page | wc -l)"' ;scrollbar: false;}' \ + -theme $ROFI_CONFIG_FILE \ + -selected-row $(( current_row + bias_row )) \ + -p "$header")" + # select next/prev month if necessary and prepare row to be highlighted + [[ $selected =~ $PREV_MONTH_TEXT ]] && { increment_month -1; bias_row=-1; } + [[ $selected =~ $NEXT_MONTH_TEXT ]] && { increment_month +1; bias_row=0; } + # get ready for successive next/prev month hits + unset current_row + done +esac + +# print blocklet text +echo $LABEL$(date "$DATEFTM") +echo $LABEL$(date "$SHORTFMT") +###### Main body ###### diff --git a/common/.config/i3blocks/scripts/rofi-calendar/screenshot.png b/common/.config/i3blocks/scripts/rofi-calendar/screenshot.png new file mode 100755 index 0000000..b57f962 Binary files /dev/null and b/common/.config/i3blocks/scripts/rofi-calendar/screenshot.png differ diff --git a/common/.config/i3blocks/scripts/rofi-calendar/screenshot2.png b/common/.config/i3blocks/scripts/rofi-calendar/screenshot2.png new file mode 100755 index 0000000..5963bea Binary files /dev/null and b/common/.config/i3blocks/scripts/rofi-calendar/screenshot2.png differ diff --git a/common/.config/i3blocks/scripts/rofi-wttr/LICENSE.md b/common/.config/i3blocks/scripts/rofi-wttr/LICENSE.md new file mode 100755 index 0000000..eeb411b --- /dev/null +++ b/common/.config/i3blocks/scripts/rofi-wttr/LICENSE.md @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 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 Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are 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. + + 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. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + 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 Affero 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. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + 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 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 work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + 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 AGPL, see +. diff --git a/common/.config/i3blocks/scripts/rofi-wttr/README.md b/common/.config/i3blocks/scripts/rofi-wttr/README.md new file mode 100755 index 0000000..7211b7d --- /dev/null +++ b/common/.config/i3blocks/scripts/rofi-wttr/README.md @@ -0,0 +1,37 @@ +# rofi-wttr + +A minimal weather line with forecast pop up on click. Using [rofi](https://github.com/davatorium/rofi) for the pop up and [wttr.in](https://wttr.in/) as the weather interface. + +![The statusbar weather](rofi-wttr-status-line.png) +The statusbar + +![The weather forecast popup](rofi-wttr-detail.png) +The popup with the default rofi theme + +## Depencencies + +* [rofi](https://github.com/davatorium/rofi) +* curl + +## Installation + +* Copy the script into your directory of choice, e.g. ~/.i3blocks/blocklets +* Give it execution permission (`chmod +x rofi-wttr`) +* Optional: Customize your rofi theme via the `rofi-theme-selector` command +* Optional: Customize the rofi launch options in the script +* Optional: Customize the wttr curl arguments in the script +* Add the following blocklet to your i3blocks.conf: + +```ini +[rofi-wttr] +command=$SCRIPT_DIR/rofi-wttr +interval=3600 +#BAR_POSITION=top +#FONT=Monospace 10 +#LABEL=🌡️ +#LOCATION=Washington_DC +#ROFI_CONFIG_FILE=/dev/null +``` + +## Thanks +Modeled off of [rofi-calendar](https://github.com/vivien/i3blocks-contrib/tree/master/rofi-calendar) with thanks to its authors. diff --git a/common/.config/i3blocks/scripts/rofi-wttr/i3blocks.conf b/common/.config/i3blocks/scripts/rofi-wttr/i3blocks.conf new file mode 100755 index 0000000..88e3d69 --- /dev/null +++ b/common/.config/i3blocks/scripts/rofi-wttr/i3blocks.conf @@ -0,0 +1,8 @@ +[rofi-wttr] +command=$SCRIPT_DIR/rofi-wttr +interval=300 +#BAR_POSITION=top +#FONT=Monospace 10 +#LABEL=🌡️ +#LOCATION=Washington_DC +#ROFI_CONFIG_FILE=/dev/null diff --git a/common/.config/i3blocks/scripts/rofi-wttr/rofi-wttr b/common/.config/i3blocks/scripts/rofi-wttr/rofi-wttr new file mode 100755 index 0000000..c6acd9f --- /dev/null +++ b/common/.config/i3blocks/scripts/rofi-wttr/rofi-wttr @@ -0,0 +1,75 @@ +#! /usr/bin/env bash + +###### Variables ###### +LABEL="${LABEL:- }" +LOCATION="${LOCATION:- }" +FONT="${FONT:-Monospace 10}" +ROFI_CONFIG_FILE="${ROFI_CONFIG_FILE:-/dev/null}" +BAR_POSITION="${BAR_POSITION:-bottom}" + +###### Variables ###### + + +###### Functions ###### +# print the full weather +# see https://github.com/chubin/wttr.in#usage for full configuration options +print_weather_report() { + if [[ $LOCATION != " " ]]; then + curl https://wttr.in/$LOCATION?T + else + curl https://wttr.in/?T + fi +} + +# print the one line weather +# see https://github.com/chubin/wttr.in#one-line-output for formatting options +print_weather_line() { + if [[ $LOCATION != " " ]]; then + curl -s https://wttr.in/${LOCATION}?u\&format="%C+%c+%t+(%f)+%w" | tr -d \" + else + curl -s 'https://wttr.in/?u\&format="%C+%c+%t+(%f)+%w"' | tr -d \" + fi +} + +###### Functions ###### + + +###### Main body ###### + +# handle any click +# rofi pop up +case "$BLOCK_BUTTON" in + 1|2|3) + IFS= + weather_report=$(print_weather_report) + + # check bar position and adjust anchor accordingly + if [[ $BAR_POSITION = "top" ]]; then + anchor="northwest" + else + anchor="southwest" + fi + + # open rofi + # (add the following option to rofi command with proper config file, if needed) + echo $weather_report \ + | rofi \ + -dmenu \ + -markup-rows \ + -font $FONT \ + -m -3 \ + -theme-str 'window {width: 53%; anchor: '"$anchor"'; location: northwest;}' \ + -theme-str 'listview {lines: '"$(echo $weather_report | wc -l)"' ;scrollbar: false;}' \ + -theme $ROFI_CONFIG_FILE \ + -p "Detailed weather report" +esac + +# print blocklet text + +if [[ $LABEL != " " ]]; then + echo $LABEL$(print_weather_line) +else + echo $(print_weather_line) +fi + +###### Main body ###### diff --git a/common/.config/i3blocks/scripts/rofi-wttr/rofi-wttr-detail.png b/common/.config/i3blocks/scripts/rofi-wttr/rofi-wttr-detail.png new file mode 100755 index 0000000..361ae79 Binary files /dev/null and b/common/.config/i3blocks/scripts/rofi-wttr/rofi-wttr-detail.png differ diff --git a/common/.config/i3blocks/scripts/rofi-wttr/rofi-wttr-status-line.png b/common/.config/i3blocks/scripts/rofi-wttr/rofi-wttr-status-line.png new file mode 100755 index 0000000..a8593ba Binary files /dev/null and b/common/.config/i3blocks/scripts/rofi-wttr/rofi-wttr-status-line.png differ diff --git a/common/.config/i3blocks/scripts/shutdown_menu/README.md b/common/.config/i3blocks/scripts/shutdown_menu/README.md new file mode 100755 index 0000000..3f72bb7 --- /dev/null +++ b/common/.config/i3blocks/scripts/shutdown_menu/README.md @@ -0,0 +1,54 @@ +# 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 + +``` +[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 +#FG_COLOR=#bbbbbb +#BG_COLOR=#111111 +#HLFG_COLOR=#111111 +#HLBG_COLOR=#bbbbbb +#BORDER_COLOR=#222222 +#ROFI_TEXT=Menu: +#ROFI_OPTIONS=-width 11 -location 3 -hide-scrollbar -bw 2 +#ZENITY_TITLE=Menu +#ZENITY_TEXT=Action: +#ZENITY_OPTIONS=--column= --hide-header +#ENABLE_CONFIRMATIONS=true (must be true or false) +#LAUNCHER=rofi (must be rofi or zenity) +#LOCKSCRIPT=i3lock --color=${BG_COLOR#"#"} +``` + +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 +``` + +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/common/.config/i3blocks/scripts/shutdown_menu/i3blocks.conf b/common/.config/i3blocks/scripts/shutdown_menu/i3blocks.conf new file mode 100755 index 0000000..8c6bb82 --- /dev/null +++ b/common/.config/i3blocks/scripts/shutdown_menu/i3blocks.conf @@ -0,0 +1,18 @@ +[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 +#FG_COLOR=#bbbbbb +#BG_COLOR=#111111 +#HLFG_COLOR=#111111 +#HLBG_COLOR=#bbbbbb +#BORDER_COLOR=#222222 +#ROFI_TEXT=Menu: +#ROFI_OPTIONS=-width 11 -location 3 -hide-scrollbar -bw 2 +#ZENITY_TITLE=Menu +#ZENITY_TEXT=Action: +#ZENITY_OPTIONS=--column= --hide-header +#ENABLE_CONFIRMATIONS=true (must be true or false) +#LAUNCHER=rofi (must be rofi or zenity) +#LOCKSCRIPT=i3lock --color=${BG_COLOR#"#"} diff --git a/common/.config/i3blocks/scripts/shutdown_menu/rofi.png b/common/.config/i3blocks/scripts/shutdown_menu/rofi.png new file mode 100755 index 0000000..a4068bc Binary files /dev/null and b/common/.config/i3blocks/scripts/shutdown_menu/rofi.png differ diff --git a/common/.config/i3blocks/scripts/shutdown_menu/shutdown_menu b/common/.config/i3blocks/scripts/shutdown_menu/shutdown_menu new file mode 100755 index 0000000..7ae826f --- /dev/null +++ b/common/.config/i3blocks/scripts/shutdown_menu/shutdown_menu @@ -0,0 +1,186 @@ +#!/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="${FG_COLOR:-#bbbbbb}" +BG_COLOR="${BG_COLOR:-#111111}" +HLFG_COLOR="${HLFG_COLOR:-#111111}" +HLBG_COLOR="${HLBG_COLOR:-#bbbbbb}" +BORDER_COLOR="${BORDER_COLOR:-#222222}" + +# Options not related to colors +ROFI_TEXT="${ROFI_TEXT:-Menu:}" +ROFI_OPTIONS=(${ROFI_OPTIONS:--theme-str 'window {width: 11%; border: 2;} listview {scrollbar: false;}' -location 3}) + +# Zenity options +ZENITY_TITLE="${ZENITY_TITLE:-Menu}" +ZENITY_TEXT="${ZENITY_TEXT:-Action:}" +ZENITY_OPTIONS=(${ZENITY_OPTIONS:---column= --hide-header}) + +####################################################################### +# END CONFIG # +####################################################################### + +# Whether to ask for user's confirmation +enable_confirmation=${ENABLE_CONFIRMATIONS:-false} + +# Preferred launcher if both are available +preferred_launcher="${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_launcher "${preferred_launcher}" + +# 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/common/.config/i3blocks/scripts/shutdown_menu/zenity.png b/common/.config/i3blocks/scripts/shutdown_menu/zenity.png new file mode 100755 index 0000000..7d7620b Binary files /dev/null and b/common/.config/i3blocks/scripts/shutdown_menu/zenity.png differ diff --git a/common/.config/i3blocks/sound/sound_burst.sh b/common/.config/i3blocks/scripts/sound/sound_burst.sh similarity index 100% rename from common/.config/i3blocks/sound/sound_burst.sh rename to common/.config/i3blocks/scripts/sound/sound_burst.sh diff --git a/common/.config/i3blocks/sound/sound_info.sh b/common/.config/i3blocks/scripts/sound/sound_info.sh similarity index 100% rename from common/.config/i3blocks/sound/sound_info.sh rename to common/.config/i3blocks/scripts/sound/sound_info.sh diff --git a/common/.config/i3blocks/scripts/spotify/spotify.py b/common/.config/i3blocks/scripts/spotify/spotify.py new file mode 100755 index 0000000..b3aa14c --- /dev/null +++ b/common/.config/i3blocks/scripts/spotify/spotify.py @@ -0,0 +1,34 @@ +#!/usr/bin/python + +import dbus +import os +import sys + + +try: + bus = dbus.SessionBus() + spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2") + + + if os.environ.get('BLOCK_BUTTON'): + control_iface = dbus.Interface(spotify, 'org.mpris.MediaPlayer2.Player') + if (os.environ['BLOCK_BUTTON'] == '1'): + control_iface.Previous() + elif (os.environ['BLOCK_BUTTON'] == '2'): + control_iface.PlayPause() + elif (os.environ['BLOCK_BUTTON'] == '3'): + control_iface.Next() + + spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties') + props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata') + + if (sys.version_info > (3, 0)): + print(str(props['xesam:artist'][0]) + " - " + str(props['xesam:title'])) + else: + print(props['xesam:artist'][0] + " - " + props['xesam:title']).encode('utf-8') + exit +except dbus.exceptions.DBusException: + exit + + + diff --git a/common/.config/i3blocks/scripts/time/LICENSE b/common/.config/i3blocks/scripts/time/LICENSE new file mode 100755 index 0000000..8cdb845 --- /dev/null +++ b/common/.config/i3blocks/scripts/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/common/.config/i3blocks/scripts/time/README.md b/common/.config/i3blocks/scripts/time/README.md new file mode 100755 index 0000000..88f6f5e --- /dev/null +++ b/common/.config/i3blocks/scripts/time/README.md @@ -0,0 +1,36 @@ +# 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] +command=$SCRIPT_DIR/time +interval=1 +#TZ_FILE=~/.tz +STRFTIME_FORMAT=%Y-%m-%d %H:%M +TZONES=$DEFAULT_TZ,Brazil/East,Australia/Brisbane,Asia/Calcutta +TZ_LABELS=,Brazil,AU,Hyderabad +``` + +See [strftime](https://linux.die.net/man/3/strftime) for allowed strftime formats. + +Here TZONES is a comma separated list of timeszones, see /usr/share/zoneinfo (Olson DB) +for allowed timezones. One exception is that the string $DEFAULT_TZ +is also allowed and represents whatever your current system timezone is. + +Also TZ_LABELS is a comma separated list of how to label each timezone in case you prefer +not to see the full timezone as part of the label. +E.g. you may want it to say "12:34 (US)" instead of "12:34 (America/Chicago)". +Labels are allowed to be empty, +in which case the script omits parentheses. +For example, in the config above, the label for the default timezone is omitted. diff --git a/common/.config/i3blocks/scripts/time/i3blocks.conf b/common/.config/i3blocks/scripts/time/i3blocks.conf new file mode 100755 index 0000000..c19f71c --- /dev/null +++ b/common/.config/i3blocks/scripts/time/i3blocks.conf @@ -0,0 +1,7 @@ +[time] +command=$SCRIPT_DIR/time +interval=1 +#TZ_FILE=~/.tz +STRFTIME_FORMAT=%Y-%m-%d %R +TZONES=$DEFAULT_TZ,Brazil/East,Australia/Brisbane,Asia/Calcutta +TZ_LABELS=,Brazil,AU,Hyderabad diff --git a/common/.config/i3blocks/scripts/time/time b/common/.config/i3blocks/scripts/time/time new file mode 100755 index 0000000..e552a92 --- /dev/null +++ b/common/.config/i3blocks/scripts/time/time @@ -0,0 +1,101 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use POSIX qw/strftime/; + +my $click = $ENV{BLOCK_BUTTON} || 0; +my $format = $ENV{BLOCK_INSTANCE} || $ENV{STRFTIME_FORMAT} || "%H:%M"; +my $tz_file = shift || $ENV{TZ_FILE} || "$ENV{HOME}/.tz"; +$tz_file = glob($tz_file); +my $default_tz = get_default_tz(); + +my $tzones = $ENV{TZONES} || '$DEFAULT_TZ'; +$tzones =~ s/\$DEFAULT_TZ/$default_tz/g; +my @tz_list = split(/,/, $tzones); +my @tz_labels = split(/,/, $ENV{TZ_LABELS} || ""); +if (scalar(@tz_list) != scalar(@tz_labels)) { + @tz_labels = @tz_list; +} + +my $current_tz; +if ($click == 1) { + $current_tz = get_tz(); + + my %tzmap; + $tzmap{""} = $tz_list[0]; + my $prev = $tz_list[0]; + foreach my $tz (@tz_list) { + $tzmap{$prev} = $tz; + $prev = $tz; + } + $tzmap{$prev} = $tz_list[0]; + + 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; +for (my $i=0; $i < scalar(@tz_list); $i++) { + $display_map{$tz_list[$i]} = $tz_labels[$i]; +} + +if (!defined $current_tz) { + $current_tz = get_tz(); + set_tz($current_tz); +} +$ENV{TZ} = $current_tz; +my $tz_display = ""; +if (!exists $display_map{$ENV{TZ}}) { + $ENV{TZ} = $tz_list[0]; + set_tz($tz_list[0]); +} +$tz_display = $display_map{$ENV{TZ}}; + +binmode(STDOUT, ":utf8"); +my $time = strftime($format, localtime()); +if ($tz_display eq "") { + print "$time\n"; +} else { + print "$time ($tz_display)\n"; +} + +sub get_tz { + my $current_tz; + + if (-f $tz_file) { + open my $fh, '<', $tz_file || die "Couldn't open file: $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 || die "Couldn't open file: $tz_file"; + print $fh $tz; + close $fh; +} + +sub get_default_tz { + my $tz = "Europe/London"; + + if (-f "/etc/timezone") { + open my $fh, '<', "/etc/timezone" || die "Couldn't open file: /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/common/.config/i3blocks/scripts/time/time.png b/common/.config/i3blocks/scripts/time/time.png new file mode 100755 index 0000000..3658465 Binary files /dev/null and b/common/.config/i3blocks/scripts/time/time.png differ diff --git a/common/.config/i3blocks/scripts/volume/README.md b/common/.config/i3blocks/scripts/volume/README.md new file mode 100755 index 0000000..0778dac --- /dev/null +++ b/common/.config/i3blocks/scripts/volume/README.md @@ -0,0 +1,49 @@ +# 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=♪ +LABEL=VOL +interval=once +signal=10 +#STEP=5% +#MIXER=[determined automatically] +#SCONTROL=[determined automatically] +#NATURAL_MAPPING=0 +``` +For PulseAudio users, MIXER is usually "pulse" or "default". +For Jack/Jack2 users, MIXER is usually "jackplug". +For ALSA users, use "default" for your primary card, or "hw:#" +where # is the number of the card desired. + +For a list of available SCONTROL options, use `amixer -D $MIXER scontrols`. + +If `NATURAL_MAPPING` is set to a non-zero value, the `-M` flag is used for `amixer`, enabling +a volume mapping more natural for the human ear, as used in alsamixer. diff --git a/common/.config/i3blocks/scripts/volume/i3blocks.conf b/common/.config/i3blocks/scripts/volume/i3blocks.conf new file mode 100755 index 0000000..1e257e2 --- /dev/null +++ b/common/.config/i3blocks/scripts/volume/i3blocks.conf @@ -0,0 +1,9 @@ +[volume] +command=$SCRIPT_DIR/volume +#LABEL=♪ +LABEL=VOL +interval=once +signal=10 +#STEP=5% +#MIXER=[determined automatically] +#SCONTROL=[determined automatically] diff --git a/common/.config/i3blocks/scripts/volume/volume b/common/.config/i3blocks/scripts/volume/volume new file mode 100755 index 0000000..e8e1372 --- /dev/null +++ b/common/.config/i3blocks/scripts/volume/volume @@ -0,0 +1,91 @@ +#!/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, eventually 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 +if [[ -z "$MIXER" ]] ; then + MIXER="default" + if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then + # pulseaudio is running, but not all installations use "pulse" + if amixer -D pulse info >/dev/null 2>&1 ; then + MIXER="pulse" + fi + fi + [ -n "$(lsmod | grep jack)" ] && MIXER="jackplug" + MIXER="${2:-$MIXER}" +fi + +# 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` +if [[ -z "$SCONTROL" ]] ; then + SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols | + sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | + head -n1 + )}" +fi + +# 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) +if [[ -z "$STEP" ]] ; then + STEP="${1:-5%}" +fi + +# AMIXER(1): +# "Use the mapped volume for evaluating the percentage representation like alsamixer, to be +# more natural for human ear." +NATURAL_MAPPING=${NATURAL_MAPPING:-0} +if [[ "$NATURAL_MAPPING" != "0" ]] ; then + AMIXER_PARAMS="-M" +fi + +#------------------------------------------------------------------------ + +capability() { # Return "Capture" if the device is a capture device + amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL | + sed -n "s/ Capabilities:.*cvolume.*/Capture/p" +} + +volume() { + amixer $AMIXER_PARAMS -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}' + output=$(perl -ne "$perl_filter") + echo "$LABEL$output" +} + +#------------------------------------------------------------------------ + +case $BLOCK_BUTTON in + 3) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute + 4) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase + 5) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease +esac + +volume | format diff --git a/common/.config/i3blocks/scripts/volume/volume.png b/common/.config/i3blocks/scripts/volume/volume.png new file mode 100755 index 0000000..2eba45e Binary files /dev/null and b/common/.config/i3blocks/scripts/volume/volume.png differ diff --git a/common/.config/picom.conf b/common/.config/picom.conf index d37f758..0b7e1eb 100644 --- a/common/.config/picom.conf +++ b/common/.config/picom.conf @@ -1,121 +1,491 @@ -# config is for this fork: -# https://github.com/pijulius/picom -# https://aur.archlinux.org/packages/picom-pijulius-git +################################# +# Animations # +################################# + +# Animations (requires pijulius) +animations = true; +animation-clamping = true; +animation-delta = 12; +animation-dampening = 20.0; +animation-stiffness = 500.0; +animation-for-open-window = "zoom"; +animation-for-menu-window = "slide-down"; +animation-for-transient-window = "zoom"; +animation-for-workspace-switch-in = "zoom"; +animation-for-workspace-switch-out = "zoom"; + +################################## +# Corners # +################################# +# requires: https://github.com/sdhand/compton or https://github.com/jonaburg/picom +corner-radius = 20; + +rounded-corners-exclude = [ + "class_g = 'i3-frame'", + "class_g = 'Polybar'", + "class_g = 'i3bar'", +]; + +round-borders = 20; + +round-borders-exclude = [ + "class_g = 'i3-frame'", + "class_g = 'Polybar'", + "class_g = 'i3bar'", +]; ################################# # Shadows # ################################# -shadow = true; -shadow-radius = 15; -shadow-opacity = 0.85; -shadow-offset-x = -12; -shadow-offset-y = -12; -shadow-color = "#000000"; -shadow-ignore-shaped = false; -shadow-exclude = [ - "name = 'Notification'", - "class_g ?= 'Notify-osd'", - "_GTK_FRAME_EXTENTS@:c", - "class_g = 'org.wezfurlong.wezterm'", -]; -clip-shadow-above = []; + + +# Enabled client-side shadows on windows. Note desktop windows +# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow, +# unless explicitly requested using the wintypes option. +# +# shadow = false +shadow = false; + +# The blur radius for shadows, in pixels. (defaults to 12) +# shadow-radius = 12 +shadow-radius = 12; + +# The opacity of shadows. (0.0 - 1.0, defaults to 0.75) + #shadow-opacity = .75 + +# The left offset for shadows, in pixels. (defaults to -15) +# shadow-offset-x = -15 +#shadow-offset-x = -150; + +# The top offset for shadows, in pixels. (defaults to -15) +# shadow-offset-y = -15 +#shadow-offset-y = -15; + +# Avoid drawing shadows on dock/panel windows. This option is deprecated, +# you should use the *wintypes* option in your config file instead. +# +# no-dock-shadow = false + +# Don't draw shadows on drag-and-drop windows. This option is deprecated, +# you should use the *wintypes* option in your config file instead. +# +# no-dnd-shadow = false + +# Red color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-red = 0 + +# Green color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-green = 0 + +# Blue color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-blue = 0 + +# Do not paint shadows on shaped windows. Note shaped windows +# here means windows setting its shape through X Shape extension. +# Those using ARGB background is beyond our control. +# Deprecated, use +# shadow-exclude = 'bounding_shaped' +# or +# shadow-exclude = 'bounding_shaped && !rounded_corners' +# instead. +# +# shadow-ignore-shaped = '' + +# Specify a list of conditions of windows that should have no shadow. +# +# examples: +# shadow-exclude = "n:e:Notification"; +# +# shadow-exclude = [] + +# Specify a X geometry that describes the region in which shadow should not +# be painted in, such as a dock window region. Use +# shadow-exclude-reg = "x10+0+0" +# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. +# +# shadow-exclude-reg = "" + +# Crop shadow of a window fully on a particular Xinerama screen to the screen. +# xinerama-shadow-crop = false + ################################# # Fading # ################################# -fading = true; + + +# Fade windows in/out when opening/closing and when opacity changes, +# unless no-fading-openclose is used. +# fading = false +fading = false; + +# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028) +# fade-in-step = 0.028 fade-in-step = 0.03; + +# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) +# fade-out-step = 0.03 fade-out-step = 0.03; +# The time between steps in fade step, in milliseconds. (> 0, defaults to 10) +# fade-delta = 10 + +# Specify a list of conditions of windows that should not be faded. +# don't need this, we disable fading for all normal windows with wintypes: {} +fade-exclude = [ + "class_g = 'slop'" # maim +] + +# Do not fade on window open/close. +# no-fading-openclose = false + +# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc. +# no-fading-destroyed-argb = false + + ################################# # Transparency / Opacity # ################################# -inactive-opacity = 1.0; -frame-opacity = 1.0; + + +# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0) +# inactive-opacity = 1 +inactive-opacity = 0.9; + +# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default) +# frame-opacity = 1.0 +frame-opacity = 0.5; + +# Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0) +# menu-opacity = 1.0 +# menu-opacity is depreciated use dropdown-menu and popup-menu instead. + +#If using these 2 below change their values in line 510 & 511 aswell +popup_menu = { opacity = 0.8; } +dropdown_menu = { opacity = 0.8; } + + +# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows. +# inactive-opacity-override = true inactive-opacity-override = false; + +# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) active-opacity = 1.0; -inactive-dim = 0.0; -focus-exclude = []; + +# Dim inactive windows. (0.0 - 1.0, defaults to 0.0) +# inactive-dim = 0.0 + +# Specify a list of conditions of windows that should always be considered focused. +# focus-exclude = [] +focus-exclude = [ + "class_g = 'rofi'", +]; + +# Use fixed inactive dim value, instead of adjusting according to window opacity. +# inactive-dim-fixed = 1.0 + +# Specify a list of opacity rules, in the format `PERCENT:PATTERN`, +# like `50:name *= "Firefox"`. picom-trans is recommended over this. +# Note we don't make any guarantee about possible conflicts with other +# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. +# example: +# opacity-rule = [ "80:class_g = 'URxvt'" ]; +# +# opacity-rule = [] opacity-rule = [ - "75:class_g = 'Conky'", - "95:class_g = 'obsidian'", - "95:class_g = 'inkdrop'", - "95:class_g = 'Thunar'", + "85:class_g = 'org.wezfurlong.wezterm'", + "85:class_g = 'discord'", + "85:class_g = 'Spotify'", ]; -################################# -# Corners # -################################# -corner-radius = 12; -rounded-corners-exclude = [ - "class_g = 'polybar'", - "class_g = 'Polybar'", - "class_g = 'csgo_linux64'", - # "class_g = 'rofi'", - # "class_g = 'Rofi'", - "class_g = 'osu!'", - "class_g = 'Dunst'", - "class_g = 'awesome'", - # "!_PICOM_CORNERS@:32c = 1" -]; - -################################# -# Animations # -################################# -animations = true; -animation-for-open-window = "zoom"; -animation-for-transient-window = "none"; -animation-for-unmap-window = "zoom"; -animation-for-workspace-switch-in = "none"; -animation-for-workspace-switch-out = "none"; -animation-for-menu-window = "none"; -animation-stiffness = 250; -animation-dampening = 20; -animation-window-mass = 0.069; -animation-clamping = true; ################################# # Background-Blurring # ################################# -blur-method = "dual_kawase"; -blur-size = 1; -blur-background = true; -blur-background-frame = false; -blur-background-fixed = false; -blur-kern = "3x3box"; + + +# Parameters for background blurring, see the *BLUR* section for more information. +# blur-method = +# blur-size = 12 +# +# blur-deviation = false + +# Blur background of semi-transparent / ARGB windows. +# Bad in performance, with driver-dependent behavior. +# The name of the switch may change without prior notifications. +# +# blur-background = true; + +# Blur background of windows when the window frame is not opaque. +# Implies: +# blur-background +# Bad in performance, with driver-dependent behavior. The name may change. +# +# blur-background-frame = false; + + +# Use fixed blur strength rather than adjusting according to window opacity. +# blur-background-fixed = false; + + +# Specify the blur convolution kernel, with the following format: +# example: +# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; +# +# blur-kern = '' +# blur-kern = "3x3box"; + +blur: { + # requires: https://github.com/ibhagwan/picom + method = "kawase"; + #method = "kernel"; + strength = 3; + # deviation = 1.0; + # kernel = "11x11gaussian"; + background = false; + background-frame = false; + background-fixed = false; + kern = "3x3box"; +} + +# Exclude conditions for background blur. blur-background-exclude = [ - # "class_g = 'Rofi'", - # "class_g = 'rofi'", - "class_g = 'polybar'", - "class_g = 'Polybar'", - "class_g = 'screenkey'", - "class_g = 'Screenkey'", - "class_g = 'slop'", - "class_g = 'Discover-overlay'", - # "class_g = 'org.wezfurlong.wezterm'", - "_GTK_FRAME_EXTENTS@:c" + #"window_type = 'dock'", + #"window_type = 'desktop'", + #"class_g = 'URxvt'", + # + # prevents picom from blurring the background + # when taking selection screenshot with `main` + # https://github.com/naelstrof/maim/issues/130 + "class_g = 'slop'", + "_GTK_FRAME_EXTENTS@:c" ]; + ################################# # General Settings # ################################# + +# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. +# daemon = false + +# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. +# `xrender` is the default one. +# +experimental-backends = true; backend = "glx"; -vsync = false; +#backend = "xrender"; + + +# Enable/disable VSync. +# vsync = false +vsync = true + +# Enable remote control via D-Bus. See the *D-BUS API* section below for more details. +# dbus = false + +# Try to detect WM windows (a non-override-redirect window with no +# child that has 'WM_STATE') and mark them as active. +# +# mark-wmwin-focused = false +mark-wmwin-focused = true; + +# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused. +# mark-ovredir-focused = false mark-ovredir-focused = true; + +# Try to detect windows with rounded corners and don't consider them +# shaped windows. The accuracy is not very high, unfortunately. +# +# detect-rounded-corners = false detect-rounded-corners = true; + +# Detect '_NET_WM_OPACITY' on client windows, useful for window managers +# not passing '_NET_WM_OPACITY' of client windows to frame windows. +# +# detect-client-opacity = false detect-client-opacity = true; -unredir-if-possible = false; -detect-transient = true; -detect-client-leader = true; -use-damage = true; -max-brightness = 1.0; + +# Specify refresh rate of the screen. If not specified or 0, picom will +# try detecting this with X RandR extension. +# +# refresh-rate = 60 +refresh-rate = 0 + +# Limit picom to repaint at most once every 1 / 'refresh_rate' second to +# boost performance. This should not be used with +# vsync drm/opengl/opengl-oml +# as they essentially does sw-opti's job already, +# unless you wish to specify a lower refresh rate than the actual value. +# +# sw-opti = + +# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, +# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, +# provided that the WM supports it. +# +# use-ewmh-active-win = false + +# Unredirect all windows if a full-screen opaque window is detected, +# to maximize performance for full-screen windows. Known to cause flickering +# when redirecting/unredirecting windows. paint-on-overlay may make the flickering less obvious. +# +# unredir-if-possible = false + +# Delay before unredirecting the window, in milliseconds. Defaults to 0. +# unredir-if-possible-delay = 0 + +# Conditions of windows that shouldn't be considered full-screen for unredirecting screen. +# unredir-if-possible-exclude = [] + +# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows +# in the same group focused at the same time. +# +# detect-transient = false +detect-transient = true + +# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same +# group focused at the same time. 'WM_TRANSIENT_FOR' has higher priority if +# detect-transient is enabled, too. +# +# detect-client-leader = false +detect-client-leader = true + +# Resize damaged region by a specific number of pixels. +# A positive value enlarges it while a negative one shrinks it. +# If the value is positive, those additional pixels will not be actually painted +# to screen, only used in blur calculation, and such. (Due to technical limitations, +# with use-damage, those pixels will still be incorrectly painted to screen.) +# Primarily used to fix the line corruption issues of blur, +# in which case you should use the blur radius value here +# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`, +# with a 5x5 one you use `--resize-damage 2`, and so on). +# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly. +# +# resize-damage = 1 + +# Specify a list of conditions of windows that should be painted with inverted color. +# Resource-hogging, and is not well tested. +# +# invert-color-include = [] + +# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer. +# Might cause incorrect opacity when rendering transparent content (but never +# practically happened) and may not work with blur-background. +# My tests show a 15% performance boost. Recommended. +# +# glx-no-stencil = false + +# GLX backend: Avoid rebinding pixmap on window damage. +# Probably could improve performance on rapid window content changes, +# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). +# Recommended if it works. +# +# glx-no-rebind-pixmap = false + +# Disable the use of damage information. +# This cause the whole screen to be redrawn everytime, instead of the part of the screen +# has actually changed. Potentially degrades the performance, but might fix some artifacts. +# The opposing option is use-damage +# +# no-use-damage = false +#use-damage = true (Causing Weird Black semi opaque rectangles when terminal is opened) +#Changing use-damage to false fixes the problem +use-damage = false + +# Use X Sync fence to sync clients' draw calls, to make sure all draw +# calls are finished before picom starts drawing. Needed on nvidia-drivers +# with GLX backend for some users. +# +# xrender-sync-fence = false + +# GLX backend: Use specified GLSL fragment shader for rendering window contents. +# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` +# in the source tree for examples. +# +# glx-fshader-win = '' + +# Force all windows to be painted with blending. Useful if you +# have a glx-fshader-win that could turn opaque pixels transparent. +# +# force-win-blend = false + +# Do not use EWMH to detect fullscreen windows. +# Reverts to checking if a window is fullscreen based only on its size and coordinates. +# + #no-ewmh-fullscreen = false + +# Dimming bright windows so their brightness doesn't exceed this set value. +# Brightness of a window is estimated by averaging all pixels in the window, +# so this could comes with a performance hit. +# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0) +# +# max-brightness = 1.0 + +# Make transparent windows clip other windows like non-transparent windows do, +# instead of blending on top of them. +# +# transparent-clipping = false + +# Set the log level. Possible values are: +# "trace", "debug", "info", "warn", "error" +# in increasing level of importance. Case doesn't matter. +# If using the "TRACE" log level, it's better to log into a file +# using *--log-file*, since it can generate a huge stream of logs. +# +# log-level = "debug" log-level = "info"; + +# Set the log file. +# If *--log-file* is never specified, logs will be written to stderr. +# Otherwise, logs will to written to the given file, though some of the early +# logs might still be written to the stderr. +# When setting this option from the config file, it is recommended to use an absolute path. +# +# log-file = '/path/to/your/log/file' + +# Show all X errors (for debugging) +# show-all-xerrors = false + +# Write process ID to a file. +# write-pid-path = '/path/to/your/log/file' + +# Window type settings +# +# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard: +# "unknown", "desktop", "dock", "toolbar", "menu", "utility", +# "splash", "dialog", "normal", "dropdown_menu", "popup_menu", +# "tooltip", "notification", "combo", and "dnd". +# +# Following per window-type options are available: :: +# +# fade, shadow::: +# Controls window-type-specific shadow and fade settings. +# +# opacity::: +# Controls default opacity of the window type. +# +# focus::: +# Controls whether the window of this type is to be always considered focused. +# (By default, all window types except "normal" and "dialog" has this on.) +# +# full-shadow::: +# Controls whether shadow is drawn under the parts of the window that you +# normally won't be able to see. Useful when the window has parts of it +# transparent, and you want shadows in those areas. +# +# redir-ignore::: +# Controls whether this type of windows should cause screen to become +# redirected again after been unredirected. If you have unredir-if-possible +# set, and doesn't want certain window to cause unnecessary screen redirection, +# you can set this to `true`. +# wintypes: { normal = { fade = false; shadow = false; } - tooltip = { fade = false; shadow = true; opacity = 1.0; focus = true; full-shadow = false; }; + tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; dock = { shadow = false; } dnd = { shadow = false; } - popup_menu = { opacity = 1.0; } - dropdown_menu = { opacity = 1.0; } + popup_menu = { opacity = 0.8; } + dropdown_menu = { opacity = 0.8; } }; diff --git a/common/.config/picom/.picom.conf b/common/.config/picom/.picom.conf deleted file mode 100644 index d37f758..0000000 --- a/common/.config/picom/.picom.conf +++ /dev/null @@ -1,121 +0,0 @@ -# config is for this fork: -# https://github.com/pijulius/picom -# https://aur.archlinux.org/packages/picom-pijulius-git - -################################# -# Shadows # -################################# -shadow = true; -shadow-radius = 15; -shadow-opacity = 0.85; -shadow-offset-x = -12; -shadow-offset-y = -12; -shadow-color = "#000000"; -shadow-ignore-shaped = false; -shadow-exclude = [ - "name = 'Notification'", - "class_g ?= 'Notify-osd'", - "_GTK_FRAME_EXTENTS@:c", - "class_g = 'org.wezfurlong.wezterm'", -]; -clip-shadow-above = []; - -################################# -# Fading # -################################# -fading = true; -fade-in-step = 0.03; -fade-out-step = 0.03; - -################################# -# Transparency / Opacity # -################################# -inactive-opacity = 1.0; -frame-opacity = 1.0; -inactive-opacity-override = false; -active-opacity = 1.0; -inactive-dim = 0.0; -focus-exclude = []; -opacity-rule = [ - "75:class_g = 'Conky'", - "95:class_g = 'obsidian'", - "95:class_g = 'inkdrop'", - "95:class_g = 'Thunar'", -]; - -################################# -# Corners # -################################# -corner-radius = 12; -rounded-corners-exclude = [ - "class_g = 'polybar'", - "class_g = 'Polybar'", - "class_g = 'csgo_linux64'", - # "class_g = 'rofi'", - # "class_g = 'Rofi'", - "class_g = 'osu!'", - "class_g = 'Dunst'", - "class_g = 'awesome'", - # "!_PICOM_CORNERS@:32c = 1" -]; - -################################# -# Animations # -################################# -animations = true; -animation-for-open-window = "zoom"; -animation-for-transient-window = "none"; -animation-for-unmap-window = "zoom"; -animation-for-workspace-switch-in = "none"; -animation-for-workspace-switch-out = "none"; -animation-for-menu-window = "none"; -animation-stiffness = 250; -animation-dampening = 20; -animation-window-mass = 0.069; -animation-clamping = true; - -################################# -# Background-Blurring # -################################# -blur-method = "dual_kawase"; -blur-size = 1; -blur-background = true; -blur-background-frame = false; -blur-background-fixed = false; -blur-kern = "3x3box"; -blur-background-exclude = [ - # "class_g = 'Rofi'", - # "class_g = 'rofi'", - "class_g = 'polybar'", - "class_g = 'Polybar'", - "class_g = 'screenkey'", - "class_g = 'Screenkey'", - "class_g = 'slop'", - "class_g = 'Discover-overlay'", - # "class_g = 'org.wezfurlong.wezterm'", - "_GTK_FRAME_EXTENTS@:c" -]; - -################################# -# General Settings # -################################# -backend = "glx"; -vsync = false; -mark-ovredir-focused = true; -detect-rounded-corners = true; -detect-client-opacity = true; -unredir-if-possible = false; -detect-transient = true; -detect-client-leader = true; -use-damage = true; -max-brightness = 1.0; -log-level = "info"; -wintypes: -{ - normal = { fade = false; shadow = false; } - tooltip = { fade = false; shadow = true; opacity = 1.0; focus = true; full-shadow = false; }; - dock = { shadow = false; } - dnd = { shadow = false; } - popup_menu = { opacity = 1.0; } - dropdown_menu = { opacity = 1.0; } -}; diff --git a/common/.config/polybar/colors.ini b/common/.config/polybar/colors.ini new file mode 100644 index 0000000..1252362 --- /dev/null +++ b/common/.config/polybar/colors.ini @@ -0,0 +1,24 @@ +[colors] +; background = #1e222a +background = #1A1826 +; foreground = #c8ccd4 +foreground = #C3BAC6 + +color0 = #282c34 +color1 = #e06c75 +color2 = #98c379 +color3 = #e5c07b +color4 = #61afef +color5 = #c678dd +color6 = #56b6c2 +color7 = #abb2bf +color8 = #545862 +color9 = #e06c75 +color10 = #98c379 +color11 = #e5c07b +color12 = #61afef +color13 = #c678dd +color14 = #56b6c2 +color15 = #c8ccd4 +dark-light = #272A2B +active-light = #313435 diff --git a/common/.config/polybar/config.ini b/common/.config/polybar/config.ini new file mode 100644 index 0000000..83a1926 --- /dev/null +++ b/common/.config/polybar/config.ini @@ -0,0 +1,5 @@ +# vim: filetype=config +include-file = "~/.config/polybar/colors.ini" +include-file = "~/.config/polybar/modules.ini" +include-file = "~/.config/polybar/main-bar.ini" +include-file = "~/.config/polybar/settings.ini" diff --git a/common/.config/polybar/fonts.ini b/common/.config/polybar/fonts.ini new file mode 100644 index 0000000..cbb794f --- /dev/null +++ b/common/.config/polybar/fonts.ini @@ -0,0 +1,10 @@ +# font-0 = CaskaydiaCove Nerd Font:style=Regular:pixelsize=11:antialias=true;2.5 +font-0 = DejaVu Sans Mono Nerd Font:style=Bold:pixelsize=14;3 +font-1 = DejaVu Sans Mono Nerd Font:size=14;4 +font-2 = Material Design Icons:style=Regular:size=12;3 +font-6 = unifont:fontformat=truetype:size=11;3 +font-4 = DejaVu Sans Mono Nerd Font:size=14 +font-5 = DejaVu Sans Mono:size=11 +font-3 = Weather Icons:size=12;1 +font-7 = Material Icons:size=12;0 +# font-4 = Material Design Icons:style=Regular:pixelsize=11:antialias=true;2.5 diff --git a/common/.config/polybar/launch.sh b/common/.config/polybar/launch.sh new file mode 100755 index 0000000..d1f37cc --- /dev/null +++ b/common/.config/polybar/launch.sh @@ -0,0 +1,8 @@ +if type "xrandr"; then + for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do + MONITOR=$m polybar --reload main & + done +else + polybar --reload main & +fi + diff --git a/common/.config/polybar/main-bar.ini b/common/.config/polybar/main-bar.ini new file mode 100644 index 0000000..252f0d3 --- /dev/null +++ b/common/.config/polybar/main-bar.ini @@ -0,0 +1,31 @@ +[bar/main] +monitor = ${env:MONITOR:} + +include-file = "~/.config/polybar/fonts.ini" + +width = 100% +height = 30 +bottom = true + +background = ${colors.background} +foreground = ${colors.foreground} + +padding-right = 1 +padding-left = 1 +line-size = 1 + +border-top-size = 5 +border-bottom-size = 5 +border-top-color = ${colors.background} + +border-bottom-color = ${colors.background} + +modules-left = round-left i3 round-right empty-space spotify +modules-center = round-left time round-right +modules-right = empty-space round-left network round-right empty-space round-left backlight colored-empty-space audio round-right empty-space round-left cpu temperature colored-empty-space memory round-right empty-space round-left battery round-right + +cursor-click = pointer +cursor-scroll = ns-resize + +# override-redirect = true + diff --git a/common/.config/polybar/modules.ini b/common/.config/polybar/modules.ini new file mode 100644 index 0000000..0152819 --- /dev/null +++ b/common/.config/polybar/modules.ini @@ -0,0 +1,266 @@ +[module/i3] +type = internal/i3 +pin-workspaces = true +enable-click = true +show-urgent = true + +format-background = #1E1E2E + +label-active-foreground = ${colors.foreground} +label-urgent-foreground = ${colors.foreground} + +[module/empty-space] +type = custom/text +content = " " + +# ======================================= + +[module/colored-empty-space] +type = custom/text +content = " " +content-background = #1e1e2e + +# ======================================= + +[module/round-left] +type = custom/text +content = %{T3}%{T-} +content-foreground = #1E1E2E + +# ======================================= + +[module/round-right] +type = custom/text +content = %{T3}%{T-} +content-foreground = #1E1E2E + +# ======================================= + +[module/time] +type = internal/date +interval = 60 + +format =