Initial commit

This commit is contained in:
Akko
2022-03-18 16:48:18 +01:00
parent 6e159f44d4
commit 3012ee6bfa
21 changed files with 2334 additions and 0 deletions

570
html/posts/framework.html Normal file
View File

@@ -0,0 +1,570 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- 2022-03-18 Fri 13:55 -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Framework Laptop Review</title>
<meta name="generator" content="Org Mode" />
<style>
#content { max-width: 60em; margin: auto; }
.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 #e6e6e6;
border-radius: 3px;
background-color: #f2f2f2;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: auto;
}
pre.src:before {
display: none;
position: absolute;
top: -8px;
right: 12px;
padding: 3px;
color: #555;
background-color: #f2f2f299;
}
pre.src:hover:before { display: inline; margin-top: 14px;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-authinfo::before { content: 'Authinfo'; }
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>
<link rel="stylesheet" href="/static/style.css" type="text/css"/>
</head>
<body>
<div id="preamble" class="status">
<div id="header">
<a href="/">Home</a> |
<a href="/about.html">dare desu ka</a> |
<a href="/sitemap.html">Sitemap</a>
</div>
</div>
<div id="content" class="content">
<div id="outline-container-org8391d41" class="outline-2">
<h2 id="org8391d41">My Experience with the Framework Laptop</h2>
<div class="outline-text-2" id="text-org8391d41">
</div>
<div id="outline-container-org1ce456a" class="outline-3">
<h3 id="org1ce456a">Ordering</h3>
<div class="outline-text-3" id="text-org1ce456a">
<p>
I&rsquo;d been eyeing the <a href="https:frame.work">Framework laptop</a> since somewhere in October 2021, but the EU release got delayed and they were very hesitant to give time estimates. I only managed to get my hands on it in late February, and I ended up having to have it delivered to France. I understand the difficulty of setting up logistics especially these days, but I broke my previous laptop and being stuck in limbo like this was not fun.
</p>
<p>
On top of that, since I had it delivered to France, I was forced to use the French-language website. I wish websites wouldn&rsquo;t get this wrong, since there&rsquo;s a lot of people who don&rsquo;t speak the native language of the country they&rsquo;re in for various reasons. <br>
I asked their customer service to make a small change to the delivery address, but never got a reply, and the address wasn&rsquo;t changed. This was a non-issue, in the end, though~
</p>
</div>
</div>
<div id="outline-container-org50ca9d5" class="outline-3">
<h3 id="org50ca9d5">Set-up</h3>
<div class="outline-text-3" id="text-org50ca9d5">
</div>
<div id="outline-container-orgb9b62a2" class="outline-4">
<h4 id="orgb9b62a2">Hardware</h4>
<div class="outline-text-4" id="text-orgb9b62a2">
<p>
I got the DIY edition with the (lowest-end) i5-1135G7 CPU, 2x16GB RAM. I brought my own 1TB SSD. The higher spec CPUs didn&rsquo;t seem worth the money to me. The RAM is probably overkill.
</p>
<p>
Assembling the DIY edition took no time at all; you could probably speedrun this in &lt;30 seconds. The level of care here is excellent - all that&rsquo;s needed to replace virtually any part is the included screwdriver, and parts pop off easily. All screws are easily accessible, and every part is labelled with a QR code that links to their knowledge base with replacement instructions.
</p>
<p>
Replaceable RAM, storage and battery are table stakes - you can get that in plenty of laptops if you look for it. What&rsquo;s impressing about the Framework is first of all the sheer ease with which to disassemble it. It&rsquo;s a world of difference even compared to my old Thinkpad X230t, which is^H^H was an extremely servicable laptop (;_;). It&rsquo;s an experience.
</p>
<p>
Also very impressing is the sheer extent of things that can be replaced. You can see their store of replacement parts <a href="https:https://frame.work/marketplace/parts">here</a> and it includes everything from the audio board to the hinge to the CPU heatsink and so on. The parts aren&rsquo;t even expensive either!
</p>
<p>
My enrapturement was short-lived, though, as after a quick assembly my new laptop would not boot up or charge. Not even the charging light would come on. After some searching we did find a <a href="https://guides.frame.work/Guide/Fully+Resetting+the+Mainboard+State/113">guide</a> with instructions on how to fully power cycle the mainboard, and that resolved the issue. It seems the issue could potentially be caused by a dead CMOS battery. Regardless of what caused it, the fix was an obscure and somewhat dangerous fix for what I&rsquo;d consider a big quality assurance failure.
</p>
<p width="60%" class="center">
<img src="../../static/images/framework_inside.jpg" alt="framework_inside.jpg" width="60%" class="center">
The more you look at it, the nicer it gets!
</p>
</div>
</div>
<div id="outline-container-org5832bd6" class="outline-4">
<h4 id="org5832bd6">Software</h4>
<div class="outline-text-4" id="text-org5832bd6">
<p>
I installed Gentoo GNU+Linux on the laptop, just like I have on my desktop. I used an Ubuntu live CD as the install medium together with the Gentoo stage3 tarball, and it worked well. I didn&rsquo;t really have to jump through any laptop-specific hoops, it was a very nice experience. I did use the dist-kernel rather than configuring my own.
</p>
<p>
The laptop held up well during compiling. It&rsquo;s not as fast as a desktop of course, but compile times are not limiting. I&rsquo;ve put this thing through bootstrapping GCC for a cross-compilation toolchain, which is just about the biggest compile job I&rsquo;ve ran, and it wasn&rsquo;t <i>that</i> painful.
</p>
</div>
<div id="outline-container-orgd4dd8be" class="outline-5">
<h5 id="orgd4dd8be">Display scaling</h5>
<div class="outline-text-5" id="text-orgd4dd8be">
<p>
Simply setting <code>Xft.dpi: 192</code> in .Xresources was enough for the vast majority of applications to use 2x scaling, which looks very good on this display. This is on X11 obviously; I don&rsquo;t use Wayland.
</p>
<p>
The odd application requires its own scaling setting. Rofi requires setting <code>rofi.dpi</code> in .Xresources, SDDM required a settings change, Steam also requires a settings change, but for the most part things &ldquo;just work&rdquo;.
</p>
</div>
</div>
<div id="outline-container-org8505691" class="outline-5">
<h5 id="org8505691">Display manager</h5>
<div class="outline-text-5" id="text-org8505691">
<p>
I used SDDM which works very well. I wanted to go for something a bit fancier looking, and this delivers. I don&rsquo;t usually use things in the whole QT ecosystem, so it&rsquo;s refreshing.
</p>
</div>
</div>
<div id="outline-container-orgc19a9e4" class="outline-5">
<h5 id="orgc19a9e4">Hibernate/suspend-to-disk</h5>
<div class="outline-text-5" id="text-orgc19a9e4">
<p>
This required setting up a swap file and setting a kernel command line parameter to refer to it, but it was easy to do. It works well. I&rsquo;ve observed the laptop auto-hibernating when the battery runs out, but it doesn&rsquo;t do this reliably, so I should probably configure it myself.
</p>
</div>
</div>
<div id="outline-container-orga44529e" class="outline-5">
<h5 id="orga44529e"><a href="http://guake-project.org/">Guake</a>-like transient terminal</h5>
<div class="outline-text-5" id="text-orga44529e">
<p>
Using some <code>fish</code> scripts, <code>bspwm</code>, <code>picom</code> and <code>xst</code> I rigged up a transient, transparent terminal to use for quick shell jobs. I used the scripts and config file in <a href="#org52dc838">Appendix A</a> to do this. The implementation is a bit hacky, and it&rsquo;s not impossible to break, but it serves my purposes well (and more important, it was fun to make)!
</p>
</div>
</div>
<div id="outline-container-org69ee640" class="outline-5">
<h5 id="org69ee640">Wallpaper-setting script</h5>
<div class="outline-text-5" id="text-org69ee640">
<p>
I wrote a script to set a random wallpaper.
</p>
<div class="org-src-container">
<pre class="src src-python"><span class="org-comment-delimiter">#</span><span class="org-comment">!/usr/bin/env python3</span>
<span class="org-keyword">import</span> os
<span class="org-keyword">from</span> random <span class="org-keyword">import</span> choice
<span class="org-variable-name">pape_path</span> = os.path.expandvars(<span class="org-string">"$HOME/Pictures/Wallpapers"</span>)
<span class="org-keyword">def</span> <span class="org-function-name">set_wallpaper</span>():
<span class="org-variable-name">files</span> = os.popen(f<span class="org-string">"ls </span>{pape_path}<span class="org-string">"</span>).read().split(<span class="org-string">'\n'</span>)
<span class="org-variable-name">pape</span> = choice(files)
<span class="org-variable-name">pp</span> = os.path.join(pape_path, pape)
os.popen(f<span class="org-string">"hsetroot -full </span>{pp}<span class="org-string">"</span>)
os.popen(f<span class="org-string">"echo </span>{pp}<span class="org-string"> &gt; /tmp/wallpaper"</span>)
<span class="org-keyword">if</span> <span class="org-builtin">__name__</span> == <span class="org-string">"__main__"</span>:
set_wallpaper()
</pre>
</div>
</div>
</div>
<div id="outline-container-org59a8170" class="outline-5">
<h5 id="org59a8170">Lockscreen</h5>
<div class="outline-text-5" id="text-org59a8170">
<p>
I hacked together some <a href="#org4a95615">pretty crappy code</a> to lock the screen using <code>i3lock</code>, with my wallpaper composed with a little lock icon as the background. Very overengineered.
</p>
<p width="60%" class="center">
<img src="../../static/images/lockscreen.png" alt="lockscreen.png" width="60%" class="center">
Simple, but cute!
</p>
<p>
Is there a better lockscreen out there that will let me set my own image as the background? They all seem pretty scrappy.
</p>
</div>
</div>
<div id="outline-container-orgcd6505e" class="outline-5">
<h5 id="orgcd6505e">TODO</h5>
<div class="outline-text-5" id="text-orgcd6505e">
</div>
<ul class="org-ul">
<li><a id="org4d13c88"></a>Battery level notifications<br></li>
<li><a id="org891bbc2"></a>sleep-then-hibernate<br></li>
<li><a id="org986ee7a"></a>Battery tuning<br></li>
</ul>
</div>
</div>
</div>
<div id="outline-container-org636f0d1" class="outline-3">
<h3 id="org636f0d1">Impressions</h3>
<div class="outline-text-3" id="text-org636f0d1">
</div>
<div id="outline-container-org199b4e0" class="outline-5">
<h5 id="org199b4e0">Build Quality</h5>
<div class="outline-text-5" id="text-org199b4e0">
<p>
The laptop is made of aluminium and feels solid but light. The screen does seem pretty flimsy, though. I probably wouldn&rsquo;t want to drop this thing. It looks sleek and elegant, but pretty muted.
</p>
</div>
</div>
<div id="outline-container-org407cc5f" class="outline-5">
<h5 id="org407cc5f">Screen</h5>
<div class="outline-text-5" id="text-org407cc5f">
<p>
This is my first time ever using a high-DPI screen, and I&rsquo;m very impressed by it. Text looks unbelievably crisp and pleasant to read. I was somewhat worried about the linux high DPI situation, but I am having no issues whatsoever.
</p>
<p>
The colours on the screen look very good too, and the black levels are very impressive. I feel like display technology has come a long way in recent times. I have professional colour calibration equipment at home, so I&rsquo;ll give calibrating the screen a shot when I get back. The 3:2 aspect ratio works very well for a laptop and I like it a lot.
</p>
<p>
The brightness goes up quite high, but colours feel somewhat washed out at high brightness, and the display is very glossy, so it&rsquo;s a bit distracting in direct sunlight. I heard some people complain that the hinge is floppy, which is true. It&rsquo;s not all that problematic, but I really don&rsquo;t agree with the decision to optimize for one-handed operation over stability.
</p>
</div>
</div>
<div id="outline-container-orge31fee0" class="outline-5">
<h5 id="orge31fee0">Keyboard</h5>
<div class="outline-text-5" id="text-orge31fee0">
<p>
Framework seems to advertise their keyboard as having particularly deep travel, but it mostly just feels like any chiclet keyboard to me. Not a bad chiclet keyboard, but not that great, either. The layout is fine, but it makes me miss the thinkpad.
</p>
</div>
</div>
<div id="outline-container-org75c2b8f" class="outline-5">
<h5 id="org75c2b8f">Touchpad</h5>
<div class="outline-text-5" id="text-org75c2b8f">
<p>
I&rsquo;ve never had a decent touchpad before, so I was pleasantly surprised. I expected to miss the trackpoint on the thinkpad a lot, but this is fine, though it&rsquo;s still a step down. Pinch to zoom doesn&rsquo;t work very well, but I don&rsquo;t use that functionality a lot. I miss having dedicated mouse buttons; the clicking functionality on this touchpad works fine for me, but it&rsquo;s hard not to mess up left/middle/right click. That&rsquo;s a good incentive for me to practice relying on the mouse less, though. There&rsquo;s plenty of <a href="https://linuxtouchpad.org/">work being done</a> on the Linux touchpad experience software-side, too. It&rsquo;s a nice time to be a linux laptop user!
</p>
</div>
</div>
<div id="outline-container-orgba8ec24" class="outline-5">
<h5 id="orgba8ec24">Battery</h5>
<div class="outline-text-5" id="text-orgba8ec24">
<p>
With the disclaimer that I haven&rsquo;t tested very intensely and I haven&rsquo;t tuned power settings very much. <br>
I seem to get about 6.5 hours of real-world use time when using Emacs and doing light web browsing. I don&rsquo;t have a good benchmark for more intensive tasks, but compiling does hit the battery pretty hard. All in all I&rsquo;m very happy with it, getting decent battery life on Linux is hard. It might be worth eventually buying a power bank for it though, for travel~
</p>
</div>
</div>
<div id="outline-container-orgda266d6" class="outline-5">
<h5 id="orgda266d6">Expansion cards/ports</h5>
<div class="outline-text-5" id="text-orgda266d6">
<p>
The little expansion cards are one of Framework&rsquo;s big marketing things. I think they&rsquo;re pretty neat, though I don&rsquo;t always quite understand the way people talk about them, as &ldquo;dongle killers&rdquo;. I would find hotswapping these about equally obnoxious as carrying dongles. The idea of aftermarket expansion cards is interesting, though - these are low level, high bandwidth ports, with I think similar capabilities to the ExpressCard ports on old business laptops, but more modern with a USB-C port. I&rsquo;m looking forward to the USB4 era!
</p>
</div>
</div>
<div id="outline-container-org3aa2900" class="outline-5">
<h5 id="org3aa2900">Performance</h5>
<div class="outline-text-5" id="text-org3aa2900">
<p>
So far I haven&rsquo;t felt limited by performance at all, the experience has been really snappy. I haven&rsquo;t thrown particularly difficult things at it, though, but that&rsquo;s fine - most of what I do on a laptop is reading, web browsing, and text editing. I played some Factorio on it and that seemed fine, but using the touchpad felt limiting so I didn&rsquo;t play very much.
</p>
</div>
</div>
</div>
<div id="outline-container-orge99e843" class="outline-3">
<h3 id="orge99e843">Closing words</h3>
<div class="outline-text-3" id="text-orge99e843">
<p>
Getting this laptop set up has been really fun! It&rsquo;s a good opportunity to take stock of where we&rsquo;re at. On the hardware side, I am very impressed that it&rsquo;s now possible to make a laptop that&rsquo;s this user-servicable, this well-specced and still not <i>that</i> expensive. It&rsquo;s a reminder of how much better things could be.
</p>
<p>
On the software side, I feel like the GNU/Linux end-user ecosystem has come a long way. The experience was very painless, though I am also an advanced user, of course. How different are things now than when I got started on Linux Mint Olivia.
</p>
<p>
Personally, I&rsquo;m getting a rare chance to critically examine all the little config files, scripts, programs, plugins and worklfows I have. It&rsquo;s fun to re-ignite the spark of join in configuring software and figuring out fluent, comfortable ways of doing things. I look forward to once more exploring and documenting the joy of computers&#x2026;! &lt;3
</p>
</div>
</div>
</div>
<div id="outline-container-org52dc838" class="outline-2">
<h2 id="org52dc838">Appendix A: Transient Terminal Sources</h2>
<div class="outline-text-2" id="text-org52dc838">
<p>
<code>togglescratch</code>
</p>
<div class="org-src-container">
<pre class="src src-fish"><span class="org-comment-delimiter">#</span><span class="org-comment">!/usr/bin/env fish</span>
<span class="org-keyword">if</span> <span class="org-keyword">test</span> ! -e /tmp/scratch_id
<span class="org-builtin">exec</span> xst -e makescratch
<span class="org-keyword">end</span>
<span class="org-keyword">set</span> <span class="org-variable-name">nid</span> (<span class="org-builtin">cat</span> /tmp/scratch_id)
<span class="org-keyword">if</span> <span class="org-keyword">test</span> -e /tmp/scratch_on
<span class="org-builtin">rm</span> /tmp/scratch_on
<span class="org-builtin">bspc</span> node <span class="org-string">$</span><span class="org-variable-name">nid</span> --to-desktop z
<span class="org-keyword">else</span>
<span class="org-builtin">touch</span> /tmp/scratch_on
<span class="org-builtin">bspc</span> node <span class="org-string">$</span><span class="org-variable-name">nid</span> --to-desktop focused --focus --state fullscreen --flag private=on
<span class="org-keyword">end</span>
</pre>
</div>
<p>
<code>makescratch</code>
</p>
<div class="org-src-container">
<pre class="src src-fish"><span class="org-comment-delimiter">#</span><span class="org-comment">!/bin/fish</span>
<span class="org-keyword">set</span> <span class="org-variable-name">nid</span> (<span class="org-builtin">xdo</span> id)
<span class="org-builtin">echo</span> <span class="org-string">$</span><span class="org-variable-name">nid</span><span class="org-negation-char"> &gt; /tmp/scratch_id</span>
<span class="org-negation-char">bspc</span> node <span class="org-string">$</span><span class="org-variable-name">nid</span> --state fullscreen --flag private=on --to-desktop focused
<span class="org-builtin">touch</span> /tmp/scratch_on
<span class="org-keyword">set</span> <span class="org-variable-name">decid</span> (<span class="org-builtin">printf</span> <span class="org-string">'%d'</span> <span class="org-string">$</span><span class="org-variable-name">nid</span>)
<span class="org-builtin">xdotool</span> set_window --name <span class="org-string">"scratchterminal"</span> <span class="org-string">$</span><span class="org-variable-name">decid</span>
<span class="org-builtin">exec</span> <span class="org-string">"$HOME/Scripts/cleanscratch"</span>
</pre>
</div>
<p>
<code>cleanscratch</code>
</p>
<div class="org-src-container">
<pre class="src src-fish"><span class="org-comment-delimiter">#</span><span class="org-comment">!/usr/bin/env fish</span>
<span class="org-string">$</span><span class="org-variable-name">SHELL</span>
<span class="org-builtin">rm</span> /tmp/scratch_id
<span class="org-builtin">rm</span> /tmp/scratch_on
</pre>
</div>
<p>
<code>picom.conf</code>
</p>
<pre class="example">
fading = true;
#no-fading-openclose = true;
fade-delta = 5;
vsync = true;
backend="glx";
opacity-rule=["90:name = 'scratchterminal'"];
#opacity-rule=["90:class_g = 'xst-256color'"];
</pre>
</div>
</div>
<div id="outline-container-org4a95615" class="outline-2">
<h2 id="org4a95615">Appendix B: lock.py</h2>
<div class="outline-text-2" id="text-org4a95615">
<div class="org-src-container">
<pre class="src src-python"><span class="org-comment-delimiter">#</span><span class="org-comment">!/usr/bin/python3</span>
<span class="org-keyword">import</span> os
<span class="org-keyword">import</span> sys
<span class="org-keyword">import</span> time
<span class="org-keyword">if</span> <span class="org-builtin">__name__</span> == <span class="org-string">"__main__"</span>:
<span class="org-variable-name">width</span>, <span class="org-variable-name">height</span>, <span class="org-variable-name">lwidth</span>, <span class="org-variable-name">lheight</span> = <span class="org-highlight-numbers-number">2256</span>, <span class="org-highlight-numbers-number">1504</span>, <span class="org-highlight-numbers-number">320</span>, <span class="org-highlight-numbers-number">320</span>
icon = <span class="org-string">"$HOME/Pictures/lock_small.png"</span>
pape = os.popen(<span class="org-string">"cat /tmp/wallpaper"</span>).read()[:-<span class="org-highlight-numbers-number">1</span>]
cache = os.popen(<span class="org-string">"cat /tmp/lockscreen_cache"</span>).read()[:-<span class="org-highlight-numbers-number">1</span>]
<span class="org-keyword">if</span> pape != cache <span class="org-keyword">or</span> <span class="org-string">'--ignore-cache'</span> <span class="org-keyword">in</span> sys.argv:
os.popen(f<span class="org-string">"convert </span>{pape}<span class="org-string"> -resize </span>{width}<span class="org-string">x</span>{height}<span class="org-string"> -background black -gravity center -extent </span>{width}<span class="org-string">x</span>{height}<span class="org-string"> /tmp/wallpaper.png"</span>).read()
os.popen(f<span class="org-string">"convert -composite /tmp/wallpaper.png </span>{icon}<span class="org-string"> -geometry +</span>{width//2 - lwidth//2}<span class="org-string">+</span>{height//2 - lheight//2}<span class="org-string"> /tmp/wallpaper.png"</span>).read()
os.popen(f<span class="org-string">"echo </span>{pape}<span class="org-string"> &gt; /tmp/lockscreen_cache"</span>)
os.popen(<span class="org-string">"i3lock -u -i /tmp/wallpaper.png"</span>)
time.sleep(<span class="org-highlight-numbers-number">0.5</span>)
os.popen(<span class="org-string">"loginctl suspend"</span>)
</pre>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<div id="footer">
<hr>
If you have any comments about this page, you can email me at: <br>
<b>akko [shift-2] nakadashi -dot- lol</b><br><br>
All code on this website is licensed <b>GPLv3</b> unless otherwise indicated. <br>
Blog proudly built using <a href="/posts/elog-1-blog.html">org-mode</a>!
</div>
</div>
</body>
</html>