more config files

This commit is contained in:
Gregor Feierabend 2021-03-06 19:21:47 +02:00
parent f1096eb90d
commit dd9048593b
8 changed files with 1116 additions and 13 deletions

111
.Xresources Executable file
View File

@ -0,0 +1,111 @@
dclock*background: #000000
dclock*led_off: black
dclock*militaryTime: yes
dclock*audioPlay: /usr/bin/sudo
dclock*alarmFile: halt
XTerm*reverseVideo: false
XTerm*loginShell: true
XTerm*vt100*translations: #override \n\
<Key>F9: set-select(toggle) \n\
<Key>F8: secure() \n\
Shift <Key>KP_8: scroll-back(1,line) \n\
Shift <Key>KP_2: scroll-forw(1,line) \n\
Shift <Key>KP_5: set-scroll-on-tty-output(toggle)
XEphem.SOHOhost: "sohowww.nascom.nasa.gov"
urxvt.depth: 32
urxvt.scrollBar: false
urxvt.scrollTtyOutput: false
urxvt.scrollTtyKeypress: true
urxvt.saveLines: 1000
urxvt*scrollWithBuffer: true
urxvt.perl-ext-common: default,tabbedex,background,font-size,matcher
urxvt.loginShell: true
urxvt*dynamicColors: on
urxvt*font: xft:DejaVu Sans Mono:pixelsize=13
urxvt.keysym.C-Up: font-size:increase
urxvt.keysym.C-Down: font-size:decrease
URxvt.cursorUnderline: false
urxvt.font-size.step: 1
urxvt.url-launcher: firefox
urxvt.matcher.button: 1
urxvt.background: rgba:0000/0000/0000/5555
urxvt.foreground: rgba:FFFF/FFFF/FFFF/FFFF
urxvt.color0: #3f3f3f
urxvt.color1: #cc0000
urxvt.color2: #4e9a06
urxvt.color3: #c4a000
urxvt.color4: #3465a4
urxvt.color5: #75507b
urxvt.color6: #06989a
urxvt.color7: #d3d7cf
urxvt.color8: #555753
urxvt.color9: #ef2929
urxvt.color10: #8ae234
urxvt.color11: #fce94f
urxvt.color12: #729fcf
urxvt.color13: #ad7fa8
urxvt.color14: #34e2e2
urxvt.color15: #eeeeec
!https://unix.stackexchange.com/questions/232881/urxvt-change-background-color-on-the-fly
urxvt*keysym.Control-Shift-F10: command:\033]11;rgba:0000/0000/0000/5555\007\
\033]10;#dcdcdc\007\
\033]12;#dcdcdc\007\
\033]4;0;#3f3f3f\007\
\033]4;1;#705050\007\
\033]4;2;#60b48a\007\
\033]4;3;#dfaf8f\007\
\033]4;4;#9ab8d7\007\
\033]4;5;#dc8cc3\007\
\033]4;6;#8cd0d3\007\
\033]4;7;#dcdcdc\007\
\033]4;8;#709080\007\
\033]4;9;#dca3a3\007\
\033]4;10;#72d5a3\007\
\033]4;11;#f0dfaf\007\
\033]4;12;#94bff3\007\
\033]4;13;#ec93d3\007\
\033]4;14;#93e0e3\007\
\033]4;15;#ffffff\007
URxvt*keysym.Control-Shift-F11: command:\033]11;rgba:0000/0000/0000/5555\007\
\033]10;#ffffff\007\
\033]12;#ffffff\007\
\033]4;0;#3f3f3f\007\
\033]4;1;#cc0000\007\
\033]4;2;#4e9a06\007\
\033]4;3;#c4a000\007\
\033]4;4;#3465a4\007\
\033]4;5;#75507b\007\
\033]4;6;#06989a\007\
\033]4;7;#d3d7cf\007\
\033]4;8;#555753\007\
\033]4;9;#ef2929\007\
\033]4;10;#8ae234\007\
\033]4;11;#fce94f\007\
\033]4;12;#729fcf\007\
\033]4;13;#ad7fa8\007\
\033]4;14;#34e2e2\007\
\033]4;15;#eeeeec\007
URxvt*keysym.Control-Shift-F12: command:\033]11;rgba:0000/0000/0000/5555\007\
\033]10;#a9a9a9\007\
\033]12;#a9a9a9\007\
\033]4;0;#000000\007\
\033]4;1;#cc0000\007\
\033]4;2;#00cc00\007\
\033]4;3;#cccc00\007\
\033]4;4;#0000cc\007\
\033]4;5;#cc00cc\007\
\033]4;6;#00cccc\007\
\033]4;7;#cccccc\007\
\033]4;8;#555555\007\
\033]4;9;#ff0000\007\
\033]4;10;#00ff00\007\
\033]4;11;#ffff00\007\
\033]4;12;#0000ff\007\
\033]4;13;#ff00ff\007\
\033]4;14;#00ffff\007\
\033]4;15;#ffffff\007

