diff --git a/.gitignore b/.gitignore index 386e60b..b507a78 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,9 @@ tags .vim # End of https://www.gitignore.io/api/vim,linux + +# Ignore dynamic colorschemes set by styler +colorscheme.vim +colorscheme +colorscheme.py +colorscheme.rasi diff --git a/README.md b/README.md index cc63a71..abf8137 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ # dotfiles Read-Me and Roadmap ## What's in these dotfiles + * [x] vim configuration for simple programming tasks (especially go/typescript/python/bash) and prose * [x] academic workflow tools, to allow quick citation, pdf compilation, and preview -* [x] simple, efficient polybar with package update notification, and spotify integration +* [x] simple, efficient polybar with package update notification, and spotify (mpris) integration * [x] tmux session management through `tm` and `tl` tools -* [x] quick terminal-wide color management through `sd`/`sD`/`sl`/`sL` commands, allowing two light and dark color-schemes -* [x] many vim color-schemes with quick light/dark switching (`F8`) and theme switch (`+F8`) +* [x] tmux fuzzy-searching of terminal sessions to switch to with hot-key (``) +* [x] system-wide color management (terminals, vim, qutebrowser, polybar, xresources) through `styler` command using [base16](http://chriskempson.com/projects/base16/) themes +* [x] quick theme switching by activating `styler` and fuzzy-searching themes with hot-key (`+F8`) +* [x] many vim color-schemes with quick light/dark switching (`F8`) and individual theme switch (`+F8`) * [x] quick directory jumping using z, with fzf integration * [x] fzf integrations for bibtex citation, vim buffer management, most recently used switching, shell command history, and more diff --git a/home/.Xresources b/home/.Xresources deleted file mode 100644 index 4988cbe..0000000 --- a/home/.Xresources +++ /dev/null @@ -1,12 +0,0 @@ -! ~/.Xresources - -! Setting up commonly changed vars -#define myfontsize 11 -#define myfont Fira Code -#define myOpacity 90 - -! Set up URxvt -#include ".config/Xresources/urxvt.Xresources" - -! Add Nord theme to every terminal emulator respecting Xresources -#include ".config/Xresources/nord.Xresources" diff --git a/nvim/.config/nvim/colo.vim b/nvim/.config/nvim/colo.vim deleted file mode 100644 index cc9ab5a..0000000 --- a/nvim/.config/nvim/colo.vim +++ /dev/null @@ -1 +0,0 @@ -colo nord diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 304fe1c..224c670 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -47,6 +47,13 @@ endif " set truecolor (neovim) set termguicolors +" load colorscheme from dynamic file +" first one is here to make airline behave correctly without reload +runtime colorscheme.vim +" this one is here to override anything set by default in colorscheme plugin +" loading +autocmd VimEnter * runtime colorscheme.vim + " sets tabs to be 2 characters, expanded into spaces, but still removable with " one press of backspace. " great explanation: http://vimcasts.org/transcripts/2/en/ diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index b9233bc..4222ae0 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -18,14 +18,14 @@ [colors] ;background = ${xrdb:color0:#222} -background = #222 -background-alt = #444 +background = ${xrdb:background} +background-alt = ${xrdb:color8} ;foreground = ${xrdb:color7:#222} -foreground = #dfdfdf -foreground-alt = #555 -primary = #ffb52a -secondary = #e60053 -alert = #bd2c40 +foreground = ${xrdb:foreground} +foreground-alt = ${xrdb:color3} +primary = ${xrdb:color1} +secondary = ${xrdb:color4} +alert = ${xrdb:color2} [settings] ; The throttle settings lets the eventloop swallow up til X events diff --git a/qutebrowser/.config/qutebrowser/config.py b/qutebrowser/.config/qutebrowser/config.py index 6dbba74..53cdfa1 100644 --- a/qutebrowser/.config/qutebrowser/config.py +++ b/qutebrowser/.config/qutebrowser/config.py @@ -61,8 +61,8 @@ c.tabs.title.format = '{index} {audio}{perc}{current_title}' c.tabs.position = "right" c.tabs.width = "15%" -# give the browser nice nord theme colors -config.source('themes/base16-gruvbox-dark.py') +# give the browser nice theme colors +config.source('colorscheme.py') # Status bar # should be visible to prevent 'jumping' bug, see https://github.com/qutebrowser/qutebrowser/issues/2236 diff --git a/rofi/.config/rofi/themes/dmenu.rasi b/rofi/.config/rofi/themes/dmenu.rasi index c062465..46aab32 100644 --- a/rofi/.config/rofi/themes/dmenu.rasi +++ b/rofi/.config/rofi/themes/dmenu.rasi @@ -22,6 +22,7 @@ #listview { spacing: 5px; lines: 100; + border: 0px; } #entry { diff --git a/rofi/.config/rofi/themes/settings.rasi b/rofi/.config/rofi/themes/settings.rasi index f1d0f5c..93146a1 100644 --- a/rofi/.config/rofi/themes/settings.rasi +++ b/rofi/.config/rofi/themes/settings.rasi @@ -10,6 +10,7 @@ * but try to keep the two separated as much as possible, so we can adjust global options easily from here */ +//default import @import "colorschemes/gruvbox-dark.rasi" * { diff --git a/shell/.config/shell/rc.d/autostartx.sh b/shell/.config/shell/rc.d/autostartx.sh index f598e0b..6a50795 100644 --- a/shell/.config/shell/rc.d/autostartx.sh +++ b/shell/.config/shell/rc.d/autostartx.sh @@ -1,5 +1,5 @@ #!/bin/sh if [ ! "$DISPLAY" ] && [ "$XDG_VTNR" -eq 1 ]; then - exec startx ~/.xinitrc + exec startx "$XDG_CONFIG_HOME"/xresources/xinitrc fi diff --git a/styler/.local/bin/styler b/styler/.local/bin/styler new file mode 100755 index 0000000..912079c --- /dev/null +++ b/styler/.local/bin/styler @@ -0,0 +1,212 @@ +#!/usr/bin/env bash + +readonly BASE_PATH="${STYLER_DATA_PATH:-${XDG_DATA_HOME:-$HOME/.local/share}/styler}" + +readonly PACKAGE_PATH="$BASE_PATH/packages" +readonly PROCESSOR_PATH="$BASE_PATH/processors" + +readonly VERSION="0.3.0" + +main() { + local cmd="" + local ret=0 + + case "$1" in + -t | --theme | theme) + cmd="switch_theme" + ;; + -s | --set | set) + cmd="set_theme" + ;; + -l | --list | list) + cmd="list" + ;; + -d | --download | download) + cmd="download" + ;; + -v | --version | version) + printf "Program theming script.\n\n©Marty Oehme\n\nVersion: %s\n" "$VERSION" + exit 0 + ;; + -h | --help | help | *) + cmd="usage" + ;; + esac + shift + + $cmd "$1" + ret=$((ret + $?)) + exit $ret +} + +usage() { + printf "%s\n" \ + "" \ + " styler - Quickly switch your linux style." \ + " Uses base16 themes to quickly set them for a variety of applications." \ + "" \ + " Usage: styler [-hv | set base16-themename]" \ + "" \ + " Options:" \ + "" \ + " -t | theme Temporarily switch theme. Use any valid base16 theme name (without base16- prefix)." \ + " Theme will be lost upon restart, or application restarts." \ + "" \ + " -s | set Set the theme. Use any valid base16 theme name (without base16- prefix)." \ + " Same as 'theme' option, but changes will be made permanent." \ + "" \ + " -d | download Download a base16 template into the package directory or download a processor16" \ + " into the processor directory. Use user/repo format to automatically pull from github." \ + "" \ + " -h | help Print out this help." \ + "" \ + " -v | version Print out program information." \ + "" \ + "" +} + +# base directory should always exist +base_dir_exists_or_create() { + [[ -d "$BASE_PATH" ]] || mkdir "$BASE_PATH" + [[ -d "$PACKAGE_PATH" ]] || mkdir "$PACKAGE_PATH" + [[ -d "$PROCESSOR_PATH" ]] || mkdir "$BASE_PATH" +} + +# retrieves all relevant packages from BASE_PATH/packages +# 'relevant' here means they follow github pattern of author/repository +get_packages() { + for author in "$PACKAGE_PATH"/*; do + # TODO should eventually be used to either distinguish between author/pkg and pkg packages + # or to spit out a warning if they should not be used. + # if grep -q -e '^base16-' <<<"$(basename -- "$author")"; then + # echo ERROR + # fi + for package in "$author"/*; do + [[ -e "$author" ]] || break + [[ -d "$package" ]] || break + printf "%s/%s\n" "$(basename -- "$author")" "$(basename -- "$package")" + done + done +} + +# retrieves all processors from BASE_PATH/processors +# 'relevant' here means they follow github pattern of author/repository +get_processors() { + for author in "$PROCESSOR_PATH"/*; do + for package in "$author"/*; do + for processor in "$package"/*; do + [[ -e "$processor" ]] || break + [[ -f "$processor" ]] || break + if grep -q -e '/theme_[[:alnum:]]\{1,\}$' <<<"$processor"; then + printf "%s\n" "$(basename -- "$processor")" + fi + done + done + done +} + +# retrieves all installed themes from all packages, appends applications they exist for +get_themes() { + local themes + themes=$(find "$PACKAGE_PATH" -type f -name 'base16-*') + echo "$themes" | sed "s/.*\\/base16-//" | sed "s/\\..*//" | sort | uniq +} + +# temporarily switch theme, same thing as setting, only with permanence flag turned off for processors +switch_theme() { + set_theme "$1" "false" +} + +# call processors for all installed packages +set_theme() { + local theme="$1" + local permanent="${2:-true}" + + local packages + packages="$(get_packages)" + if [[ -z "$packages" ]]; then + printf "ERROR: No base16 packages installed. Please install at least 1 base16 package in %s/.\n" "$PACKAGE_PATH" >&2 + exit 1 + fi + + local processors + processors="$(get_processors)" + if [[ -z "$processors" ]]; then + printf "ERROR: No application processors installed. Please install at least one processor in %s/.\n" "$PROCESSOR_PATH" >&2 + exit 1 + fi + + for pkg in $packages; do + local appext + + # filter the application a package targets, since base16 packages + # carry standard names this removes everything before base16- + # the result is the application it targets + # shellcheck disable=SC2001 + appext=$(sed "s|^[[:alnum:]]\{1,\}/base16-||" <<<"$pkg") + + # Compares application extension with existing processors and runs the appropriate processor if found + processor=$(find "$PROCESSOR_PATH" -type f -name "theme_$appext") + if [[ -f "$processor" ]]; then + "$processor" "$PACKAGE_PATH" "$pkg" "$theme" "$permanent" + else + printf "WARN: No processor found for application %s in %s. Make sure you install a processor for the application.\n" "$appext" "$PROCESSOR_PATH/" >&2 + fi + + done +} + +list() { + local selected="$1" + + case "$selected" in + packages) + get_packages + ;; + processors) + get_processors + ;; + themes) + get_themes + ;; + *) + echo "Please select one of packages | processors | themes to list." + ;; + esac +} + +download() { + local pkg="$1" + local page="https://github.com" + local repo="$page/$pkg" + + [[ -z "$pkg" ]] && { + echo "No package to download passed in. Please provide a package to download in the form user/repository." + exit 1 + } + + type git >/dev/null 2>&1 || { + echo "git is required to clone base16 package. Please install git." + exit 1 + } + + base_dir_exists_or_create + + if ! git ls-remote --exit-code -h "$repo" >/dev/null; then + echo "Repository $repo not found." + exit 1 + fi + + # if package has patter name/base16-program, put it in packages; if name/process16-program put it in processors + # if none of the above, assume it's a processor but warn the user + if grep -q -e '^[0-9A-Za-z-]\{1,\}/base16-[0-9A-Za-z-]\{1,\}$' <<<"$pkg"; then + git clone "$repo" "$PACKAGE_PATH/$pkg" + elif grep -q -e '^[0-9A-Za-z-]\{1,\}/process16-[0-9A-Za-z-]\{1,\}$' <<<"$pkg"; then + git clone "$repo" "$PROCESSOR_PATH/$pkg" + else + echo "Package does not fit default naming scheme of packages/processors. Assuming it is a processor but please check manually." + git clone "$repo" "$PROCESSOR_PATH/$pkg" + fi +} + +main "$@" diff --git a/sxhkd/.config/sxhkd/sxhkdrc b/sxhkd/.config/sxhkd/sxhkdrc index d435e50..3896a7f 100644 --- a/sxhkd/.config/sxhkd/sxhkdrc +++ b/sxhkd/.config/sxhkd/sxhkdrc @@ -30,6 +30,10 @@ super + x super + BackSpace rofi -modi "powermenu:~/.config/rofi/modes/powermenu" -show powermenu -theme themes/powermenu +# quick-switching of theme using styler +super + F8 + styler set $(styler list themes | rofi -dmenu -theme /themes/dmenu -matching fuzzy) + # enable function (/media) key functionality # TODO: set up next song, previous song, pause, etc # see: https://www.reddit.com/r/i3wm/comments/3a6nh3/help_how_to_use_function_keys_in_i3_config/ diff --git a/xresources/.config/xresources/Xresources b/xresources/.config/xresources/Xresources new file mode 100644 index 0000000..cd35b65 --- /dev/null +++ b/xresources/.config/xresources/Xresources @@ -0,0 +1,11 @@ +! ~/.Xresources + +! Setting up commonly changed vars +#define myfontsize 11 +#define myfont Iosevka Mono +#define myOpacity 90 + +! Font settings +#include "Xresources.d/fonts" + +! Colorscheme diff --git a/xresources/.config/xresources/Xresources.d/fonts b/xresources/.config/xresources/Xresources.d/fonts new file mode 100644 index 0000000..58faa41 --- /dev/null +++ b/xresources/.config/xresources/Xresources.d/fonts @@ -0,0 +1,7 @@ +Xft.antialias: 1 +Xft.autohint: 0 +Xft.dpi: 92 +Xft.hinting: true +Xft.hintstyle: hintslight +Xft.lcdfilter: lcddefault +Xft.rgba: rgb diff --git a/xresources/.config/xresources/nord.Xresources b/xresources/.config/xresources/nord.Xresources deleted file mode 100644 index 3122e26..0000000 --- a/xresources/.config/xresources/nord.Xresources +++ /dev/null @@ -1,48 +0,0 @@ -! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -! title Nord XResources + -! project nord-xresources + -! version 0.1.0 + -! repository https://github.com/arcticicestudio/nord-xresources + -! author Arctic Ice Studio + -! email development@arcticicestudio.com + -! copyright Copyright (C) 2016 + -! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -#define nord0 #2E3440 -#define nord1 #3B4252 -#define nord2 #434C5E -#define nord3 #4C566A -#define nord4 #D8DEE9 -#define nord5 #E5E9F0 -#define nord6 #ECEFF4 -#define nord7 #8FBCBB -#define nord8 #88C0D0 -#define nord9 #81A1C1 -#define nord10 #5E81AC -#define nord11 #BF616A -#define nord12 #D08770 -#define nord13 #EBCB8B -#define nord14 #A3BE8C -#define nord15 #B48EAD - -*.foreground: nord4 -*.background: [myOpacity]nord0 -*.cursorColor: nord4 -*fading: 0 -*fadeColor: nord3 - -*.color0: nord1 -*.color1: nord11 -*.color2: nord14 -*.color3: nord13 -*.color4: nord9 -*.color5: nord15 -*.color6: nord8 -*.color7: nord5 -*.color8: nord3 -*.color9: nord11 -*.color10: nord14 -*.color11: nord13 -*.color12: nord9 -*.color13: nord15 -*.color14: nord7 -*.color15: nord6 diff --git a/xresources/.config/xresources/urxvt.Xresources b/xresources/.config/xresources/urxvt.Xresources deleted file mode 100644 index 5ff2d59..0000000 --- a/xresources/.config/xresources/urxvt.Xresources +++ /dev/null @@ -1,37 +0,0 @@ -!Font -URxvt.font: xft:myfont:size=myfontsize,style=medium -URxvt.boldFont: xft:myfont:size=myfontsize,style=bold -URxvt.italicFont: xft:myfont:size=myfontsize,style=italic -URxvt.boldItalicFont: xft:myfont:size=myfontsize,style=bold,italic -URxvt.letterSpace: -1 - -!UI -URxvt.scrollBar: false -URxvt.borderless: true -URxvt.saveLines: 20000 -URxvt.dynamicColors: true -URxvt.fading: 25 - -!Sane utility defaults -URxvt.loginShell: true -URxvt.scrollTtyKeypress: true -URxvt.scrollTtyOutput: false -URxvt.scrollWithBuffer: false -URxvt.skipScroll: true - -!Extensions -!Tabbing disabled by default (TMUX used for tabbed terminals) -!to enable tabbing comment the bottom line and uncomment the one above. -!URxvt.perl-ext-common: default,matcher,tabbed -URxvt.perl-ext-common: default,matcher - -! Link Clicking -URxvt.url-launcher: /usr/bin/xdg-open -URxvt.matcher.button: 1 -URxvt.matcher.rend.0: Uline Bold fg5 - -!Tab Styling -URxvt.tabbed.tabbar-fg: 2 -URxvt.tabbed.tabbar-bg: 0 -URxvt.tabbed.tab-fg: 3 -URxvt.tabbed.tab-bg: 0 diff --git a/home/.xinitrc b/xresources/.config/xresources/xinitrc similarity index 93% rename from home/.xinitrc rename to xresources/.config/xresources/xinitrc index f2f4a59..97fbf52 100644 --- a/home/.xinitrc +++ b/xresources/.config/xresources/xinitrc @@ -1,7 +1,7 @@ #!/bin/sh -userresources=$HOME/.Xresources -usermodmap=$HOME/.Xmodmap +userresources=$XDG_CONFIG_HOME/xresources/Xresources +usermodmap=$XDG_CONFIG_HOME/xresources/Xmodmap sysresources=/etc/X11/xinit/.Xresources sysmodmap=/etc/X11/xinit/.Xmodmap @@ -37,7 +37,7 @@ fi setxkbmap -option ctrl:nocaps # sets default to EURkey layout, with possibility to switch to german # sets german layout to be default for the only pc I have with a german keyboard -if [[ $HOST == "marty-desk" ]] || [[ $HOSTNAME == "marty-desk" ]]; then +if [ "$HOST" = "marty-desk" ] || [ "$HOSTNAME" = "marty-desk" ]; then setxkbmap -layout de,eu else setxkbmap -layout eu,de