From 3800ae04d8c52d85a32da04b0771be013fd7ed17 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Sat, 3 Jul 2021 20:15:17 +0700 Subject: Restructure a tad --- blog/threa.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'blog') diff --git a/blog/threa.md b/blog/threa.md index d1063e6..1bcfcaf 100644 --- a/blog/threa.md +++ b/blog/threa.md @@ -282,7 +282,9 @@ Usage: --parent= cache path ``` -## Client Backend Implementation +## Client Implementation + +### Back-End Following the Unix™ philosophy, `threac` will do only one thing and do it well: it shall take the chosen selection and *schedule* it to move to the beginning: @@ -291,8 +293,8 @@ it shall take the chosen selection and *schedule* it to move to the beginning: my $XDG_CACHE_HOME = %*ENV // path add $*HOME: '.cache':; sub MAIN( - Str $choice where /^\w?$/, #= alphanumeric - Str :$parent = $XDG_CACHE_HOME #= cache path + $choice where /^\w?$/, #= alphanumeric + :$parent = $XDG_CACHE_HOME #= cache path ) { my $base = $parent.IO.add: 'threa'; my $order = add $base: 'order'; @@ -308,10 +310,10 @@ Though, instead of moving `$choice` to top of the deque, we place it at the bottom and use `xclip` to trigger the daemon to do it and synchronize between selections. -## Client Frontend Implementation +### Front-End Note that `threac` does not give any output: selection history (by default) -are stored in a standard and convenient location to be read by any frontend +are stored in a standard and convenient location to be read by any front-end of choice. For awesome I made a menu whose each entry is wired to `threac` and `xdotool` (to simulate primary paste with `S-Insert`) and bind the whole thing to a keyboard shortcut. @@ -336,7 +338,7 @@ awful.menu{items = items, theme = {width = 911}}:show() ## Conclusion -Through writing a clipboard manager, which is released as [threa][] +Through writing the clipboard manager [threa][], which is released under [GNU GPLv3+][] on [SourceHut][], we have discovered a few features of Raku that make it a great *scripting* language: @@ -349,7 +351,7 @@ of Raku that make it a great *scripting* language: - Statement modifiers - Topic variable - First-class regex -* Trivial asynchronization + - Trivial asynchronization As a generic programming language, Raku has other classes of characteristics that makes it useful in other larger projects such as grammars (i.e. regex -- cgit 1.4.1