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

Linux

47337 readers
1351 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
[–] popekingjoe@lemmy.world 4 points 4 weeks 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.

[–] StarlightDust@lemmy.blahaj.zone 4 points 4 weeks 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.

[–] avidamoeba@lemmy.ca 4 points 4 weeks ago* (last edited 4 weeks 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 4 weeks 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 4 weeks 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.

[–] Kazumara@discuss.tchncs.de 4 points 3 weeks ago

I wrote a script to turn the power of the the Wifi+Bluetooth chip off, then enumerate the PCIe bus again to start it back up.

The chip sometimes hung itself when using both. I looked for the bug and even found an Intel engineer on some mailing list admitting that they had issues with coexistance mode.

Just turning the wireless off and back on wasn't enough I needed to reeinitialize the hardware and that was the best way I knew.

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

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

Bootstraping.

[–] OmegaLemmy@discuss.online 3 points 3 weeks 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)
[–] BrianTheeBiscuiteer@lemmy.world 3 points 4 weeks 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.

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

[–] Trainguyrom@reddthat.com 2 points 1 week ago

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 another tty 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"

[–] ninekeysdown@lemmy.world 2 points 3 weeks 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…

load more comments
view more: ‹ prev next ›