Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Ingo Bürk Airblader

:octocat:
  • TNG Technology Consulting GmbH
  • Munich, Germany
View GitHub Profile
@Airblader
Airblader / py3lock.py
Created May 11, 2015
Obscure only actual windows for i3lock
View py3lock.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# vim:ts=2:sw=2:expandtab
import os
import xcb
from xcb.xproto import *
from PIL import Image
XCB_MAP_STATE_VIEWABLE = 2
@Airblader
Airblader / i3bar-ws-spacing.patch
Last active Sep 6, 2021
Remove padding around i3bar contents
View i3bar-ws-spacing.patch
diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c
index 6878e29..ced03c6 100644
--- a/i3bar/src/xcb.c
+++ b/i3bar/src/xcb.c
@@ -129,11 +129,11 @@ static const int ws_hoff_px = 4;
static const int ws_voff_px = 3;
/* Offset between two workspace buttons */
-static const int ws_spacing_px = 1;
+static const int ws_spacing_px = 0;
@Airblader
Airblader / detect-changes-on-change.ts
Last active May 10, 2021
Typescript / Angular Decorator: DetectChangesOnChange
View detect-changes-on-change.ts
// Copyright 2018 Ingo Bürk
// Released under the MIT License (https://opensource.org/licenses/MIT)
// TODO: Is there a better way to get access to a ChangeDetectorRef from
// within the decorator?
/**
* Decorator for class methods which caches the returned value and,
* if the value has changed, triggers change detection.
*
@Airblader
Airblader / make_dock.sh
Created May 9, 2017
Turn any window into a dock for i3 (caution, dock windows do not take focus ever)
View make_dock.sh
#!/usr/bin/env bash
# call like this:
# /path/to/this/script.sh <window_id> <dock height>
win="${1:-}"
height="${2:-}"
width=$(xrandr -q | head -n1 | awk '{print $8}')
xdotool windowunmap --sync ${win}
xdotool windowsize --sync ${win} ${width} ${height}
@Airblader
Airblader / interpolate.js
Last active Nov 23, 2017
rxjs – Interpolate progress straight from hell
View interpolate.js
// Use https://rxviz.com to see it in action.
/**
* Interpolates a (numeric) source stream with predicted values based on how
* quickly the source stream's value increases. This was intended to smooth out
* a progress bar, but should one really use this piece of sheer terror in production?
*/
const interpolate = (source$, relax = 50) => {
/* This just allows a shorter syntax, avoiding return statements in arrow functions. */
const id = obj => obj;
@Airblader
Airblader / gist:357f2c2d0c8b1ede639c
Created Mar 14, 2016
Outer gaps without inner gaps
View gist:357f2c2d0c8b1ede639c
diff --git a/src/con.c b/src/con.c
index aefdcad..bcae637 100644
--- a/src/con.c
+++ b/src/con.c
@@ -2048,7 +2048,7 @@ gaps_t calculate_effective_gaps(Con *con) {
.outer = workspace->gaps.outer + config.gaps.outer};
/* Outer gaps are added on top of inner gaps. */
- gaps.outer += 2 * gaps.inner;
+ // gaps.outer += 2 * gaps.inner;
View subscribe-workspace.pl
# example
/path/to/wallpaper.pl | while read num; do echo "feh --bg-scale /path/to/wallpaper$num.png"; done
# produces
# feh --bg-scale /path/to/wallpaper3.png
# feh --bg-scale /path/to/wallpaper1.png
# ...
@Airblader
Airblader / analyze.py
Last active Aug 29, 2015
Analyze #unixporn
View analyze.py
#!/usr/bin/env python3
import json
import urllib.request
import time
import sys
patterns = {
'i3': ['i3'],
'bspwm': ['bspwm'],
'awesome': ['awesome'],