dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 9c3b3edf02e6d706e9d8801e3f7e6e9826958bbe
parent cd0183b06accda87e30f0fb7947af633f7e35558
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Sun, 12 Jan 2020 13:57:11 +0000

Picom and stuff...

Diffstat:
D.Xdefaults | 32--------------------------------
D.Xresources | 44--------------------------------------------
M.bashrc | 4++--
M.config/fish/config.fish | 7+++++--
M.config/i3/config | 25++++++++++++++-----------
M.config/i3blocks/config | 4----
M.config/i3blocks/config2 | 4++++
M.config/irssi/config | 3++-
M.config/newsboat/config | 2+-
M.config/picom/config | 26+++++++++++++-------------
D.config/urxvt/ext/clipboard | 28----------------------------
D.config/urxvt/ext/keyboard-select | 606-------------------------------------------------------------------------------
D.config/urxvt/ext/resize-font | 169-------------------------------------------------------------------------------
D.config/urxvt/ext/url-select | 408-------------------------------------------------------------------------------
M.config/vimb/scripts.js | 10+++++-----
M.config/vimb/style.css | 6+++---
M.profile | 2+-
M.scripts/bin/display/rfeh | 3++-
M.scripts/bin/dmenu/dpass | 10+++-------
M.scripts/bin/misc/rmpv | 3++-
M.scripts/i3blocks/mpv | 21++++++++++++++-------
M.scripts/i3blocks/title | 11++++++++---
M.vimrc | 7++-----
23 files changed, 81 insertions(+), 1354 deletions(-)

diff --git a/.Xdefaults b/.Xdefaults @@ -1,32 +0,0 @@ -!! -!! .Xdefaults -!! Created by Hayden Hamilton -!! -!! haydenvh.com -!! Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 .licenses/gplv2.license -!! - -URxvt.intensityStyles:false -URxvt.depth:32 -URxvt.font:xft:monospace:size=9 -URxvt.scrollBar:false -URxvt.cursorColor:white - -!! 25px padding -URxvt*internalBorder:25 -!! Extensions -URxvt.perl-ext-common:default,resize-font,url-select,keyboard-select,clipboard -URxvt.colorUL:#4682B4 -!! url-select -URxvt.keysym.C-u:perl:url-select:select_next -URxvt.url-select.launcher:vimb -URxvt.url-select.underline:true -!! keyboard-select: -URxvt.keysym.C-s:perl:keyboard-select:activate -!! resize-font -URxvt.resize-font.smaller:C-j -URxvt.resize-font.bigger:C-k -!! Matcher -URxvt.url-launcher:vimb -!! clipboard -URxvt.keysym.M-c:perl:clipboard:copy diff --git a/.Xresources b/.Xresources @@ -1,44 +0,0 @@ -! -! .Xresources -! Created by Hayden Hamilton -! -! haydenvh.com -! Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 .licenses/gplv2.license -! - -! special -*.foreground: #1e5eb3 -*.background: #0c0a14 -*.cursorColor: #1e5eb3 - -! black -*.color0: #141726 -*.color8: #dc6f3c - -! red -*.color1: #24283c -*.color9: #4747e1 - -! green -*.color2: #31364b -*.color10: #892b2b - -! yellow -*.color3: #40445c -*.color11: #a1a1d9 - -! blue -*.color4: #575b72 -*.color12: #1f8a27 - -! magenta -*.color5: #777b8e -*.color13: #a84b8d - -! cyan -*.color6: #a3a6b3 -*.color14: #434343 - -! white -*.color7: #c7cad9 -*.color15: #3ab475 diff --git a/.bashrc b/.bashrc @@ -49,10 +49,10 @@ export LS_COLORS="di=35:fi=0:ln=33:ex=91;01:*.sh=91:*.html=92:*.css=97:*.md=97:* ##Framebuffer functions video(){ - mpv $1 --vo=drm + mpv $* --vo=drm } image(){ - mpv $1 --vo=drm --pause + mpv $* --vo=drm --pause } ##C Compilation diff --git a/.config/fish/config.fish b/.config/fish/config.fish @@ -1,5 +1,6 @@ #Prompt function fish_prompt + set STRING (pwd | sed "s~$HOME~\~~g" | tr "/" "\n" | cut -c 1-5 | tr "\n" "/") tput setaf 2 printf "[" tput setaf 3 @@ -9,7 +10,7 @@ function fish_prompt tput setaf 5 printf $hostname tput setaf 6 - printf " "(pwd | sed "s~$HOME~\~~g") + printf " "$STRING tput setaf 2 printf "]" tput setaf 11 @@ -18,7 +19,8 @@ end #Aliases function vi; vim $argv; end -function xi; sudo xbps-install $argv; cleancache; end +function xi; +sudo xbps-install $argv; cleancache; end function xq; sudo xbps-query $argv; cleancache; end function xr; sudo xbps-remove $argv; cleancache; end function irssi; irssi --config ~/.config/irssi/config $argv; end @@ -41,6 +43,7 @@ function vimb; command vimb --no-maximize; end function cleancache; sudo xbps-remove -O; end function dots; git push origin master -f; git push github master -f; end function dotsadd; bash ~/.gitaddlist; end +function clock; tty-clock -s -c -C 7; end #Set fish colors set fish_color_command a84b8d diff --git a/.config/i3/config b/.config/i3/config @@ -14,15 +14,14 @@ font pango:monospace 8 ##Setting variables set $mod Mod4 -set $terminal urxvtc +set $terminal st set $browser vimb exec export BROWSER="surf" exec export EDITOR="vim" exec_always export SUDO_ASKPASS="$HOME/.scripts/bin/dmenu/daskpass" ##Setting gaps -gaps outer 10 -gaps inner 2 +gaps inner 10 for_window [class="^.*"] border pixel 0 ##Setting Xresources @@ -48,8 +47,10 @@ set_from_resource $white2 color15 #3ab475 ##Setting bar bar{ font pango:monospace 7 + i3bar_command "sleep 2;i3bar" status_command i3blocks position top + id bar-1 mode dock modifier none separator_symbol " " @@ -61,7 +62,6 @@ bar{ inactive_workspace $background $yellow2 #000000 urgent_workspace $background #ffffff #990000 } - id bar-1 } bar{ font pango:monospace 7 @@ -151,9 +151,10 @@ workspace "TEMPORARY" output VGA1 assign [class="Gimp"] $ws9 assign [class="Vimb"] $ws1 assign [class="URxvt" instance="irssi"] $ws8 +for_window [class="URxvt" instance="fileman"] floating enable; sticky enable ##Movement bindings -bindsym $mod+h focus left +bindsym $mod+h focus left bindsym $mod+shift+h move left bindsym $mod+ctrl+h resize shrink width 5px or 5ppt bindsym $mod+j focus down @@ -170,7 +171,7 @@ bindsym $mod+ctrl+l resize grow width 5px or 5ppt bindsym $mod+shift+space floating toggle bindsym $mod+space focus mode_toggle bindsym $mod+Return exec $terminal -bindsym $mod+F1 exec $browser file:///etc/manual/index.html +bindsym $mod+shift+Return exec $terminal -e tty-clock -s -c -C 7 -b bindsym $mod+Escape exec userinput "Do you want to quit i3?" "sudo -A i3-msg exit" bindsym $mod+shift+Escape exec userinput "Do you want to shutdown?" "sudo -A halt" bindsym $mod+ctrl+Escape exec userinput "Do you want to reboot?" "sudo -A reboot" @@ -196,7 +197,7 @@ bindsym $mod+u exec wallvar ~/.wallpapers/ 60; exec dunstify "Auto-changing w bindsym $mod+shift+u exec killall wallvar; exec dunstify "Auto-changing wallpapers off." bindsym $mod+i exec $terminal -name fff -e ffflaunch bindsym $mod+shift+i exec $terminal -name fff -e ffflaunch -##bindsym $mod+o +bindsym $mod+o exec makegrid $TERMINAL ##bindsym $mod+super+o bindsym $mod+p focus parent bindsym $mod+shift+p focus child @@ -216,8 +217,8 @@ bindsym $mod+shift+z split v bindsym $mod+x split h bindsym $mod+shift+x split h bindsym $mod+c exec locker /tmp/mpv-socket2 /tmp/mpv-socket -bindsym $mod+shift+c exec slock -bindsym $mod+v workspace "TEMPORARY"; exec $terminal -e htop; exec $terminal -e alsamixer +bindsym $mod+shift+c exec $terminal -e slock_mod /tmp/mpv-socket2 /tmp/mpv-socket +bindsym $mod+v workspace "TEMPORARY" bindsym $mod+shift+v exec killall mpv bindsym $mod+b exec vimb --no-maximize bindsym $mod+shift+b exec dmpvurl /tmp/mpv-socket /tmp/mpv-socket2 @@ -250,8 +251,10 @@ client.placeholder $yellow $background $white client.urgent $yellow $background $yellow2 ##Setting volume -bindsym XF86AudioRaiseVolume exec hvol 5%+ -bindsym XF86AudioLowerVolume exec hvol 5%- +bindsym XF86AudioRaiseVolume exec hvol 3.5%+ +bindsym $mod+plus exec hvol 3.5%+ +bindsym $mod+minus exec hvol 3.5%- +bindsym XF86AudioLowerVolume exec hvol 3.5%- bindsym XF86AudioMute exec hvol toggle ##Setting brightness diff --git a/.config/i3blocks/config b/.config/i3blocks/config @@ -6,10 +6,6 @@ border_top=0 border_left=0 border_right=0 -[title] -interval=1 -border=#226644 - [vol] interval=1 border=#218888 diff --git a/.config/i3blocks/config2 b/.config/i3blocks/config2 @@ -10,6 +10,10 @@ border_right=0 interval=1 border=#666b1b +[title] +interval=1 +border=#4a6b1b + [cal] interval=30 border=#236b1b diff --git a/.config/irssi/config b/.config/irssi/config @@ -271,7 +271,7 @@ settings = { core = { real_name = "haydenh"; user_name = "haydenh"; - nick = "haydenh"; + nick = "hayden"; recode_transliterate = "no"; timestamp_format = "%H:%M:%S"; }; @@ -285,6 +285,7 @@ settings = { ascii_figlet_path = "/usr/bin/figlet"; nickcolor_colors = "4 8 9 10 11 12 13 14 15"; }; + "irc/core" = { alternate_nick = "haydenh_"; }; }; logs = { }; diff --git a/.config/newsboat/config b/.config/newsboat/config @@ -2,7 +2,7 @@ auto-reload yes browser "vimb --no-maximize" -external-url-viewer "vimb --no-maximize" +external-url-viewer "urlhand" bind-key j down bind-key k up diff --git a/.config/picom/config b/.config/picom/config @@ -5,25 +5,25 @@ # Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license # shadow=true -shadow-radius=10 -shadow-offset-x=-5 -shadow-offset-y=-5 - -shadow-exclude = [ - "class_g ?= 'dmenu'", - "class_g ?= 'i3bar'", -]; +shadow-radius=25 +shadow-offset-x=-20 +shadow-offset-y=-20 opacity-rule = [ "0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", - "90:class_g ?= 'urxvt'", - "90:class_g ?= 'i3bar'", - "100:name ?= 'fff'", - "90:class_g ?= 'vimb'", + "87:class_g ?= 'urxvt' && !focused", + "84:class_g ?= 'urxvt' && focused", + "87:class_g ?= 'st-256color' && !focused", + "84:class_g ?= 'st-256color' && focused", + "85:class_g ?= 'i3bar'", + "87:class_g ?= 'vimb' && !focused", + "84:class_g ?= 'vimb' && focused", + "87:class_g ?= 'surf' && !focused", + "84:class_g ?= 'surf' && focused", ]; fade-exclude = [ "!_I3_FLOATING_WINDOW@:c", ]; -inactive-dim = 0.2 +inactive-dim = 0.1 diff --git a/.config/urxvt/ext/clipboard b/.config/urxvt/ext/clipboard @@ -1,28 +0,0 @@ -#! perl - -# Store this file as /usr/lib/urxvt/perl/xkr-clipboard -# -# To enable, add to ~/.Xresources: -# -# URxvt.perl-ext-common: default,xkr-clipboard -# URxvt.iso14755: false -# URxvt.keysym.Shift-Control-C: perl:clipboard:copy -# URxvt.keysym.Control-Insert: perl:clipboard:copy -# -# Based on -# https://wiki.archlinux.org/index.php/Rxvt-unicode#Custom_key_bindings -# rxvt-unicode-9.19 / src/perl/clipboard-osc - -sub on_user_command { - my ($self, $osc, $resp) = @_; - - return unless $osc =~ s/^clipboard:([^;]+)//; - - if ($1 eq "copy") { - my $text = $self->selection (); - $self->selection ($text, 1); - $self->selection_grab (urxvt::CurrentTime, 1); - } - - 1 -} diff --git a/.config/urxvt/ext/keyboard-select b/.config/urxvt/ext/keyboard-select @@ -1,606 +0,0 @@ -#! perl -w -# Author: Bert Muennich -# Website: http://www.github.com/muennich/urxvt-perls -# License: GPLv2 - -# Use keyboard shortcuts to select and copy text. - -# Usage: put the following lines in your .Xdefaults/.Xresources: -# URxvt.perl-ext-common: ...,keyboard-select -# URxvt.keysym.M-Escape: perl:keyboard-select:activate -# The following line overwrites the default Meta-s binding and allows to -# activate keyboard-select directly in backward search mode: -# URxvt.keysym.M-s: perl:keyboard-select:search - -# Use Meta-Escape to activate selection mode, then use the following keys: -# h/j/k/l: Move cursor left/down/up/right (also with arrow keys) -# g/G/0/^/$/H/M/L/f/F/;/,/w/W/b/B/e/E: More vi-like cursor movement keys -# '/'/?: Start forward/backward search -# n/N: Repeat last search, N: in reverse direction -# Ctrl-f/b: Scroll down/up one screen -# Ctrl-d/u: Scroll down/up half a screen -# v/V/Ctrl-v: Toggle normal/linewise/blockwise selection -# y/Return: Copy selection to primary buffer, Return: quit afterwards -# Y: Copy selected lines to primary buffer or cursor line and quit -# q/Escape: Quit keyboard selection mode - -# Options: -# URxvt.keyboard-select.clipboard: If true, copy to clipboard too - - -use strict; - -sub on_start{ - my ($self) = @_; - - $self->{clipboard} = $self->x_resource_boolean('keyboard-select.clipboard'); - - $self->{patterns}{'w'} = qr/\w[^\w\s]|\W\w|\s\S/; - $self->{patterns}{'W'} = qr/\s\S/; - $self->{patterns}{'b'} = qr/.*(?:\w[^\w\s]|\W\w|\s\S)/; - $self->{patterns}{'B'} = qr/.*\s\S/; - $self->{patterns}{'e'} = qr/[^\w\s](?=\w)|\w(?=\W)|\S(?=\s|$)/; - $self->{patterns}{'E'} = qr/\S(?=\s|$)/; - - () -} - - -sub on_action { - my ($self, $action) = @_; - - on_user_command($self, "keyboard-select:" . $action); -} - - -sub on_user_command { - my ($self, $cmd) = @_; - - if (not $self->{active}) { - if ($cmd eq 'keyboard-select:activate') { - activate($self); - } elsif ($cmd eq 'keyboard-select:search') { - activate($self, 1); - } - } - - () -} - - -sub key_press { - my ($self, $event, $keysym, $char) = @_; - my $key = chr($keysym); - - if (lc($key) eq 'c' && $event->{state} & urxvt::ControlMask) { - deactivate($self); - } elsif ($self->{search}) { - if ($keysym == 0xff1b) { - if ($self->{search_mode}) { - deactivate($self); - } else { - $self->{search} = ''; - status_area($self); - } - } elsif ($keysym == 0xff08) { - $self->{search} = substr($self->{search}, 0, -1); - if (not $self->{search} and $self->{search_mode}) { - deactivate($self); - } else { - status_area($self); - } - } elsif ($keysym == 0xff0d || - (lc($key) eq 'm' && $event->{state} & urxvt::ControlMask)) { - my $txt = substr($self->{search}, 1); - if ($txt) { - $self->{pattern} = ($txt =~ m/[[:upper:]]/) ? qr/\Q$txt\E/ : - qr/\Q$txt\E/i; - } elsif ($self->{pattern}) { - delete $self->{pattern}; - } - $self->{search} = ''; - $self->screen_cur($self->{srhcr}, $self->{srhcc}); - if (not find_next($self)) { - if ($self->{search_mode}) { - deactivate($self); - } else { - status_area($self); - } - } - } elsif (length($char) > 0) { - $self->{search} .= $self->locale_decode($char); - my $txt = substr($self->{search}, 1); - if ($txt) { - $self->{pattern} = ($txt =~ m/[[:upper:]]/) ? qr/\Q$txt\E/ : - qr/\Q$txt\E/i; - } elsif ($self->{pattern}) { - delete $self->{pattern}; - } - $self->screen_cur($self->{srhcr}, $self->{srhcc}); - find_next($self); - status_area($self); - } - } elsif ($self->{move_to}) { - if ($keysym == 0xff1b) { - $self->{move_to} = 0; - status_area($self); - } elsif (length($char) > 0) { - $self->{move_to} = 0; - $self->{patterns}{'f-1'} = qr/^.*\Q$key\E/; - $self->{patterns}{'f+1'} = qr/^.+?\Q$key\E/; - move_to($self, ';'); - status_area($self); - } - } elsif ($keysym == 0xff1b || lc($key) eq 'q') { - deactivate($self); - } elsif (lc($key) eq 'y' || $keysym == 0xff0d || - (lc($key) eq 'm' && $event->{state} & urxvt::ControlMask)) { - my $quit = 0; - if ($key eq 'Y' && $self->{select} ne 'l') { - $quit = !$self->{select}; - toggle_select($self, 'l'); - } - if ($self->{select}) { - my ($br, $bc, $er, $ec) = calc_span($self); - $ec = $self->line($er)->l if $self->{select} eq 'l'; - $self->selection_beg($br, $bc); - $self->selection_end($er, $ec); - $self->selection_make($event->{time}, $self->{select} eq 'b'); - if ($self->{clipboard}) { - $self->selection($self->selection(), 1); - $self->selection_grab($event->{time}, 1); - } - if (lc($key) eq 'y') { - $self->selection_beg(1, 0); - $self->selection_end(1, 0); - $self->{select} = ''; - status_area($self); - $self->want_refresh(); - } else { - $quit = 1; - } - } - if ($quit) { - deactivate($self); - } - } elsif ($key eq 'V') { - toggle_select($self, 'l'); - } elsif ($key eq 'v') { - if ($event->{state} & urxvt::ControlMask) { - toggle_select($self, 'b'); - } else { - toggle_select($self, 'n'); - } - } elsif ($key eq 'k' || $keysym == 0xff52) { - move_cursor($self, 'k'); - } elsif ($key eq 'j' || $keysym == 0xff54) { - move_cursor($self, 'j'); - } elsif ($key eq 'h' || $keysym == 0xff51) { - move_cursor($self, 'h'); - } elsif ($key eq 'l' || $keysym == 0xff53) { - move_cursor($self, 'l'); - } elsif ($keysym == 0xff57) { - move_cursor($self, '$'); - } elsif ($keysym == 0xff50) { - move_cursor($self, '^'); - } elsif ('gG0^$HML' =~ m/\Q$key\E/ || - ('fbdu' =~ m/\Q$key\E/ && $event->{state} & urxvt::ControlMask)) { - move_cursor($self, $key); - } elsif (lc($key) eq 'f') { - $self->{move_to} = 1; - $self->{move_dir} = $key eq 'F' ? -1 : 1; - status_area($self, $key); - } elsif (';,wWbBeE' =~ m/\Q$key\E/) { - move_to($self, $key); - } elsif ($key eq '/' || $key eq '?') { - $self->{search} = $key; - $self->{search_dir} = $key eq '?' ? -1 : 1; - ($self->{srhcr}, $self->{srhcc}) = $self->screen_cur(); - status_area($self); - } elsif (lc($key) eq 'n') { - find_next($self, $self->{search_dir} * ($key eq 'N' ? -1 : 1)); - } - - return 1; -} - - -sub move_cursor { - my ($self, $key) = @_; - my ($cr, $cc) = $self->screen_cur(); - my $line = $self->line($cr); - - if ($key eq 'k' && $line->beg > $self->top_row) { - $cr = $line->beg - 1; - } elsif ($key eq 'j' && $line->end < $self->nrow - 1) { - $cr = $line->end + 1; - } elsif ($key eq 'h' && $self->{offset} > 0) { - $self->{offset} = $line->offset_of($cr, $cc) - 1; - $self->{dollar} = 0; - } elsif ($key eq 'l' && $self->{offset} < $line->l - 1) { - ++$self->{offset}; - } elsif ($key eq 'f' || $key eq 'd') { - my $vs = $self->view_start() + - ($key eq 'd' ? $self->nrow / 2 : $self->nrow - 1); - $vs = 0 if $vs > 0; - $cr += $vs - $self->view_start($vs); - } elsif ($key eq 'b' || $key eq 'u') { - my $vs = $self->view_start() - - ($key eq 'u' ? $self->nrow / 2 : $self->nrow - 1); - $vs = $self->top_row if $vs < $self->top_row; - $cr += $vs - $self->view_start($vs); - } elsif ($key eq 'g') { - ($cr, $self->{offset}) = ($self->top_row, 0); - $self->{dollar} = 0; - } elsif ($key eq 'G') { - ($cr, $self->{offset}) = ($self->nrow - 1, 0); - $self->{dollar} = 0; - } elsif ($key eq '0') { - $self->{offset} = 0; - $self->{dollar} = 0; - } elsif ($key eq '^') { - my $ltxt = $self->special_decode($line->t); - while ($ltxt =~ s/^( *)\t/$1 . " " x (8 - length($1) % 8)/e) {} - $self->{offset} = $ltxt =~ m/^ +/ ? $+[0] : 0; - $self->{dollar} = 0; - } elsif ($key eq '$') { - my $co = $line->offset_of($cr, $cc); - $self->{dollar} = $co + 1; - $self->{offset} = $line->l - 1; - } elsif ($key eq 'H') { - $cr = $self->view_start(); - } elsif ($key eq 'M') { - $cr = $self->view_start() + $self->nrow / 2; - } elsif ($key eq 'L') { - $cr = $self->view_start() + $self->nrow - 1; - } - - $line = $self->line($cr); - $cc = $self->{dollar} || $self->{offset} >= $line->l ? $line->l - 1 : - $self->{offset}; - $self->screen_cur($line->coord_of($cc)); - - status_area($self); - $self->want_refresh(); - - () -} - - -sub move_to { - my ($self, $key) = @_; - my ($cr, $cc) = $self->screen_cur(); - my $line = $self->line($cr); - my $offset = $self->{offset}; - my ($dir, $pattern); - my ($wrap, $found) = (0, 0); - - if ($key eq ';' || $key eq ',') { - $dir = $self->{move_dir} * ($key eq ',' ? -1 : 1); - $pattern = $self->{patterns}{sprintf('f%+d', $dir)}; - return if not $pattern; - } else { - if (lc($key) eq 'b') { - $dir = -1; - } else { - $dir = 1; - ++$offset if lc($key) eq 'e'; - } - $pattern = $self->{patterns}{$key}; - $wrap = 1; - } - - if ($dir > 0) { - NEXTDOWN: my $text = substr($line->t, $offset); - if ($text =~ m/$pattern/) { - $offset += $+[0] - 1; - $found = 1; - } elsif ($wrap && $line->end + 1 < $self->nrow) { - $cr = $line->end + 1; - $line = $self->line($cr); - $offset = 0; - if (lc($key) eq 'e') { - goto NEXTDOWN; - } else { - $found = 1; - } - } - } elsif ($dir < 0) { - NEXTUP: my $text = substr($line->t, 0, $offset); - if ($text =~ m/$pattern/) { - $offset += $+[0] - length($text) - 1; - $found = 1; - } elsif ($wrap) { - if ($offset > 0) { - $offset = 0; - $found = 1; - } elsif ($line->beg > $self->top_row) { - $cr = $line->beg - 1; - $line = $self->line($cr); - $offset = $line->l; - goto NEXTUP; - } - } - } - - if ($found) { - $self->{dollar} = 0; - $self->{offset} = $offset; - $self->screen_cur($line->coord_of($offset)); - $self->want_refresh(); - } - - () -} - - -sub find_next { - my ($self, $dir) = @_; - - return if not $self->{pattern}; - $dir = $self->{search_dir} if not $dir; - - my ($cr, $cc) = $self->screen_cur(); - my $line = $self->line($cr); - my $offset = $line->offset_of($cr, $cc); - my $text; - my $found = 0; - - ++$offset if $dir > 0; - - while (not $found) { - if ($dir > 0) { - $text = substr($line->t, $offset); - if ($text =~ m/$self->{pattern}/) { - $found = 1; - $offset += $-[0]; - } else { - last if $line->end >= $self->nrow; - $line = $self->line($line->end + 1); - $offset = 0; - } - } else { - $text = substr($line->t, 0, $offset); - if ($text =~ m/$self->{pattern}/) { - $found = 1; - $offset = $-[0] while $text =~ m/$self->{pattern}/g; - } else { - last if $line->beg <= $self->top_row; - $line = $self->line($line->beg - 1); - $offset = $line->l; - } - } - } - - if ($found) { - $self->{dollar} = 0; - $self->{offset} = $offset; - $self->screen_cur($line->coord_of($offset)); - status_area($self); - $self->want_refresh(); - } - - return $found; -} - - -sub tt_write { - return 1; -} - - -sub refresh { - my ($self) = @_; - my ($cr, $cc) = $self->screen_cur(); - - # scroll the current cursor position into visible area - if ($cr < $self->view_start()) { - $self->view_start($cr); - } elsif ($cr >= $self->view_start() + $self->nrow) { - $self->view_start($cr - $self->nrow + 1); - } - - if ($self->{select}) { - my ($hl, $reverse_cursor); - my ($br, $bc, $er, $ec) = calc_span($self); - - if ($self->x_resource('highlightColor')) { - $hl = urxvt::RS_Sel; - $reverse_cursor = 0; - } else { - $hl = urxvt::RS_RVid; - $reverse_cursor = $self->{select} ne 'l'; - } - if ($self->{select} eq 'b') { - my $co = $self->line($cr)->offset_of($cr, $cc); - my $dollar = $self->{dollar} && $co >= $self->{dollar} - 1; - - my $r = $br; - while ($r <= $er) { - my $line = $self->line($r); - if ($bc < $line->l) { - $ec = $line->l if $dollar; - my ($br, $bc) = $line->coord_of($bc); - my ($er, $ec) = $line->coord_of($ec <= $line->l ? $ec : $line->l); - $self->scr_xor_span($br, $bc, $er, $ec, $hl); - } elsif ($r == $cr) { - $reverse_cursor = 0; - } - $r = $line->end + 1; - } - } else { - $self->scr_xor_span($br, $bc, $er, $ec, $hl); - } - - if ($reverse_cursor) { - # make the cursor visible again - $self->scr_xor_span($cr, $cc, $cr, $cc + 1, $hl); - } - } - - () -} - - -sub activate { - my ($self, $search) = @_; - - $self->{active} = 1; - - $self->{select} = ''; - $self->{dollar} = 0; - $self->{move_to} = 0; - - if ($search) { - $self->{search} = '?'; - $self->{search_dir} = -1; - $self->{search_mode} = 1; - } else { - $self->{search} = ''; - $self->{search_mode} = 0; - } - - ($self->{oldcr}, $self->{oldcc}) = $self->screen_cur(); - ($self->{srhcr}, $self->{srhcc}) = $self->screen_cur(); - $self->{old_view_start} = $self->view_start(); - $self->{old_pty_ev_events} = $self->pty_ev_events(urxvt::EV_NONE); - - my $line = $self->line($self->{oldcr}); - $self->{offset} = $line->offset_of($self->{oldcr}, $self->{oldcc}); - - $self->selection_beg(1, 0); - $self->selection_end(1, 0); - - $self->enable( - key_press => \&key_press, - refresh_begin => \&refresh, - refresh_end => \&refresh, - tt_write => \&tt_write, - ); - - if ($self->{offset} >= $line->l) { - $self->{offset} = $line->l > 0 ? $line->l - 1 : 0; - $self->screen_cur($line->coord_of($self->{offset})); - $self->want_refresh(); - } - - $self->{overlay_len} = 0; - status_area($self); - - () -} - - -sub deactivate { - my ($self) = @_; - - $self->selection_beg(1, 0); - $self->selection_end(1, 0); - - delete $self->{overlay} if $self->{overlay}; - - $self->disable("key_press", "refresh_begin", "refresh_end", "tt_write"); - $self->screen_cur($self->{oldcr}, $self->{oldcc}); - $self->view_start($self->{old_view_start}); - $self->pty_ev_events($self->{old_pty_ev_events}); - - $self->want_refresh(); - - $self->{active} = 0; - - () -} - - -sub status_area { - my ($self, $extra) = @_; - my ($stat, $stat_len); - - if ($self->{search}) { - $stat_len = $self->ncol; - $stat = $self->{search} . ' ' x ($stat_len - length($self->{search})); - } else { - if ($self->{select}) { - $stat = "-V" . ($self->{select} ne 'n' ? uc($self->{select}) : "") . "- "; - } - - if ($self->top_row == 0) { - $stat .= "All"; - } elsif ($self->view_start() == $self->top_row) { - $stat .= "Top"; - } elsif ($self->view_start() == 0) { - $stat .= "Bot"; - } else { - $stat .= sprintf("%2d%%", - ($self->top_row - $self->view_start) * 100 / $self->top_row); - } - - $stat = "$extra $stat" if $extra; - $stat_len = length($stat); - } - - if (!$self->{overlay} || $self->{overlay_len} != $stat_len) { - delete $self->{overlay} if $self->{overlay}; - $self->{overlay} = $self->overlay(-1, -1, $stat_len, 1, - urxvt::OVERLAY_RSTYLE, 0); - $self->{overlay_len} = $stat_len; - } - - $self->{overlay}->set(0, 0, $self->special_encode($stat)); - $self->{overlay}->show(); - - () -} - - -sub toggle_select { - my ($self, $mode) = @_; - - if ($self->{select} eq $mode) { - $self->{select} = ''; - } else { - if (not $self->{select}) { - ($self->{ar}, $self->{ac}) = $self->screen_cur(); - } - $self->{select} = $mode; - } - - status_area($self); - $self->want_refresh(); - - () -} - - -sub calc_span { - my ($self) = @_; - my ($cr, $cc) = $self->screen_cur(); - my ($br, $bc, $er, $ec); - - if ($self->{select} eq 'b') { - $br = $self->line($cr)->beg; - $bc = $self->line($cr)->offset_of($cr, $cc); - $er = $self->line($self->{ar})->beg; - $ec = $self->line($self->{ar})->offset_of($self->{ar}, $self->{ac}); - ($br, $er) = ($er, $br) if $br > $er; - ($bc, $ec) = ($ec, $bc) if $bc > $ec; - } else { - if ($cr < $self->{ar}) { - ($br, $bc, $er, $ec) = ($cr, $cc, $self->{ar}, $self->{ac}); - } elsif ($cr > $self->{ar}) { - ($br, $bc, $er, $ec) = ($self->{ar}, $self->{ac}, $cr, $cc); - } else { - ($br, $er) = ($cr, $cr); - ($bc, $ec) = $cc < $self->{ac} ? ($cc, $self->{ac}) : ($self->{ac}, $cc); - } - } - - if ($self->{select} eq 'l') { - ($br, $er) = ($self->line($br)->beg, $self->line($er)->end); - ($bc, $ec) = (0, $self->ncol); - } else { - ++$ec; - } - - return ($br, $bc, $er, $ec); -} diff --git a/.config/urxvt/ext/resize-font b/.config/urxvt/ext/resize-font @@ -1,169 +0,0 @@ -# vim:ft=perl -# Copyright (c) 2009-, Simon Lundström <simmel@soy.se> -# Copyright (c) 2014 Maarten de Vries <maarten@de-vri.es> -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - -my @fonts = ( - {'name' => 'font', 'code' => 710}, - {'name' => 'boldFont', 'code' => 711}, - {'name' => 'italicFont', 'code' => 712}, - {'name' => 'boldItalicFont', 'code' => 713}, -); - -my @fixed = qw(4x6 5x7 5x8 6x9 6x10 6x12 6x13 7x13 7x14 8x13 8x16 9x15 9x18 - 10x20 12x24); -my $step; - -sub on_start { - my ($self) = @_; - - foreach (@fonts) { - $_->{'default'} = $self->resource($_->{'name'}); - } - - $step = $self->x_resource("%.step") || 2; -} - -sub on_init { - my ($self) = @_; - my $commands = { - "smaller" => "C-minus", - "bigger" => "C-plus", - "reset" => "C-equal", - "show" => "C-question", - }; - bind_hotkeys($self, $commands); - - () -} - -sub bind_hotkeys { - my ($self, $commands) = @_; - - for (keys %$commands) { - my $hotkey = $$commands{$_}; - my $hotkey_bound = $self->{'term'}->x_resource("keysym.$hotkey"); - if (!defined($hotkey_bound) ) { - # Support old-style key bindings - if ($self->x_resource("%.$_")) { - $hotkey = $self->x_resource("%.$_"); - } - - # FIXME If we're bound to a keysym, don't bind the default. - $self->bind_action($hotkey, "%:$_") or - warn "unable to register '$hotkey' as hotkey for $_"; - } - else { - if ($hotkey_bound !~ /^resize-font:/) { - warn "Hotkey $$commands{$_} already bound to $hotkey_bound, not ". - "binding to resize-font:$_ by default."; - } - } - } -} - -sub on_action { - my ($self, $string) = @_; - - if ($string eq "bigger") { - foreach (@fonts) { - next if not defined($_->{'default'}); - update_font_size($self, $_, +$step); - } - } - elsif ($string eq "smaller") { - foreach (@fonts) { - next if not defined($_->{'default'}); - update_font_size($self, $_, -$step); - } - } - elsif ($string eq "reset") { - foreach (@fonts) { - next if not defined($_->{'default'}); - set_font($self, $_, $_->{'default'}); - } - } - elsif ($string eq "show") { - - my $term = $self->{'term'}; - $term->{'resize-font'}{'overlay'} = { - ov => $term->overlay_simple(0, -1, format_font_info($self)), - to => urxvt::timer - ->new - ->start(urxvt::NOW + 1) - ->cb(sub { - delete $term->{'resize-font'}{'overlay'}; - }), - }; - } - - () -} - -sub get_font { - my ($self, $name) = @_; - return $self->resource($name); -} - -sub set_font { - my ($self, $font, $new) = @_; - $self->cmd_parse(sprintf("\33]%d;%s\007", $font->{'code'}, $new)); -} - -sub update_font_size { - my ($self, $font, $delta) = @_; - my $regex = qr"(?<=size=)(\d+)"; - my $current = get_font($self, $font->{'name'}); - - my ($index) = grep { $fixed[$_] eq $current } 0..$#fixed; - if ($index or $index eq 0) { - my $inc = $delta / abs($delta); - $index += $inc; - if ($index < 0) { $index = 0; } - if ($index > $#fixed) { $index = $#fixed; } - $current = $fixed[$index]; - } - elsif ($current =~ /^-/) { - my @font = split(/-/, $current); - # https://en.wikipedia.org/wiki/X_logical_font_description - my $newsize = $font[7]+$delta; - $font[7] = $newsize if ($newsize > 0); - $current = join('-', @font); - } - else { - my $newsize = $1+$delta if ($current =~ /$regex/); - $current =~ s/$regex/$newsize/ge if ($newsize > 0); - } - set_font($self, $font, $current); -} - -sub format_font_info { - my ($self) = @_; - - my $width = 0; - foreach (@fonts) { - my $length = length($_->{'name'}); - $width = $length > $width ? $length : $width; - } - ++$width; - - my $info = ''; - foreach (@fonts) { - $info .= sprintf("%-${width}s %s\n", $_->{'name'} . ':', - get_font($self, $_->{'name'})); - } - - return $info; -} diff --git a/.config/urxvt/ext/url-select b/.config/urxvt/ext/url-select @@ -1,408 +0,0 @@ -#! perl -w -# Author: Bert Muennich -# Website: http://www.github.com/muennich/urxvt-perls -# Based on: http://www.jukie.net/~bart/blog/urxvt-url-yank -# License: GPLv2 - -# Use keyboard shortcuts to select URLs. -# This should be used as a replacement for the default matcher extension, -# it also makes URLs clickable with the middle mouse button. - -# Usage: put the following lines in your .Xdefaults/.Xresources: -# URxvt.perl-ext-common: ...,url-select -# URxvt.keysym.M-u: perl:url-select:select_next - -# Use Meta-u to activate URL selection mode, then use the following keys: -# j/k: Select next downward/upward URL (also with arrow keys) -# g/G: Select first/last URL (also with home/end key) -# o/Return: Open selected URL in browser, Return: deactivate afterwards -# y: Copy (yank) selected URL and deactivate selection mode -# q/Escape: Deactivate URL selection mode - -# Options: -# URxvt.url-select.autocopy: If true, selected URLs are copied to PRIMARY -# URvxt.url-select.button: Mouse button to click-open URLs (default: 2) -# URxvt.url-select.launcher: Browser/command to open selected URL with -# URxvt.url-select.underline: If set to true, all URLs get underlined - -use strict; - -# The custom rendition bit to use for marking the cell as being underlined -# by us so we can unset it again after a line has changed. -use constant UNDERLINED => 1<<3; # arbitrarily chosen in hope of no collision - -sub on_start { - my ($self) = @_; - - # read resource settings - if ($self->x_resource('url-select.launcher')) { - @{$self->{browser}} = split /\s+/, $self->x_resource('url-select.launcher'); - } else { - @{$self->{browser}} = ('x-www-browser'); - } - if ($self->x_resource('url-select.underline') eq 'true') { - $self->enable(line_update => \&line_update); - } - if ($self->x_resource('url-select.autocopy') eq 'true') { - $self->{autocopy} = 1; - } - - $self->{state} = 0; - - for my $mod (split '', $self->x_resource("url-select.button") || - $self->x_resource("matcher.button") || 2) { - if ($mod =~ /^\d+$/) { - $self->{button} = $mod; - } elsif ($mod eq "C") { - $self->{state} |= urxvt::ControlMask; - } elsif ($mod eq "S") { - $self->{state} |= urxvt::ShiftMask; - } elsif ($mod eq "M") { - $self->{state} |= $self->ModMetaMask; - } elsif ($mod ne "-" && $mod ne " ") { - warn("invalid button/modifier in $self->{_name}<$self->{argv}[0]>: $mod\n"); - } - } - - if ($self->x_resource('matcher.pattern')) { - @{$self->{pattern}} = ($self->x_resource('matcher.pattern')); - } elsif ($self->x_resource('matcher.pattern.0')) { - my $current = 0; - - while (defined (my $res = $self->x_resource("matcher.pattern.$current"))) { - $res = $self->locale_decode($res); - utf8::encode $res; - push @{$self->{pattern}}, qr($res)x; - $current++; - } - } else { - @{$self->{pattern}} = qr{ - (?:https?://|ftp://|news://|mailto:|file://|\bwww\.) - [\w\-\@;\/?:&=%\$.+!*\x27,~#]* - ( - \([\w\-\@;\/?:&=%\$.+!*\x27,~#]*\) # Allow a pair of matched parentheses - | # - [\w\-\@;\/?:&=%\$+*~] # exclude some trailing characters (heuristic) - )+ - }x; - } - - () -} - - -sub line_update { - my ($self, $row) = @_; - - my $line = $self->line($row); - my $text = $line->t; - my $rend = $line->r; - - # clear all underlines that were set by us - for (@$rend) { - if (urxvt::GET_CUSTOM($_) & UNDERLINED) { - $_ = urxvt::SET_CUSTOM($_, urxvt::GET_CUSTOM($_) & ~UNDERLINED) & - ~urxvt::RS_Uline; - } - } - - for my $pattern (@{$self->{pattern}}) { - while ($text =~ /$pattern/g) { - my $url = $&; - my ($beg, $end) = ($-[0], $+[0] - 1); - - for (@{$rend}[$beg .. $end]) { - unless ($_ & urxvt::RS_Uline) { - $_ = urxvt::SET_CUSTOM($_, urxvt::GET_CUSTOM($_) | UNDERLINED); - $_ |= urxvt::RS_Uline; - } - } - } - } - - $line->r($rend); - - () -} - -sub on_action { - my ($self, $action) = @_; - - on_user_command($self, "url-select:" . $action); -} - - -sub on_user_command { - my ($self, $cmd) = @_; - - if ($cmd eq 'url-select:select_next') { - if (not $self->{active}) { - activate($self); - } - select_next($self, -1); - } - - () -} - - -sub key_press { - my ($self, $event, $keysym) = @_; - my $char = chr($keysym); - - if ($keysym == 0xff1b || lc($char) eq 'q' || - (lc($char) eq 'c' && $event->{state} & urxvt::ControlMask)) { - deactivate($self); - } elsif ($keysym == 0xff0d || $char eq 'o' || - (lc($char) eq 'm' && $event->{state} & urxvt::ControlMask)) { - $self->exec_async(@{$self->{browser}}, ${$self->{found}[$self->{n}]}[4]); - deactivate($self) unless $char eq 'o'; - } elsif ($char eq 'y') { - my $found = $self->{found}[$self->{n}]; - $self->selection_beg(${$found}[0], ${$found}[1]); - $self->selection_end(${$found}[2], ${$found}[3]); - $self->selection_make($event->{time}); - $self->selection_beg(1, 0); - $self->selection_end(1, 0); - deactivate($self); - } elsif ($char eq 'k' || $keysym == 0xff52 || $keysym == 0xff51) { - select_next($self, -1, $event); - } elsif ($char eq 'j' || $keysym == 0xff54 || $keysym == 0xff53) { - select_next($self, 1, $event); - } elsif ($char eq 'g' || $keysym == 0xff50) { - $self->{row} = $self->top_row - 1; - delete $self->{found}; - select_next($self, 1, $event); - } elsif ($char eq 'G' || $keysym == 0xff57) { - $self->{row} = $self->nrow; - delete $self->{found}; - select_next($self, -1, $event); - } - - return 1; -} - - -sub on_button_press { - my ($self, $event) = @_; - - my $mask = $self->ModLevel3Mask | $self->ModMetaMask | - urxvt::ShiftMask | urxvt::ControlMask; - - if ($event->{button} == $self->{button} && ($event->{state} & $mask) == $self->{state}) { - my $col = $event->{col}; - my $row = $event->{row}; - my $line = $self->line($row); - my $text = $line->t; - - for my $pattern (@{$self->{pattern}}) { - while ($text =~ /$pattern/g) { - my ($url, $beg, $end) = ($&, $-[0], $+[0]); - --$end if $url =~ s/["')]$//; - - if ($col >= $beg && $col <= $end) { - $self->{button_pressed} = 1; - $self->{button_col} = $col; - $self->{button_row} = $row; - $self->{button_url} = $url; - return 1; - } - } - } - } - - () -} - -sub on_button_release { - my ($self, $event) = @_; - - if ($self->{button_pressed} && $event->{button} == $self->{button}) { - my $col = $event->{col}; - my $row = $event->{row}; - - $self->{button_pressed} = 0; - - if ($col == $self->{button_col} && $row == $self->{button_row}) { - $self->exec_async(@{$self->{browser}}, $self->{button_url}); - return 1; - } - } - - () -} - - -sub select_next { - # $dir < 0: up, > 0: down - my ($self, $dir, $event) = @_; - my $row = $self->{row}; - - if (($dir < 0 && $self->{n} > 0) || - ($dir > 0 && $self->{n} < $#{ $self->{found} })) { - # another url on current line - $self->{n} += $dir; - hilight($self); - if ($self->{autocopy}) { - my $found = $self->{found}[$self->{n}]; - $self->selection_beg(${$found}[0], ${$found}[1]); - $self->selection_end(${$found}[2], ${$found}[3]); - $self->selection_make($event->{time}); - $self->selection_beg(1, 0); - $self->selection_end(1, 0); - } - return; - } - - while (($dir < 0 && $row > $self->top_row) || - ($dir > 0 && $row < $self->nrow - 1)) { - my $line = $self->line($row); - $row = ($dir < 0 ? $line->beg : $line->end) + $dir; - $line = $self->line($row); - my $text = $line->t; - - for my $pattern (@{$self->{pattern}}) { - if ($text =~ /$pattern/g) { - delete $self->{found}; - - do { - my ($beg, $end) = ($-[0], $+[0]); - push @{$self->{found}}, [$line->coord_of($beg), - $line->coord_of($end), substr($text, $beg, $end - $beg)]; - } while ($text =~ /$pattern/g); - - $self->{row} = $row; - $self->{n} = $dir < 0 ? $#{$self->{found}} : 0; - hilight($self); - if ($self->{autocopy}) { - my $found = $self->{found}[$self->{n}]; - $self->selection_beg(${$found}[0], ${$found}[1]); - $self->selection_end(${$found}[2], ${$found}[3]); - $self->selection_make($event->{time}); - $self->selection_beg(1, 0); - $self->selection_end(1, 0); - } - return; - } - } - } - - deactivate($self) unless $self->{found}; - - () -} - - -sub hilight { - my ($self) = @_; - - if ($self->{found}) { - if ($self->{row} < $self->view_start() || - $self->{row} >= $self->view_start() + $self->nrow) { - # scroll selected url into visible area - my $top = $self->{row} - ($self->nrow >> 1); - $self->view_start($top < 0 ? $top : 0); - } - - status_area($self); - $self->want_refresh(); - } - - () -} - - -sub refresh { - my ($self) = @_; - - if ($self->{found}) { - if ($self->x_resource('highlightColor')) { - $self->scr_xor_span(@{$self->{found}[$self->{n}]}[0 .. 3], urxvt::RS_Sel); - } else { - $self->scr_xor_span(@{$self->{found}[$self->{n}]}[0 .. 3], urxvt::RS_RVid); - } - } - - () -} - - -sub status_area { - my ($self) = @_; - - my $row = $self->{row} < 0 ? - $self->{row} - $self->top_row : abs($self->top_row) + $self->{row}; - my $text = sprintf("%d,%d ", $row + 1, $self->{n} + 1); - - if ($self->top_row == 0) { - $text .= "All"; - } elsif ($self->view_start() == $self->top_row) { - $text .= "Top"; - } elsif ($self->view_start() == 0) { - $text .= "Bot"; - } else { - $text .= sprintf("%2d%", - ($self->top_row - $self->view_start) * 100 / $self->top_row); - } - - my $text_len = length($text); - - if ($self->{overlay_len} != $text_len) { - delete $self->{overlay} if $self->{overlay}; - $self->{overlay} = $self->overlay(-1, -1, $text_len, 1, - urxvt::OVERLAY_RSTYLE, 0); - $self->{overlay_len} = $text_len; - } - - $self->{overlay}->set(0, 0, $self->special_encode($text)); - $self->{overlay}->show(); - - () -} - - -sub tt_write { - return 1; -} - - -sub activate { - my ($self) = @_; - - $self->{active} = 1; - - $self->{row} = $self->view_start() + $self->nrow; - $self->{n} = 0; - $self->{overlay_len} = 0; - $self->{button_pressed} = 0; - - $self->{view_start} = $self->view_start(); - $self->{pty_ev_events} = $self->pty_ev_events(urxvt::EV_NONE); - - $self->enable( - key_press => \&key_press, - refresh_begin => \&refresh, - refresh_end => \&refresh, - tt_write => \&tt_write, - ); - - () -} - - -sub deactivate { - my ($self) = @_; - - $self->disable("key_press", "refresh_begin", "refresh_end", "tt_write"); - $self->view_start($self->{view_start}); - $self->pty_ev_events($self->{pty_ev_events}); - - delete $self->{overlay} if $self->{overlay}; - delete $self->{found} if $self->{found}; - - $self->want_refresh(); - - $self->{active} = 0; - - () -} diff --git a/.config/vimb/scripts.js b/.config/vimb/scripts.js @@ -9,25 +9,25 @@ function addGlobalStyle(css) { } var hostname = window.location.hostname; if (hostname == "www.youtube.com") { -addGlobalStyle("#watch7-sidebar *, #watch7-content *{background-color:#141726 !important; border-radius:#141726 !important;}#masthead-positioner, #masthead-positioner-height-offset{display:none !important;}#meta-contents{margin-bottom:2vw !important;}ytd-watch-flexy #secondary{padding:2.5vw !important;}ytd-watch-flexy #player{display:none !important;}ytd-watch-flexy #primary-inner, ytd-watch-flexy #secondary-inner{padding:2.5vw !important;margin:0.5vw !important;background-color:#14172666 !important}.ytp-videowall-still-info-content *{background-color:#090711cc !important;padding:1vw;margin:0 !important;}.ytp-videowall-info-content{padding:0 !important;}a *{font-weight:bold !important;}*{color:#1e5eb3 !important;}#columns{margin:0 !important;padding-left:4vw !important;padding-right:4vw} .avatar-container *{ background-color:#141726 !important;}a{ font-weight:bold !important;}.sbdd_a *{ background-color:#141726 !important; border:0 !important;}.ytp-ad-image-overlay *{ display:none !important;}ytd-video-masthead-ad-v3-renderer{ display:none !important;}ytd-section-list-renderer{ background-color:#070911 !important;}.ytd-page-manager{ background-color:#070911 !important;}#channel-container *{ background-color:#141726 !important;}app-toolbar *{ background-color:#141726 !important;g}ytd-guide-renderer{ background-color:#141726 !important;}ytd-mini-guide-renderer,ytd-mini-guide-renderer *{ background-color:#141726 !important;}ytd-section-list-renderer{ background-color:#070911 !important;}.ytd-page-manager{ background-color:#070911 !important;}#channel-container *{ background-color:#141726 !important;}app-toolbar *{ background-color:#141726 !important;g}ytd-guide-renderer{ background-color:#141726 !important;}ytd-clarification-renderer{ display:none !important;}::placeholder,input{font-family:monospace;}.ytd-playlist-panel-renderer{background:rgba(0,0,0,0) !important;}ytd-player #container #movie_player{background-color:#090711 !important;}#merch-shelf{display:none !important;}#columns{background-color:#090711;}#masthead-container #container{ background-color:#141726;}#masthead-container #container #logo-icon-container,#country-code,#guide-icon,#end #buttons{ display:none;}#container.ytd-searchbox input.ytd-searchbox{ color:#bbbbff !important;;}html{ font-family:monospace !important; font-size:9px !important;}#top-level-buttons{ display:none !important;}ytd-menu-renderer{ display:none !important;}#companion,#like-bar{ display:none !important;}.style-scope .ytd-sentiment-bar-renderer{ display:none !important;}#subscribe-button{ display:none !important;}ytd-rich-metadata-renderer{ display:none !important;}yt-dropdown-menu{ display:none !important;}ytd-comment-simplebox-renderer{ display:none;}.ytd-comments #header{ display:none !important;}.ytd-video-owner-renderer{ display:none;}span{ color:#ffffff;}ytd-expander{ margin-left:0 !important;;}#collapsible .style-scope .ytd-video-secondary-info-renderer{ display:none !important;}ytd-player{ background-color:#090711;}.ytp-gradient-bottom{ display:none;}.ytp-chrome-controls{ background-color:#141726;}"); +addGlobalStyle("#watch7-sidebar *, #watch7-content *{background-color:#141726 !important; border-radius:#141726 !important;}#masthead-positioner, #masthead-positioner-height-offset{display:none !important;}#meta-contents{margin-bottom:2vw !important;}ytd-watch-flexy #secondary{padding:2.5vw !important;}ytd-watch-flexy #player{display:none !important;}ytd-watch-flexy #primary-inner, ytd-watch-flexy #secondary-inner{padding:2.5vw !important;margin:0.5vw !important;background-color:#14172666 !important}.ytp-videowall-still-info-content *{background-color:#0c0a14cc !important;padding:1vw;margin:0 !important;}.ytp-videowall-info-content{padding:0 !important;}a *{font-weight:bold !important;}*{color:#1e5eb3 !important;}#columns{margin:0 !important;padding-left:4vw !important;padding-right:4vw} .avatar-container *{ background-color:#141726 !important;}a{ font-weight:bold !important;}.sbdd_a *{ background-color:#141726 !important; border:0 !important;}.ytp-ad-image-overlay *{ display:none !important;}ytd-video-masthead-ad-v3-renderer{ display:none !important;}ytd-section-list-renderer{ background-color:#070911 !important;}.ytd-page-manager{ background-color:#070911 !important;}#channel-container *{ background-color:#141726 !important;}app-toolbar *{ background-color:#141726 !important;g}ytd-guide-renderer{ background-color:#141726 !important;}ytd-mini-guide-renderer,ytd-mini-guide-renderer *{ background-color:#141726 !important;}ytd-section-list-renderer{ background-color:#070911 !important;}.ytd-page-manager{ background-color:#070911 !important;}#channel-container *{ background-color:#141726 !important;}app-toolbar *{ background-color:#141726 !important;g}ytd-guide-renderer{ background-color:#141726 !important;}ytd-clarification-renderer{ display:none !important;}::placeholder,input{font-family:monospace;}.ytd-playlist-panel-renderer{background:rgba(0,0,0,0) !important;}ytd-player #container #movie_player{background-color:#0c0a14 !important;}#merch-shelf{display:none !important;}#columns{background-color:#0c0a14;}#masthead-container #container{ background-color:#141726;}#masthead-container #container #logo-icon-container,#country-code,#guide-icon,#end #buttons{ display:none;}#container.ytd-searchbox input.ytd-searchbox{ color:#bbbbff !important;;}html{ font-family:monospace !important; font-size:9px !important;}#top-level-buttons{ display:none !important;}ytd-menu-renderer{ display:none !important;}#companion,#like-bar{ display:none !important;}.style-scope .ytd-sentiment-bar-renderer{ display:none !important;}#subscribe-button{ display:none !important;}ytd-rich-metadata-renderer{ display:none !important;}yt-dropdown-menu{ display:none !important;}ytd-comment-simplebox-renderer{ display:none;}.ytd-comments #header{ display:none !important;}.ytd-video-owner-renderer{ display:none;}span{ color:#ffffff;}ytd-expander{ margin-left:0 !important;;}#collapsible .style-scope .ytd-video-secondary-info-renderer{ display:none !important;}ytd-player{ background-color:#0c0a14;}.ytp-gradient-bottom{ display:none;}.ytp-chrome-controls{ background-color:#141726;}"); document.getElementsByTagName("html")[0].setAttribute("dark","true"); } if (hostname == "gitlab.com") { var element = document.getElementsByTagName("tr"); element.outerHTML = element.outerHTML; -addGlobalStyle("*{color:#1e5eb3 !important;}#js-tab-pipeline *{background-color:#090711 !important}form *{background-color:#090711 !important;}h1,h2,h3,h4,h5,h6{color:inherit !important;}.avatar-container *{ background-color:#141726 !important;}.top-bar{ background:#111111 !important;}aside{ background-color:#111111 !important;}.js-jobs-container{ background-color:#111111 !important;}.build-job *{ background-color:#222222 !important; border:0 !important;}body.ui-indigo .navbar-gitlab .navbar-sub-nav > li.active > button{ background-color:rgba(10,10,10,0.5) !important;}.content-block, .content-block *, .content-block * *{ background-color:#141726 !important;}.dropdown{ background-color:rgba(0,0,0,0) !important;}.file-holder *{ background-color:#141726 !important;}.banner-callout{ display:none !important;}.bg-light{ background-color:#141726 !important; border:none !important;}*{ color:#1e5eb3 !important; border-radius:0 !important;}.avatar-tile{ background-color:#141726 !important;}.avatar-container{ background-color:rgba(0,0,0,0) !important;}textarea{ border:0 !important; background-color:rgba(50,50,50,0.5) !important;}.input-group-prepend,.input-group-prepend div{ border:0 !important; background-color:rgba(25,25,25,0.5) !important;}gspan{color:#aaaaaa !important}.commit-sha-group div{ background-color:#141726 !important; border:0 !important; color:#ffffff !important;}.ci-status-link{ display:none !important;}.card, .card div{ background-color:#141726 !important;}.card{ border:0 !important;}.row-content-block{ background-color:#141726; border:0 !important;}.commit-header{ background-color:#141726 !important; border:0 !important;}body{font-family:monospace !important}.toggle-sidebar-button{ background-color:#141726; border:0 !important;}.dropdown-menu{ background-color:#141726;}input{ background:rgba(50,50,50,0.5) !important;}.cover-block{ background-color:#141726; color:#ffffff !important; padding-bottom:5vh !important;}.cover-block p,.cover-block .cover-title{ color:#ffffff !important;}.profile-link-holder{ color:#ffffff !important;}.cover-block .scrolling-tabs-container .nav-links{ border-bottom:0; position:relative; top:5vh;}.cover-block .scrolling-tabs-container .nav-links li{ border-top:#ffffff 1px solid !important;}.user-caller{display:none !important;}.avatar-container{border:0 !important;border-radius:0 !important;}article{border:0 !important;}article div{background-color:#141726 !important; border:0 !important; color:#ffffff !important;}article p{ color:#ffffff !important;}code{ background-color:rgba(15,15,15,0.5)}body{ background-color:#090711; color:#1e5eb3 !important;}#content-body input,#content-body button,#content-body.dropdown,#content-body a{ border:none; background-color:rgba(0,0,0,0) !important; color:#1e5eb3 !important;font-weight:bold !important;}header{ background-color:#141726 !important;}.nav-sidebar{ background-color:#141726 !important;}.fly-out-list{ background-color:#141726 !important; border:0; border:#393982 1px solid !important; color:#ffffff !important;}a{ color:#ffffff !important;}.info-well{ background-color:rgba(0,0,0,0); border:0;}.bs-callout{ display:none !important;}.count-badge-count{ display:none !important;}table{ border:0 !important; background-color:rgba(0,0,0,0) !important; color:#ffffff !important;}.table-holder{ border:0 !important;}thead th{ background-color:#141726 !important; border:0 !important;}tr{ border-bottom-color:#141726 !important;}tr:hover{ border-bottom-color:#141726 !important; display:}"); +addGlobalStyle("*{color:#1e5eb3 !important;}#js-tab-pipeline *{background-color:#0c0a14 !important}form *{background-color:#0c0a14 !important;}h1,h2,h3,h4,h5,h6{color:inherit !important;}.avatar-container *{ background-color:#141726 !important;}.top-bar{ background:#111111 !important;}aside{ background-color:#111111 !important;}.js-jobs-container{ background-color:#111111 !important;}.build-job *{ background-color:#222222 !important; border:0 !important;}body.ui-indigo .navbar-gitlab .navbar-sub-nav > li.active > button{ background-color:rgba(10,10,10,0.5) !important;}.content-block, .content-block *, .content-block * *{ background-color:#141726 !important;}.dropdown{ background-color:rgba(0,0,0,0) !important;}.file-holder *{ background-color:#141726 !important;}.banner-callout{ display:none !important;}.bg-light{ background-color:#141726 !important; border:none !important;}*{ color:#1e5eb3 !important; border-radius:0 !important;}.avatar-tile{ background-color:#141726 !important;}.avatar-container{ background-color:rgba(0,0,0,0) !important;}textarea{ border:0 !important; background-color:rgba(50,50,50,0.5) !important;}.input-group-prepend,.input-group-prepend div{ border:0 !important; background-color:rgba(25,25,25,0.5) !important;}gspan{color:#aaaaaa !important}.commit-sha-group div{ background-color:#141726 !important; border:0 !important; color:#ffffff !important;}.ci-status-link{ display:none !important;}.card, .card div{ background-color:#141726 !important;}.card{ border:0 !important;}.row-content-block{ background-color:#141726; border:0 !important;}.commit-header{ background-color:#141726 !important; border:0 !important;}body{font-family:monospace !important}.toggle-sidebar-button{ background-color:#141726; border:0 !important;}.dropdown-menu{ background-color:#141726;}input{ background:rgba(50,50,50,0.5) !important;}.cover-block{ background-color:#141726; color:#ffffff !important; padding-bottom:5vh !important;}.cover-block p,.cover-block .cover-title{ color:#ffffff !important;}.profile-link-holder{ color:#ffffff !important;}.cover-block .scrolling-tabs-container .nav-links{ border-bottom:0; position:relative; top:5vh;}.cover-block .scrolling-tabs-container .nav-links li{ border-top:#ffffff 1px solid !important;}.user-caller{display:none !important;}.avatar-container{border:0 !important;border-radius:0 !important;}article{border:0 !important;}article div{background-color:#141726 !important; border:0 !important; color:#ffffff !important;}article p{ color:#ffffff !important;}code{ background-color:rgba(15,15,15,0.5)}body{ background-color:#0c0a14; color:#1e5eb3 !important;}#content-body input,#content-body button,#content-body.dropdown,#content-body a{ border:none; background-color:rgba(0,0,0,0) !important; color:#1e5eb3 !important;font-weight:bold !important;}header{ background-color:#141726 !important;}.nav-sidebar{ background-color:#141726 !important;}.fly-out-list{ background-color:#141726 !important; border:0; border:#393982 1px solid !important; color:#ffffff !important;}a{ color:#ffffff !important;}.info-well{ background-color:rgba(0,0,0,0); border:0;}.bs-callout{ display:none !important;}.count-badge-count{ display:none !important;}table{ border:0 !important; background-color:rgba(0,0,0,0) !important; color:#ffffff !important;}.table-holder{ border:0 !important;}thead th{ background-color:#141726 !important; border:0 !important;}tr{ border-bottom-color:#141726 !important;}tr:hover{ border-bottom-color:#141726 !important; display:}"); } -if (hostname == "searx.me" || hostname == "searx.ch") {addGlobalStyle("*{color:#1e5eb3 !important;border-color:#1e5e3 !important;}#categories label{ background-color:#141726; border:none !important; padding:1vw; cursor:pointer; border-bottom:#5555 5px solid !important;}.result{ background-color:rgba(0,0,0,0) !important;}.highlight{ background-color:#aaa !important;}.alert{ background-color:rgba(10,10,10,0.5) !important;}.panel div{ background-color:#090711 !important; color:#1e5eb3 !important;}.panel img{ border:7.5px solid #141726}.searx-navbar{ background-color:#141726;}body{ background-color:#090711; font-family:monospace !important;}input,button{ background-color:rgba(0,0,0,0) !important;}.footer{ display:none;}");} +if (hostname == "searx.me" || hostname == "searx.ch") {addGlobalStyle("*{color:#1e5eb3 !important;border-color:#1e5e3 !important;}#categories label{ background-color:#141726; border:none !important; padding:1vw; cursor:pointer; border-bottom:#5555 5px solid !important;}.result{ background-color:rgba(0,0,0,0) !important;}.highlight{ background-color:#aaa !important;}.alert{ background-color:rgba(10,10,10,0.5) !important;}.panel div{ background-color:#0c0a14 !important; color:#1e5eb3 !important;}.panel img{ border:7.5px solid #141726}.searx-navbar{ background-color:#141726;}body{ background-color:#0c0a14; font-family:monospace !important;}input,button{ background-color:rgba(0,0,0,0) !important;}.footer{ display:none;}");} if (hostname == "neinchan.com") { addGlobalStyle(".greenText{color:#3ab475 !important;}a{color:#3ab475 !important;font-weight:bold !important;font-decoration:underline !important;}*{color:#1e5eb3 !important;}fieldset{ border:0 !important;}fieldset legend{ display:none !important;}.small{ display:none !important;g}*{border-radius:0 !important; background-color:#070911 !important;font-family:monospace !important;}nav{ padding-top:2vh !important; border-bottom:#aaaaaa 1px solid !important;}nav *,nav{ background-color:#141726 !important; color:#1e5eb3 !important;}hr{ border:0 !important; border-bottom:#aaaaaa 1px solid !important;}.postCell .innerPost{ border:#aaaaaa 1px solid !important;}.deletionCheckBox{ display:none !important;}th{ border:#aaaaaa 0.5px solid !important; padding-left:1vw !important; padding-right:1vw !important;}table input,table textarea,table .dropzone,button{ border:#aaaaaa 0.5px solid !important; padding:0.5vw !important; max-width:285px !important;}") document.getElementsByTagName("table")[0].setAttribute("cellspacing","0") } -function wikipedia() {addGlobalStyle("#mw-panel{margin:0 !important;width:10vw !important;}body{margin-right:10vw !important;}mw-navigation{display:none !important;}*{ border-color:#333333 !important;}img{ background-color:#333 !important;}code{color:#892b2b;border:0 !important;border-bottom:#fff 1px solid !important}html *{ background-color:#090711 !important; border-radius:0 !important;}p,h1,h2,h3,h4,h5,h6{ color:#892b2b !important;}.collapsible-heading div{ display:none !important;}th,td{ color:#ffffff;}a{ color:#3ab475 !important;}div{ color:#892b2b !important;}.mw-wiki-logo{ display:none !important;}#p-logo{ display:none !important;}#content{ border:none !important;}#mp-upper *,#mp-bottom *,#mp-center *,#mp-other-content *,#mp-other-lower *{ border:0 !important;}");} +function wikipedia() {addGlobalStyle("#mw-panel{margin:0 !important;width:10vw !important;}body{margin-right:10vw !important;}mw-navigation{display:none !important;}*{ border-color:#333333 !important;}img{ background-color:#333 !important;}code{color:#892b2b;border:0 !important;border-bottom:#fff 1px solid !important}html *{ background-color:#0c0a14 !important; border-radius:0 !important;}p,h1,h2,h3,h4,h5,h6{ color:#892b2b !important;}.collapsible-heading div{ display:none !important;}th,td{ color:#ffffff;}a{ color:#3ab475 !important;}div{ color:#892b2b !important;}.mw-wiki-logo{ display:none !important;}#p-logo{ display:none !important;}#content{ border:none !important;}#mp-upper *,#mp-bottom *,#mp-center *,#mp-other-content *,#mp-other-lower *{ border:0 !important;}");} if (hostname == "en.wikipedia.org") { wikipedia(); } if (hostname == "en.m.wikipedia.org") { wikipedia(); } -if (hostname == "duckduckgo.com") {addGlobalStyle("body *{background-color:#090711 !important;color:#1e5eb3 !important;}a *{text-decoration:underline !important;}#header_wrapper *{background-color:#141726 !important;}.header--aside{display:none !important;}#header_wrapper{width:100vw !important; background-color:#141726 !important;}.header__search{border:#1e5eb3 1px solid !important;}div.search-filters-wrap::before{display:none !important;}div.search-filters-wrap::after{display:none !important;}.results--ads{display:none !important;}#header, #header *{background-color:#141726 !important;}") +if (hostname == "duckduckgo.com") {addGlobalStyle("body *{background-color:#0c0a14 !important;color:#1e5eb3 !important;}a *{text-decoration:underline !important;}#header_wrapper *{background-color:#141726 !important;}.header--aside{display:none !important;}#header_wrapper{width:100vw !important; background-color:#141726 !important;}.header__search{border:#1e5eb3 1px solid !important;}div.search-filters-wrap::before{display:none !important;}div.search-filters-wrap::after{display:none !important;}.results--ads{display:none !important;}#header, #header *{background-color:#141726 !important;}") } diff --git a/.config/vimb/style.css b/.config/vimb/style.css @@ -1,5 +1,5 @@ span[vimbhint^='label'] { - background-color:#0a542599 !important; + background-color:#0c0a1499 !important; border:0 !important; color:#fff !important; opacity:1 !important; @@ -8,10 +8,10 @@ span[vimbhint^='label'] { font-size:16px !important; } *[vimbhint^='hint'] { - background-color:#0a542533 !important; + background-color:#0c0a1433 !important; } *[vimbhint^='hint focus'] { - background-color:#0a542533 !important; + background-color:#0c0a1433 !important; } *{ border-radius:0 !important; diff --git a/.profile b/.profile @@ -13,7 +13,7 @@ export SCRIPTS="$HOME/.scripts/bin" scripts=$(ls -d $SCRIPTS/*/ | tr '\n' ':') export PATH="$PATH:$scripts" export EDITOR="vim" -export TERMINAL="urxvt" +export TERMINAL="st" export BROWSER="vimb" export work="$HOME/work" export WORK="$HOME/work" diff --git a/.scripts/bin/display/rfeh b/.scripts/bin/display/rfeh @@ -54,7 +54,8 @@ allfiles() { randomize() { filearray=($files) length=${#filearray[@]} - randomn=$(($RANDOM%$length)) + randoms=$(od -vAn -N2 -tu2 < /dev/urandom) + randomn=$((1+$randoms%$length)) echo ${filearray[$randomn]} } diff --git a/.scripts/bin/dmenu/dpass b/.scripts/bin/dmenu/dpass @@ -19,11 +19,10 @@ Written by Hayden Hamilton <haydenvh.com>" exit 0 fi dmenu="dmenu" -. $HOME/.dmenurc [ ! -f $PASS ] && touch $PASS pass=$(printf "GENERATE\nEDIT\n$(cat $PASS | awk '// {print $1}')" | $dmenu -l 50 -i -p "Select a password/generate/edit:" | tr '[:upper:]' '[:lower:]') -getpass=$(cat $PASS | awk "/$pass/ "'{print $0}') +getpass=$(cat "$PASS" | awk "/$pass/ "'{print $0}') if [ "$pass" == "" ] then exit 0 @@ -31,16 +30,13 @@ elif [ "$pass" == "generate" ] then password=$(head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9~!@#$%^&*_+=-' | fold -w 30 | head -n 1) passname=$(echo "" | $dmenu -l 50 -i -p "Name for password (only 1 word):") - if [ "$passname" == "" ] - then - passname="pleaseeditthis" - fi + [ "$passname" == "" ] && passname="pleaseeditthis" echo "$passname: $password" >> $PASS [ "$(printf "No\nYes" | $dmenu -i -p "Edit the pasword file?")" == "Yes" ] && $TERMINAL "$1" vim $PASS elif [ "$pass" == "edit" ] then $TERMINAL "$1" vim $PASS else - echo $getpass | sed "s/$pass.//g" | tr " " "\n" | $dmenu $2 -P -l 20 -p "Password:" | xclip + echo "$getpass" | sed "s/$pass.//g" | tr " " "\n" | $dmenu $2 -P -l 20 -p "Password:" | xclip notify-send "Password copied to clipboard." fi diff --git a/.scripts/bin/misc/rmpv b/.scripts/bin/misc/rmpv @@ -28,7 +28,8 @@ allfiles() { randomize() { filearray=($files) length=${#filearray[@]} - randomn=$(($RANDOM%$length)) + randoms=$(od -vAn -N2 -tu2 < /dev/urandom) + randomn=$((1+$randoms%$length)) echo ${filearray[$randomn]} } diff --git a/.scripts/i3blocks/mpv b/.scripts/i3blocks/mpv @@ -6,8 +6,10 @@ # haydenvh.com # Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 haydenh.gitlab.io/p/gplv2.license -file=$(echo '{command:["get_property", "media-title"]}' | socat - /tmp/mpv-socket | tr "." " " | sed 's/opus//g' | sed 's/mp3//g' | sed 's/mkv//g' | sed 's/flac//g' | sed 's/webm//g' | sed 's/part//g' | tr '"\{:,}[' ' ' | sed 's/data//g' | sed 's/request_id 0//g' | sed 's/error success//g' | sed 's/ //g' | tail -c +2 | sed 's/$//g' | tr "()'" " " | sed 's/ / /g' |sed 's/ / /g' | sed 's/ / /g' | sed 's/ / /g' | cut -zc-40) -vidtitle=$(echo '{command:["get_property", "media-title"]}' | socat - /tmp/mpv-socket2 | tr '"{:,}\[' ' ' | sed 's/data//g' | sed 's/request_id 0//g' | sed 's/error success//g' | sed 's/ / /g' | sed 's/ / /g' | sed 's/ / /g' | sed 's/ / /g' | cut -zc-40) +file=$(echo '{command:["get_property", "media-title"]}' | socat - /tmp/mpv-socket | tr "." " " | sed 's/opus//g' | sed 's/mp3//g' | sed 's/mkv//g' | sed 's/flac//g' | sed 's/webm//g' | sed 's/part//g' | tr '"\{:,}[' ' ' | sed 's/data//g' | sed 's/request_id 0//g' | sed 's/error success//g' | sed 's/ //g' | tail -c +2 | sed 's/$//g' | tr "()'" " " | sed 's/ / /g' |sed 's/ / /g' | sed 's/ / /g' | sed 's/ / /g') +file2=$(echo "$file" | cut -zc-25) +vidtitle=$(echo '{command:["get_property", "media-title"]}' | socat - /tmp/mpv-socket2 | tr '"{:,}\[' ' ' | sed 's/data//g' | sed 's/request_id 0//g' | sed 's/error success//g' | sed 's/ / /g' | sed 's/ / /g' | sed 's/ / /g' | sed 's/ / /g' | sed 's/^//g') +vidtitle2=$(echo "$vidtitle" | cut -zc-25) state=$(echo '{ "command": ["get_property", "pause"] }' | socat - /tmp/mpv-socket | tr '{":0,}' ' ' | awk '// {print $2}') state2=$(echo '{ "command": ["get_property", "pause"] }' | socat - /tmp/mpv-socket2 | tr '{":0,}' ' ' | awk '// {print $2}') convertsecs() { @@ -18,26 +20,27 @@ convertsecs() { } time=$(convertsecs $(echo '{ "command": ["get_property", "playback-time"] }' | socat - /tmp/mpv-socket | tr '{":,}' ' ' | awk '// {print $2}' | sed 's/\./ /g' | awk '// {print $1}')) time2=$(convertsecs $(echo '{ "command": ["get_property", "playback-time"] }' | socat - /tmp/mpv-socket2 | tr '{":,}' ' ' | awk '// {print $2}' | sed 's/\./ /g' | awk '// {print $1}')) + if [ "$state" == "false" ] then - out=" PLAY - MUSIC - $file - $time" + out=" PLAY - MUSIC - $file2 - $time" color="true" elif [ "$state" == "true" ] then if [ "$state2" == "false" ] then - out=" PLAY - VIDEO - $vidtitle - $time2" + out=" PLAY - VIDEO - $vidtitle2 - $time2" else - out=" STOP - MUSIC - $file - $time" + out=" STOP - MUSIC - $file2 - $time" fi color="true" elif [ "$state2" == "false" ] then - out=" PLAY - VIDEO - $vidtitle - $time2" + out=" PLAY - VIDEO - $vidtitle2 - $time2" color="true" elif [ "$state2" == "true" ] then - out=" STOP - VIDEO - $vidtitle - $time2" + out=" STOP - VIDEO - $vidtitle2 - $time2" color="true" else out=" NONE" @@ -55,3 +58,7 @@ else echo "Nothing set?... Exiting" exit 1 fi +if [ "$BLOCK_BUTTON" == "1" ] +then + dunstify "Currently playing" "$file\n$vidtitle" +fi diff --git a/.scripts/i3blocks/title b/.scripts/i3blocks/title @@ -7,7 +7,12 @@ # Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 haydenh.gitlab.io/p/gplv2.license id=$(xprop -root _NET_ACTIVE_WINDOW | awk '// {print $5}') -out=$(xprop -id $id | awk '/WM_ICON_NAME\(STRING\)/ { $1=""; $2=""; print}' | sed 's/"//g' | sed "s/^[ \t]*//" | cut -zc-40) -echo $out +out1=$(xprop -id $id | awk '/WM_CLASS/ {print $3}' | sed 's/"//g' | sed 's/,//g') +out2=$(xprop -id $id | awk '/WM_ICON_NAME\(STRING\)/ { $1=""; $2=""; print}' | sed 's/"//g' | sed "s/^[ \t]*//") +if [ "$BLOCK_BUTTON" == "1" ] +then + dunstify "Current window title" "$out2" +fi +echo "$out1 - $(echo "$out2" | cut -zc-25)" echo -echo \#226644 +echo \#4a6b1b diff --git a/.vimrc b/.vimrc @@ -24,8 +24,5 @@ set relativenumber set number set hlsearch -"Set useful bindings -nmap <Leader>s !bash % -nmap <Leader>p !perl % -nmap <Leader>c !gcc % -o compilefile -nmap <Leader>u !g++ % -o compilefile +autocmd BufWritePost config.h,config.def.h,dmenu.c !sudo make install clean +autocmd BufWritePost ~/.Xreources,~/.Xdefaults !xrdb -merge %