configs  Check-in [0c9a86bb64]

Overview
Comment:zshrc: Add command to switch NVIDIA GPU in Mutter
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA3-256: 0c9a86bb64945a6d80c7c436563c445d1fbb444fc574a0a5c052f486fa594e5b
User & Date: js 2024-12-14 10:54:25
Context
2024-12-14
10:54
zshrc: Add command to switch NVIDIA GPU in Mutter Leaf check-in: 0c9a86bb64 user: js tags: trunk
10:53
Merge accidental fork check-in: 3b44e9e6f8 user: js tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to zshrc.

635
636
637
638
639
640
641



























642
643
644
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



	esac

	export objfw_configure_flags=(
		--host=$cross_host
		$=objfw_configure_flags
	)
}

if [ -e /dev/nvidia0 ]; then
	nvidia() {
		case "$1" in
		1|on)
			primary="/dev/dri/card0"
			secondary="/dev/dri/card1"
			;;
		0|off)
			primary="/dev/dri/card1"
			secondary="/dev/dri/card0"
			;;
		*)
			return 1
			;;
		esac

		sudo tee /etc/udev/rules.d/61-mutter-primary-gpu.rules \
			>/dev/null <<__EOF__
ENV{DEVNAME}=="${primary}", TAG+="mutter-device-preferred-primary"
ENV{DEVNAME}=="${secondary}", TAG=""
__EOF__
		sudo udevadm control --reload
		sudo udevadm trigger
		sudo systemctl restart gdm
	}
fi

unset fgrep grep grep_color ls ls_color ls_on_cd ls_on_init
unset HISTFILE