tell me the most ass over backward shit you do to keep your system chugging?
here’s mine:
sway struggles with my dual monitors, when my screen powers off and back on it causes sway to crash.
system service ‘switch-to-tty1.service’
[Unit]
Description=Switch to tty1 on resume
After=suspend.target
[Service]
Type=simple
ExecStart=/usr/local/bin/switch-to-tty1.sh
[Install]
WantedBy=suspend.target
‘switch-to-tty1.service’ executes ‘/usr/local/bin/switch-to-tty1.sh’ and send user to tty1
#!/bin/bash
# Switch to tty1
chvt 1
.bashrc login from tty1 then kicks user to tty2 and logs out tty1.
if [[ "$(tty)" == "/dev/tty1" ]]; then
chvt 2
logout
fi
also tty2 is blocked from keyboard inputs (Alt+Ctrl+F2) so its a somewhat secure lock-screen which on sway lock-screen aren’t great.
My control key was broken, but I found that when I used an app and held down the space bar key, the CPU would get abnormally hot.
So I wrote an Emacs interrupt to interpret a rapid CPU rise as “press the control button”.
Unfortunately the dev pushed an update that broke space bar heating, which broke my workflow. I opened a bug report about it, though…
How the fuck…
Other way around.
That’s horrifying.
Hey, my setup works for me! Just add an option to enable CPU overheating in the next update!
Just think how many children are holding down spacebar to keep warm in the winter. We need to keep this feature around.
Wow…
It’s not real, it’s an xkcd joke
This is an absolute winner IMHO. I’m imagining all the hotkeys that are accidentally activated when a CPU-intensive task spins up.
I had to use unity game engine for one of my assignments for school, but unity wouldn’t generate files needed for the language server unless I set the code editor to vscode. I fixed this by creating a bash script with the path
/usr/bin/code
that opensneovim
inkonsole
.#!/usr/bin/env bash konsole -e "nvim $@"
based
intel won’t allow its linux drivers to work above wifi 4 speeds in ap mode, so i created a kvm virtual windows machine with pci pass through on the wifi nic plus ip masquerade and now i’m getting wifi 6 speeds in ap mode.
Oh god, this is horrible. I beg you to find a better solution 🙏
it’s horrible in more ways that you would expect and what other solutions exist with intel wifi hardware in ap mode on linux?
this is beautiful
I’m using Gentoo with systemd and a customized kernel, and additionally I have the
/usr
partition LUKS encrypted. Because/usr
is absolutely essential for systemd to function, I configured dracut to make a specially crafted initrd which activates the luks lvm and prompts for the password to decrypt and mount/usr
on startup before systemd init tries to run.About a year or two ago, some update to dracut or some other dependency (assumption) caused the dracut generated initrd’s to kernel panic. After multiple days of troubleshooting, I discovered that just copying forward an older initrd in
/boot
and naming it to match the new kernel, e.g.initramfs-6.6.38-gentoo.img
, allows the system to boot normally .So, my Gentoo is booting a kernel
6.6.something
with a ramdisk generated in the5.9
kernel era. I am dreading the day when this behavior breaks and I can no longer update my kernel 😳I can hear the ticking…
Here’s a few of the micro-hacks that I’ve hacked up in the past.
A 2-line script to chroot into Debian when logging in as a certain user on FreeBSD.
#!/bin/sh clear doas chroot /linux /bin/login
I didn't have an IDE, so I just made a script called
ide
which runs Vim, and then compiles the code and makes it executable.#!/bin/sh #Works only for C vim $1.c && cc -O3 -Wall -Werror -Wno-unused-result $1.c -o $1 #MODE=`stat -f "%OLp" $1` if ("stat -f "%OLp" $1 | grep -e 6 -e 4 -e 2") then chmod +x $1 fi
This thing, called
demoronize
, which does what it says in the comments#!/bin/sh #dos2unix -O -e -s $1 | sed 's/ / /g' | sed 's/“/"/g' | sed 's/”/"/g' cat $1 | sed 's/ / /g' | sed 's/“/"/g' | sed 's/”/"/g' #Convert DOS line endings to Unix ones and add a final newline if there isn't one, #replace sequence of 4 spaces with tab, #and replace "smart" quotes with normal ones
I just keep those ones for historical value, but there’s one hack I use every day. My keyboard doesn’t have a function key (Fn), so I use the Super/Windows key instead.
I havexdotool keyup Super_L keyup Super_R keyup F4 key XF86Sleep
bound to a custom keyboard shortcut. It unpresses the keys used for the shortcut (Super + F4), then presses the sleep key.I think this one beats them all.
My home server keeps a few services up, including an instance of Jitsi Meet. The server runs nixos and the nixos package for jitsi is incomplete to say the least and doesn’t even support authentication, so I use the docker-compose version and I have a script that runs periodically to keep it updated. So far so good, right? Well, no.
Because the server is at home, I have a dynamic external IP address, so I have to use a DDNS provider, but jitsi doesn’t expect this and uses a stun server at startup to determine the public IP of the server once, so if my connection goes down or is restarted and the IP changes, jitsi needs to be restarted or it won’t work anymore.
The solution?
- My router runs OpenWrt, so I am able to run a script that checks for external IP changes. When a change is detected, it uses SSH to connect to my server to restart jitsi
- Because I don’t want the router to just be able to run any command, I created a jitsi-restart user that has no shell
- When the router tries to log in with its pubkey, sshd creates a file called restartasap in the jitsi folder and closes the connection
- On the server, there’s a systemd unit running a script as the jitsi user that periodically checks for that file, and if it exists it deletes it and restarts jitsi
I’ve been running this setup since mid 2020 and I expect this to continue until IPv6 becomes the norm.
So… There’s no plans to decommission it, ever?
wayland.windowManager.sway.config.keybindings = let # ... screenshot = with pkgs; writeShellScriptBin "screenshot.sh" '' DATE=$(date +"%Y%m%d%H%M%S") if [ "$1" = "full" ]; then ${grim}/bin/grim ~/Pictures/shot_$DATE.png ${libnotify}/bin/notify-send "saved full screenshot to shot_$DATE.png" elif [ "$1" = "full-copy" ]; then ${grim}/bin/grim - | ${wl-clipboard}/bin/wl-copy -t image/png ${libnotify}/bin/notify-send "copied full screenshot" elif [ "$1" = "sel" ]; then ${grim}/bin/grim -g "$(${slurp}/bin/slurp)" ~/Pictures/sel_$(date +"%Y%m%d%H%M%S").png ${libnotify}/bin/notify-send "saved selection to sel_$DATE.png" elif [ "$1" = "sel-copy" ]; then ${grim}/bin/grim -g "$(${slurp}/bin/slurp)" - | ${wl-clipboard}/bin/wl-copy -t image/png ${libnotify}/bin/notify-send "copied screenshot" else printf "Invalid argument: '$1'\n" fi ''; in lib.mkOptionDefault { # ...
This is in my Home Manager configuration. I don’t think this is that bad, it’s just kinda messy. If you can’t tell, it’s a script for taking screenshots, embedded in my configuration.
I like to use
unclutter
to hide my mouse pointer after a few seconds without being moved.Now, the thing is, it doesn’t just visually hide the cursor, it actually removes it, so UI elements triggered by hovering disappear. Sometimes that’s great, other times it’s infurriating, like when reading a tooltip or menu.
I mostly use a touchpad, and so I developed a habit to wiggle my finger while I’m intentionally hovering something, so that there was enough mouse movement for
unclutter
to not remove my pointer.Then I found a setting for the jitter threshold of the touchpad. Basically, with the threshold on, it ignores tiny movements, because the hardware reports finger wiggling, even if you hold your finger perfectly still. Which is perfect for me to turn off.
Now when I have my finger on the touchpad, it automatically wiggles and allows me to read hover elements. If I take my finger off, it stops wiggling and removes the cursor.
It’s almost like someone designed an OS with touchpads in mind, rather than them being an afterthought.What is
unclutter
?Uh, well, I kind of already wrote most of what there’s to say in the comment above, it hides your mouse pointer when you don’t move it for a few seconds.
In most distros, it’s available as the
unclutter
package, directly from the repos. On Debian-based systems, the package you want is calledunclutter-xfixes
.https://wiki.archlinux.org/title/Unclutter
It is built for X11 and won’t work on Wayland.
But KDE recently shipped a built-in feature as part of Plasma 6.1 (a Desktop Effect called “Hide Cursor”), which also works very nicely. That one does not cause hover elements to disappear.
That reminds me of this
Everything here reminds everyone of that.
I made a script to add a middle click scroll function with a toggle. I can share the script, it’s a really bash script
this sounds quit useful tbf
My mother uses some software that runs in the browser for her shop. It can print out receipts and scan items. To do these things it has a small “sattelite” application that runs on the system and interacts with the printer and scanner. This software only runs on Windows and Linux doesn’t have drivers for the scanner.
When I switched her over to Linux and found this out in the process I wanted to stop, give up and install windows.
But then I had a stupid idea. I could run the sattelite program in a Windows VM and pass through the USB devices for receipt printer and scanner. The webapp uses requests to localhost:9998 to communicate with the sattelite so I set up a apache server that proxies these requests into the VM. I also prevented the VM from acessing the Interner so Windows doesn’t update and screw everything up.
And it works. It has been in use for a week now and I’ve heard no complaints. I’m just praying to god it doesn’t break
At least getting a snapshot of the Windows VM should be simple. And since it doesn’t connect to the internet and doesn’t update, restore should be quick and relatively easy.
Create a script to send important data records (if you need that for taxes or inventory data etc) as a nightly routine, that way you have a consistent database for any important records.
Then just create a restore point. If it breaks in 2 weeks, then you just relaunch it and know that it’s going to kill itself in 2 weeks. A simple restart to that restore point solves everything.
Sounds 100% functional to me!
holy shit i was about to post about how i have automatic login and lock to start a program that refuses to work correctly on boot through systemd.
but then you guys are here casually posting some of the worst duct tape shit ive heard of so far. im not sure if i should reprimand or congratulate you for that jankiness.
About a decade ago I was playing a game on Linux and the game crashed and took the entire DE with it. So I went to a different
tty
and started a fresh x desktop session and started playing again until the game crashed again (I was running a bunch of mods so it would crash every couple of hours or so) and still didn’t feel like rebooting so I went to yet anothertty
and started yet another x desktop session. I did this about 3 times in total before I finally went “I should probably actually reboot because this has to be making a bigger mess of things”So I use a surface device with the Linux surface kernel, and there was (and probably still is) an issue where the type cover doesn’t properly rebind after being detached and re-attatched. To make matters worse, connecting other USB devices disconnected the type cover. My solution was to make a udev rule that detected if the keyboard is “removed” and then try to rebind it, effectively unplugging it and plugging it back in again in software.
bindntr=CTRL,C,exec,hyprctl dispatch closewindow alacrittyclipboard & hyprctl activewindow | rg -q "class: Wfica" && alacritty -qq --config-file ~/.config/alacritty/alacrittyclipboard.toml --class 'alacrittyclipboard' --title 'Office365 Desktop - Nexus (SSL/TLS Secured, 256 bit)' -e sh -c 'sleep .03 && xclip -o | wl-copy ; wl-paste | xclip -i' windowrulev2 = float,class:(alacrittyclipboard) windowrulev2 = stayfocused,class:(alacrittyclipboard) windowrulev2 = noborder,class:(alacrittyclipboard) windowrulev2 = noanim,class:(alacrittyclipboard) windowrulev2 = noblur,class:(alacrittyclipboard) windowrulev2 = opacity 0,class:(alacrittyclipboard) windowrulev2 = maxsize 1 1,class:(alacrittyclipboard)
Fixes the fucking clipboard in citrix, no, I cannot figure out a better solution.
the move to aquamarine with hyprland mostly resolved this… but not completely and i’m going to have to write a new duct tape solution for that.
If you’re wondering why I launch alacritty… it doesn’t work without alacritty, wayland needs the window to be in focus, if alacritty isn’t there there’s no in focus window and it doesn’t update the clipboard.
Well it was more like a temporary duct tape, but I “installed” a copy of Ubuntu in RAM from the running Ubuntu system so that I could “boot” (pivot_root) into it without restarting it
All because I didn’t want to wait on a ticket for my dedicated server provider to hook in a KVM LOL
(See my meme post I posted to c/linuxmemes a few weeks back for more info)