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.

  • DeltaWingDragon
    link
    fedilink
    arrow-up
    4
    ·
    4 months ago

    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 have xdotool 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.