From cef34b86cb9838058521eed3acb512b17f022052 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Thu, 17 Sep 2020 23:55:09 +0800 Subject: [PATCH] Add slop and newsboat config I've also updated the Rofi config with my custom mode scripts. Aside from that, I've finally took the time to recreate my file metadata editing script. Well, there's also the update of the README. --- .gitignore | 1 + README.adoc | 13 +-- bin/choose-emoji-menu | 3 +- bin/edit-file-metadata | 55 ++++++++++++- emacs/config.el | 37 +++++++-- emacs/init.el | 2 +- emacs/packages.el | 19 +++-- emacs/snippets/fundamental-mode/now | 4 +- emacs/snippets/org-mode/quote | 7 ++ locations.json | 5 +- newsboat/urls | 2 + rofi/config.rasi | 9 --- rofi/{mode => modes}/buku | 0 rofi/{mode => modes}/delim | 0 rofi/{mode => modes}/recoll | 0 rofi/{mode => modes}/script | 0 rofi/themes/dmenu.rasi | 66 --------------- rofi/themes/fds-center-menu.rasi | 93 --------------------- rofi/themes/fds-mini-sidebar.rasi | 121 ---------------------------- slop/crosshair.frag | 43 ++++++++++ slop/crosshair.vert | 12 +++ 21 files changed, 175 insertions(+), 317 deletions(-) create mode 100755 emacs/snippets/org-mode/quote create mode 100644 newsboat/urls delete mode 100755 rofi/config.rasi rename rofi/{mode => modes}/buku (100%) rename rofi/{mode => modes}/delim (100%) rename rofi/{mode => modes}/recoll (100%) rename rofi/{mode => modes}/script (100%) delete mode 100755 rofi/themes/dmenu.rasi delete mode 100755 rofi/themes/fds-center-menu.rasi delete mode 100755 rofi/themes/fds-mini-sidebar.rasi create mode 100644 slop/crosshair.frag create mode 100644 slop/crosshair.vert diff --git a/.gitignore b/.gitignore index ea289fc..97caa8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ **/.envrc +**/shell.nix diff --git a/README.adoc b/README.adoc index 13cd80d..7517293 100755 --- a/README.adoc +++ b/README.adoc @@ -82,13 +82,11 @@ If you're not familiar with it, you can read http://brandon.invergo.net/news/201 However, with Python 3 (specifically 3.8) installed, you have another option. Behold, the link:./vtsm["Very Tiny Stow Manager"] (VTSM for short)! +The best way to describe VTSM is basically GNU Stow with a generic shell runner. VTSM takes inspiration from GNU Stow (obviously) and https://github.com/holman/dotfiles[how Zach Holman's dotfiles are set]. When managing your dotfiles, VTSM is going to be your friend/workmate. -Using VTSM should be simple and it is nothing special, really. -All it needs is a directory containing a file named `locations.json` with the name of the packages and their target path. -VTSM will simply run commands with those packages. -In short, it's just a shell runner set by a data file. +All VTSM needs is a directory containing a package list stored in `locations.json` with the name of the packages and their target path. .An example of what `locations.json` could be [source, json] @@ -113,7 +111,7 @@ In short, it's just a shell runner set by a data file. ---- With the tiny manager and the package list, we can then execute commands with all of the packages and its target path with one go. -For the command string, it is a https://docs.python.org/3/library/string.html#string.Template[Python template] with `package` and `location` as the available objects. +Here are some examples of running commands with VTSM. [source, shell] ---- @@ -127,8 +125,13 @@ For the command string, it is a https://docs.python.org/3/library/string.html#st # Create the directories of the target path and install them with GNU Stow. # Bada-bing, bada-boom, you have installed your setup or something. ./vtsm --commands "mkdir -p {location} && stow {package} --target {location}" + +# Run commands only to Rofi and Emacs config files. +./vtsm --only "rofi" "emacs" --commands "stow --restow {package} --target {location}" ---- +For the command string, it is a https://docs.python.org/3/library/string.html#string.Template[Python template] with `package` and `location` as the available objects. + === Custom scripts diff --git a/bin/choose-emoji-menu b/bin/choose-emoji-menu index 814f172..4ed693d 100755 --- a/bin/choose-emoji-menu +++ b/bin/choose-emoji-menu @@ -12,8 +12,9 @@ # * rofi - Version: 1.5.4 # * xclip - version 0.13 -emoji_file="$HOME/.local/share/emoji-list.txt" +emoji_file="${XDG_DATA_HOME:-HOME/.local/share}/emoji-list.txt" if [[ ! -f $emoji_file ]]; then + notify-send "Downloading the emoji data file." wget --output-document "$emoji_file" https://unicode.org/Public/emoji/13.0/emoji-test.txt fi diff --git a/bin/edit-file-metadata b/bin/edit-file-metadata index 8ec5bb1..e48447c 100755 --- a/bin/edit-file-metadata +++ b/bin/edit-file-metadata @@ -1,8 +1,57 @@ #!/usr/bin/env perl +# A quick script on moving a document with the embedded metadata. +# It uses exiftool for embedding so be sure to have it installed. +# Only needs an argument of a filename to be converted. + +# TODO: Create --title (-t) option that automatically skips the title prompt. +# TODO: Create --author (-a) option that automatically skips the author prompt. +# TODO: Create --date (-d) option that automatically skips the date prompt. + +use File::Basename; +use File::Copy; use Modern::Perl; -sub kebab_case { - my ($sentence) = @_; - $sentence = +# Create a simple prompt returning with the given answer. +sub prompt { + my ($msg) = @_; + say $msg; + print ">> "; + return ; } + +# This implementation of kebab-case conversion is opinionated. +# It converts into lowercase and removes all non-alphanumeric characters. +sub kebab_case { + my ($string) = @_; + + # Convert into lowercase. + $string = lc($string); + + # Substitute all spaces and extra dashes as one dash. + $string =~ s/\s+|-+/-/g; + + # Remove all invalid characters. + $string =~ s/[^a-z0-9-]//g; + + # Remove all leading and trailing dashes. + $string =~ s/^-+|-+$//g; + + return $string; +} + +my $file = $ARGV[0]; + +# Prompt for all the required information. +my $title = prompt "Title of the document?"; +my $author = prompt "Author?"; +my $publication_date = prompt "Publication date?"; + +# Overwrite the file metadata. +system "exiftool -title=\"${title}\" -author=\"${author}\" -date=\"${publication_date}\" \"$file\""; + +# Once the file metadata has been written, it is time to move the file into its kebab-case equivalent. +my ($filename, $dirs, $suffix) = fileparse($file, '\.[^.]+$'); +my $file_slug = $dirs . kebab_case($title) . $suffix; +move($file, $file_slug); + diff --git a/emacs/config.el b/emacs/config.el index b81241e..bc724d9 100755 --- a/emacs/config.el +++ b/emacs/config.el @@ -67,15 +67,23 @@ (add-to-list 'safe-local-variable-values '(TeX-command-extra-options . "-shell-escape"))) - (after! org (setq ; Set the journal. org-journal-dir "~/writings/journal" org-journal-file-format "%F" + org-capture-templates `( + ("i" "inbox" entry (file ,(concat org-directory "/inbox.org")) + ,(concat "* TODO %?\n" + "entered on %<%F %T %:z>")) + + ("c" "org-protocol-capture" entry (file ,(concat org-directory "/inbox.org")) + "* TODO [[%:link][%:description]]\n%x" + :immediate-finish t)) + ; Set a custom time-stamp pattern. - ; Even though, it's not recommended, most of the time, + ; Even though, it's not recommended, most of the time, it is mainly for personal documents so it is safe. time-stamp-start "DATE_MODIFIED:[ ]+\\\\?[\"<]+" ; Configure org-roam. @@ -84,8 +92,8 @@ ("d" "default" plain (function org-roam--capture-get-point) "#+AUTHOR: \"%(user-full-name)\" #+EMAIL: \"%(user-mail-address)\" -#+DATE: \"%<%Y-%m-%d %T%:z>\" -#+DATE_MODIFIED: \"%<%Y-%m-%d %T%:z>\" +#+DATE: \"%<%Y-%m-%d %T %:z>\" +#+DATE_MODIFIED: \"%<%Y-%m-%d %T %:z>\" #+LANGUAGE: en #+OPTIONS: toc:t #+PROPERTY: header-args :exports both @@ -95,7 +103,22 @@ :head "#+TITLE: ${title}\n" :unnarrowed t)))) -; Modify the time-stamp with each save. -(setq time-stamp-format "%Y-%02m-%02d %02H:%02M:%02S%:z" - +file-templates-dir (expand-file-name "templates/" doom-private-dir)) +(setq + ; Modify the time-stamp with each save. + time-stamp-format "%Y-%02m-%02d %02H:%02M:%02S %:z" + + ; Set file templates folder at $DOOMDIR/templates. + +file-templates-dir (expand-file-name "templates/" doom-private-dir)) + +; Automate updating timestamps. (add-hook 'before-save-hook 'time-stamp) + +; Activate minimap for all program-based modes (e.g., web-mode, python-mode) and text-based modes (e.g., org-mode, markdown-mode). +(after! minimap + (setq minimap-major-modes '(prog-mode text-mode org-mode))) + +; Org-roam-bibtex is somehow a horrible name. +; I guess that's why they insist on calling it ORB. +(use-package! org-roam-bibtex + :after-call org-mode + :hook (org-roam-mode . org-roam-bibtex-mode)) diff --git a/emacs/init.el b/emacs/init.el index d4aabf6..9266a84 100755 --- a/emacs/init.el +++ b/emacs/init.el @@ -182,6 +182,6 @@ ;; This is where custom modules in the Doom directory should be put for orgaanizational purposes. :tools - neuron ; Neurons are a must for the brain. + ;;neuron ; Neurons are a must for the brain. ) diff --git a/emacs/packages.el b/emacs/packages.el index ad5852d..8cf420c 100755 --- a/emacs/packages.el +++ b/emacs/packages.el @@ -51,9 +51,16 @@ ;;;;;;;;;;;; ; PACKAGES ; ;;;;;;;;;;;; -(package! flycheck-vale) -(package! ya-org-capture - :recipe (:host github - :repo "ag91/ya-org-capture") - :pin "0333ee28c92a40a351e64695a0cfcd715c69838b") -(package! yankpad) +;;(package! flycheck-vale) +(package! org-roam-bibtex + :recipe (:host github + :repo "org-roam/org-roam-bibtex")) + +; Since org-roam-bibtex is a connector to all of the specified packages and in alpha stage, it can be problematic so we'll disable it for now. +(unpin! org-roam company-org-roam) + +; A minimap in case you have Stockholm Syndrome for your bloated IDEs. :) +(package! minimap + :recipe (:host github + :repo "dengste/minimap") + :pin "8bc9a65825925a7c58b83ad389f07a93f22d60f3") diff --git a/emacs/snippets/fundamental-mode/now b/emacs/snippets/fundamental-mode/now index ffe4475..1830dd7 100755 --- a/emacs/snippets/fundamental-mode/now +++ b/emacs/snippets/fundamental-mode/now @@ -1,5 +1,5 @@ # -*- mode: snippet -*- -# name: Print today's date in ISO format. +# name: Print today's datetime in ISO format. # key: now # -- -`(format-time-string "%F %T%:z %Z")` $0 +`(format-time-string "%F %T %:z")` $0 diff --git a/emacs/snippets/org-mode/quote b/emacs/snippets/org-mode/quote new file mode 100755 index 0000000..dc938b0 --- /dev/null +++ b/emacs/snippets/org-mode/quote @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: Org-Mode source block +# key: quote +# -- +#+BEGIN_QUOTE +$1 +#+END_QUOTE diff --git a/locations.json b/locations.json index daf35fc..f1cf3a4 100755 --- a/locations.json +++ b/locations.json @@ -5,14 +5,13 @@ "dunst": "$HOME/.config/dunst/", "emacs": "$HOME/.config/doom", "lf": "$HOME/.config/lf", + "newsboat": "$HOME/.config/newsboat", "nvim": "$HOME/.config/nvim/", "picom": "$HOME/.config/picom", "polybar": "$HOME/.config/polybar", "rofi": "$HOME/.config/rofi/", + "slop": "$HOME/.config/slop/", "sxiv": "$HOME/.config/sxiv", "sxhkd": "$HOME/.config/sxhkd/", - "systemd": "$HOME/.config/systemd", - "wal": "$HOME/.config/wal", - "xorg": "$HOME", "zsh": "$HOME/.config/zsh" } diff --git a/newsboat/urls b/newsboat/urls new file mode 100644 index 0000000..86a5429 --- /dev/null +++ b/newsboat/urls @@ -0,0 +1,2 @@ +https://ma.ttias.be/cronweekly/index.xml +https://venam.nixers.net/blog/feed.xml diff --git a/rofi/config.rasi b/rofi/config.rasi deleted file mode 100755 index 74578f6..0000000 --- a/rofi/config.rasi +++ /dev/null @@ -1,9 +0,0 @@ -configuration { - display-drun: "Application"; - display-run: "Execute"; - display-window: "Window"; - display-ssh: "SSH"; - font: "Iosevka 14"; - show-icons: true; - theme: "fds-mini-sidebar"; -} diff --git a/rofi/mode/buku b/rofi/modes/buku similarity index 100% rename from rofi/mode/buku rename to rofi/modes/buku diff --git a/rofi/mode/delim b/rofi/modes/delim similarity index 100% rename from rofi/mode/delim rename to rofi/modes/delim diff --git a/rofi/mode/recoll b/rofi/modes/recoll similarity index 100% rename from rofi/mode/recoll rename to rofi/modes/recoll diff --git a/rofi/mode/script b/rofi/modes/script similarity index 100% rename from rofi/mode/script rename to rofi/modes/script diff --git a/rofi/themes/dmenu.rasi b/rofi/themes/dmenu.rasi deleted file mode 100755 index dcb3397..0000000 --- a/rofi/themes/dmenu.rasi +++ /dev/null @@ -1,66 +0,0 @@ -/** - * ROFI Color theme - * User: Qball - * Copyright: Dave Davenport - * Modified by: Gabriel Arazas (foo-dogsquared) - */ - -* { - /* The color swatch */ - /* Useful for quick editing of the colors */ - background: #2E3440; - foreground: #D8DEE9; - color0: #3B4252; - color1: #BF616A; - color2: #A3BE8C; - color3: #EBCB8B; - color4: #81A1C1; - color5: #B48EAD; - color6: #88C0D0; - color7: #E5E9F0; - color8: #727B8A; - color9: #BF616A; - color10: #A3BE8C; - color11: #EBCB8B; - color12: #81A1C1; - color13: #B48EAD; - color14: #8FBCBB; - color15: #ECEFF4; - - background-color: @background; - border-color: @foreground; - text-color: @foreground; - font: "Iosevka 14"; -} - -window { - anchor: north; - location: north; - width: 100%; - padding: 7px; - children: [ horibox ]; -} - -horibox { - orientation: horizontal; - children: [ prompt, entry, listview ]; -} - -listview { - layout: horizontal; - spacing: 5px; - lines: 100; -} - -entry { - expand: false; - width: 10em; -} - -element { - padding: 0px 2px; -} - -element.selected { - background-color: @color6; -} diff --git a/rofi/themes/fds-center-menu.rasi b/rofi/themes/fds-center-menu.rasi deleted file mode 100755 index 2f35716..0000000 --- a/rofi/themes/fds-center-menu.rasi +++ /dev/null @@ -1,93 +0,0 @@ -* { - /* The color configuration */ - /* Useful for quick editing in case for compiled templates */ - background: #2E3440; - foreground: #D8DEE9; - color0: #3B4252; - color1: #BF616A; - color2: #A3BE8C; - color3: #EBCB8B; - color4: #81A1C1; - color5: #B48EAD; - color6: #88C0D0; - color7: #E5E9F0; - color8: #727B8A; - color9: #BF616A; - color10: #A3BE8C; - color11: #EBCB8B; - color12: #81A1C1; - color13: #B48EAD; - color14: #8FBCBB; - color15: #ECEFF4; - - /* Theme settings */ - highlight: bold italic; - scrollbar: true; - - /* Style */ - text-color: @foreground; - background-color: @background; - font: "Font Awesome 5 Free,Font Awesome 5 Free Solid:style=Solid 14"; - font: "Iosevka 14"; -} - -window { - background-color: transparent; - - height: 65%; - width: 45%; - position: center; - location: center; - text-color: @foreground; -} - -mainbox { - background-color: @background; - border: 2; - border-color: @color6; - children: [ inputbar, listview, mode-switcher ]; -} - -inputbar, -listview { - background: @background; -} - -inputbar { - orientation: vertical; - children: [ prompt, entry ]; - background-color: @color0; -} - -entry, -prompt { - background-color: @color0; -} - -listview { - cyclic: true; -} - -element selected.normal { - background-color: @color6; - text-color: @background; -} - -scrollbar { - background-color: @color0; - handle-color: @color6; - handle-width: 10px; - height: 100%; -} - -button, -case-indicator, -inputbar, -element { - padding: 5; -} - -button.selected { - background-color: @color6; - text-color: @background; -} diff --git a/rofi/themes/fds-mini-sidebar.rasi b/rofi/themes/fds-mini-sidebar.rasi deleted file mode 100755 index a41f707..0000000 --- a/rofi/themes/fds-mini-sidebar.rasi +++ /dev/null @@ -1,121 +0,0 @@ -* { - /* The color configuration */ - /* Useful for quick editing in case for compiled templates */ - background: #2E3440; - foreground: #D8DEE9; - color0: #3B4252; - color1: #BF616A; - color2: #A3BE8C; - color3: #EBCB8B; - color4: #81A1C1; - color5: #B48EAD; - color6: #88C0D0; - color7: #E5E9F0; - color8: #727B8A; - color9: #BF616A; - color10: #A3BE8C; - color11: #EBCB8B; - color12: #81A1C1; - color13: #B48EAD; - color14: #8FBCBB; - color15: #ECEFF4; - - /* General theme settings */ - highlight: bold italic; - scrollbar: true; - - /* Font settings */ - text-color: @foreground; - background-color: @background; - font: "Font Awesome 5 Free,Font Awesome 5 Free Solid:style=Solid 14"; - font: "Iosevka 14"; -} - -window { - background-color: transparent; - - height: 65%; - width: 35%; - position: southwest; - location: southwest; - text-color: @foreground; -} - -mainbox { - background-color: @background; - border: 2; - border-color: @color6; - children: [ inputbar, message, listview, mode-switcher ]; - padding: 0.5em; -} - -inputbar, -listview, -message { - background: @background; - margin: 0 0 0.5em 0; -} - -inputbar { - orientation: vertical; - children: [ prompt, entry ]; -} - -prompt { - text-style: underline; - width: 100%; -} - -entry { - background-color: @color0; - margin: 0 1em 0 0; -} - -element { - background-color: @color0; - padding: 5; -} - -element selected.normal { - background-color: @color6; - text-color: @background; -} - -scrollbar { - background-color: @color0; - border-radius: 30%; - handle-color: @color6; - handle-width: 15px; - height: 100%; - text-color: @background; - width: 10px; -} - -listview { - cyclic: true; - spacing: 0.6em; -} - -element, button { -} - -button, -case-indicator, -entry, -inputbar { - padding: 5; -} - -sidebar { - padding: 5; - margin: 5; -} - -button { - margin: 0.25em; -} - -button.selected { - background-color: @color6; - text-color: @background; -} diff --git a/slop/crosshair.frag b/slop/crosshair.frag new file mode 100644 index 0000000..e96782f --- /dev/null +++ b/slop/crosshair.frag @@ -0,0 +1,43 @@ +#version 120 + +uniform sampler2D texture; +uniform sampler2D desktop; +uniform vec2 screenSize; +uniform vec2 mouse; + +varying vec2 uvCoord; + +void main() +{ + // adjustable parameters + float circleSize = 28; + float borderSize = 2; + // The smaller this value is, the more intense the magnification! + float magnifyNerf = 1.5; + vec4 borderColor = vec4(0,0,0,1); + bool crosshair = true; + + // actual code + vec2 mUV = vec2(mouse.x, -mouse.y)/screenSize + vec2(0,1); + float du = distance(mUV,uvCoord); + float dr = distance(mUV*screenSize,uvCoord*screenSize); + vec4 color = vec4(0); + if ( dr > circleSize+borderSize ) { + color = texture2D( texture, uvCoord ); + } else if ( dr < circleSize ) { + if ( crosshair && (distance(mUV.x, uvCoord.x)<1/screenSize.x || distance(mUV.y,uvCoord.y)<1/screenSize.y) ) { + color = borderColor; + } else { + float t = 1-du; + vec2 b = uvCoord; + vec2 c = (mUV-uvCoord); + vec2 upsideDown = c/magnifyNerf*t*t+b; + + vec4 textureColor = texture2D( texture, upsideDown ); + color = mix( texture2D( desktop, vec2(upsideDown.x, -upsideDown.y) ), textureColor, textureColor.a ); + } + } else if ( dr < circleSize+borderSize ) { + color = borderColor; + } + gl_FragColor = color; +} diff --git a/slop/crosshair.vert b/slop/crosshair.vert new file mode 100644 index 0000000..ce52359 --- /dev/null +++ b/slop/crosshair.vert @@ -0,0 +1,12 @@ +#version 120 + +attribute vec2 position; +attribute vec2 uv; + +varying vec2 uvCoord; + +void main() +{ + uvCoord = uv; + gl_Position = vec4(position,0,1); +}