dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 23db4798e0958e48af1097d45574ff021b2dd0a7
parent 718e235ae2d48f2f0e93f6fd43fbb4de6bffa989
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu, 19 Sep 2019 16:50:56 +0200

Merge branch 'master' of adamsgaard.dk:src/dotfiles

Diffstat:
M.config/mimeapps.list | 3++-
M.config/nnn/plugins/fzf-edit | 4++--
M.config/nnn/plugins/fzf-open | 4++--
M.config/zathura/zathurarc | 3++-
M.local/bin/syncdir | 2+-
D.local/lib/watch/Makefile | 35-----------------------------------
D.local/lib/watch/watch.c | 137-------------------------------------------------------------------------------
A.local/share/applications/zathura.desktop | 4++++
8 files changed, 13 insertions(+), 179 deletions(-)

diff --git a/.config/mimeapps.list b/.config/mimeapps.list @@ -4,7 +4,6 @@ video/mkv=mpv.desktop; video/avi=mpv.desktop; video/x-matroska=mpv.desktop; video/webm=mpv.desktop; -application/pdf=org.pwmt.zathura-pdf-mupdf.desktop; image/png=sxiv.desktop; image/jpeg=sxiv.desktop; image/gif=sxiv.desktop; @@ -19,6 +18,7 @@ x-scheme-handler/spice=org.remmina.Remmina.desktop x-scheme-handler/vnc=org.remmina.Remmina.desktop x-scheme-handler/remmina=org.remmina.Remmina.desktop application/x-remmina=org.remmina.Remmina.desktop +application/pdf=zathura.desktop [Added Associations] x-scheme-handler/rdp=org.remmina.Remmina.desktop; @@ -26,3 +26,4 @@ x-scheme-handler/spice=org.remmina.Remmina.desktop; x-scheme-handler/vnc=org.remmina.Remmina.desktop; x-scheme-handler/remmina=org.remmina.Remmina.desktop; application/x-remmina=org.remmina.Remmina.desktop; +application/pdf=org.pwmt.zathura-pdf-poppler.desktop; diff --git a/.config/nnn/plugins/fzf-edit b/.config/nnn/plugins/fzf-edit @@ -1,2 +1,2 @@ -#!/usr/bin/env sh -vim "$(find . -type f | fzf)" +#!/bin/sh +$EDITOR "$(find . -type f | fzf)" diff --git a/.config/nnn/plugins/fzf-open b/.config/nnn/plugins/fzf-open @@ -1,2 +1,2 @@ -#!/usr/bin/env sh -xdg-open "$(find . -type f | fzf)" >/dev/null 2>&1 +#!/bin/sh +setsid xdg-open "$(find . -type f | fzf)" >/dev/null 2>&1 diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc @@ -1,4 +1,4 @@ -set font "lime normal 9" +set font "pragmatapro normal 9" set guioptions "" set default-bg "#30303a" set default-fg "#d6d6d6" @@ -8,6 +8,7 @@ set adjust-open width set inputbar-fg "#aaaaaa" set completion-highlight-bg "#30303a" set completion-highlight-fg "#aaaaaa" +set statusbar-home-tilde map <C-o> feedkeys ":exec zathura '$FILE'<Return>" map <C-i> feedkeys ":exec getdoi --notify --clip '$FILE'<Return>" diff --git a/.local/bin/syncdir b/.local/bin/syncdir @@ -68,6 +68,6 @@ if [ $# -lt 1 ]; then fi for d in "$@"; do - [ ! -d "$d" ] && die "Error: $d is not a directory" + mkdir -p "$d" sync_dir "$d" done diff --git a/.local/lib/watch/Makefile b/.local/lib/watch/Makefile @@ -1,35 +0,0 @@ -CFLAGS = -g -std=c99 -pedantic -Wall -LDFLAGS = -lm -SRC = $(wildcard *.c) -OBJ = $(patsubst %.c,%.o,$(SRC)) -HDR = $(wildcard *.h) -BIN = ./watch - -PREFIX ?= ~/.local -INSTALL ?= install -STRIP ?= strip - -default: $(BIN) - -$(BIN): $(OBJ) $(HDR) - $(CC) $(LDFLAGS) $(OBJ) -o $@ - -install: $(BIN) - $(STRIP) $(BIN) - $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin - $(INSTALL) -m 0755 $(BIN) $(DESTDIR)$(PREFIX)/bin - -uninstall: - $(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN) - -memtest: $(BIN) - valgrind --error-exitcode=1 --leak-check=full $(BIN) -h - valgrind --error-exitcode=1 --leak-check=full $(BIN) -v - valgrind --error-exitcode=1 --leak-check=full $(BIN) -q -r 2 date - valgrind --error-exitcode=1 --leak-check=full $(BIN) -q -n 2 -r 2 ls - -clean: - $(RM) *.o - $(RM) $(BIN) - -.PHONY: default install uninstall memtest clean diff --git a/.local/lib/watch/watch.c b/.local/lib/watch/watch.c @@ -1,137 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <getopt.h> -#include <string.h> -#include <unistd.h> - -#define VERSION "0.1.0" -#define PROGNAME "watch" - -void -usage(int interval) -{ - printf("%s: %s [OPTIONS] COMMAND\n" - "will repeatedly run COMMAND every %d seconds.\n" - "Following OPTIONS are valid:\n" - " -h, --help show this message\n" - " -v, --version show version and license information\n" - " -n, --interval SECONDS set interval between command invocations\n" - " -r, --repeat N repeat for N times and then quit\n" - " -q, --quiet suppress output (stdout) from COMMAND\n" - " -c, --no-clear do not clear screen between COMMAND calls\n" - " -- do not consider any following args as options\n" - , - __func__, PROGNAME, interval); -} - -void -version() -{ - printf("%s version %s\n" - "Licensed under the GNU Public License, v3+\n" - "Written by Anders Damsgaard, anders@adamsgaard.dk\n", - PROGNAME, VERSION); -} - -void -die(char* error_message) -{ - fprintf(stderr, "%s", error_message); - exit(1); -} - -void -run_cmd(int sleeptime, char* command, int quiet, int clearscreen) -{ - if (!quiet) { - if (clearscreen) - printf("\e[1;1H\e[2J"); /* clear screen (POSIX) */ - else - puts(""); - printf("Every %ds: %s\n\n", sleeptime, command); - } - if (quiet) - strcat(command, " >/dev/null"); - system(command); - sleep(sleeptime); -} - -int -main(int argc, char* argv[]) -{ - int i, opt; - int interval, repeat, quiet, clearscreen; - const char* optstring; - char* command; - - interval = 5; - quiet = 0; - optstring = "hvn:r:qc"; - const struct option longopts[] = { - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'v'}, - {"interval", required_argument, NULL, 'n'}, - {"repeat", required_argument, NULL, 'r'}, - {"quiet", no_argument, NULL, 'q'}, - {"no-clear", no_argument, NULL, 'c'}, - {NULL, 0, NULL, 0} - }; - - repeat = 0; - clearscreen = 1; - while ((opt = getopt_long(argc, argv, optstring, longopts, NULL)) != -1) { - switch (opt) { - case -1: /* no more arguments */ - case 0: /* long options toggles*/ - break; - case 'h': - usage(interval); - return 0; - case 'v': - version(); - return 0; - case 'n': - interval = atoi(optarg); - break; - case 'r': - repeat = atoi(optarg); - break; - case 'q': - quiet = 1; - break; - case 'c': - clearscreen = 0; - break; - default: - fprintf(stderr, "%s: invalid option -- %c\n", argv[0], opt); - fprintf(stderr, "try `%s --help` for more information\n", - argv[0]); - return -2; - } - } - - if (optind == argc) - die("error: no COMMAND specified\n"); - - if ((command = malloc(512)) != NULL) { - command[0] = '\0'; - strcat(command, "[ -f ~/.commands.sh ] && . ~/.commands.sh; "); - for (i=optind; i<argc; ++i) { - strcat(command, argv[i]); - if (i < argc-1) - strcat(command, " "); - } - } else { - die("command malloc failed"); - } - - if (repeat > 0) { - for (i=0; i<repeat; ++i) - run_cmd(interval, command, quiet, clearscreen); - } else { - for (;;) - run_cmd(interval, command, quiet, clearscreen); - } - free(command); - return 0; -} diff --git a/.local/share/applications/zathura.desktop b/.local/share/applications/zathura.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=PDF +Exec=zathura %U