Skip to content

Instantly share code, notes, and snippets.

@spoelstraethan
Last active September 26, 2021 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spoelstraethan/8306ade023b88e63542f64377a6e1175 to your computer and use it in GitHub Desktop.
Save spoelstraethan/8306ade023b88e63542f64377a6e1175 to your computer and use it in GitHub Desktop.
Cosmo Communicator handy snippets for i3 or scripting

i3 fixes

sudo apt install i3 rofi
sed -i -e 's/47/48/' -e 's/pango://' /etc/i3/config.keycodes /etc/i3/config
# even with the pango: removed from the config the wizard uses it and fails to show up properly on first login
i3-config-wizard -m alt

Battery device for i3status battery all to battery 0 and path = /sys/class/power_supply/battery/uevent

LED devices to control with brillo etc

/sys/devices/platform/leds-mt65xx/leds/lcd-backlight/brightness
/sys/devices/platform/leds-mt65xx/leds/lcd-backlight/max_brightness
/sys/devices/platform/aw9524_key/leds/kbd_backlight/brightness
/sys/devices/platform/aw9524_key/leds/kbd_backlight/max_brightness
pkill: applet not found
/usr/bin/sxmo_xinit.sh: 41: /usr/bin/sxmo_xinit.sh: alsactl: not found
/usr/bin/sxmo_xinit.sh: 49: /usr/bin/sxmo_xinit.sh: synclient: not found
/usr/bin/sxmo_xinit.sh: 69: /usr/bin/sxmo_xinit.sh: autocutsel: not found
/usr/bin/sxmo_xinit.sh: 70: /usr/bin/sxmo_xinit.sh: autocutsel: not found
pkill: applet not found
dbus-run-session: ignoring unknown child process 18792
dbus-run-session: ignoring unknown child process 18793
pkill: applet not found
sh: 12: ~/.config/sxmo/xinit: feh: not found
sh: 15: ~/.config/sxmo/xinit: conky: not found

synclient is xserver-xorg-input-synaptics autocutsel is itself feh is itself conky is itself

Unpacking alsa-utils (1.1.8-2) ...
dpkg: error processing archive /tmp/apt-dpkg-install-y5aQgs/01-alsa-utils_1.1.8-2_arm64.deb (--unpack):
 trying to overwrite '/lib/udev/rules.d/90-alsa-restore.rules', which is also in package lxc-android 0.3+gemian+0~20210422170358.20~1.gbp8861de
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)

Fixed by force installing alsa with -o dpkg --force-overwrite

