some mount and unmount scripts

This commit is contained in:
2025-07-27 13:46:15 +02:00
parent b2a0364fcb
commit 299e5aa5de
9 changed files with 99 additions and 18 deletions

View File

@@ -19,9 +19,8 @@ hyprland-plugin-hyprexpo # scale workspaces and put them in a grid
# xdg-desktop-portal*
xdg-desktop-portal
xdg-desktop-portal-kde # Dolphin as file picker (change value of widget.use-xdg-desktop-portal.file-picker in about:config if not working correctly in firefox)
xdg-desktop-portal-hyprland # not working with my Intel iGPU, but fine with NVIDIA dGPU
xdg-desktop-portal-gnome # not necessary maybe, but just in case
xdg-desktop-portal-gtk # required by nautilus for file picker
# terminal emulator(s)
kitty # normal terminal
@@ -49,17 +48,16 @@ rofi(-wayland)
mpv
blueman # bluetooth GUI & applet
pavucontrol
nautilus # file manager and file picker
sushi # "Quicklook" for nautilus
gnome-text-editor # or kwrite, just notepad replacement
btop # system monitor
activate-linux # :/
polkit-gnome # polkit authentication agent
# fonts & themes
maplemono-nf-cn
maplemono-nf-cn / ttf-maplemono-nf-cn-unhinted (archlinuxcn)
ttf-font-awesome
meslo font # I installed it manually
ttf-meslo-nerd
ttf-jetbrains-mono-nerd
spicetify # spotify tweaks
spicetify-maketplace # spotify themes
nwg-look # theme of GTK apps

17
.scripts/issu.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
if [ "$(id -u)" -eq 0 ]; then
exit 1
fi
if [ -n "$SUDO_USER" ]; then
exit 1
fi
if [ "$LOGNAME" != "$USER" ]; then
exit 1
fi
if [ "$(ps -o comm= -p $(ps -o ppid= -p $$) 2>/dev/null)" = "su" ]; then
exit 1
fi

View File

@@ -1,19 +1,24 @@
#!/bin/sh
[ -z $SMB_CREDENTIALS ] && SMB_CREDENTIALS="$HOME/.smbcredentials"
[ ! -f $SMB_CREDENTIALS ] && exit 1
path="$(dirname "$(realpath "$0")")"
[ -z $SMB_HOST ] && SMB_HOST="10.8.0.1"
[ -z $SMB_DIR ] && SMB_DIR="share"
[ -z $SMB_MOUNT_POINT ] && SMB_MOUNT_POINT="/mnt/smb"
[ -z $SMB_UID ] && SMB_UID=$(id -u)
[ -z $SMB_GID ] && SMB_GID=$(id -g)
"$path/issu.sh" || {
echo "Do not run this script in sudo mode."
exit 1
}
[ -z "$SMB_CREDENTIALS" ] && SMB_CREDENTIALS="$HOME/.smbcredentials"
[ ! -f "$SMB_CREDENTIALS" ] && exit 1
[ -z "$SMB_HOST" ] && SMB_HOST="10.8.0.1"
[ -z "$SMB_DIR" ] && SMB_DIR="share"
[ -z "$SMB_MOUNT_POINT" ] && SMB_MOUNT_POINT="/mnt/smb"
[ -z "$SMB_UID" ] && SMB_UID=$(id -u)
[ -z "$SMB_GID" ] && SMB_GID=$(id -g)
[ ! -d "$SMB_MOUNT_POINT" ] && sudo mkdir -p "$SMB_MOUNT_POINT"
sudo mount -t cifs //$SMB_HOST/$SMB_DIR "$SMB_MOUNT_POINT" -o credentials=$SMB_CREDENTIALS,uid=$SMB_UID,gid=$SMB_GID
if [ $? -eq 0 ]; then
if sudo mount -t cifs //"$SMB_HOST"/"$SMB_DIR" "$SMB_MOUNT_POINT" -o credentials="$SMB_CREDENTIALS",uid="$SMB_UID",gid="$SMB_GID"; then
echo "Mounted $SMB_HOST/$SMB_DIR at $SMB_MOUNT_POINT"
else
echo "Failed to mount $SMB_HOST/$SMB_DIR at $SMB_MOUNT_POINT"

9
.scripts/smb-unmount.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
[ -z "$SMB_MOUNT_POINT" ] && SMB_MOUNT_POINT="/mnt/smb"
if sudo umount "$SMB_MOUNT_POINT" && sudo rmdir "$SMB_MOUNT_POINT"; then
echo "Unmounted and removed mount point $SMB_MOUNT_POINT"
else
exit 1
fi

29
.scripts/wsl-mount.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
path="$(dirname "$(realpath "$0")")"
"$path/issu.sh" || {
echo "Do not run this script in sudo mode."
exit 1
}
[ -z "$1" ] && echo "Usage: $0 <VHDX_PATH>" && exit 1
vhdx_path="$1"
[ -z "$2" ] && mount_point="/mnt/wsl" || mount_point="$2"
[ -d "$mount_point" ] || sudo mkdir -p "$mount_point"
username=$(whoami)
sudo chown "$username:$username" "$mount_point"
export LIBGUESTFS_BACKEND=direct
guestmount --add "$vhdx_path" --inspector --ro "$mount_point" || {
echo "Failed to mount VHDX file."
exit 1
}
echo "Successfully mounted $vhdx_path to $mount_point"

15
.scripts/wsl-unmount.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
[ -z "$1" ] && mount_point="/mnt/wsl" || mount_point="$1"
sudo umount "$mount_point" || {
echo "Failed to unmount $mount_point. It may not be mounted or you may not have the necessary permissions."
exit 1
}
sudo rmdir "$mount_point" || {
echo "Failed to remove the mount point directory $mount_point. It may not be empty or you may not have the necessary permissions."
exit 1
}
echo "Successfully unmounted and removed $mount_point."

8
.scripts/xdph-nuclear.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
sleep 1
killall -e xdg-desktop-portal-hyprland
killall -e xdg-desktop-portal-wlr
killall xdg-desktop-portal
/usr/lib/xdg-desktop-portal-hyprland &
sleep 2
/usr/lib/xdg-desktop-portal &

View File

@@ -4,7 +4,7 @@
#!
##! Apps
bind = Super, C, exec, code --password-store=gnome-libsecret # Launch VSCode (editor)
bind = Super, E, exec, nautilus --new-window # Launch Dolphin (file manager)
bind = Super, E, exec, dolphin --new-window # Launch Dolphin (file manager)
bind = Super, W, exec, firefox --new-window # Launch Firefox
bind = Super, X, exec, gnome-text-editor --new-window # Launch GNOME Text Editor
bind = Super, B, exec, killall btop || ghostty -e btop # Launch btop (system monitor)

View File

@@ -1,7 +1,7 @@
@import 'mocha.css';
* {
font-family: 'Font Awesome 6 Free', 'Maple Mono NF CN ExtraLight', 'Noto Sans', Arial, sans-serif;
font-family: 'Font Awesome 6 Free Regular', 'Maple Mono NF CN ExtraLight', 'Noto Sans', Arial, sans-serif;
font-size: 12px;
font-weight: 900;
margin: 0;