205
.config/cmus/autosave Normal file
View File

@ -0,0 +1,205 @@
set aaa_mode=artist
set altformat_current= %F
set altformat_playlist= %f%= %d
set altformat_title=%f
set altformat_trackwin= %f%= %d
set auto_expand_albums_follow=true
set auto_expand_albums_search=true
set auto_expand_albums_selcur=true
set auto_reshuffle=true
set buffer_seconds=10
set color_cmdline_attr=default
set color_cmdline_bg=default
set color_cmdline_fg=default
set color_cur_sel_attr=default
set color_error=lightred
set color_info=blue
set color_separator=white
set color_statusline_attr=default
set color_statusline_bg=default
set color_statusline_fg=white
set color_titleline_attr=default
set color_titleline_bg=default
set color_titleline_fg=white
set color_trackwin_album_attr=default
set color_trackwin_album_bg=default
set color_trackwin_album_fg=white
set color_win_attr=default
set color_win_bg=default
set color_win_cur=white
set color_win_cur_attr=default
set color_win_cur_sel_attr=default
set color_win_cur_sel_bg=blue
set color_win_cur_sel_fg=white
set color_win_dir=white
set color_win_fg=default
set color_win_inactive_cur_sel_attr=default
set color_win_inactive_cur_sel_bg=gray
set color_win_inactive_cur_sel_fg=darkgray
set color_win_inactive_sel_attr=default
set color_win_inactive_sel_bg=gray
set color_win_inactive_sel_fg=black
set color_win_sel_attr=default
set color_win_sel_bg=blue
set color_win_sel_fg=gray
set color_win_title_attr=default
set color_win_title_bg=default
set color_win_title_fg=white
set confirm_run=true
set continue=true
set device=/dev/cdrom
set display_artist_sort_name=false
set dsp.alsa.device=btheadset
set dsp.ao.buffer_size=16384
set dsp.ao.device_interface=
set dsp.ao.driver=
set dsp.ao.wav_counter=1
set dsp.ao.wav_dir=/home/x
set follow=true
set format_current= %a - %l -%3n. %t%= %y
set format_playlist= %-21%a %3n. %t%= %y %d %{?X!=0?%3X ? }
set format_playlist_va= %-21%A %3n. %t (%a)%= %y %d %{?X!=0?%3X ? }
set format_statusline= %{status} %{?show_playback_position?%{position} %{?duration?/ %{duration} }?%{?duration?%{duration} }}- %{total} %{?bpm>0?at %{bpm} BPM }%{?volume>=0?vol: %{?lvolume!=rvolume?%{lvolume},%{rvolume} ?%{volume} }}%{?stream?buf: %{buffer} }%{?show_current_bitrate & bitrate>=0? %{bitrate} kbps }%=%{?repeat_current?repeat current?%{?play_library?%{playlist_mode} from %{?play_sorted?sorted }library?playlist}} | %1{continue}%1{follow}%1{repeat}%1{shuffle}
set format_title=%a - %l - %t (%y)
set format_trackwin=%3n. %t%= %y %d
set format_trackwin_album= %l
set format_trackwin_va=%3n. %t (%a)%= %y %d
set format_treewin= %l
set format_treewin_artist=%a
set icecast_default_charset=ISO-8859-1
set id3_default_charset=ISO-8859-1
set input.aac.priority=50
set input.cue.priority=50
set input.ffmpeg.priority=30
set input.flac.priority=50
set input.mad.priority=55
set input.mikmod.priority=40
set input.modplug.priority=50
set input.mp4.priority=50
set input.mpc.priority=50
set input.opus.priority=50
set input.vorbis.priority=50
set input.wav.priority=50
set input.wavpack.priority=50
set lib_add_filter=
set lib_sort=filemtime
set mixer.alsa.channel=
set mixer.alsa.device=
set mixer.pulse.restore_volume=1
set mouse=false
set mpris=false
set output_plugin=pulse
set passwd=
set pl_sort=
set play_library=true
set play_sorted=false
set repeat=false
set repeat_current=false
set replaygain=disabled
set replaygain_limit=true
set replaygain_preamp=0.000000
set resume=false
set rewind_offset=5
set scroll_offset=2
set set_term_title=true
set show_all_tracks=true
set show_current_bitrate=false
set show_hidden=false
set show_playback_position=true
set show_remaining_time=true
set shuffle=false
set skip_track_info=false
set smart_artist_sort=true
set softvol=false
set softvol_state=0 0
set start_view=tree
set status_display_program=
set time_show_leading_zero=true
set wrap_search=true
bind browser backspace browser-up
bind browser i toggle show_hidden
bind browser space win-activate
bind browser u win-update
bind common ! push shell
bind common + vol +10%
bind common , seek -1m
bind common - vol -10%
bind common . seek +1m
bind common 1 view tree
bind common 2 view sorted
bind common 3 view playlist
bind common 4 view queue
bind common 5 view browser
bind common 6 view filters
bind common 7 view settings
bind common = vol +10%
bind common C toggle continue
bind common D win-remove
bind common E win-add-Q
bind common F push filter
bind common G win-bottom
bind common I echo {}
bind common L push live-filter
bind common M toggle play_library
bind common N search-prev
bind common P win-mv-before
bind common U win-update-cache
bind common [ vol +1% +0
bind common ] vol +0 +1%
bind common ^B win-page-up
bind common ^C echo Type :quit<enter> to exit cmus.
bind common ^D win-remove
bind common ^E win-scroll-down
bind common ^F win-page-down
bind common ^L refresh
bind common ^R toggle repeat_current
bind common ^Y win-scroll-up
bind common a win-add-l
bind common b player-next
bind common c player-pause
bind common delete win-remove
bind common down win-down
bind common e win-add-q
bind common end win-bottom
bind common enter win-activate
bind common f toggle follow
bind common g win-top
bind common h seek -5
bind common home win-top
bind common i win-sel-cur
bind common j win-down
bind common k win-up
bind common l seek +5
bind common left seek -5
bind common m toggle aaa_mode
bind common mlb_click_selected win-activate
bind common mouse_scroll_down win-down
bind common mouse_scroll_up win-up
bind common n search-next
bind common o toggle play_sorted
bind common p win-mv-after
bind common page_down win-page-down
bind common page_up win-page-up
bind common q quit -i
bind common r toggle repeat
bind common right seek +5
bind common s toggle shuffle
bind common space win-toggle
bind common t toggle show_remaining_time
bind common tab win-next
bind common u update-cache
bind common up win-up
bind common v player-stop
bind common x player-play
bind common y win-add-p
bind common z player-prev
bind common { vol -1% -0
bind common } vol -0 -1%
fset 90s=date>=1990&date<2000
fset classical=genre="Classical"
fset missing-tag=!stream&(artist=""|album=""|title=""|tracknumber=-1|date=-1)
fset mp3=filename="*.mp3"
fset ogg=filename="*.ogg"
fset ogg-or-mp3=ogg|mp3
fset unheard=play_count=0
factivate