#!/bin/bash
# show commands as they are ran
set -x
# exit on first error
set -e
# meson must be newer than what's available in Debian packages to build wlroots:
REPOS=~/repos
mkdir -p $REPOS
sudo apt install python3-pip git ninja-build -y
sudo pip3 install meson
# prequisites for wlroots:
sudo apt install \
libwayland-dev \
wayland-protocols \
libgles2-mesa-dev \
libdrm-dev \
libgbm-dev \
libinput-dev \
libxkbcommon-dev \
libudev-dev \
libpixman-1-dev \
libsystemd-dev \
libcap-dev \
libavutil-dev \
libavcodec-dev \
libavformat-dev \
libpng-dev -y
# Additional prerequisites for sway. There are more if you want to be able to run
# X11 apps in Sway using Xwayland, but I just want to run native apps.
sudo apt install \
libpcre3-dev \
libpango1.0-dev \
libcairo2-dev \
libgdk-pixbuf2.0-dev -y
#wlroots:
cd $REPOS
mkdir -p github.com/swaywm
cd github.com/swaywm
git clone https://github.com/swaywm/wlroots.git
cd wlroots
# Cannot install from git master because it requires wayland-server >=1.18
# and Debian has 1.16
git checkout 0.10.1
meson build
ninja -C build
sudo ninja -C build install
# json-c
sudo apt install cmake -y
cd $REPOS
mkdir -p github.com/json-c
cd github.com/json-c
git clone https://github.com/json-c/json-c.git
cd json-c
# build a released version:
git checkout json-c-0.14
mkdir json-c-build
cd json-c-build
cmake ../
make
sudo make install
# move libs to correct location
cd /usr/local/lib
sudo mv libjson-c.so* aarch64*/ #x86_64-linux-gnu/
sudo ldconfig
# scdoc: debian has 1.9, need >=1.9.2
cd $REPOS
mkdir -p git.sr.ht/~sircmpwn
cd git.sr.ht/~sircmpwn
git clone https://git.sr.ht/~sircmpwn/scdoc
cd scdoc
git checkout 1.10.1
make
sudo make install
# Sway:
cd $REPOS
mkdir -p github.com/swaywm
cd github.com/swaywm
git clone https://github.com/swaywm/sway.git
cd sway
# I got errors if I tried to build against git master, probably b/c it
# expects the latest version of wlroots
git checkout 1.4
meson build
ninja -C build
sudo ninja -C build install
# Firefox: you'll need a browser that supports native Wayland. The stock
# Debian version didn't work for me, so use a later release:
# mkdir -p ~/Downloads
# cd ~/Downloads
# wget https://ftp.mozilla.org/pub/firefox/releases/75.0/linux-x86_64/en-US/firefox-75.0.tar.bz2
# tar xf firefox-75.0.tar.bz2
# sudo mv firefox /usr/local/bin/firefox-75.0
# sudo ln -s firefox-75.0/firefox /usr/local/bin/
# # other packages Firefox expects to be install
# sudo apt install libgtk-3-0 libdbus-glib-1-2 libxt6 -y
# kitty: you'll need a terminal that supports native Wayland. The stock
# Debian version of kitty is too old to support Wayland. Alacritty is
# another option, but I like to use FiraCode font with ligatures and
# Alacritty does not support ligatures.
# cd ~/Downloads
# wget https://github.com/kovidgoyal/kitty/releases/download/v0.17.3/kitty-0.17.3-x86_64.txz
# sudo mkdir /usr/local/bin/kitty-0.17.3
# sudo tar -C /usr/local/bin/kitty-0.17.3 -xf kitty-0.17.3-x86_64.txz
# sudo ln -s kitty-0.17.3/bin/kitty /usr/local/bin/
sudo apt install -y kitty
mkdir -p ~/.config/sway
cp /usr/local/etc/sway/config ~/.config/sway/
sed -i 's/alacritty/kitty/' ~/.config/sway/config
# wofi: this is a application laucher like rofi/dmenu that is Wayland native.
## sudo apt install mercurial libgtk-3-dev pkg-config -y
## cd $REPOS
## mkdir -p hg.sr.ht/~scoopta
## cd hg.sr.ht/~scoopta
## hg clone https://hg.sr.ht/~scoopta/wofi
## cd wofi
## hg checkout v1.1.2
## # wofi needs libglib 2.60 to support g_app_info_launch_uris_async, but Debian
## # has 2.58, so I added this patch to not use the async version.
## patch -p1 << 'EOF'
## diff -r 96d47bb081be modes/drun.c
## --- a/modes/drun.c Mon Mar 09 22:37:36 2020 -0700
## +++ b/modes/drun.c Sat May 02 17:18:15 2020 -0500
## @@ -315,21 +315,6 @@
## return NULL;
## }
##
## -static void launch_done(GObject* obj, GAsyncResult* result, gpointer data) {
## - GError* err = NULL;
## - if(g_app_info_launch_uris_finish(G_APP_INFO(obj), result, &err)) {
## - exit(0);
## - } else if(err != NULL) {
## - char* cmd = data;
## - fprintf(stderr, "%s cannot be executed: %s\n", cmd, err->message);
## - g_error_free(err);
## - } else {
## - char* cmd = data;
## - fprintf(stderr, "%s cannot be executed\n", cmd);
## - }
## - exit(1);
## -}
## -
## void wofi_drun_exec(const gchar* cmd) {
## GDesktopAppInfo* info = g_desktop_app_info_new_from_filename(cmd);
## if(G_IS_DESKTOP_APP_INFO(info)) {
## @@ -338,7 +323,12 @@
## printf("%s\n", g_app_info_get_commandline(G_APP_INFO(info)));
## exit(0);
## } else {
## - g_app_info_launch_uris_async(G_APP_INFO(info), NULL, NULL, NULL, launch_done, (gchar*) cmd);
## + gboolean ret = g_app_info_launch_uris(G_APP_INFO(info), NULL, NULL, NULL);
## + if (!ret) {
## + fprintf(stderr, "%s cannot be executed\n", cmd);
## + exit(1);
## + }
## +
## }
## } else if(strrchr(cmd, ' ') != NULL) {
## char* space = strrchr(cmd, ' ');
## EOF
## meson build
## ninja -C build
## sudo ninja -C build install
## sed -i 's/\sdmenu\s/ wofi --show run /' ~/.config/sway/config
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment