diff options
Diffstat (limited to 'site')
| -rw-r--r-- | site/2023-11-15-scraping-images-from-open-tabs.md | 25 | ||||
| -rw-r--r-- | site/2026-02-20-pleasant-arch-setup.md | 123 | ||||
| -rw-r--r-- | site/index.html | 7 | ||||
| -rw-r--r-- | site/sakura.css | 243 |
4 files changed, 398 insertions, 0 deletions
diff --git a/site/2023-11-15-scraping-images-from-open-tabs.md b/site/2023-11-15-scraping-images-from-open-tabs.md new file mode 100644 index 0000000..b0aebb6 --- /dev/null +++ b/site/2023-11-15-scraping-images-from-open-tabs.md @@ -0,0 +1,25 @@ +# Scraping images from open tabs + +<time id="post-upload-date">2023-11-15</time> +<time id="post-update-date">2023-11-15</time> + +```zsh +cat export.json \ + | jaq --raw-output '..["url"]? | strings' \ + | rg --fixed-strings "wallhaven.cc/w" \ + | gallery-dl --input-file - +``` +I exported my current session to json with tab session manager. This command +takes that json export (referred to as `export.json`), finds all the urls +that contain `wallhaven.cc/w` (i.e. all urls that are wallhaven images) and +passes them to gallery-dl. Gallery-dl then neatly downloads all of those images +in their original quality. + +This workflow could be made better by creating a version of tab session manager +that exports in a simpler (or more configurable format), and I could also turn +this into a script that takes the wanted website formats as an argument. +Invocation of the script might look something like: +```zsh +tabsession-dl --format "wallhaven.cc/w" --format "reddit.com/r" \ + --input-file export.json +``` diff --git a/site/2026-02-20-pleasant-arch-setup.md b/site/2026-02-20-pleasant-arch-setup.md new file mode 100644 index 0000000..93f35b0 --- /dev/null +++ b/site/2026-02-20-pleasant-arch-setup.md @@ -0,0 +1,123 @@ +# A pleasant Arch Linux setup + +<time id="post-upload-date">2026-02-20</time> +<time id="post-update-date">2026-02-20</time> + +Recently I distrohopped back to Arch Linux on my laptop and, given the +opportunity for a fresh start, wanted to keep the setup tidy. In this post I +note down a bunch of small changes I made that make my system more neat, lean +and aesthetically pleasant by my judgement. I will (hopefully) periodically +update this post as I find and implement new improvements. + +## Environment variables + +First order of business is setting environment variables since so much else is +configured through them. Traditionally one might put their variables into shell +initialization files, such a `~/.profile` or `~/.bashrc`. I don't like this for +a few reasons. First it pollutes my home directory with configuration files +that don't belong there, and second it's not portable across shells. If you opt +to use [fish shell](https://fishshell.com/) as I do then `.profile` will not +be loaded by default, you'll have to [create a fishlogin file](https://superuser.com/a/1046884) +that sources it manually. + +A better solution I found is to use [systemd's environment.d](https://www.freedesktop.org/software/systemd/man/latest/environment.d.html) +to set variables set by the corresponding systemd user service (`user@<uid>.service`). +I created the `~/.config/environment.d` directory and populated it with a few +files for different types of assignments. For example here's the file I use to +set my XDG base directories: + +```bash +# ~/.config/environment.d/10-user-dirs.conf +XDG_CONFIG_HOME=$HOME/.config +XDG_CACHE_HOME=$HOME/.cache +XDG_DATA_HOME=$HOME/.local/share +XDG_STATE_HOME=$HOME/.local/state +``` + +This approach has a few benefits and a few downsides. It means my variables +aren't dependent on my shell, that they're located in a common location, and +have a dead-simple format that's not interspersed with other shell stuff. +However it also means that `~/.config/` is necessarily my config home (after +all you can't read `$XDG_CONFIG_HOME` before you've set it) and that reloading +my environment requires reloading the user service and all services after +it. So far the easiest way I've found to do this is to do a full `systemctl +soft-reboot`. + +## Keeping my `$HOME` clean + +In our blessed year of 2026 a nontrivial amount of programs still don't respect +the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir/latest/) +by default. Thankfully a lot of them have environment-based configuration options +I can use to fix that. To detect such cases I periodically run +[xdg-ninja](https://github.com/b3nj5m1n/xdg-ninja) which helpfully lists out +offending programs on my system as well as the fix, if any is available. + +Most fixes tend to be environment variables, and as such I have the following +file in my `environment.d` + +```bash +# ~/.config/environment.d/40-xdg-ninja.conf +CARGO_HOME=$XDG_DATA_HOME/cargo +RUSTUP_HOME=$XDG_DATA_HOME/rustup +# ... +``` + +## SSH agent + +Loading the SSH agent is yet another pain point when using a shell based +approach. The Arch wiki even recommends using a [bash snippet](https://wiki.archlinux.org/title/SSH_keys#ssh-agent) in your `.bashrc` +that uses `pgrep` to find the current running ssh agent instance and source its +environment variable in the current shell as a method of dealing with it. +Too janky for my tastes. Thankfully the very next section notes that a systemd user +service for the agent is included with the `openssh` package that I can use +it instead, so long as I set the `SSH_AUTH_SOCK` environment variable manually. + +Therefore an invocation of `systemctl --user enable ssh-agent.service` along +with creating the following environment file solves my troubles. + +```bash +# ~/.config/environment.d/30-ssh-agent.conf +SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket +``` + +## Xwayland + +By default the `xwayland-satellite` package does not start the satellite +nor set up a service for it. It should be clear by now that I prefer +using systemd services for this sort of thing rather than mechanisms +like niri's `spawn-at-startup`. Therefore I dropped this [service +file](https://github.com/Supreeeme/xwayland-satellite/blob/main/resources/xwayland-satellite.service) +into my user services. + +```ini +# ~/.config/systemd/user/xwayland-satellite.service +[Unit] +Description=Xwayland outside your Wayland +BindsTo=graphical-session.target +PartOf=graphical-session.target +After=graphical-session.target +Requisite=graphical-session.target + +[Service] +Type=notify +NotifyAccess=all +ExecStart=/usr/local/bin/xwayland-satellite ; <- this needed adjustment +StandardOutput=journal + +[Install] +WantedBy=graphical-session.target +``` + +X based applications also expect the `DISPLAY` environment variable to be set +so I created put that into my wayland workarounds environment file. That file +also contains other environment-based hints to programs that they should really +use wayland pretty-please. + +```bash +# ~/.config/environment.d/20-wayland-hints.conf +DISPLAY=:1 +ELECTRON_OZONE_PLATFORM_HINT=wayland +_JAVA_AWT_WM_NONREPARENTING=1 +``` + +I'm not sure whether the exact number you choose for the display has any effect. diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000..49822cd --- /dev/null +++ b/site/index.html @@ -0,0 +1,7 @@ +<h1>Sorre</h1> + +<p>Random thoughts written down so I can come back to them later.</p> +<p>Blog still under construction...</p> + +<div id="blog-index"> +</div> diff --git a/site/sakura.css b/site/sakura.css new file mode 100644 index 0000000..7d1886a --- /dev/null +++ b/site/sakura.css @@ -0,0 +1,243 @@ +/* Sakura.css v1.5.1 + * ================ + * Minimal css theme. + * Project: https://github.com/oxalorg/sakura/ + */ +/* Body */ +html { + font-size: 62.5%; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; +} + +body { + font-size: 1.8rem; + line-height: 1.618; + max-width: 38em; + margin: auto; + color: #4a4a4a; + background-color: #f9f9f9; + padding: 13px; +} + +@media (max-width: 684px) { + body { + font-size: 1.53rem; + } +} +@media (max-width: 382px) { + body { + font-size: 1.35rem; + } +} +h1, h2, h3, h4, h5, h6 { + line-height: 1.1; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-weight: 700; + margin-top: 3rem; + margin-bottom: 1.5rem; + overflow-wrap: break-word; + word-wrap: break-word; + -ms-word-break: break-all; + word-break: break-word; +} + +h1 { + font-size: 2.35em; +} + +h2 { + font-size: 2em; +} + +h3 { + font-size: 1.75em; +} + +h4 { + font-size: 1.5em; +} + +h5 { + font-size: 1.25em; +} + +h6 { + font-size: 1em; +} + +p { + margin-top: 0px; + margin-bottom: 2.5rem; +} + +small, sub, sup { + font-size: 75%; +} + +hr { + border-color: #1d7484; +} + +a { + text-decoration: none; + color: #1d7484; +} +a:visited { + color: #144f5a; +} +a:hover { + color: #982c61; + border-bottom: 2px solid #4a4a4a; +} + +ul { + padding-left: 1.4em; + margin-top: 0px; + margin-bottom: 2.5rem; +} + +li { + margin-bottom: 0.4em; +} + +blockquote { + margin-left: 0px; + margin-right: 0px; + padding-left: 1em; + padding-top: 0.8em; + padding-bottom: 0.8em; + padding-right: 0.8em; + border-left: 5px solid #1d7484; + margin-bottom: 2.5rem; + background-color: #f1f1f1; +} + +blockquote p { + margin-bottom: 0; +} + +img, video { + height: auto; + max-width: 100%; + margin-top: 0px; + margin-bottom: 2.5rem; +} + +/* Pre and Code */ +pre { + background-color: #f1f1f1; + display: block; + padding: 1em; + overflow-x: auto; + margin-top: 0px; + margin-bottom: 2.5rem; + font-size: 0.9em; +} + +code, kbd, samp { + font-size: 0.9em; + padding: 0 0.5em; + background-color: #f1f1f1; + white-space: pre-wrap; +} + +pre > code { + padding: 0; + background-color: transparent; + white-space: pre; + font-size: 1em; +} + +/* Tables */ +table { + text-align: justify; + width: 100%; + border-collapse: collapse; + margin-bottom: 2rem; +} + +td, th { + padding: 0.5em; + border-bottom: 1px solid #f1f1f1; +} + +/* Buttons, forms and input */ +input, textarea { + border: 1px solid #4a4a4a; +} +input:focus, textarea:focus { + border: 1px solid #1d7484; +} + +textarea { + width: 100%; +} + +.button, button, +input[type=submit], +input[type=reset], +input[type=button], +input[type=file]::file-selector-button { + display: inline-block; + padding: 5px 10px; + text-align: center; + text-decoration: none; + white-space: nowrap; + background-color: #1d7484; + color: #f9f9f9; + border-radius: 1px; + border: 1px solid #1d7484; + cursor: pointer; + box-sizing: border-box; +} +.button:hover, button:hover, +input[type=submit]:hover, +input[type=reset]:hover, +input[type=button]:hover, +input[type=file]::file-selector-button:hover { + background-color: #982c61; + color: #f9f9f9; + outline: 0; +} + +.button[disabled], button[disabled], +input[type=submit][disabled], +input[type=reset][disabled], +input[type=button][disabled], +input[type=file][disabled] { + cursor: default; + opacity: 0.5; +} +.button:focus-visible, button:focus-visible, +input[type=submit]:focus-visible, +input[type=reset]:focus-visible, +input[type=button]:focus-visible, +input[type=file]:focus-visible { + outline-style: solid; + outline-width: 2px; +} + +textarea, select, input { + color: #4a4a4a; + padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */ + margin-bottom: 10px; + background-color: #f1f1f1; + border: 1px solid #f1f1f1; + border-radius: 4px; + box-shadow: none; + box-sizing: border-box; +} +textarea:focus, select:focus, input:focus { + border: 1px solid #1d7484; + outline: 0; +} + +input[type=checkbox]:focus { + outline: 1px dotted #1d7484; +} + +label, legend, fieldset { + display: block; + margin-bottom: 0.5rem; + font-weight: 600; +} |