255
.config/i3/config Normal file
View File

@ -0,0 +1,255 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
# they are included here as an example. Modify as you see fit.
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
#exec --no-startup-id nm-applet
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+g split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
bindsym $mod+Shift+s sticky toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# reload the configuration file
# EDIT:
#bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
#bar {
# status_command i3status
#}
bar {
font xft:DejaVu Sans Mono 8
#status_command i3blocks -c ~/.i3/i3blocks.conf
status_command i3status
colors {
# separator #268bd2
background #111111
# statusline #839496
# focused_workspace #fdf6e3 #6c71c4 #fdf6e3
# active_workspace #fdf6e3 #6c71c4 #fdf6e3
# inactive_workspace #002b36 #586e75 #002b36
# urgent_workspace #d33682 #d33682 #fdf6e3
}
}
#client.focused #6c71c4 #6c71c4 #fdf6e3 #6c71c4
#client.focused_inactive #073642 #073642 #eee8d5 #6c71c4
#client.unfocused #073642 #073642 #93a1a1 #586e75
#client.urgent #d33682 #d33682 #fdf6e3 #dc322f
focus_follows_mouse no
bindsym $mod+m floating enable; resize set 1400 850; move absolute position center; move scratchpad
bindsym $mod+n scratchpad show
bindsym $mod+Shift+x exec i3lock -c 222222
bindsym $mod+z [class="Zathura"] scratchpad show
bindsym $mod+u [class="URxvt"] scratchpad show
bindsym $mod+c [title="Android Emulator*"] scratchpad show
bindsym $mod+Shift+w exec /scripts/simplephone.sh
bindsym $mod+Shift+f exec /scripts/devphone.sh
#bindsym $mod+t exec transset -n `xdotool getwindowfocus getwindowname` --dec 0.2
#bindsym $mod+Shift+t exec transset -n `xdotool getwindowfocus getwindowname` --inc 0.2
bindsym $mod+t exec /scripts/incop.sh
bindsym $mod+Shift+t exec /scripts/decop.sh
bindsym $mod+y exec sleep 1 && transset 0.6
bindsym $mod+Shift+y exec sleep 1 && transset 1
bindsym $mod+o exec /scripts/screenshot.sh
bindsym $mod+x move absolute position center
bindsym $mod+i exec xrandr-invert-colors
#bindsym $mod+Shift+f exec firefox
#bindsym $mod+Shift+g exec typora
bindsym $mod+p exec pqiv -c -c -i ~/ANNOTATIONS
#bindsym $mod+b exec sleep 1 && /scripts/plotsel.sh
bindsym $mod+b exec /scripts/plotsel.sh
for_window [class="URxvt" floating] resize set 1400 850
for_window [class="URxvt"] move absolute position center
for_window [class="Pqiv"] floating enable
for_window [class="Dclock"] floating enable
for_window [title="^Skype$"] floating enable
for_window [title="Typora$"] fullscreen disable
for_window [title="^Emulator$"] move scratchpad
for_window [title="Android Emulator - thePhone:5554"] resize set 375 667
for_window [title="Android Emulator*"] scratchpad show
#client.focused #00eb00 #00eb00 #00eb00 #00eb00
#client.focused_inactive #ff14ff #ff14ff #ffffff #484e50
#client.unfocused #ffffff #ff14ff #888888 #292d2e
#client.urgent #C10004 #2b2b2b #ffffff #900000
default_border pixel 4
default_floating_border pixel 1
hide_edge_borders both
#exec --no-startup-id xcompmgr -c -n
exec --no-startup-id compton
exec --no-startup-id pasystray
#exec --no-startup-id unclutter -idle 5 -jitter 20
#exec --no-startup-id xrdb ~/.Xresources
#exec --no-startup-id redshift -l -18:33
#exec --no-startup-id fbsetroot -solid black

