literate-dotfiles/docs/binaries.html

1106 lines
138 KiB
HTML
Raw Normal View History

2020-01-11 22:04:45 +01:00
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
2020-04-05 11:30:26 +02:00
<!-- 2020-04-05 dim. 11:29 -->
2020-01-11 22:04:45 +01:00
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Binaries</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
2020-01-11 22:22:46 +01:00
<link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="./js/readtheorg.js"></script>
2020-01-11 22:04:45 +01:00
<script type="text/javascript">
2020-04-05 11:30:26 +02:00
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&amp;dn=gpl-3.0.txt GPL-v3-or-Later
2020-01-11 22:04:45 +01:00
<!--/*--><![CDATA[/*><!--*/
2020-03-01 22:51:16 +01:00
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
// @license-end
2020-01-11 22:04:45 +01:00
</script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Binaries</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
2020-04-05 11:30:26 +02:00
<li><a href="#org28d68eb"><code>displayselect</code> - Select Screen</a></li>
<li><a href="#org4400f92"><span class="todo TODO">TODO</span> <code>getbib</code></a></li>
<li><a href="#orgd951db9"><code>vpntoggle</code> - Connect to VPN using NordVPN</a></li>
<li><a href="#org39f3bdf"><code>bukurun</code> - Open link from Buku</a></li>
<li><a href="#org1ce653d"><code>i3exit</code> - Manage lock, suspend, reboot, &#x2026;</a></li>
<li><a href="#org17ef4d2"><code>readbib</code> - Open Bibliography File</a></li>
<li><a href="#orgda667bb"><code>readnotes</code> - Open Note File</a></li>
<li><a href="#org94000e9"><span class="todo TODO">TODO</span> askpass</a></li>
<li><a href="#org2d85447"><code>screenshot</code> - Take Screenshot</a></li>
<li><a href="#orge31d949"><code>remote-desktop</code> - Remote Desktop Connect</a></li>
<li><a href="#org8a00ba3"><code>network-toggle</code> - Toggle Network</a></li>
<li><a href="#orgdd09825"><code>print-rnice</code> - Print on Rnice</a></li>
<li><a href="#orgf1a877f"><span class="todo TODO">TODO</span> Mount TMP14DAYS</a></li>
<li><a href="#orgd568e72"><code>make-gif</code> - Make GIF</a></li>
<li><a href="#orgd7e49ff"><code>yt-audio</code> - Download-Audio from youtube</a></li>
<li><a href="#org89810de"><code>yt-video</code> - Download-Video from youtube</a></li>
<li><a href="#org18a85d1"><code>pdf-shrink</code> Pdf Shrink</a></li>
<li><a href="#org539efcb"><code>setbg</code> - Set Background</a></li>
<li><a href="#orge6aa5bf">Insert Unicode Icon</a></li>
<li><a href="#org02426ec">Insert Nerd Font Icon</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-org28d68eb" class="outline-2">
<h2 id="org28d68eb"><code>displayselect</code> - Select Screen</h2>
<div class="outline-text-2" id="text-org28d68eb">
2020-01-11 22:04:45 +01:00
<p>
Script taken from Luke Smith.
</p>
<div class="org-src-container">
<pre class="src src-bash"><span class="org-function-name">twoscreen</span><span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span> <span class="org-comment-delimiter"># </span><span class="org-comment">If multi-monitor is selected and there are two screens.</span>
<span class="org-variable-name">mirror</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">printf</span> <span class="org-string">"no\\nyes"</span> | dmenu -i -p <span class="org-string">"Mirror displays?"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Mirror displays using native resolution of external display and a scaled</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">version for the internal display</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">mirror</span></span><span class="org-string">"</span> = <span class="org-string">"yes"</span> <span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">external</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">screens</span></span><span class="org-string">"</span> | dmenu -i -p <span class="org-string">"Optimize resolution for:"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">internal</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">screens</span></span><span class="org-string">"</span> | <span class="org-type">grep</span> -v <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">external</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">res_external</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">xrandr</span> --query | sed -n <span class="org-string">"/^</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">external</span></span><span class="org-string">/,/\+/p"</span> | <span class="org-sh-escaped-newline">\</span>
tail -n <span class="org-highlight-numbers-number">1</span> | awk <span class="org-string">'{print $1}'</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">res_internal</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">xrandr</span> --query | sed -n <span class="org-string">"/^</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">internal</span></span><span class="org-string">/,/\+/p"</span> | <span class="org-sh-escaped-newline">\</span>
tail -n <span class="org-highlight-numbers-number">1</span> | awk <span class="org-string">'{print $1}'</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">res_ext_x</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> $<span class="org-variable-name">res_external</span> | sed <span class="org-string">'s/x.*//'</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">res_ext_y</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> $<span class="org-variable-name">res_external</span> | sed <span class="org-string">'s/.*x//'</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">res_int_x</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> $<span class="org-variable-name">res_internal</span> | sed <span class="org-string">'s/x.*//'</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">res_int_y</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> $<span class="org-variable-name">res_internal</span> | sed <span class="org-string">'s/.*x//'</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">scale_x</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">res_ext_x</span></span><span class="org-string"> / </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">res_int_x</span></span><span class="org-string">"</span> | bc -l<span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">scale_y</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">res_ext_y</span></span><span class="org-string"> / </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">res_int_y</span></span><span class="org-string">"</span> | bc -l<span class="org-rainbow-delimiters-depth-2">)</span>
xrandr --output <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">external</span></span><span class="org-string">"</span> --auto --scale 1.0x1.0 <span class="org-sh-escaped-newline">\</span>
--output <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">internal</span></span><span class="org-string">"</span> --auto --same-as <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">external</span></span><span class="org-string">"</span> <span class="org-sh-escaped-newline">\</span>
--scale <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">scale_x</span></span><span class="org-string">"</span>x<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">scale_y</span></span><span class="org-string">"</span>
<span class="org-keyword">else</span>
<span class="org-variable-name">primary</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">screens</span></span><span class="org-string">"</span> | dmenu -i -p <span class="org-string">"Select primary display:"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">secondary</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">screens</span></span><span class="org-string">"</span> | <span class="org-type">grep</span> -v <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">primary</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">direction</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">printf</span> <span class="org-string">"left\\nright"</span> | dmenu -i -p <span class="org-string">"What side of </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">primary</span></span><span class="org-string"> should </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">secondary</span></span><span class="org-string"> be on?"</span><span class="org-rainbow-delimiters-depth-2">)</span>
xrandr --output <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">primary</span></span><span class="org-string">"</span> --auto --scale 1.0x1.0 --output <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">secondary</span></span><span class="org-string">"</span> --<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">direction</span></span><span class="org-string">"</span>-of <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">primary</span></span><span class="org-string">"</span> --auto --scale 1.0x1.0
<span class="org-keyword">fi</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">morescreen</span><span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span> <span class="org-comment-delimiter"># </span><span class="org-comment">If multi-monitor is selected and there are more than two screens.</span>
<span class="org-variable-name">primary</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">screens</span></span><span class="org-string">"</span> | dmenu -i -p <span class="org-string">"Select primary display:"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">secondary</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">screens</span></span><span class="org-string">"</span> | <span class="org-type">grep</span> -v <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">primary</span></span><span class="org-string">"</span> | dmenu -i -p <span class="org-string">"Select secondary display:"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">direction</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">printf</span> <span class="org-string">"left\\nright"</span> | dmenu -i -p <span class="org-string">"What side of </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">primary</span></span><span class="org-string"> should </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">secondary</span></span><span class="org-string"> be on?"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">tertiary</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">screens</span></span><span class="org-string">"</span> | <span class="org-type">grep</span> -v <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">primary</span></span><span class="org-string">"</span> | <span class="org-type">grep</span> -v <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">secondary</span></span><span class="org-string">"</span> | dmenu -i -p <span class="org-string">"Select third display:"</span><span class="org-rainbow-delimiters-depth-2">)</span>
xrandr --output <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">primary</span></span><span class="org-string">"</span> --auto --output <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">secondary</span></span><span class="org-string">"</span> --<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">direction</span></span><span class="org-string">"</span>-of <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">primary</span></span><span class="org-string">"</span> --auto --output <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">tertiary</span></span><span class="org-string">"</span> --<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">printf</span><span class="org-string"><span class="org-sh-quoted-exec"> "left\\nright" | </span></span><span class="org-type"><span class="org-string"><span class="org-sh-quoted-exec">grep</span></span></span><span class="org-string"><span class="org-sh-quoted-exec"> -v "</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">direction</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">")</span></span><span class="org-string">"</span>-of <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">primary</span></span><span class="org-string">"</span> --auto
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">multimon</span><span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span> <span class="org-comment-delimiter"># </span><span class="org-comment">Multi-monitor handler.</span>
<span class="org-keyword">case</span> <span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">echo</span><span class="org-string"><span class="org-sh-quoted-exec"> "</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">screens</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">" | wc -l)</span></span><span class="org-string">"</span><span class="org-keyword"> in</span>
<span class="org-highlight-numbers-number">1</span>) xrandr $<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">allposs</span></span><span class="org-string">"</span> | <span class="org-type">grep</span> -v <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">screens</span></span><span class="org-string">"</span> | awk <span class="org-string">'{print "--output", $1, "--off"}'</span> | tr <span class="org-string">'\n'</span> <span class="org-string">' '</span><span class="org-rainbow-delimiters-depth-2">)</span> ;;
<span class="org-highlight-numbers-number">2</span>) twoscreen ;;
*) morescreen ;;
<span class="org-keyword">esac</span> ;<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Get all possible displays</span>
<span class="org-variable-name">allposs</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">xrandr</span> -q | <span class="org-type">grep</span> <span class="org-string">"connected"</span><span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Get all connected screens.</span>
<span class="org-variable-name">screens</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">allposs</span></span><span class="org-string">"</span> | <span class="org-type">grep</span> <span class="org-string">" connected"</span> | awk <span class="org-string">'{print $1}'</span><span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Get user choice including multi-monitor and manual selection:</span>
<span class="org-variable-name">chosen</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">printf</span> <span class="org-string">"%s\\ncancel\\nmulti-monitor\\nmanual selection"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">screens</span></span><span class="org-string">"</span> | dmenu -i -p <span class="org-string">"Select display arangement:"</span><span class="org-rainbow-delimiters-depth-1">)</span> &amp;&amp;
<span class="org-keyword">case</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">chosen</span></span><span class="org-string">"</span><span class="org-keyword"> in</span>
<span class="org-string">"cancel"</span>) <span class="org-keyword">exit</span> ;;
<span class="org-string">"manual selection"</span>) arandr ; <span class="org-keyword">exit</span> ;;
<span class="org-string">"multi-monitor"</span>) multimon ;;
*) xrandr --output <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">chosen</span></span><span class="org-string">"</span> --auto --scale 1.0x1.0 $<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">allposs</span></span><span class="org-string">"</span> | <span class="org-type">grep</span> -v <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">chosen</span></span><span class="org-string">"</span> | awk <span class="org-string">'{print "--output", $1, "--off"}'</span> | tr <span class="org-string">'\n'</span> <span class="org-string">' '</span><span class="org-rainbow-delimiters-depth-1">)</span> ;;
<span class="org-keyword">esac</span>
$<span class="org-variable-name">HOME</span>/.config/polybar/scripts/launch.sh <span class="org-comment-delimiter"># </span><span class="org-comment">restart polybar</span>
<span class="org-type">pgrep</span> -x dunst &gt;/dev/null &amp;&amp; killall dunst &amp;&amp; setsid dunst &amp; <span class="org-comment-delimiter"># </span><span class="org-comment">Restart dunst to ensure proper location on screen</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-org4400f92" class="outline-2">
<h2 id="org4400f92"><span class="todo TODO">TODO</span> <code>getbib</code></h2>
<div class="outline-text-2" id="text-org4400f92">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-rainbow-delimiters-depth-1">[</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-type">echo</span> <span class="org-string">"Give either a pdf file or a DOI as an argument."</span> &amp;&amp; <span class="org-keyword">exit</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> -f <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Try to get DOI from pdfinfo or pdftotext output.</span>
<span class="org-variable-name">doi</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pdfinfo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> | <span class="org-type">grep</span> -io <span class="org-string">"doi:.*"</span><span class="org-rainbow-delimiters-depth-1">)</span> ||
<span class="org-variable-name">doi</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pdftotext</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> <span class="org-highlight-numbers-number">2</span>&gt;/dev/null - | <span class="org-type">grep</span> -io <span class="org-string">"doi:.*"</span> -m <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span> ||
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-keyword">else</span>
<span class="org-variable-name">doi</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span>
<span class="org-keyword">fi</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Check crossref.org for the bib citation.</span>
<span class="org-type">curl</span> -s <span class="org-string">"http://api.crossref.org/works/</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">doi</span></span><span class="org-string">/transform/application/x-bibtex"</span> -w <span class="org-string">"\\n"</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-orgd951db9" class="outline-2">
<h2 id="orgd951db9"><code>vpntoggle</code> - Connect to VPN using NordVPN</h2>
<div class="outline-text-2" id="text-orgd951db9">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> $<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-sh-quoted-exec">nordvpn</span> status<span class="org-rainbow-delimiters-depth-3">)</span> == *<span class="org-string">"Connected"</span>* <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
nordvpn disconnect &amp;&amp; dunstify --replace=<span class="org-highlight-numbers-number">23198</span> <span class="org-string">"VPN"</span> <span class="org-string">"Disconnected"</span>;
<span class="org-keyword">else</span>
<span class="org-variable-name">country</span>=<span class="org-sh-quoted-exec">`</span><span class="org-type"><span class="org-sh-quoted-exec">cat</span></span><span class="org-sh-quoted-exec"> ~/bin/nordvpn_countries.txt | sed 's/\s*\t\s*/ /g ; s/\s/\n/g ; s/_/ /g ; /^[a-zA-Z]/!d ; s/\(.*\)/\L\1/' | rofi -i -dmenu | sed 's/\s/_/g'`</span>;
dunstify --replace=<span class="org-highlight-numbers-number">23198</span> <span class="org-string">"VPN"</span> <span class="org-string">"Connecting to </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">country</span></span><span class="org-string">..."</span>;
nordvpn connect $<span class="org-variable-name">country</span> &amp;&amp; dunstify --replace=<span class="org-highlight-numbers-number">23198</span> <span class="org-string">"VPN"</span> <span class="org-string">"Connected to </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">country</span></span><span class="org-string">"</span>;
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-org39f3bdf" class="outline-2">
<h2 id="org39f3bdf"><code>bukurun</code> - Open link from Buku</h2>
<div class="outline-text-2" id="text-org39f3bdf">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-function-name">_rofi</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
rofi -dmenu -i -no-levenshtein-sort -width <span class="org-highlight-numbers-number">1000</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">@</span></span><span class="org-string">"</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">display settings</span>
<span class="org-variable-name">display_type</span>=<span class="org-highlight-numbers-number">1</span>
<span class="org-variable-name">max_str_width</span>=<span class="org-highlight-numbers-number">80</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">keybindings</span>
<span class="org-variable-name">switch_view</span>=<span class="org-string">"Alt+Tab"</span>
<span class="org-variable-name">new_bookmark</span>=<span class="org-string">"Alt+n"</span>
<span class="org-variable-name">actions</span>=<span class="org-string">"Alt+a"</span>
<span class="org-variable-name">edit</span>=<span class="org-string">"Alt+e"</span>
<span class="org-variable-name">delete</span>=<span class="org-string">"Alt+d"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">colors</span>
<span class="org-variable-name">help_color</span>=<span class="org-string">"#334433"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">source global config</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -f /etc/buku_run.config <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span>
<span class="org-keyword">then</span>
<span class="org-builtin">source</span> /etc/buku_run.config
<span class="org-keyword">fi</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">source local config:</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -z $<span class="org-variable-name">XDG_CONFIG_DIR</span> <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span>
<span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -f $<span class="org-variable-name">HOME</span>/.config/buku_run/config <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span>
<span class="org-keyword">then</span>
<span class="org-builtin">source</span> $<span class="org-variable-name">HOME</span>/.config/buku_run/config
<span class="org-keyword">else</span>
<span class="org-type">echo</span> <span class="org-string">"User config file \'~/.config/buku_run/config\' not found. using global config"</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">else</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -f <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{XDG_CONFIG_DIR}</span></span><span class="org-string">/buku_run/config"</span> <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span>
<span class="org-keyword">then</span>
<span class="org-builtin">source</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{XDG_CONFIG_DIR}</span></span><span class="org-string">/buku_run/config"</span>
<span class="org-keyword">else</span>
<span class="org-type">echo</span> <span class="org-string">"User config file \'~/.config/buku_run/config\' not found. using global config"</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-function-name">main</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-variable-name">HELP</span>=<span class="org-string">"Welcome to Buku. Use &lt;span color='</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{help_color}</span></span><span class="org-string">'&gt;</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{new_bookmark}</span></span><span class="org-string">&lt;/span&gt; to add a new Bookmark</span>
<span class="org-string">Use &lt;span color='</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{help_color}</span></span><span class="org-string">'&gt;</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{switch_view}</span></span><span class="org-string">&lt;/span&gt; to switch View. &lt;span color='</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{help_color}</span></span><span class="org-string">'&gt;</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{actions}</span></span><span class="org-string">&lt;/span&gt; for actions"</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">mode</span> == <span class="org-string">"bookmarks"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">content</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">parseBuku</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">menu</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{content}</span></span><span class="org-string">"</span> | _rofi -p <span class="org-string">'&gt; '</span> -filter <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{filter}</span></span><span class="org-string">"</span> -mesg <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{HELP}</span></span><span class="org-string">"</span> -kb-custom-1 <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{new_bookmark}</span></span><span class="org-string">"</span> -kb-custom-2 <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{switch_view}</span></span><span class="org-string">"</span> -kb-custom-3 <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{actions}</span></span><span class="org-string">"</span> -kb-custom-4 <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{edit}</span></span><span class="org-string">"</span> -kb-custom-5 <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{delete}</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">mode</span> == <span class="org-string">"tags"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">menu</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">buku</span> --np --st | awk <span class="org-string">'{$NF=""; print $0}'</span> | cut -d <span class="org-string">' '</span> -f2- | _rofi -p <span class="org-string">'&gt; '</span> -mesg <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{HELP}</span></span><span class="org-string">"</span> -kb-custom-1 <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{new_bookmark}</span></span><span class="org-string">"</span> -kb-custom-2 <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{switch_view}</span></span><span class="org-string">"</span> -kb-custom-3 <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{actions}</span></span><span class="org-string">"</span> -kb-custom-4 <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{edit}</span></span><span class="org-string">"</span> -kb-custom-5 <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{delete}</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-keyword">fi</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">12</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
optionsMenu
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">10</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
addMark
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">14</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
deleteMenu
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">13</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
editMenu
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">11</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">mode</span> == <span class="org-string">"bookmarks"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-builtin">export</span> <span class="org-variable-name">mode</span>=<span class="org-string">"tags"</span>
<span class="org-variable-name">mode</span>=tags main
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">mode</span> == <span class="org-string">"tags"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-builtin">export</span> <span class="org-variable-name">mode</span>=<span class="org-string">"bookmarks"</span>
<span class="org-variable-name">mode</span>=bookmarks main
<span class="org-keyword">fi</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">mode</span> == <span class="org-string">"bookmarks"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">id</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">getId</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">content</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">menu</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-keyword">for</span> bm<span class="org-keyword"> in</span> $<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-variable-name">id</span><span class="org-rainbow-delimiters-depth-2">}</span>; <span class="org-keyword">do</span>
buku -o <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{bm}</span></span><span class="org-string">"</span>
<span class="org-keyword">done</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">mode</span> == <span class="org-string">"tags"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">filter</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{menu}</span></span><span class="org-string">"</span> <span class="org-variable-name">mode</span>=<span class="org-string">"bookmarks"</span> main
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">optionsMenu</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">mode</span> == <span class="org-string">"bookmarks"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">askmenu</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">"&lt; Return\n---\n1. Edit\n2. Delete"</span> | _rofi -p <span class="org-string">'&gt; '</span> -mesg <span class="org-string">"Choose Action for bookmark"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">askmenu</span> == <span class="org-string">"&lt; Return"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-builtin">export</span> <span class="org-variable-name">mode</span>=bookmarks
main
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">askmenu</span> == <span class="org-string">"1. Edit"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
editMenu
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">askmenu</span> == <span class="org-string">"2. Delete"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
deleteMenu
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">mode</span> == <span class="org-string">"tags"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">askmenu</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">"&lt; Return\n---\n1. Replace Tag\n2. Delete Tag"</span> | _rofi -p <span class="org-string">'&gt; '</span> -mesg <span class="org-string">"Choose Action for tag \"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{menu}</span></span><span class="org-string">\""</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">askmenu</span> == <span class="org-string">"&lt; Return"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-builtin">export</span> <span class="org-variable-name">mode</span>=tags
main
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">askmenu</span> == <span class="org-string">"1. Replace Tag"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">newtag</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> | _rofi -p <span class="org-string">'&gt; '</span> -mesg <span class="org-string">"Enter new tag name for tag \"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{menu}</span></span><span class="org-string">\""</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">newtag</span> == <span class="org-string">""</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">mode</span>=tags main
<span class="org-keyword">else</span>
buku -r <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{menu}</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{newtag}</span></span><span class="org-string">"</span>
<span class="org-variable-name">mode</span>=tags main
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">askmenu</span> == <span class="org-string">"2. Delete Tag"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">delask</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">"1. Yes\n2. No"</span> | _rofi -p <span class="org-string">'&gt; '</span> -mesg <span class="org-string">"Really delete tag?"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">delask</span> == <span class="org-string">"1. Yes"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
buku -r <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{menu}</span></span><span class="org-string">"</span>
<span class="org-variable-name">mode</span>=tags main
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">delask</span> == <span class="org-string">"2. No"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">mode</span>=tags main
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">deleteMenu</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-variable-name">id</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">getId</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">content</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">menu</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">delask</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">"1. Yes\n2. No"</span> | _rofi -p <span class="org-string">'&gt; '</span> -mesg <span class="org-string">"Really delete bookmark?"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">delask</span> == <span class="org-string">"1. Yes"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
buku -d $<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-variable-name">id</span><span class="org-rainbow-delimiters-depth-2">}</span> --tacit
<span class="org-variable-name">mode</span>=bookmarks main
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">delask</span> == <span class="org-string">"2. No"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
optionsMenu
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">editMenu</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-variable-name">id</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">getId</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">content</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">menu</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">title</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">getTitleFromId</span><span class="org-string"><span class="org-sh-quoted-exec"> </span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">id</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">)</span></span><span class="org-string">"</span>
<span class="org-variable-name">bookmark</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">getUrlFromId</span><span class="org-string"><span class="org-sh-quoted-exec"> </span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">id</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">)</span></span><span class="org-string">"</span>
<span class="org-variable-name">tags</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">getTagsFromId</span><span class="org-string"><span class="org-sh-quoted-exec"> </span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">id</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">)</span></span><span class="org-string">"</span>
<span class="org-variable-name">content</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">"1. title: </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">title</span></span><span class="org-string">\n2. url: </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">bookmark</span></span><span class="org-string">\n3. tags: </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">tags</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">editmenu</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">"&lt; Return\n---\n</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{content}</span></span><span class="org-string">"</span> | _rofi -p <span class="org-string">'&gt; '</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">editmenu</span> == <span class="org-string">"&lt; Return"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
main
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">editmenu</span> == <span class="org-string">"tags: NOTAG"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
addTags --update
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">editmenu</span> =~ tags:* <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">tags</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{tags}</span></span><span class="org-string">"</span> editTags
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">editmenu</span> =~ url:* <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
editBookmark
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">editmenu</span> =~ title:* <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
editTitle
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">editTags</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-variable-name">edittagsmenu</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> | _rofi -filter <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{tags}</span></span><span class="org-string">"</span> -p <span class="org-string">'&gt; '</span> -mesg <span class="org-string">"Edit Tags and hit Enter"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
buku -u $<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-variable-name">id</span><span class="org-rainbow-delimiters-depth-2">}</span> --tag <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{edittagsmenu}</span></span><span class="org-string">"</span>
<span class="org-keyword">fi</span>
<span class="org-variable-name">mode</span>=bookmarks main
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">editBookmark</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-variable-name">bmarkmenu</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">""</span> | _rofi -p <span class="org-string">"&gt; "</span> -filter <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{bookmark}</span></span><span class="org-string">"</span> -mesg <span class="org-string">"Edit Bookmark and hit Enter"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">bmarkmenu</span> == <span class="org-string">"http"</span>* <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
buku -u <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{id}</span></span><span class="org-string">"</span> --url <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{bmarkmenu}</span></span><span class="org-string">"</span>
<span class="org-keyword">else</span>
<span class="org-type">echo</span> <span class="org-string">""</span> | rofi -e <span class="org-string">"Not a valid URI, Make sure URLs start with http"</span>
editBookmark
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-variable-name">mode</span>=bookmarks main
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">editTitle</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-variable-name">titlemenu</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">""</span> | _rofi -p <span class="org-string">"&gt; "</span> -filter <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{title}</span></span><span class="org-string">"</span> -mesg <span class="org-string">"Edit Title and hit Enter"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
buku -u <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{id}</span></span><span class="org-string">"</span> --title <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{titlemenu}</span></span><span class="org-string">"</span>
<span class="org-keyword">fi</span>
<span class="org-variable-name">mode</span>=bookmarks main
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">addMark</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-variable-name">inserturl</span>=<span class="org-sh-quoted-exec">$</span><span class="org-sh-quoted-exec"><span class="org-rainbow-delimiters-depth-2">(</span></span><span class="org-sh-quoted-exec">echo -e </span><span class="org-string"><span class="org-sh-quoted-exec">"$(</span></span><span class="org-sh-quoted-exec">xclip</span><span class="org-string"><span class="org-sh-quoted-exec"> -o)</span></span><span class="org-string">"</span> | _rofi -p <span class="org-string">'&gt; '</span> -mesg <span class="org-string">"Use URL below or type manually"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
addTags
<span class="org-keyword">fi</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">addTags</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-variable-name">inserttags</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">buku</span> --np --st | awk <span class="org-string">'{$NF=""; print $0}'</span> | cut -d <span class="org-string">' '</span> -f2- | _rofi -p <span class="org-string">'&gt; '</span> -mesg <span class="org-string">"Add some tags. Separate tags with ', '"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">val</span>=$<span class="org-variable-name">?</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-variable-name">val</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{inserttags}</span></span><span class="org-string">"</span> | wc -l<span class="org-rainbow-delimiters-depth-1">)</span> -gt <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">taglist</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{inserttags}</span></span><span class="org-string">"</span> | tr <span class="org-string">'\n'</span> <span class="org-string">','</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-variable-name">tags</span>=<span class="org-rainbow-delimiters-depth-2">()</span>
<span class="org-keyword">for</span> tag<span class="org-keyword"> in</span> $<span class="org-variable-name">taglist</span>; <span class="org-keyword">do</span>
<span class="org-variable-name">tags</span>+=<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">tag</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-keyword">done</span>
<span class="org-keyword">else</span>
<span class="org-variable-name">tags</span>=$<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-variable-name">inserttags</span><span class="org-rainbow-delimiters-depth-2">}</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> $<span class="org-highlight-numbers-number">1</span> == <span class="org-string">"--update"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
buku -u <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{id}</span></span><span class="org-string">"</span> --tag $<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-variable-name">tags</span><span class="org-rainbow-delimiters-depth-2">}</span>
<span class="org-keyword">else</span>
buku -a $<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-variable-name">inserturl</span><span class="org-rainbow-delimiters-depth-2">}</span> $<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-variable-name">tags</span><span class="org-rainbow-delimiters-depth-2">}</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">parseBuku</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-type">echo</span> <span class="org-string">"$(</span><span class="org-sh-quoted-exec">buku</span><span class="org-string"> --nc -p | gawk -v max="</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">max_str_width</span></span><span class="org-string">" -v type="</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">display_type</span></span><span class="org-string">" '</span>
<span class="org-string">BEGIN {</span>
<span class="org-string"> RS=""</span>
<span class="org-string"> FS="\n"</span>
<span class="org-string">}</span>
<span class="org-string">{</span>
<span class="org-string"> if (</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">3</span></span><span class="org-string"> == "")</span>
<span class="org-string"> </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">3</span></span><span class="org-string"> = " # NOTAG"</span>
<span class="org-string"> id = gensub(/([0-9]+)\.(.*)/, "\\1", "g", </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">)</span>
<span class="org-string"> url = substr(gensub(/\s+&gt; (.*)/, "\\1", "g", </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">2</span></span><span class="org-string">),0,max)</span>
<span class="org-string"> tags = gensub(/\s+# (.*)/, "\\1", "g", </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">3</span></span><span class="org-string">)</span>
<span class="org-string"> title = substr(gensub(/[0-9]+\.\s*(.*)/, "\\1", "g", </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">),0,max)</span>
<span class="org-string"> if (type == 1)</span>
<span class="org-string"> print id "\t" url "\t" tags</span>
<span class="org-string"> else</span>
<span class="org-string"> print id "\t" title "\t" tags</span>
<span class="org-string"> if (type == 3)</span>
<span class="org-string"> print " \t" url "\t "</span>
<span class="org-string"> print ""</span>
<span class="org-string">}</span>
<span class="org-string">' | column -t -s $'\t')"</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">getId</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-variable-name">id</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{2%% *}</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">id</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">prev</span>=<span class="org-string">""</span>
<span class="org-variable-name">IFS</span>=$<span class="org-string">'\n'</span>
<span class="org-keyword">for</span> line<span class="org-keyword"> in</span> $<span class="org-highlight-numbers-number">1</span>; <span class="org-keyword">do</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">2</span></span><span class="org-string">"</span> = <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">line</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">id</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{prev%% *}</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-keyword">break</span>
<span class="org-keyword">else</span>
<span class="org-variable-name">prev</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">line</span></span><span class="org-string">"</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">done</span>
<span class="org-keyword">fi</span>
<span class="org-type">echo</span> $<span class="org-variable-name">id</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">getTitleFromId</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-type">echo</span> <span class="org-string">"$(</span><span class="org-sh-quoted-exec">buku</span><span class="org-string"> --nc -p </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string"> | gawk '</span>
<span class="org-string"> BEGIN {</span>
<span class="org-string"> RS=""</span>
<span class="org-string"> FS="\n"</span>
<span class="org-string"> }</span>
<span class="org-string"> {</span>
<span class="org-string"> print gensub(/[0-9]+\.\s*(.*)/, "\\1", "g", </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">)</span>
<span class="org-string"> }</span>
<span class="org-string"> ')"</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">getUrlFromId</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-type">echo</span> <span class="org-string">"$(</span><span class="org-sh-quoted-exec">buku</span><span class="org-string"> --nc -p </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string"> | gawk '</span>
<span class="org-string"> BEGIN {</span>
<span class="org-string"> RS=""</span>
<span class="org-string"> FS="\n"</span>
<span class="org-string"> }</span>
<span class="org-string"> {</span>
<span class="org-string"> print gensub(/\s+&gt; (.*)/, "\\1", "g", </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">2</span></span><span class="org-string">)</span>
<span class="org-string"> }</span>
<span class="org-string"> ')"</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">getTagsFromId</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-type">echo</span> <span class="org-string">"$(</span><span class="org-sh-quoted-exec">buku</span><span class="org-string"> --nc -p </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string"> | gawk '</span>
<span class="org-string"> BEGIN {</span>
<span class="org-string"> RS=""</span>
<span class="org-string"> FS="\n"</span>
<span class="org-string"> }</span>
<span class="org-string"> {</span>
<span class="org-string"> print gensub(/\s+# (.*)/, "\\1", "g", </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">3</span></span><span class="org-string">)</span>
<span class="org-string"> }</span>
<span class="org-string"> ')"</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-variable-name">mode</span>=bookmarks main
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-org1ce653d" class="outline-2">
<h2 id="org1ce653d"><code>i3exit</code> - Manage lock, suspend, reboot, &#x2026;</h2>
<div class="outline-text-2" id="text-org1ce653d">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-comment-delimiter"># </span><span class="org-comment">with openrc use loginctl</span>
<span class="org-keyword">case</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span><span class="org-keyword"> in</span>
lock)
~/scripts/lockscreen.sh
;;
<span class="org-keyword">logout</span>)
loginctl terminate-session <span class="org-sh-quoted-exec">`loginctl session-status | head -n 1 | awk '{print $1}'`</span>
;;
switch_user)
dm-tool switch-to-greeter
;;
<span class="org-builtin">suspend</span>)
systemctl suspend &amp;&amp; ~/scripts/lockscreen.sh
;;
hibernate)
systemctl hibernate &amp;&amp; ~/scripts/lockscreen.sh
;;
reboot)
systemctl reboot
;;
shutdown)
systemctl poweroff
;;
*)
<span class="org-type">echo</span> <span class="org-string">"== ! i3exit: missing or invalid argument ! =="</span>
<span class="org-type">echo</span> <span class="org-string">"Try again with: lock | logout | switch_user | suspend | hibernate | reboot | shutdown"</span>
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">2</span>
<span class="org-keyword">esac</span>
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">0</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-org17ef4d2" class="outline-2">
<h2 id="org17ef4d2"><code>readbib</code> - Open Bibliography File</h2>
<div class="outline-text-2" id="text-org17ef4d2">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-01-28 21:32:38 +01:00
<pre class="src src-bash"><span class="org-type">cd</span> ~/Cloud/thesis/ressources/pdfs/ &amp;&amp; <span class="org-type">ls</span> | rofi -dmenu -lines <span class="org-highlight-numbers-number">20</span> | xargs -I <span class="org-rainbow-delimiters-depth-1">{}</span> zathura <span class="org-rainbow-delimiters-depth-1">{}</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-orgda667bb" class="outline-2">
<h2 id="orgda667bb"><code>readnotes</code> - Open Note File</h2>
<div class="outline-text-2" id="text-orgda667bb">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-03-19 10:42:30 +01:00
<pre class="src src-bash"><span class="org-type">cd</span> ~/Cloud/thesis/ressources/notes/pdfs/ &amp;&amp; <span class="org-type">ls</span> *.pdf | rofi -dmenu -lines <span class="org-highlight-numbers-number">20</span> | xargs -I <span class="org-rainbow-delimiters-depth-1">{}</span> zathura <span class="org-rainbow-delimiters-depth-1">{}</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org94000e9" class="outline-2">
2020-04-05 11:30:26 +02:00
<h2 id="org94000e9"><span class="todo TODO">TODO</span> askpass</h2>
2020-01-11 22:04:45 +01:00
<div class="outline-text-2" id="text-org94000e9">
2020-04-05 11:30:26 +02:00
<ul class="org-ul">
<li class="off"><code>[&#xa0;]</code> Should be a script</li>
</ul>
2020-01-11 22:04:45 +01:00
<p>
Take password prompt from STDIN, print password to STDOUT.
The sed piece just removes the colon from the provided prompt: <code>rofi -p</code> already gives us a colon
</p>
<div class="org-src-container">
<pre class="src src-bash">rofi -dmenu <span class="org-sh-escaped-newline">\</span>
-password <span class="org-sh-escaped-newline">\</span>
-no-fixed-num-lines <span class="org-sh-escaped-newline">\</span>
-p <span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">printf</span><span class="org-string"><span class="org-sh-quoted-exec"> "</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">1</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">" | sed s/://)</span></span><span class="org-string">"</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-org2d85447" class="outline-2">
<h2 id="org2d85447"><code>screenshot</code> - Take Screenshot</h2>
<div class="outline-text-2" id="text-org2d85447">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">status</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">"All\nGUI\nSelection\nCropped\nCopy\nShadow\nActive"</span> | rofi -i -dmenu -p <span class="org-string">"Type"</span><span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">status</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>;
<span class="org-keyword">fi</span>
<span class="org-variable-name">name</span>=<span class="org-sh-quoted-exec">$</span><span class="org-sh-quoted-exec"><span class="org-rainbow-delimiters-depth-1">(</span></span><span class="org-sh-quoted-exec">echo -e </span><span class="org-string"><span class="org-sh-quoted-exec">"screenshot-$(</span></span><span class="org-sh-quoted-exec">date</span><span class="org-string"><span class="org-sh-quoted-exec"> +"%m-%d-%y_%H-%M-%S")</span></span><span class="org-string">"</span> | rofi -i -dmenu -p <span class="org-string">"Filename"</span><span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">name</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span>;
<span class="org-keyword">fi</span>
<span class="org-keyword">case</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">status</span></span><span class="org-string">"</span><span class="org-keyword"> in</span>
<span class="org-string">"All"</span>)
maim ~/Pictures/$<span class="org-variable-name">name</span>.png ;;
<span class="org-string">"GUI"</span>)
flameshot gui -r &gt; ~/Pictures/$<span class="org-variable-name">name</span>.png ;;
<span class="org-string">"Selection"</span>)
maim -s ~/Pictures/$<span class="org-variable-name">name</span>.png ;;
<span class="org-string">"Cropped"</span>)
maim -s ~/Pictures/$<span class="org-variable-name">name</span>.png &amp;&amp; convert -trim ~/Pictures/$<span class="org-variable-name">name</span>.png ~/Pictures/$<span class="org-variable-name">name</span>.png;;
<span class="org-string">"Copy"</span>)
maim -s | xclip -selection clipboard -t image/png ;;
<span class="org-string">"Shadow"</span>)
maim -st <span class="org-highlight-numbers-number">9999999</span> | convert - <span class="org-string">\(</span> +clone -background black -shadow 80x3+5+5 <span class="org-string">\)</span> +swap -background none -layers merge +repage ~/Pictures/$<span class="org-variable-name">name</span>.png ;;
<span class="org-string">"Active"</span>)
maim -i $<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">xdotool</span> getactivewindow<span class="org-rainbow-delimiters-depth-1">)</span> ~/Pictures/$<span class="org-variable-name">name</span>.png ;;
<span class="org-keyword">esac</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-orge31d949" class="outline-2">
<h2 id="orge31d949"><code>remote-desktop</code> - Remote Desktop Connect</h2>
<div class="outline-text-2" id="text-orge31d949">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">computer</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">'RNICE\nPCMEL1\nPCNASS1\nPCMEG01'</span> | dmenu -p <span class="org-string">'Computer:'</span> -l <span class="org-highlight-numbers-number">20</span><span class="org-rainbow-delimiters-depth-1">)</span>;
<span class="org-keyword">case</span> $<span class="org-variable-name">computer</span><span class="org-keyword"> in</span>
PCMEL1)
rdesktop -a <span class="org-highlight-numbers-number">16</span> -P -z -x m -r sound:off -g <span class="org-string">"80%"</span> -u <span class="org-string">"ESRF\OPPEL"</span> -p $<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> esrf/PCMEL1/OPPEL | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> pcmel1
;;
PCMEG01)
rdesktop -a <span class="org-highlight-numbers-number">16</span> -P -z -x m -r sound:off -g <span class="org-string">"80%"</span> -u <span class="org-string">"ESRF\DEHAEZE"</span> -p $<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> ssl.esrf.fr/dehaeze | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> pcmeg01
;;
PCNASS1)
rdesktop -a <span class="org-highlight-numbers-number">16</span> -P -z -x m -r sound:off -g <span class="org-string">"80%"</span> -u <span class="org-string">"ESRF\DEHAEZE"</span> -p $<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> ssl.esrf.fr/dehaeze | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> pcnass1
;;
RNICE)
<span class="org-type">echo</span> <span class="org-string">"Not yet implemented"</span>
;;
*)
<span class="org-type">echo</span> <span class="org-string">"Not existing"</span>
;;
<span class="org-keyword">esac</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-org8a00ba3" class="outline-2">
<h2 id="org8a00ba3"><code>network-toggle</code> - Toggle Network</h2>
<div class="outline-text-2" id="text-org8a00ba3">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">result</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">nmcli</span> device | sed <span class="org-string">'1d'</span> | dmenu -l <span class="org-highlight-numbers-number">20</span><span class="org-rainbow-delimiters-depth-1">)</span>;
<span class="org-variable-name">interface</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> $<span class="org-variable-name">result</span> | awk -F <span class="org-string">' '</span> <span class="org-string">'{print $1}'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
<span class="org-variable-name">status</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> $<span class="org-variable-name">result</span> | awk -F <span class="org-string">' '</span> <span class="org-string">'{print $3}'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-variable-name">status</span> == <span class="org-string">'disconnected'</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
nmcli device connect $<span class="org-variable-name">interface</span>
<span class="org-keyword">else</span>
nmcli device disconnect $<span class="org-variable-name">interface</span>
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-orgdd09825" class="outline-2">
<h2 id="orgdd09825"><code>print-rnice</code> - Print on Rnice</h2>
<div class="outline-text-2" id="text-orgdd09825">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">nbpage</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">'1\n2\n4'</span> | dmenu -p <span class="org-string">'Number of pages per sheet'</span> -l <span class="org-highlight-numbers-number">20</span><span class="org-rainbow-delimiters-depth-1">)</span>;
<span class="org-variable-name">sides</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">'one-sided\ntwo-sided-long-edge\ntwo-sided-short-edge'</span> | dmenu -p <span class="org-string">'Two Sided:'</span> -l <span class="org-highlight-numbers-number">20</span><span class="org-rainbow-delimiters-depth-1">)</span>;
<span class="org-comment-delimiter"># </span><span class="org-comment">First copy the file to Rnice</span>
<span class="org-keyword">if</span> sshpass -p <span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">pass</span><span class="org-string"><span class="org-sh-quoted-exec"> ssl.esrf.fr/dehaeze | sed -n 1p)</span></span><span class="org-string">"</span> scp $<span class="org-highlight-numbers-number">1</span> dehaeze@rnice:~/Downloads/; <span class="org-keyword">then</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Then print on Rnice</span>
sshpass -p <span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">pass</span><span class="org-string"><span class="org-sh-quoted-exec"> ssl.esrf.fr/dehaeze | sed -n 1p)</span></span><span class="org-string">"</span> ssh dehaeze@rnice <span class="org-string">"lpr -o media=A4 -o sides=</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">sides</span></span><span class="org-string"> -o number-up=</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">nbpage</span></span><span class="org-string"> -P ctb110c1u ~/Downloads/</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span>;
<span class="org-comment-delimiter"># </span><span class="org-comment">Finally, delete the file</span>
<span class="org-keyword">else</span>
<span class="org-type">echo</span> <span class="org-string">"Command Failed"</span>
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf1a877f" class="outline-2">
2020-04-05 11:30:26 +02:00
<h2 id="orgf1a877f"><span class="todo TODO">TODO</span> Mount TMP14DAYS</h2>
2020-01-11 22:04:45 +01:00
<div class="outline-text-2" id="text-orgf1a877f">
2020-04-05 11:30:26 +02:00
<ul class="org-ul">
<li class="off"><code>[&#xa0;]</code> Put that as a script?</li>
</ul>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-type">sudo</span> -A <span class="org-type">mkdir</span> ~/tmp_14_days;
<span class="org-type">sudo</span> -A mount -o rw,relatime,<span class="org-variable-name">vers</span>=3,<span class="org-variable-name">rsize</span>=1048576,<span class="org-variable-name">wsize</span>=1048576,<span class="org-variable-name">namlen</span>=255,hard,<span class="org-variable-name">proto</span>=tcp,<span class="org-variable-name">timeo</span>=600,<span class="org-variable-name">retrans</span>=2,<span class="org-variable-name">sec</span>=sys,<span class="org-variable-name">mountaddr</span>=160.103.232.103,<span class="org-variable-name">mountvers</span>=3,<span class="org-variable-name">mountport</span>=597,<span class="org-variable-name">mountproto</span>=tcp,<span class="org-variable-name">local_lock</span>=none,<span class="org-variable-name">addr</span>=160.103.232.103 rnice:/hz/tmp_14_days ~/tmp_14_days;
</pre>
</div>
</div>
</div>
2020-03-01 22:51:16 +01:00
2020-04-05 11:30:26 +02:00
<div id="outline-container-orgd568e72" class="outline-2">
<h2 id="orgd568e72"><code>make-gif</code> - Make GIF</h2>
<div class="outline-text-2" id="text-orgd568e72">
2020-03-01 22:51:16 +01:00
<p>
<a href="http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html">http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html</a>
</p>
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">palette</span>=<span class="org-string">"/tmp/palette.png"</span>
<span class="org-variable-name">filters</span>=<span class="org-string">"fps=15,scale=320:-1:flags=lanczos"</span>
ffmpeg -v warning -i $<span class="org-highlight-numbers-number">1</span> -vf <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">filters</span></span><span class="org-string">,palettegen"</span> -y $<span class="org-variable-name">palette</span>
ffmpeg -v warning -i $<span class="org-highlight-numbers-number">1</span> -i $<span class="org-variable-name">palette</span> -lavfi <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">filters</span></span><span class="org-string"> [x]; [x][1:v] paletteuse"</span> -y $<span class="org-highlight-numbers-number">2</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-orgd7e49ff" class="outline-2">
<h2 id="orgd7e49ff"><code>yt-audio</code> - Download-Audio from youtube</h2>
<div class="outline-text-2" id="text-orgd7e49ff">
2020-03-01 22:51:16 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-variable-name">TMUX</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
2020-04-05 11:30:26 +02:00
tmux split -v -l <span class="org-highlight-numbers-number">5</span> <span class="org-string">"</span><span class="org-type"><span class="org-string">cd</span></span><span class="org-string"> ~/Downloads/ &amp;&amp; youtube-dl --add-metadata -xic -f bestaudio/best </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> &amp;&amp; tmux select-pane -U
2020-03-01 22:51:16 +01:00
<span class="org-keyword">else</span>
<span class="org-type">cd</span> ~/Downloads/;
setsid nohup youtube-dl --add-metadata -xic -f bestaudio/best $<span class="org-highlight-numbers-number">1</span> &amp;&gt; /dev/null &amp;
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-org89810de" class="outline-2">
<h2 id="org89810de"><code>yt-video</code> - Download-Video from youtube</h2>
<div class="outline-text-2" id="text-org89810de">
2020-03-01 22:51:16 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-variable-name">TMUX</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
2020-04-05 11:30:26 +02:00
tmux split -v -l <span class="org-highlight-numbers-number">5</span> <span class="org-string">"</span><span class="org-type"><span class="org-string">cd</span></span><span class="org-string"> ~/Downloads/ &amp;&amp; youtube-dl --add-metadata -ic </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> &amp;&amp; tmux select-pane -U
2020-03-01 22:51:16 +01:00
<span class="org-keyword">else</span>
<span class="org-type">cd</span> ~/Downloads/;
setsid nohup youtube-dl --add-metadata -ic $<span class="org-highlight-numbers-number">1</span> &amp;&gt; /dev/null &amp;
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-org18a85d1" class="outline-2">
<h2 id="org18a85d1"><code>pdf-shrink</code> Pdf Shrink</h2>
<div class="outline-text-2" id="text-org18a85d1">
2020-03-01 22:51:16 +01:00
<div class="org-src-container">
<pre class="src src-bash"><span class="org-function-name">shrink</span> <span class="org-rainbow-delimiters-depth-1">()</span>
<span class="org-rainbow-delimiters-depth-1">{</span>
gs <span class="org-sh-escaped-newline">\</span>
-q -dNOPAUSE -dBATCH -dSAFER <span class="org-sh-escaped-newline">\</span>
-sDEVICE=pdfwrite <span class="org-sh-escaped-newline">\</span>
-dCompatibilityLevel=<span class="org-highlight-numbers-number">1.3</span> <span class="org-sh-escaped-newline">\</span>
-dPDFSETTINGS=/screen <span class="org-sh-escaped-newline">\</span>
-dEmbedAllFonts=true <span class="org-sh-escaped-newline">\</span>
-dSubsetFonts=true <span class="org-sh-escaped-newline">\</span>
-dAutoRotatePages=/None <span class="org-sh-escaped-newline">\</span>
-dColorImageDownsampleType=/Bicubic <span class="org-sh-escaped-newline">\</span>
-dColorImageResolution=$<span class="org-highlight-numbers-number">3</span> <span class="org-sh-escaped-newline">\</span>
-dGrayImageDownsampleType=/Bicubic <span class="org-sh-escaped-newline">\</span>
-dGrayImageResolution=$<span class="org-highlight-numbers-number">3</span> <span class="org-sh-escaped-newline">\</span>
-dMonoImageDownsampleType=/Subsample <span class="org-sh-escaped-newline">\</span>
-dMonoImageResolution=$<span class="org-highlight-numbers-number">3</span> <span class="org-sh-escaped-newline">\</span>
-sOutputFile=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">2</span></span><span class="org-string">"</span> <span class="org-sh-escaped-newline">\</span>
<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">check_smaller</span> <span class="org-rainbow-delimiters-depth-1">()</span>
<span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">If $1 and $2 are regular files, we can compare file sizes to</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">see if we succeeded in shrinking. If not, we copy $1 over $2:</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span> <span class="org-negation-char">!</span> -f <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> -o <span class="org-negation-char">!</span> -f <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">2</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">return</span> <span class="org-highlight-numbers-number">0</span>;
<span class="org-keyword">fi</span>
<span class="org-variable-name">ISIZE</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">echo</span><span class="org-string"><span class="org-sh-quoted-exec"> $(</span></span><span class="org-sh-quoted-exec">wc</span><span class="org-string"><span class="org-sh-quoted-exec"> -c "</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">1</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">")</span></span><span class="org-string"> | cut -f1 -d\ )"</span>
<span class="org-variable-name">OSIZE</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">echo</span><span class="org-string"><span class="org-sh-quoted-exec"> $(</span></span><span class="org-sh-quoted-exec">wc</span><span class="org-string"><span class="org-sh-quoted-exec"> -c "</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">2</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">")</span></span><span class="org-string"> | cut -f1 -d\ )"</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">ISIZE</span></span><span class="org-string">"</span> -lt <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">OSIZE</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-type">echo</span> <span class="org-string">"Input smaller than output, doing straight copy"</span> &gt;&amp;<span class="org-highlight-numbers-number">2</span>
<span class="org-type">cp</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">2</span></span><span class="org-string">"</span>
<span class="org-keyword">fi</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-function-name">usage</span> <span class="org-rainbow-delimiters-depth-1">()</span>
<span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-type">echo</span> <span class="org-string">"Reduces PDF filesize by lossy recompressing with Ghostscript."</span>
<span class="org-type">echo</span> <span class="org-string">"Not guaranteed to succeed, but usually works."</span>
<span class="org-type">echo</span> <span class="org-string">" Usage: </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string"> infile [outfile] [resolution_in_dpi]"</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
<span class="org-variable-name">IFILE</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Need an input file:</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">IFILE</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
usage <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">0</span></span><span class="org-string">"</span>
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-keyword">fi</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Output filename defaults to "-" (stdout) unless given:</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> <span class="org-negation-char">!</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">2</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">OFILE</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">2</span></span><span class="org-string">"</span>
<span class="org-keyword">else</span>
<span class="org-variable-name">OFILE</span>=<span class="org-string">"-"</span>
<span class="org-keyword">fi</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Output resolution defaults to 72 unless given:</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> <span class="org-negation-char">!</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">3</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-variable-name">res</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">3</span></span><span class="org-string">"</span>
<span class="org-keyword">else</span>
<span class="org-variable-name">res</span>=<span class="org-string">"90"</span>
<span class="org-keyword">fi</span>
shrink <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">IFILE</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">OFILE</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">res</span></span><span class="org-string">"</span> || <span class="org-keyword">exit</span> $<span class="org-variable-name">?</span>
check_smaller <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">IFILE</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">OFILE</span></span><span class="org-string">"</span>
</pre>
</div>
</div>
</div>
2020-04-05 11:30:26 +02:00
<div id="outline-container-org539efcb" class="outline-2">
<h2 id="org539efcb"><code>setbg</code> - Set Background</h2>
<div class="outline-text-2" id="text-org539efcb">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">bgloc</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{XDG_CACHE_HOME:-$HOME/.cache/}</span></span><span class="org-string">/bg"</span>
<span class="org-rainbow-delimiters-depth-1">[</span> -f <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-type">ln</span> -sf <span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">readlink</span><span class="org-string"><span class="org-sh-quoted-exec"> -f "</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">1</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">")</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">bgloc</span></span><span class="org-string">"</span>
<span class="org-rainbow-delimiters-depth-1">[</span> -d <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-type">ln</span> -sf <span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">find</span><span class="org-string"><span class="org-sh-quoted-exec"> "$(</span></span><span class="org-sh-quoted-exec">readlink</span><span class="org-string"><span class="org-sh-quoted-exec"> -f "</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">1</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">")</span></span><span class="org-string">" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">bgloc</span></span><span class="org-string">"</span>
xwallpaper --zoom <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">bgloc</span></span><span class="org-string">"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orge6aa5bf" class="outline-2">
<h2 id="orge6aa5bf">Insert Unicode Icon</h2>
<div class="outline-text-2" id="text-orge6aa5bf">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-comment-delimiter"># </span><span class="org-comment">The famous "get a menu of emojis to copy" script.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Must have xclip installed to even show menu.</span>
xclip -h <span class="org-highlight-numbers-number">2</span>&gt;/dev/null || <span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-variable-name">chosen</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">cut</span> -d <span class="org-string">';'</span> -f1 ~/.local/share/emoji | rofi -dmenu -i -l <span class="org-highlight-numbers-number">20</span> | sed <span class="org-string">"s/ .*//"</span><span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-rainbow-delimiters-depth-1">[</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">chosen</span></span><span class="org-string">"</span> != <span class="org-string">""</span> <span class="org-rainbow-delimiters-depth-1">]</span> || <span class="org-keyword">exit</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">If you run this command with an argument, it will automatically insert the character.</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> -n <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
xdotool key Shift+Insert
<span class="org-keyword">else</span>
<span class="org-type">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">chosen</span></span><span class="org-string">"</span> | tr -d <span class="org-string">'\n'</span> | xsel -ib
dunstify <span class="org-string">"'</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">chosen</span></span><span class="org-string">' copied to clipboard."</span> &amp;
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org02426ec" class="outline-2">
<h2 id="org02426ec">Insert Nerd Font Icon</h2>
<div class="outline-text-2" id="text-org02426ec">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-comment-delimiter"># </span><span class="org-comment">Must have xsel installed to even show menu.</span>
xsel -h <span class="org-highlight-numbers-number">2</span>&gt;/dev/null || <span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-variable-name">chosen</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">cat</span> ~/.local/share/nerd-fonts | rofi -dmenu -i -l <span class="org-highlight-numbers-number">20</span> | sed <span class="org-string">"s/ .*//"</span><span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-rainbow-delimiters-depth-1">[</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">chosen</span></span><span class="org-string">"</span> != <span class="org-string">""</span> <span class="org-rainbow-delimiters-depth-1">]</span> || <span class="org-keyword">exit</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">If you run this command with an argument, it will automatically insert the character.</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> -n <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
xdotool key Shift+Insert
<span class="org-keyword">else</span>
<span class="org-type">echo</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">chosen</span></span><span class="org-string">"</span> | tr -d <span class="org-string">'\n'</span> | xsel -ib
dunstify <span class="org-string">"'</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">chosen</span></span><span class="org-string">' copied to clipboard."</span> &amp;
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
2020-01-11 22:04:45 +01:00
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
2020-04-05 11:30:26 +02:00
<p class="date">Created: 2020-04-05 dim. 11:29</p>
2020-01-11 22:04:45 +01:00
</div>
</body>
</html>