From 7637ae4790f12008ff27ba2134153ce20296a6fa Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Fri, 12 Nov 2021 13:21:53 +0100 Subject: [PATCH] many updates --- .stowrc | 2 + cal/.config/vdirsyncer/config | 46 +++ clean/.local/bin/install_clean.sh | 4 +- config.h/dwm/config.h | 3 +- config.h/slstatus/config.h | 7 +- config.h/st/config.h | 3 + email/.config/msmtp/config | 3 +- email/.config/offlineimap/config | 3 +- email/.local/bin/newmail.sh | 5 +- shell/.bashrc | 9 +- shell/.local/bin/update | 1 + vim/.vim/spell/en.utf-8.add | 1 + vim/.vimrc | 3 + vimdoc.sh | 5 + x/.config/mimeapps.list | 28 ++ x/.local/bin/dock.sh | 6 +- x/.local/bin/headphone_connect.sh | 4 + x/.local/bin/headphone_disconnect.sh | 2 + x/.urxvt/ext/font-size | 434 --------------------------- x/.xinitrc | 1 - 20 files changed, 120 insertions(+), 450 deletions(-) create mode 100644 .stowrc create mode 100644 vimdoc.sh create mode 100644 x/.config/mimeapps.list create mode 100755 x/.local/bin/headphone_connect.sh create mode 100755 x/.local/bin/headphone_disconnect.sh delete mode 100755 x/.urxvt/ext/font-size diff --git a/.stowrc b/.stowrc new file mode 100644 index 0000000..63e03cd --- /dev/null +++ b/.stowrc @@ -0,0 +1,2 @@ +--target=~ +--no-folding diff --git a/cal/.config/vdirsyncer/config b/cal/.config/vdirsyncer/config index dd94fc2..ceddd8a 100644 --- a/cal/.config/vdirsyncer/config +++ b/cal/.config/vdirsyncer/config @@ -12,6 +12,52 @@ status_path = "~/.local/share/vdirsyncer/status/" #default_command = "sync" +# Webcal +[pair uni] +a = "uni_web" +b = "uni_remote" +collections = null + +[storage uni_web] +type = "http" +url = "https://persoonlijkrooster.ru.nl/ical?612f428e&group=false&eu=VTUzMTE1OA==&h=fwIseCt7TiLdsmZedg33fpvCIrs00_mKW4-HN0jjCWA=" + +[storage uni_remote] +type = "caldav" +url = "https://cal.martlubbers.net/dav.php/calendars/mart/uni/" +username = "mart" +password.fetch = ["command", "pass", "show", "caldav_ygdrassil/mart"] + +[pair vuilnis] +a = "vuilnis_web" +b = "vuilnis_remote" +collections = null + +[storage vuilnis_web] +type = "http" +url = "https://wasteapi.ximmio.com/api/CallIcal?cn=Gemeente%20Almere&x=53d8db94-7945-42fd-9742-9bbc71dbe4c1&ty=null&ua=11219&sd=2020-12-21&ed=2024-01-09&path=https://wasteapi.ximmio.com&ln=nl&nt=1130" + +[storage vuilnis_remote] +type = "caldav" +url = "https://cal.martlubbers.net/dav.php/calendars/mart/vuilnis/" +username = "mart" +password.fetch = ["command", "pass", "show", "caldav_ygdrassil/mart"] + +[pair swsseminar] +a = "sws_web" +b = "sws_remote" +collections = null + +[storage sws_web] +type = "http" +url = "webcal://mail.ru.nl/owa/calendar/b6e050a43db94f69b7f22d03b199e2d3@ru.nl/d9d2aad2370a45e384cdd0df82dc0372275936403019441775/S-1-8-3775058472-2008174625-2090802342-630350554/reachcalendar.ics" + +[storage sws_remote] +type = "caldav" +url = "https://cal.martlubbers.net/dav.php/calendars/mart/swsseminar/" +username = "mart" +password.fetch = ["command", "pass", "show", "caldav_ygdrassil/mart"] + # CARDDAV [pair contacts] a = "contacts_local" diff --git a/clean/.local/bin/install_clean.sh b/clean/.local/bin/install_clean.sh index 0de33a1..e9be47e 100755 --- a/clean/.local/bin/install_clean.sh +++ b/clean/.local/bin/install_clean.sh @@ -8,7 +8,7 @@ then fi DISTRO="https://ftp.cs.ru.nl/Clean/builds/linux-$1/clean-bundle-complete-linux-$1-latest.tgz" -TAGS="https://gitlab.science.ru.nl/cloogle/cloogle-tags/-/jobs/artifacts/master/raw/cloogletags?job=build" +TAGS="https://gitlab.com/cloogle/periphery/cloogle-tags/-/jobs/artifacts/master/raw/cloogletags?job=build" CLMMAN="https://gitlab.science.ru.nl/clean-and-itasks/clm/raw/master/clm.1" CP2CG="https://gitlab.science.ru.nl/clean-and-itasks/cleanprof2callgrind/-/jobs/artifacts/master/raw/cleanprof2callgrind?job=test" CLEAN_HOME="/opt/clean-$1" @@ -17,7 +17,7 @@ echo "Cleaning up the old distro" rm -rf "$CLEAN_HOME"/* mkdir -p "$CLEAN_HOME" echo "Downloading clean" -curl -sSL "$DISTRO" | tar -C "$CLEAN_HOME" --strip-components=1 -xz +curl -ksSL "$DISTRO" | tar -C "$CLEAN_HOME" --strip-components=1 -xz echo "Installing manpages" mkdir -p ~/.local/man/man1 curl -sSLo ~/.local/man/man1/clm.1 "$CLMMAN" diff --git a/config.h/dwm/config.h b/config.h/dwm/config.h index bff64b5..ad4a1a7 100644 --- a/config.h/dwm/config.h +++ b/config.h/dwm/config.h @@ -21,7 +21,8 @@ static const char *colors[][3] = { }; /* tagging */ -static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +//static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +static const char *tags[] = { "1", "2", "3", "4", "5" }; static const Rule rules[] = { /* xprop(1): diff --git a/config.h/slstatus/config.h b/config.h/slstatus/config.h index 5846931..c44eb2f 100644 --- a/config.h/slstatus/config.h +++ b/config.h/slstatus/config.h @@ -76,10 +76,9 @@ static const struct arg args[] = { { battery_perc, "⚡%s%%", "BAT0"}, { battery_state, "(%s) | ", "BAT0"}, #else - { disk_free, "/mnt/data: %s/", "/mnt/data" }, - { disk_total, "%s | ", "/mnt/data" }, + { disk_perc, "/mnt/data: %s%% | " + ,"/mnt/data" }, #endif - { disk_free, "/: %s/", "/" }, - { disk_total, "%s | ", "/" }, + { disk_perc, "/: %s%% | ", "/" }, { datetime, "%s", "%Y-%m-%d %H:%M" }, }; diff --git a/config.h/st/config.h b/config.h/st/config.h index fb7ff97..7d82da8 100644 --- a/config.h/st/config.h +++ b/config.h/st/config.h @@ -191,6 +191,9 @@ static Shortcut shortcuts[] = { { XK_ANY_MOD, XK_Print, printsel, {.i = 0} }, { TERMMOD, XK_Prior, zoom, {.f = +1} }, { TERMMOD, XK_Next, zoom, {.f = -1} }, + { ShiftMask|ControlMask,XK_Up, zoom, {.f = +1} }, + { ShiftMask|ControlMask,XK_Down, zoom, {.f = -1} }, + { ShiftMask|ControlMask,XK_Left, zoomreset, {.f = 0} }, { TERMMOD, XK_Home, zoomreset, {.f = 0} }, { TERMMOD, XK_C, clipcopy, {.i = 0} }, { TERMMOD, XK_V, clippaste, {.i = 0} }, diff --git a/email/.config/msmtp/config b/email/.config/msmtp/config index a567e5f..52362b9 100644 --- a/email/.config/msmtp/config +++ b/email/.config/msmtp/config @@ -16,7 +16,8 @@ host smtp.science.ru.nl port 587 auth on tls on -tls_fingerprint BE:B9:55:15:31:91:FD:0A:C1:E5:DB:FE:C7:94:AB:8D:49:9D:B2:0E:2C:6B:4A:78:04:FD:0E:76:AE:2B:63:44 +#tls_fingerprint BE:B9:55:15:31:91:FD:0A:C1:E5:DB:FE:C7:94:AB:8D:49:9D:B2:0E:2C:6B:4A:78:04:FD:0E:76:AE:2B:63:44 +tls_certcheck off user mlubbers #proxy_host localhost #proxy_port 8008 diff --git a/email/.config/offlineimap/config b/email/.config/offlineimap/config index f3a309f..42d5b4b 100644 --- a/email/.config/offlineimap/config +++ b/email/.config/offlineimap/config @@ -7,7 +7,7 @@ ui = blinkenlights [Account net] localrepository = Local remoterepository = Remote -autorefresh = 0.5 +autorefresh = 6 quick = 10 postsynchook = newmail.sh #proxy = SOCKS5:localhost:8008 @@ -26,6 +26,7 @@ ssl = yes sslcacertfile = /etc/ssl/certs/ca-certificates.crt keepalive = 60 holdconnectionopen = yes +idlefolders = ['INBOX'] [mbnames] enabled = yes diff --git a/email/.local/bin/newmail.sh b/email/.local/bin/newmail.sh index 94d5945..16c2888 100755 --- a/email/.local/bin/newmail.sh +++ b/email/.local/bin/newmail.sh @@ -1,4 +1,7 @@ #!/bin/sh notmuch new -vdirsyncer sync killall -s SIGUSR1 slstatus +if [ "$OFFLINEIMAPSYNCMODE" = full ] +then + vdirsyncer sync --max-workers=1 +fi diff --git a/shell/.bashrc b/shell/.bashrc index 9ea8e26..cc8f34c 100644 --- a/shell/.bashrc +++ b/shell/.bashrc @@ -57,9 +57,14 @@ set_prompt(){ [[ $last_c -ge 1 ]] && PS1="($last_c) $PS1" if [[ -n "$SCHROOT_CHROOT_NAME" ]] then - PS1="($SCHROOT_CHROOT_NAME)$PS1\w\$ " + PS1="($SCHROOT_CHROOT_NAME)$PS1" + fi + if [[ "$COLUMNS" -le 80 ]] + then + PS1="$PS1 $(echo "$PWD" | sed -e 's|'"$HOME"'|~|g' -e 's|\([^/][^/]\)[^\/]\{3,\}\/|\1..\/|g')" else - PS1="$PS1\w\$ " + PS1="$PS1\w" fi + PS1="$PS1\$ " } PROMPT_COMMAND='set_prompt' diff --git a/shell/.local/bin/update b/shell/.local/bin/update index 69ed36f..946edc8 100755 --- a/shell/.local/bin/update +++ b/shell/.local/bin/update @@ -2,6 +2,7 @@ NUL=">/dev/null 2>&1" offlineimap -o -u ttyui +vdirsyncer sync --max-workers=1 cmd() { echo -n 'apt-get update && apt-get dist-upgrade && ' diff --git a/vim/.vim/spell/en.utf-8.add b/vim/.vim/spell/en.utf-8.add index dc2deae..d0c03a5 100644 --- a/vim/.vim/spell/en.utf-8.add +++ b/vim/.vim/spell/en.utf-8.add @@ -28,3 +28,4 @@ deserialization tagless Brightspace GitLab +metaprogramming diff --git a/vim/.vimrc b/vim/.vimrc index f3ea493..d2a798e 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -82,3 +82,6 @@ let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 0 let g:syntastic_check_on_wq = 0 + +" Vimwiki +let g:vimwiki_list = [{'path': '~/projects/kaartenbak'}] diff --git a/vimdoc.sh b/vimdoc.sh new file mode 100644 index 0000000..f34e546 --- /dev/null +++ b/vimdoc.sh @@ -0,0 +1,5 @@ +#!/bin/sh +for f in ~/.vim/pack/plugins/*/*/doc +do + vim -c "helptags $f" -c quit +done diff --git a/x/.config/mimeapps.list b/x/.config/mimeapps.list new file mode 100644 index 0000000..a191f44 --- /dev/null +++ b/x/.config/mimeapps.list @@ -0,0 +1,28 @@ +[Default Applications] +application/pdf=org.gnome.Evince.desktop +x-scheme-handler/msteams=teams.desktop +x-scheme-handler/http=firefox-esr.desktop +x-scheme-handler/https=firefox-esr.desktop +x-scheme-handler/ftp=firefox-esr.desktop +x-scheme-handler/chrome=firefox-esr.desktop +text/html=firefox-esr.desktop +application/x-extension-htm=firefox-esr.desktop +application/x-extension-html=firefox-esr.desktop +application/x-extension-shtml=firefox-esr.desktop +application/xhtml+xml=firefox-esr.desktop +application/x-extension-xhtml=firefox-esr.desktop +application/x-extension-xht=firefox-esr.desktop + +[Added Associations] +application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop; +x-scheme-handler/http=firefox-esr.desktop; +x-scheme-handler/https=firefox-esr.desktop; +x-scheme-handler/ftp=firefox-esr.desktop; +x-scheme-handler/chrome=firefox-esr.desktop; +text/html=firefox-esr.desktop; +application/x-extension-htm=firefox-esr.desktop; +application/x-extension-html=firefox-esr.desktop; +application/x-extension-shtml=firefox-esr.desktop; +application/xhtml+xml=firefox-esr.desktop; +application/x-extension-xhtml=firefox-esr.desktop; +application/x-extension-xht=firefox-esr.desktop; diff --git a/x/.local/bin/dock.sh b/x/.local/bin/dock.sh index 16178c7..b05de71 100755 --- a/x/.local/bin/dock.sh +++ b/x/.local/bin/dock.sh @@ -1,8 +1,8 @@ #!/bin/sh -sudo ifdown enp0s31f6 -sudo ifdown wlp1s0 -sudo ifup enp0s31f6 xrandr-extend-hdmi.sh setxkbmap -option setxkbmap dvorak,ru ,phonetic_dvorak compose:ralt,grp:shifts_toggle,grp_led:scroll +sudo ifdown enp0s31f6 +sudo ifdown wlp1s0 +sudo ifup enp0s31f6 mount /mnt/data diff --git a/x/.local/bin/headphone_connect.sh b/x/.local/bin/headphone_connect.sh new file mode 100755 index 0000000..17acd5a --- /dev/null +++ b/x/.local/bin/headphone_connect.sh @@ -0,0 +1,4 @@ +#!/bin/sh +bluetoothctl connect 14:3F:A6:72:1F:40 +sleep 5 +bluetoothctl connect 14:3F:A6:72:1F:40 diff --git a/x/.local/bin/headphone_disconnect.sh b/x/.local/bin/headphone_disconnect.sh new file mode 100755 index 0000000..c432f99 --- /dev/null +++ b/x/.local/bin/headphone_disconnect.sh @@ -0,0 +1,2 @@ +#!/bin/sh +bluetoothctl disconnect 14:3F:A6:72:1F:40 diff --git a/x/.urxvt/ext/font-size b/x/.urxvt/ext/font-size deleted file mode 100755 index aba0cf4..0000000 --- a/x/.urxvt/ext/font-size +++ /dev/null @@ -1,434 +0,0 @@ -#!/usr/bin/env perl -# -# On-the-fly adjusting of the font size in urxvt -# -# Copyright (c) 2008 David O'Neill -# 2012 Noah K. Tilton -# 2012-2013 Jan Larres -# -# 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 -# - -#: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 - -Add some keybindings: - - 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 - -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 - -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. - -=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_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); - } -} - -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); - } -} - -sub fonts_change_size -{ - my ($term, $change, $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, $newbasesize) = handle_font($term, $basefont, $change, 0); - push @newfonts, $newbasefont; - - # Only adjust other fonts if base font changed - if ($newbasefont ne $basefont) { - foreach my $font (@curfonts) { - my ($newfont, $newsize) = handle_font($term, $font, $change, $newbasesize); - push @newfonts, $newfont; - } - my $newres = join(",", @newfonts); - font_apply_new($term, $newres, "font", $save); - - handle_type($term, "boldFont", $change, $newbasesize, $save); - handle_type($term, "italicFont", $change, $newbasesize, $save); - handle_type($term, "boldItalicFont", $change, $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 handle_type -{ - my ($term, $type, $change, $basesize, $save) = @_; - - my $curres = $term->resource($type); - if (!$curres) { - return; - } - my @curfonts = split(/\s*,\s*/, $curres); - my @newfonts = (); - - foreach my $font (@curfonts) { - my ($newfont, $newsize) = handle_font($term, $font, $change, $basesize); - push @newfonts, $newfont; - } - - my $newres = join(",", @newfonts); - font_apply_new($term, $newres, $type, $save); -} - -sub handle_font -{ - my ($term, $font, $change, $basesize) = @_; - - my $newfont; - my $newsize; - my $prefix = 0; - - if ($font =~ /^\s*x:/) { - $font =~ s/^\s*x://; - $prefix = 1; - } - if ($font =~ /^\s*(\[.*\])?xft:/) { - ($newfont, $newsize) = font_change_size_xft($term, $font, $change, $basesize); - } elsif ($font =~ /^\s*-/) { - ($newfont, $newsize) = font_change_size_xlfd($term, $font, $change, $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, $basesize); - } - - my $fontinfo = (split(/\n/, $lsfinfo))[-1]; - my ($fontfull) = ($fontinfo =~ /\s+([-a-z0-9]+$)/); - ($newfont, $newsize) = font_change_size_xlfd($term, $fontfull, $change, $basesize); - } - - # $term->scr_add_lines("\r\nNew font is $newfont\n"); - if ($prefix) { - $newfont = "x:$newfont"; - } - return ($newfont, $newsize); -} - -sub font_change_size_xft -{ - my ($term, $fontstring, $change, $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 ($basesize != 0) { - $new_size = $basesize; - } else { - $new_size = $size + $change - } - - $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); - } else { - if ($basesize == 0) { - $term->scr_bell; - } - return ($fontstring, $size); - } -} - -sub font_change_size_xlfd -{ - my ($term, $fontstring, $change, $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 @possible; - # $term->scr_add_lines("\r\nPattern is $new_fontstring\n"); - open(FOO, "xlsfonts -fn '$new_fontstring' | sort -u |") or die $!; - while () { - chomp; - s/^-//; # Strip leading '-' before split - my @fontdata = split(/-/, $_); - - push @possible, [$fontdata[6], "-$_"]; - # $term->scr_add_lines("\r\npossibly $fontdata[6] $_\n"); - } - close(FOO); - - if (!@possible) { - die "No possible fonts!"; - } - - if ($basesize != 0) { - # sort by font size, descending - @possible = sort {$b->[0] <=> $a->[0]} @possible; - - # 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 ($possible[0]->[0] > $basesize) { - foreach my $candidate (@possible) { - if ($candidate->[0] <= $basesize) { - return ($candidate->[1], $candidate->[0]); - } - } - } - } elsif ($change > 0) { - # sort by font size, ascending - @possible = sort {$a->[0] <=> $b->[0]} @possible; - - foreach my $candidate (@possible) { - if ($candidate->[0] >= $font{pixelSize} + $change) { - return ($candidate->[1], $candidate->[0]); - } - } - } elsif ($change < 0) { - # sort by font size, descending - @possible = sort {$b->[0] <=> $a->[0]} @possible; - - foreach my $candidate (@possible) { - if ($candidate->[0] <= $font{pixelSize} + $change && $candidate->[0] != 0) { - return ($candidate->[1], $candidate->[0]); - } - } - } - - # no fitting font available, check whether a 0-size font can be used to - # fit the size of the base font - @possible = sort {$a->[0] <=> $b->[0]} @possible; - if ($basesize != 0 && $possible[0]->[0] == 0) { - return ($possible[0]->[1], $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", $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: $! $?"; - } -} diff --git a/x/.xinitrc b/x/.xinitrc index 4a91997..d807ad9 100755 --- a/x/.xinitrc +++ b/x/.xinitrc @@ -18,7 +18,6 @@ xcompmgr -a -c -l0 -t0 -r0 -o.00 & setxkbmap dvorak,ru ,phonetic_dvorak compose:ralt,grp:shifts_toggle,grp_led:scroll,ctrl:swapcaps - # Other system wide xinit files if [ -f /etc/X11/xinit/xinitrc ]; then . /etc/X11/xinit/xinitrc -- 2.20.1