35
.newsboat/config Normal file
View File

@ -0,0 +1,35 @@
browser "2>/dev/null 1>&2 firefox %u &"
player "mpv"
download-path "~/Podcasts/%h/%n"
macro y set browser "~/.newsboat/scripts/enq.sh %u"; open-in-browser ; set browser "firefox %u"
# general settings
auto-reload yes
max-items 50
# unbind keys
unbind-key ENTER
unbind-key j
unbind-key k
unbind-key J
unbind-key K
# bind keys - vim style
bind-key j down
bind-key k up
bind-key l open
bind-key h quit
# solarized
color background default default
color listnormal default default
color listnormal_unread default default
color listfocus default blue
color listfocus_unread default blue
color info default default
color article default default
# highlights
highlight article "^(Title):.*$" blue default
highlight article "https?://[^ ]+" red default
highlight article "\\[image\\ [0-9]+\\]" green default

2
.newsboat/scripts/enq.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
cmus-remote -q "`echo $1 | sed 's/https/http/g'`"

1
.sage/init.sage Normal file
View File

@ -0,0 +1 @@
%colors Linux

486
.urxvt/ext/font-size Executable file
View File

@ -0,0 +1,486 @@
#!/usr/bin/env perl
#
# On-the-fly adjusting of the font size in urxvt
#
# Copyright (c) 2008 David O'Neill
# 2012 Noah K. Tilton <noahktilton@gmail.com>
# 2009-2012 Simon Lundström <simmel@soy.se>
# 2012-2016 Jan Larres <jan@majutsushi.net>
#
# 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.
#
# URL: https://github.com/majutsushi/urxvt-font-size
#
# Based on:
# https://github.com/dave0/urxvt-font-size
# https://github.com/noah/urxvt-font
# https://github.com/simmel/urxvt-resize-font
#
# X11 fonts background:
# http://keithp.com/~keithp/talks/xtc2001/paper/
#:META:X_RESOURCE:%.step:interger:font size increase/decrease step
=head1 NAME
font-size - interactive font size setter
=head1 USAGE
Put the font-size script into $HOME/.urxvt/ext/ and add it to the list
of enabled perl-extensions in ~/.Xresources:
URxvt.perl-ext-common: ...,font-size
The extension automatically binds Ctrl++ to the 'increase' function,
Ctrl+- to 'decrease', and Ctrl+0 to 'reset'. To use the other available functions
or change the keys, add some keybindings of your own:
URxvt.keysym.C-Up: font-size:increase
URxvt.keysym.C-Down: font-size:decrease
URxvt.keysym.C-S-Up: font-size:incglobal
URxvt.keysym.C-S-Down: font-size:decglobal
URxvt.keysym.C-equal: font-size:reset
URxvt.keysym.C-slash: font-size:show
Note that for urxvt versions older than 9.21 the resources have to look like this:
URxvt.keysym.C-Up: perl:font-size:increase
URxvt.keysym.C-Down: perl:font-size:decrease
URxvt.keysym.C-S-Up: perl:font-size:incglobal
URxvt.keysym.C-S-Down: perl:font-size:decglobal
URxvt.keysym.C-equal: perl:font-size:reset
URxvt.keysym.C-slash: perl:font-size:show
Supported functions:
=over 2
=item * increase/decrease:
increase or decrease the font size of the current terminal.
=item * incglobal/decglobal:
same as above and also adjust the X server values so all newly
started terminals will use the same fontsize.
=item * incsave/decsave:
same as incglobal/decglobal and also modify the ~/.Xresources
file so the changed font sizes will persist over a restart of
the X server or a reboot.
=item * reset:
reset the font size to the value of the resource when starting
the terminal.
=item * show
show the current value of the 'font' resource in a popup.
=back
You can also change the step size that the script will use to increase
the font size:
URxvt.font-size.step: 4
The default step size is 1. This means that with this setting a
size change sequence would be for example 8->12->16->20 instead of
8->9->10->11->12 etc. Please note that many X11 fonts are only
available in specific sizes, though, and odd sizes are often not
available, resulting in an effective step size of 2 instead of 1
in that case.
=cut
use strict;
use warnings;
my %escapecodes = (
"font" => 710,
"boldFont" => 711,
"italicFont" => 712,
"boldItalicFont" => 713
);
sub on_init {
my ($self) = @_;
$self->bind_action ("C-plus", "%:increase")
or warn "unable to register 'C-plus' as font-size increase hotkey\n";
$self->bind_action ("C-minus", "%:decrease")
or warn "unable to register 'C-minus' as font-size decrease hotkey\n";
$self->bind_action ("C-0", "%:reset")
or warn "unable to register 'C-0' as font-size reset hotkey\n";
}
sub on_start
{
my ($self) = @_;
$self->{step} = $self->x_resource("%.step") || 1;
foreach my $type (qw(font boldFont italicFont boldItalicFont)) {
$self->{$type} = $self->x_resource($type) || "undef";
}
}
# Needed for backwards compatibility with < 9.21
sub on_user_command
{
my ($self, $cmd) = @_;
my $step = $self->{step};
if ($cmd eq "font-size:increase") {
fonts_change_size($self, $step, 0);
} elsif ($cmd eq "font-size:decrease") {
fonts_change_size($self, -$step, 0);
} elsif ($cmd eq "font-size:incglobal") {
fonts_change_size($self, $step, 1);
} elsif ($cmd eq "font-size:decglobal") {
fonts_change_size($self, -$step, 1);
} elsif ($cmd eq "font-size:incsave") {
fonts_change_size($self, $step, 2);
} elsif ($cmd eq "font-size:decsave") {
fonts_change_size($self, -$step, 2);
} elsif ($cmd eq "font-size:reset") {
fonts_reset($self);
} elsif ($cmd eq "font-size:show") {
fonts_show($self);
}
}
sub on_action
{
my ($self, $action) = @_;
my $step = $self->{step};
if ($action eq "increase") {
fonts_change_size($self, $step, 0);
} elsif ($action eq "decrease") {
fonts_change_size($self, -$step, 0);
} elsif ($action eq "incglobal") {
fonts_change_size($self, $step, 1);
} elsif ($action eq "decglobal") {
fonts_change_size($self, -$step, 1);
} elsif ($action eq "incsave") {
fonts_change_size($self, $step, 2);
} elsif ($action eq "decsave") {
fonts_change_size($self, -$step, 2);
} elsif ($action eq "reset") {
fonts_reset($self);
} elsif ($action eq "show") {
fonts_show($self);
}
}
sub fonts_change_size
{
my ($term, $delta, $save) = @_;
my @newfonts = ();
my $curres = $term->resource('font');
if (!$curres) {
$term->scr_add_lines("\r\nWarning: No font configured, trying a default.\r\nPlease set a font with the 'URxvt.font' resource.");
$curres = "fixed";
}
my @curfonts = split(/\s*,\s*/, $curres);
my $basefont = shift(@curfonts);
my ($newbasefont, $newbasedelta, $newbasesize) = handle_font($term, $basefont, $delta, 0, 0);
push @newfonts, $newbasefont;
# Only adjust other fonts if base font changed
if ($newbasefont ne $basefont) {
foreach my $font (@curfonts) {
my ($newfont, $newdelta, $newsize) = handle_font($term, $font, $delta, $newbasedelta, $newbasesize);
push @newfonts, $newfont;
}
my $newres = join(",", @newfonts);
font_apply_new($term, $newres, "font", $save);
handle_type($term, "boldFont", $delta, $newbasedelta, $newbasesize, $save);
handle_type($term, "italicFont", $delta, $newbasedelta, $newbasesize, $save);
handle_type($term, "boldItalicFont", $delta, $newbasedelta, $newbasesize, $save);
}
if ($save > 1) {
# write the new values back to the file
my $xresources = readlink $ENV{"HOME"} . "/.Xresources";
system("xrdb -edit " . $xresources);
}
}
sub fonts_reset
{
my ($term) = @_;
foreach my $type (qw(font boldFont italicFont boldItalicFont)) {
my $initial = $term->{$type};
if ($initial ne "undef") {
font_apply_new($term, $initial, $type, 0);
}
}
}
sub fonts_show
{
my ($term) = @_;
my $out = $term->resource('font');
$out =~ s/\s*,\s*/\n/g;
$term->{'font-size'}{'overlay'} = {
overlay => $term->overlay_simple(0, -1, $out),
timer => urxvt::timer->new->start(urxvt::NOW + 5)->cb(
sub {
delete $term->{'font-size'}{'overlay'};
}
),
};
}
sub handle_type
{
my ($term, $type, $delta, $basedelta, $basesize, $save) = @_;
my $curres = $term->resource($type);
if (!$curres) {
return;
}
my @curfonts = split(/\s*,\s*/, $curres);
my @newfonts = ();
foreach my $font (@curfonts) {
my ($newfont, $newdelta, $newsize) = handle_font($term, $font, $delta, $basedelta, $basesize);
push @newfonts, $newfont;
}
my $newres = join(",", @newfonts);
font_apply_new($term, $newres, $type, $save);
}
sub handle_font
{
my ($term, $font, $delta, $basedelta, $basesize) = @_;
my $newfont;
my $newdelta;
my $newsize;
my $prefix = 0;
if ($font =~ /^\s*x:/) {
$font =~ s/^\s*x://;
$prefix = 1;
}
if ($font =~ /^\s*(\[.*\])?xft:/) {
($newfont, $newdelta, $newsize) = font_change_size_xft($term, $font, $delta, $basedelta, $basesize);
} elsif ($font =~ /^\s*-/) {
($newfont, $newdelta, $newsize) = font_change_size_xlfd($term, $font, $delta, $basedelta, $basesize);
} else {
# check whether the font is a valid alias and if yes resolve it to the
# actual font
my $lsfinfo = `xlsfonts -l $font 2>/dev/null`;
if ($lsfinfo eq "") {
# not a valid alias, ring the bell if it is the base font and just
# return the current font
if ($basesize == 0) {
$term->scr_bell;
}
return ($font, $basedelta, $basesize);
}
my $fontinfo = (split(/\n/, $lsfinfo))[-1];
my ($fontfull) = ($fontinfo =~ /\s+([-a-z0-9]+$)/);
($newfont, $newdelta, $newsize) = font_change_size_xlfd($term, $fontfull, $delta, $basedelta, $basesize);
}
# $term->scr_add_lines("\r\nNew font is $newfont\n");
if ($prefix) {
$newfont = "x:$newfont";
}
return ($newfont, $newdelta, $newsize);
}
sub font_change_size_xft
{
my ($term, $fontstring, $delta, $basedelta, $basesize) = @_;
my @pieces = split(/:/, $fontstring);
my @resized = ();
my $size = 0;
my $new_size = 0;
foreach my $piece (@pieces) {
if ($piece =~ /^(?:(?:pixel)?size=|[^=-]+-)(\d+(\.\d*)?)$/) {
$size = $1;
if ($basedelta != 0) {
$new_size = $size + $basedelta;
} else {
$new_size = $size + $delta;
}
$piece =~ s/(=|-)$size/$1$new_size/;
}
push @resized, $piece;
}
my $resized_str = join(":", @resized);
# don't make fonts too small
if ($new_size >= 6) {
return ($resized_str, $new_size - $size, $new_size);
} else {
if ($basesize == 0) {
$term->scr_bell;
}
return ($fontstring, 0, $size);
}
}
sub font_change_size_xlfd
{
my ($term, $fontstring, $delta, $basedelta, $basesize) = @_;
#-xos4-terminus-medium-r-normal-*-12-*-*-*-*-*-*-1
my @fields = qw(foundry family weight slant setwidth style pixelSize pointSize Xresolution Yresolution spacing averageWidth registry encoding);
my %font;
$fontstring =~ s/^-//; # Strip leading - before split
@font{@fields} = split(/-/, $fontstring);
if ($font{pixelSize} eq '*') {
$term->scr_add_lines("\r\nWarning: Font size undefined, assuming 12.\r\nPlease set the 'URxvt.font' resource to a font with a concrete size.");
$font{pixelSize} = '12'
}
if ($font{registry} eq '*') {
$font{registry} ='iso8859';
}
# Blank out the size for the pattern
my %pattern = %font;
$pattern{foundry} = '*';
$pattern{setwidth} = '*';
$pattern{pixelSize} = '*';
$pattern{pointSize} = '*';
# if ($basesize != 0) {
# $pattern{Xresolution} = '*';
# $pattern{Yresolution} = '*';
# }
$pattern{averageWidth} = '*';
# make sure there are no empty fields
foreach my $field (@fields) {
$pattern{$field} = '*' unless defined($pattern{$field});
}
my $new_fontstring = '-' . join('-', @pattern{@fields});
my @candidates;
# $term->scr_add_lines("\r\nPattern is $new_fontstring\n");
open(FOO, "xlsfonts -fn '$new_fontstring' | sort -u |") or die $!;
while (<FOO>) {
chomp;
s/^-//; # Strip leading '-' before split
my @fontdata = split(/-/, $_);
push @candidates, [$fontdata[6], "-$_"];
# $term->scr_add_lines("\r\npossibly $fontdata[6] $_\n");
}
close(FOO);
if (!@candidates) {
die "No possible fonts!";
}
if ($basesize != 0) {
# sort by font size, descending
@candidates = sort {$b->[0] <=> $a->[0]} @candidates;
# font is not the base font, so find the largest font that is at most
# as large as the base font. If the largest possible font is smaller
# than the base font bail and hope that a 0-size font can be found at
# the end of the function
if ($candidates[0]->[0] > $basesize) {
foreach my $candidate (@candidates) {
if ($candidate->[0] <= $basesize) {
return ($candidate->[1], $candidate->[0] - $font{pixelSize}, $candidate->[0]);
}
}
}
} elsif ($delta > 0) {
# sort by font size, ascending
@candidates = sort {$a->[0] <=> $b->[0]} @candidates;
foreach my $candidate (@candidates) {
if ($candidate->[0] >= $font{pixelSize} + $delta) {
return ($candidate->[1], $candidate->[0] - $font{pixelSize}, $candidate->[0]);
}
}
} elsif ($delta < 0) {
# sort by font size, descending
@candidates = sort {$b->[0] <=> $a->[0]} @candidates;
foreach my $candidate (@candidates) {
if ($candidate->[0] <= $font{pixelSize} + $delta && $candidate->[0] != 0) {
return ($candidate->[1], $candidate->[0] - $font{pixelSize}, $candidate->[0]);
}
}
}
# no fitting font available, check whether a 0-size font can be used to
# fit the size of the base font
@candidates = sort {$a->[0] <=> $b->[0]} @candidates;
if ($basesize != 0 && $candidates[0]->[0] == 0) {
return ($candidates[0]->[1], $basedelta, $basesize);
} else {
# if there is absolutely no smaller/larger font that can be used
# return the current one, and beep if this is the base font
if ($basesize == 0) {
$term->scr_bell;
}
return ("-$fontstring", 0, $font{pixelSize});
}
}
sub font_apply_new
{
my ($term, $newfont, $type, $save) = @_;
# $term->scr_add_lines("\r\nnew font is $newfont\n");
$term->cmd_parse("\033]" . $escapecodes{$type} . ";" . $newfont . "\033\\");
# load the xrdb db
# system("xrdb -load " . X_RESOURCES);
if ($save > 0) {
# merge the new values
open(XRDB_MERGE, "| xrdb -merge") || die "can't fork: $!";
local $SIG{PIPE} = sub { die "xrdb pipe broken" };
print XRDB_MERGE "URxvt." . $type . ": " . $newfont;
close(XRDB_MERGE) || die "bad xrdb: $! $?";
}
}

