this post was submitted on 21 Aug 2024
284 points (98.3% liked)

Linux

48323 readers
679 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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.

(page 3) 50 comments
sorted by: hot top controversial new old
[–] Quackdoc@lemmy.world 5 points 3 months ago

I really needed to run a compositor from an arch chroot and systemd's udev is straight up broken in chroot, so I used libudev-zero and made sure that every time systemd updated I would delete the libudev .so file and plunk libudev-zero ontop of it, no i've moved on to greener pastures (Artix) but hey, it did work.

[–] popekingjoe@lemmy.world 4 points 3 months ago

In the earlier days of Plasma 6, it would crash on me when waking from sleep, so I had a small script that would basically restart plasmashell when waking so I didn't have to wait the several seconds for the system to realize that it was frozen before I had a functional desktop.

[–] avidamoeba@lemmy.ca 4 points 3 months ago* (last edited 3 months ago)

On the client side of a relayd-based wireless bridge using OpenWrt, I discovered there was a bug in that relayd version which made the process hang after it moved so many gigs of data. I made a cron job that pings the network relayd makes accessible. If the ping fails, it nukes relayd. Of course this relies on a live machine to ping. If this machine dies for some reason, the cron job would just keep killing relayd over and over again. 🥹

[–] Samueru@lemmy.ml 4 points 3 months ago (1 children)

It makes me mad to see the current state sway is in, I even bought an AMD GPU for nothing.

[–] downhomechunk@midwest.social 4 points 3 months ago

I too was a bit underwhelmed by sway. I also bought an amd gpu, but I don't regret it. I couldn't get Wayland to work at all on my 3060 ti.

[–] StarlightDust@lemmy.blahaj.zone 4 points 3 months ago

gtk3-classic still doesn't work properly on Wayland and I doubt it will ever be fixed so I include WAYLAND_DISPLAY=0 in each shortcut file to force them into xwayland.

[–] DeltaWingDragon@sh.itjust.works 4 points 2 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.

[–] callyral@pawb.social 3 points 3 months ago
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.

[–] BrianTheeBiscuiteer@lemmy.world 3 points 3 months ago

Don't remember the specifics but I had a key combo setup to force a soft reset in my DE. Occasionally a kernel or driver update would fuck up my video and make the system unusable but still live. I try to avoid hard resets.

[–] MonkderVierte@lemmy.ml 3 points 3 months ago* (last edited 3 months ago)

Bootstraping.

[–] ninekeysdown@lemmy.world 2 points 3 months ago

I’ll leave this one here for someone:

You can tunnel L2 over OpenVPN. Just bridge your interfaces in both sides and it works.

That way if you need to provision a VOIP phone or just have something NetBoot remotely. Not that I recommend doing that…

[–] OmegaLemmy@discuss.online 2 points 2 months ago (1 children)

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

load more comments (1 replies)
load more comments
view more: ‹ prev next ›