34
.vimrc
View File

@ -1,12 +1,13 @@
set nocompatible
"https://github.com/tpope/vim-pathogen.git
execute pathogen#infect()
syntax enable
filetype plugin on
filetype indent on
colorscheme noctu
colorscheme noctu_adapted
set colorcolumn=80
set mouse=a
@ -103,7 +104,6 @@ endfun
map <C-F> :call ShowFuncName() <CR>
"https://stackoverflow.com/questions/1054701/get-ctags-in-vim-to-go-to-definition-not-declaration
" setup
if has("cscope")
set csto=0
set cst
@ -124,10 +124,22 @@ nmap <silent> <C-_> :cs find c <C-R>=expand("<cword>")<CR><CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""" PLUGIN SPECIFIC """""""""""""""""""""""""""""""
runtime ftplugin/man.vim
""""""""""""""""""""""""""""""""""" AUTO-MKDIR """""""""""""""""""""""""""""""""
"https://github.com/arp242/auto_mkdir2.vim.git
"""""""""""""""""""""""""""""""""" VIM-BUFKILL """""""""""""""""""""""""""""""""
"https://github.com/qpkorr/vim-bufkill.git
""""""""""""""""""""""""""""""" MULTIPLE SEARCH """""""""""""""""""""""""""""""
"https://www.vim.org/scripts/script.php?script_id=479
""""""""""""""""""""""""""""""" MULTIPLE CURSORS """""""""""""""""""""""""""""""
"https://github.com/terryma/vim-multiple-cursors.git
""""""""""""""""""""""""""""""""""" SYNTASTIC """"""""""""""""""""""""""""""""""
"https://github.com/vim-syntastic/syntastic.git
let g:syntastic_mode_map = {"mode": "active"}
let g:syntastic_always_populate_loc_list = 1
@ -152,6 +164,7 @@ map <C-j><C-k> :lprev<CR>
map <C-j><C-j> :lnext<CR>
"""""""""""""""""""""""""""""""""""""" VIMUX """""""""""""""""""""""""""""""""""
"https://github.com/preservim/vimux.git
function! REPLsettings(cmd)
call VimuxOpenRunner()
@ -166,10 +179,12 @@ nmap <C-c><C-o> :call VimuxOpenRunner()<CR>
nmap <C-c><C-p> :call REPLsettings("")<CR>
"""""""""""""""""""""""""""""""""""" DIFFCHAR """"""""""""""""""""""""""""""""""
"https://github.com/rickhowe/diffchar.vim.git
let g:DiggUnit="Char"
"""""""""""""""""""""""""""""""""" LATEX SUITE """""""""""""""""""""""""""""""""
"https://github.com/vim-latex/vim-latex
set grepprg=grep\ -nH\ $*
@ -209,18 +224,9 @@ imap <C-l><C-x> <Plug>Tex_MathCal
imap <C-l><C-v> <Plug>Tex_MathBF
""""""""""""""""""""""""""""""" RAINBOW BRACKETS """""""""""""""""""""""""""""""
"https://github.com/luochen1990/rainbow.git
let g:rainbow_active = 1
"let g:rainbow_load_separately = [
" \ [ '*' , [['(', ')'], ['\[', '\]'], ['{', '}']] ],
" \ [ '*.tex' , [['(', ')'], ['\[', '\]']] ],
" \ [ '*.cpp' , [['(', ')'], ['\[', '\]'], ['{', '}']] ],
" \ [ '*.{html,htm}' , [['(', ')'], ['\[', '\]'], ['{', '}'], ['<\a[^>]*>',
" \'</[^>]*>']] ], ]
"
"let g:rainbow_ctermfgs = ['lightblue', 'lightgreen', 'magenta', 'yellow']
let g:rainbow_conf = {
\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'],
\ 'ctermfgs': ['lightblue', 'lightgreen', 'magenta', 'yellow'],
@ -256,6 +262,7 @@ let g:rainbow_conf = {
\}
""""""""""""""""""""""""""""""""""" TINY MODE """"""""""""""""""""""""""""""""""
"https://www.vim.org/scripts/script.php?script_id=2223
nmap <C-W>+ <C-W>+<SID>ws
nmap <C-W>- <C-W>-<SID>ws
@ -268,6 +275,7 @@ nn <script> <SID>ws< <C-W><<SID>ws
nmap <SID>ws <Nop>
"""""""""""""""""""""""""""""""" DOXYGEN TOOLKIT """""""""""""""""""""""""""""""
"https://www.vim.org/scripts/script.php?script_id=987
"fu! DoxyFoldText()
" if match(getline(v:foldstart+1), "\^/\[*]\[*]") == 0