Compare commits

...

17 Commits

Author SHA1 Message Date
kenji 47ccb71a0d steam-session: added more opt
unfixed
2025-12-03 15:05:14 -06:00
kenji d8dc2ec1b8 steam-session: fixed binding 2025-12-01 22:05:22 -06:00
kenji c2faf2cda8 bind: fixed formatting 2025-12-01 22:05:11 -06:00
kenji 0fa579f28b bind: minor fix 2025-12-01 21:51:56 -06:00
kenji 638e26e026 cleaned up and removed environment.d 2025-12-01 21:40:10 -06:00
kenji e31f67e53e gamescope-session fixed scripting 2025-12-01 21:15:02 -06:00
kenji 417f5e17ad added more packages 2025-12-01 20:54:16 -06:00
kenji 333d493424 added script installer for steam-session-plus 2025-12-01 20:54:10 -06:00
kenji b72bfb6a84 gamescope-session: added VRR 2025-12-01 20:53:56 -06:00
kenji 64cae7dff1 vdirsyncer: conflict resolution added 2025-12-01 20:53:48 -06:00
kenji d9d7a98457 added gamescope-session-plus config 2025-11-30 20:24:57 -06:00
kenji e60437e244 bind: added switch to steamos 2025-11-30 20:24:41 -06:00
kenji 905be7b581 README: updated 2025-11-30 20:24:29 -06:00
kenji 753fc37901 README: updated 2025-11-30 19:51:44 -06:00
kenji edfb9c49ea README: appended anki if not working 2025-11-26 17:28:39 -06:00
kenji a863bd3f1e hypr: fix test 2025-11-26 17:28:28 -06:00
kenji 90d26a6304 added tickrs 2025-11-26 17:28:18 -06:00
8 changed files with 959 additions and 1 deletions
+36 -1
View File
@@ -1,6 +1,10 @@
# Stow-away! # Stow-away!
This repository ensures that the custom `OmarchyOS` is not filled with filth called `bloat`. It also adds its own feature that strongly adheres with the Linux principle (e.g., TUIs replacement for GUIs). This repository ensures that the custom `OmarchyOS` is not filled with filth called `bloat`. It also adds its own feature that strongly adheres with the Linux principle (e.g., TUIs replacement for GUIs).
# Problems
* `.xsession` and `~/.local/bin/switch-session.sh` original scripting needs to be revised for `OmarchyOS`. Manual interventions work well.
* `OmarchyOS` may overwrite custom `./omarchy-bin/` files such as **default browser**.
# Scripting # Scripting
[🚧 under construction 🚧] [🚧 under construction 🚧]
@@ -8,7 +12,7 @@ This repository ensures that the custom `OmarchyOS` is not filled with filth cal
## Custom Applications Installed [🚧] ## Custom Applications Installed [🚧]
```sh ```sh
sudo pacman -Sy yazi stow 7zip python-pipx tickrs flatpak \ sudo pacman -Sy networkmanager yazi stow 7zip python-pipx tickrs flatpak mangohud \
pipx install todoman khal vdirsyncer pipx install todoman khal vdirsyncer
``` ```
@@ -18,6 +22,27 @@ sudo pacman -Rs 1password-cli 1password-beta omarchy-chromium lazydocker ufw-doc
``` ```
## Interventions ## Interventions
### Wi-fi Back-end (For steam not detecting Wi-Fi)
Tells the `networkmanager` to use `iwd` for Wi-Fi instead.
```sh
sudo -e /etc/NetworkManager/conf.d/wifi_backend.conf
```
Paste this inside:
```toml
[device]
wifi.backend=iwd
```
Stops old one:
```sh
sudo systemctl stop systemd-networkd
sudo systemctl disable systemd-networkd
```
Starts and enables NetworkManager:
```sh
sudo systemctl enable NetworkManager
sudo systemctl start NetworkManager
```
### Proper `Vdirsync` Implementation ### Proper `Vdirsync` Implementation
Must sync (usually q5m) to avoid outdated information. Must sync (usually q5m) to avoid outdated information.
@@ -38,3 +63,13 @@ Inside this directory, `.secrets` folder must be filled with the following:
vdirsyncer discover vdirsyncer discover
vdirsyncer sync vdirsyncer sync
``` ```
Otherwise, modify `caldav` to your needs.
### Anki not launching
```bash
flatpak run --command=bash net.ankiweb.Anki
[📦 net.ankiweb.Anki ~]$ touch ~/.var/app/net.ankiweb.Anki/data/Anki2/gldriver6
[📦 net.ankiweb.Anki ~]$ echo software > ~/.var/app/net.ankiweb.Anki/data/Anki2/gldriver6
[📦 net.ankiweb.Anki ~]$ exit
```
+3
View File
@@ -8,6 +8,7 @@ a = "my_calendar_local"
b = "my_calendar_remote" b = "my_calendar_remote"
collections = ["from a", "from b"] collections = ["from a", "from b"]
metadata = ["displayname", "color"] metadata = ["displayname", "color"]
conflict_resolution = "b wins"
# --- LOCAL STORAGE --- # --- LOCAL STORAGE ---
# Where the calendar files will sit on your Linux machine # Where the calendar files will sit on your Linux machine
@@ -30,6 +31,7 @@ password.fetch = ["shell", "cat ~/Dotfiles/.secrets/vdirsyncer_secret"]
a = "school_sched_local" a = "school_sched_local"
b = "school_sched_remote" b = "school_sched_remote"
collections = null collections = null
conflict_resolution = "b wins"
# collections = ["from a", "from b"] # collections = ["from a", "from b"]
[storage school_sched_local] [storage school_sched_local]
@@ -49,6 +51,7 @@ a = "school_task_local"
b = "school_task_remote" b = "school_task_remote"
collections = null collections = null
# collections = ["from a", "from b"] # collections = ["from a", "from b"]
conflict_resolution = "b wins"
[storage school_task_local] [storage school_task_local]
type = "filesystem" type = "filesystem"
+3
View File
@@ -62,3 +62,6 @@ bindd = SUPER SHIFT, F, File manager, exec, uwsm-app -- yazi
# Web App URL # Web App URL
# Session Switcher Keybinding
bindd = SUPER, F12, Switch to SteamOS, exec, /home/kenji/.local/bin/switch-session.sh
+25
View File
@@ -21,3 +21,28 @@ source = ~/.config/hypr/autostart.conf
# Add any other personal Hyprland configuration below # Add any other personal Hyprland configuration below
# windowrule = workspace 5, class:qemu # windowrule = workspace 5, class:qemu
# ######### Input method ##########
# See https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland
#env = QT_IM_MODULE, fcitx
#env = XMODIFIERS, @im=fcitx
#env = SDL_IM_MODULE, fcitx
#env = GLFW_IM_MODULE, ibus
#env = INPUT_METHOD, fcitx
# ############ Wayland #############
env = ELECTRON_OZONE_PLATFORM_HINT,auto
######### Applications #########
env = XDG_DATA_DIRS,$HOME/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
# ############ Themes #############
env = QT_QPA_PLATFORM, wayland
env = QT_QPA_PLATFORMTHEME, kde
env = XDG_MENU_PREFIX, plasma-
# ######## Wayland #########
# Tearing
# env = WLR_DRM_NO_ATOMIC, 1
# ?
# env = WLR_NO_HARDWARE_CURSORS, 1
+264
View File
@@ -0,0 +1,264 @@
# 🎮 Hyprland ↔ SteamOS Session Switcher
<div align="center">
![Hyprland Logo](https://raw.githubusercontent.com/hyprwm/Hyprland/main/assets/header.png)
**Seamlessly switch between Desktop and Gaming modes on Arch Linux**
[![Arch Linux](https://img.shields.io/badge/Arch_Linux-1793D1?style=for-the-badge&logo=arch-linux&logoColor=white)](https://archlinux.org/)
[![Hyprland](https://img.shields.io/badge/Hyprland-00D9FF?style=for-the-badge&logo=wayland&logoColor=white)](https://hyprland.org/)
[![Steam](https://img.shields.io/badge/Steam-000000?style=for-the-badge&logo=steam&logoColor=white)](https://store.steampowered.com/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
</div>
## ✨ Features
🚀 **One-Click Session Switching** - Toggle between Desktop (Hyprland) and Gaming (SteamOS-like) modes
🎯 **Gaming Optimized** - Seamless integration with Steam Big Picture and Gamescope
🎨 **Beautiful UI** - Custom Wofi interface with glassmorphism effects
**Lightning Fast** - Instant session switching with proper cleanup
🔧 **Arch Native** - Built specifically for Arch Linux gaming setups
🎮 **Controller Friendly** - Works perfectly with gaming controllers
## 🖼️ Preview
```
┌─────────────────────────────┐
│ Switch Mode: │
├─────────────────────────────┤
│ 🎮 SteamOS │
│ 🖥️ Desktop │
└─────────────────────────────┘
```
*Elegant Wofi interface with SteamOS-inspired glassmorphism design*
## 🎯 What This Does
Transform your Arch Linux gaming rig into the ultimate dual-purpose machine:
- **🖥️ Desktop Mode**: Full Hyprland experience with UWSM session management
- **🎮 Gaming Mode**: SteamOS-like experience with Gamescope for optimal gaming performance
- **⌨️ Quick Switch**: `SUPER + F12` to instantly toggle between modes
- **🔄 Smart Cleanup**: Properly terminates sessions and handles process management
## 📋 Requirements
### Core Dependencies
```bash
# Essential packages
sudo pacman -S hyprland sddm wofi gamescope steam
# AUR packages (install with yay)
yay -S gamescope-session-git uwsm-git gamescope-session-steam-git
```
### System Setup
- **OS**: Arch Linux (or Arch-based distro)
- **Display Manager**: SDDM
- **Session Manager**: UWSM
- **Window Manager**: Hyprland
- **Gaming Layer**: Gamescope + Steam
## 🚀 Installation
### Quick Install
```bash
# Clone the repository
git clone https://github.com/yourusername/hyprland-steamos-switcher.git
cd hyprland-steamos-switcher
# Make installer executable
chmod +x install.sh
# Run installation
./install.sh
```
### Manual Installation
<details>
<summary>Click to expand manual installation steps</summary>
1. **Copy the session switcher script**:
```bash
mkdir -p ~/.local/bin
cp install.sh ~/.local/bin/switch-session.sh
chmod +x ~/.local/bin/switch-session.sh
```
2. **Add Hyprland keybinding**:
```bash
echo "bind = SUPER, F12, exec, ~/.local/bin/switch-session.sh" >> ~/.config/hypr/hyprland.conf
```
3. **Configure SDDM for autologin** (optional):
```bash
sudo tee /etc/sddm.conf > /dev/null <<EOF
[Autologin]
User=yourusername
Session=switcher
EOF
```
</details>
## 🎮 Usage
### Switching Sessions
**Method 1: Keyboard Shortcut**
- Press `SUPER + F12` while in Hyprland
- Select your desired mode from the Wofi menu
**Method 2: Terminal**
```bash
~/.local/bin/switch-session.sh
```
**Method 3: From Gaming Mode**
- Use Steam's built-in session switching
- Or run the script from a terminal in desktop mode
### Session Types
| Mode | Description | Best For |
|------|-------------|----------|
| 🎮 **SteamOS Mode** | Gamescope + Steam Big Picture | Gaming, controller use, living room setup |
| 🖥️ **Desktop Mode** | Hyprland + UWSM | Development, productivity, general computing |
## ⚙️ Configuration
### Customizing the Wofi Interface
Edit `~/.config/wofi/style.css` to modify the appearance:
```css
/* Example: Change the accent color */
#entry:selected {
background: linear-gradient(135deg, rgba(255, 107, 107, 0.8) 0%, rgba(255, 142, 83, 0.8) 100%);
}
```
### Adding Custom Session Options
Modify the script to add more session types:
```bash
choice=$(printf "🎮 SteamOS\n🖥️ Desktop\n🎲 RetroArch\n🎵 Music Mode" | wofi --dmenu ...)
```
## 🛠️ Troubleshooting
### Common Issues
**Session won't switch**
```bash
# Check if services are running
systemctl --user status gamescope-session-plus@steam
systemctl --user status uwsm@hyprland-uwsm.service
```
**Wofi not appearing**
```bash
# Verify Wayland display
echo $WAYLAND_DISPLAY
echo $XDG_RUNTIME_DIR
```
**Steam not launching in gaming mode**
```bash
# Restart Steam service
systemctl --user restart gamescope-session-plus@steam
```
### Getting Help
- 📖 Check the [Wiki](../../wiki) for detailed guides
- 🐛 Report issues on [GitHub Issues](../../issues)
- 💬 Join the discussion in [Discussions](../../discussions)
## 🗑️ Uninstallation
To completely remove the session switcher:
```bash
chmod +x uninstall.sh
./uninstall.sh
```
This will remove:
- ✅ Session switching scripts
- ✅ SDDM autologin configuration
- ✅ Systemd service overrides
- ✅ Wofi custom styling
- ✅ Hyprland keybinding
**Preserved**:
- ✅ Hyprland configuration (except switcher keybinding)
- ✅ UWSM setup
- ✅ All installed packages
- ✅ Steam and gaming setup
## 🏗️ Architecture
```
┌─────────────────┐ ┌─────────────────┐
│ Desktop Mode │ │ Gaming Mode │
│ │ │ │
│ Hyprland │◄──►│ Gamescope │
│ + UWSM │ │ + Steam │
│ + Full DE │ │ + Big Picture │
└─────────────────┘ └─────────────────┘
▲ ▲
│ │
└───────── Wofi ────────┘
Session Switcher
```
## 🤝 Contributing
We love contributions! Here's how you can help:
1. 🍴 Fork the repository
2. 🌿 Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. 💍 Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. 📤 Push to the branch (`git push origin feature/AmazingFeature`)
5. 🎯 Open a Pull Request
### Development Setup
```bash
# Clone your fork
git clone https://github.com/yourusername/hyprland-steamos-switcher.git
# Create a development branch
git checkout -b my-awesome-feature
# Test your changes
./install.sh # Test installation
./uninstall.sh # Test cleanup
```
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## 🙏 Acknowledgments
- **[Hyprland](https://hyprland.org/)** - Amazing Wayland compositor
- **[Gamescope](https://github.com/ValveSoftware/gamescope)** - Valve's gaming compositor
- **[UWSM](https://github.com/Vladimir-csp/uwsm)** - Universal Wayland Session Manager
- **[Wofi](https://hg.sr.ht/~scoopta/wofi)** - Beautiful application launcher
- **Arch Linux Community** - For the amazing ecosystem
## 🌟 Star History
[![Star History Chart](https://api.star-history.com/svg?repos=yourusername/hyprland-steamos-switcher&type=Date)](https://star-history.com/#yourusername/hyprland-steamos-switcher&Date)
---
<div align="center">
**Made with ❤️ for the Arch Linux Gaming Community**
[🏠 Homepage](../../) • [📖 Documentation](../../wiki) • [🐛 Report Bug](../../issues) • [💡 Request Feature](../../issues)
</div>
+406
View File
@@ -0,0 +1,406 @@
#!/bin/bash
#
# Seamless Hyprland <-> Gamescope Session Switcher for Arch Linux
# Updated: Clean Config, User Inputs for HDR/VRR
#
set -e
# --- Pre-flight Checks and Setup ---
C_GREEN='\033[0;32m'
C_YELLOW='\033[1;33m'
C_RED='\033[0;31m'
C_BLUE='\033[0;34m'
C_NC='\033[0m' # No Color
if [ "$EUID" -eq 0 ]; then
echo -e "${C_RED}Error: Do not run this script as root! It will use 'sudo' as needed.${C_NC}"
exit 1
fi
USER_NAME=$(whoami)
USER_HOME=$HOME
# --- Banner ---
echo -e "${C_BLUE}===================================================================${C_NC}"
echo -e "${C_BLUE} Hyprland <-> Gamescope Session Switcher Setup for: ${C_YELLOW}$USER_NAME${C_NC}"
echo -e "${C_BLUE}===================================================================${C_NC}\n"
# --- USER INPUTS ---
echo -e "${C_YELLOW}Configuration Choice:${C_NC}"
echo "Do you want to enable automatic login? [y/N]: "
read AUTOLOGIN_CHOICE
echo -e "\n${C_YELLOW}Monitor Configuration:${C_NC}"
# 1. Output Port
echo "Enter your Output Connector (default: DP-1):"
read USER_OUTPUT
USER_OUTPUT=${USER_OUTPUT:-DP-1}
# 2. Width
echo "Enter Screen Width (default: 3440):"
read USER_WIDTH
USER_WIDTH=${USER_WIDTH:-3440}
# 3. Height
echo "Enter Screen Height (default: 1440):"
read USER_HEIGHT
USER_HEIGHT=${USER_HEIGHT:-1440}
# 4. Refresh Rate
echo "Enter Refresh Rate (default: 180):"
read USER_REFRESH
USER_REFRESH=${USER_REFRESH:-180}
# 5. VRR (Adaptive Sync)
echo "Enable VRR / Adaptive Sync? [Y/n] (Default: Yes)"
read USER_VRR
if [[ "$USER_VRR" =~ ^[Nn]$ ]]; then
VRR_FLAG=""
echo -e "-> VRR Disabled"
else
VRR_FLAG="--adaptive-sync"
echo -e "-> VRR Enabled"
fi
# 6. HDR
echo "Enable HDR? [Y/n] (Default: Yes)"
read USER_HDR
if [[ "$USER_HDR" =~ ^[Nn]$ ]]; then
HDR_FLAG=""
echo -e "-> HDR Disabled"
else
HDR_FLAG="--hdr-enabled"
echo -e "-> HDR Enabled"
fi
echo -e "${C_GREEN}Configured: ${USER_OUTPUT} @ ${USER_WIDTH}x${USER_HEIGHT} (${USER_REFRESH}Hz)${C_NC}\n"
# --- Script Variables ---
HYPR_CONF="$USER_HOME/.config/hypr/bindings.conf"
SWITCH_SCRIPT_PATH="$USER_HOME/.local/bin/switch-session.sh"
XSESSION_PATH="$USER_HOME/.xsession"
SERVICE_OVERRIDE_DIR="/etc/systemd/user/gamescope-session-plus@.service.d"
SERVICE_OVERRIDE_FILE="$SERVICE_OVERRIDE_DIR/override.conf"
GS_ENV_DIR="$USER_HOME/.config/environment.d"
GS_ENV_FILE="$GS_ENV_DIR/gamescope-session-plus.conf"
OFFICIAL_PACKAGES=( "hyprland" "sddm" "uwsm" "networkmanager" )
AUR_PACKAGES=( "gamescope-git" "gamescope-session-git" "steam" "gamescope-session-steam-git" "walker" )
#=======================================================
# STEP 1: DEPENDENCY INSTALLATION
#=======================================================
echo -e "${C_BLUE}==> Installing Dependencies...${C_NC}"
if command -v yay &> /dev/null; then AUR_HELPER="yay"; elif command -v paru &> /dev/null; then AUR_HELPER="paru"; else
echo -e "${C_RED}Error: No AUR helper found (yay or paru). Please install one.${C_NC}"; exit 1; fi
echo -e "${C_GREEN}Found AUR helper: ${AUR_HELPER}${C_NC}"
sudo pacman -Syudd --needed "${OFFICIAL_PACKAGES[@]}" --noconfirm
$AUR_HELPER -Sdd --needed "${AUR_PACKAGES[@]}" --noconfirm
#=======================================================
# STEP 2: CLEAN UP OLD CONFIGURATIONS
#=======================================================
echo -e "${C_BLUE}==> Cleaning Up Old Configurations...${C_NC}"
sudo rm -rf "$SERVICE_OVERRIDE_DIR"
rm -f "$XSESSION_PATH"
rm -f "$SWITCH_SCRIPT_PATH"
#=======================================================
# STEP 3: APPLY SYSTEMD FIXES
#=======================================================
echo -e "${C_BLUE}==> Applying Core Fix for Wayland Socket Errors...${C_NC}"
sudo mkdir -p "$SERVICE_OVERRIDE_DIR"
sudo tee "$SERVICE_OVERRIDE_FILE" > /dev/null <<'EOF'
[Service]
ExecStart=
ExecStart=/usr/bin/env -u WAYLAND_DISPLAY /usr/share/gamescope-session-plus/gamescope-session-plus %i
EOF
systemctl --user daemon-reload
#=======================================================
# STEP 3.5: GRANT REAL-TIME PRIORITY CAPABILITIES
#=======================================================
echo -e "${C_BLUE}==> Granting CAP_SYS_NICE to Gamescope...${C_NC}"
# This allows gamescope to use --rt (realtime) scheduling without root
GAME_BIN=$(which gamescope)
if [ -f "$GAME_BIN" ]; then
sudo setcap 'CAP_SYS_NICE=eip' "$GAME_BIN"
echo -e "${C_GREEN}Capability set on $GAME_BIN${C_NC}"
else
echo -e "${C_RED}Error: Gamescope binary not found!${C_NC}"
fi
#=======================================================
# STEP 4: CONFIGURE GAMESCOPE ENVIRONMENT (CLEAN)
#=======================================================
echo -e "${C_BLUE}==> Configuring Gamescope Command...${C_NC}"
if [ -f "$GS_ENV_DIR" ]; then rm "$GS_ENV_DIR"; fi
mkdir -p "$GS_ENV_DIR"
echo "Writing to: $GS_ENV_FILE"
# NOTE: We do NOT use quotes around EOF here.
# This allows the variables ($USER_OUTPUT, $VRR_FLAG, etc.) to expanded
# RIGHT NOW, so the resulting file contains only hardcoded values.
cat > "$GS_ENV_FILE" <<EOF
# --- GAMESCOPE CONFIGURATION ---
# Generated by setup script on $(date)
#
# Flags Explanation:
# -O : Output Connector
# -r : Refresh Rate
# -W/-H : Resolution the Game sees
# -w/-h : Resolution sent to Monitor
# -e : Steam Integration
# -f : Force Fullscreen
# --xwayland-count 2 : Vital for Steam Deck UI + Game
# --immediate-flips : Low latency mode
# --rt : Real-time priority
GAMESCOPECMD="/usr/bin/gamescope \\
-O $USER_OUTPUT \\
-r $USER_REFRESH \\
-W $USER_WIDTH -H $USER_HEIGHT \\
-w $USER_WIDTH -h $USER_HEIGHT \\
$VRR_FLAG \\
$HDR_FLAG \\
--immediate-flips \\
--rt \\
-e \\
--mangoapp \\
--xwayland-count 2 \\
--default-touch-mode 4 \\
--hide-cursor-delay 3000 \\
--fade-out-duration 200"
EOF
#=======================================================
# STEP 5: CONFIGURE NETWORK MANAGER (IWD BACKEND)
#=======================================================
echo -e "${C_BLUE}==> Configuring NetworkManager for SteamOS compatibility...${C_NC}"
sudo mkdir -p /etc/NetworkManager/conf.d
sudo tee /etc/NetworkManager/conf.d/wifi_backend.conf > /dev/null <<EOF
[device]
wifi.backend=iwd
EOF
echo "Enabling NetworkManager..."
sudo systemctl enable NetworkManager
#=======================================================
# STEP 6: INSTALL SESSION SWITCHING LOGIC
#=======================================================
echo -e "${C_BLUE}==> Installing Session Switching Workflow...${C_NC}"
if [[ "$AUTOLOGIN_CHOICE" =~ ^[Yy]$ ]]; then
echo "--> Configuring SDDM for autologin..."
sudo tee /etc/sddm.conf > /dev/null <<EOF
[Autologin]
User=${USER_NAME}
Session=switcher.desktop
Relogin=true
EOF
AUTOLOGIN_ENABLED=true
else
AUTOLOGIN_ENABLED=false
fi
sudo tee /usr/share/wayland-sessions/switcher.desktop > /dev/null <<EOF
[Desktop Entry]
Name=Auto Session Switcher
Exec=${XSESSION_PATH}
Type=Application
EOF
#=======================================================
# STEP 7: CREATE XSESSION LAUNCH SCRIPT (THE LOOP)
#=======================================================
echo -e "${C_BLUE}==> Creating Session Launch Script (Infinite Loop + Safe Priority)...${C_NC}"
cat > "$XSESSION_PATH" <<'EOS'
#!/bin/bash
# Redirect logs for debugging
exec > >(tee -a "$HOME/.xsession.log") 2>&1
# Function to handle Wayland socket waiting
wait_for_wayland() {
local socket_path="$XDG_RUNTIME_DIR/wayland-1"
local max_attempts=60
local attempt=1
echo "Waiting for Wayland socket at $socket_path"
while [ $attempt -le $max_attempts ]; do
if [ -e "$socket_path" ] && [ -S "$socket_path" ]; then
return 0
fi
sleep 0.1
((attempt++))
done
return 1
}
# --- THE ENDLESS LOOP ---
while true; do
echo "--- New Session Cycle Starting ---"
# 1. READ THE NEXT SESSION
if [ -f "$HOME/.next-session" ]; then
SESSION=$(cat "$HOME/.next-session")
rm -f "$HOME/.next-session"
else
SESSION="hyprland"
fi
# 2. UPDATE ENVIRONMENT
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY
# 3. LAUNCH THE SESSION (WITHOUT EXEC)
if [[ "$SESSION" == *"gamescope-session-steam"* ]]; then
echo "Starting Gamescope session..."
# --- LOAD USER CONFIG FROM ENVIRONMENT.D ---
if [ -f "$HOME/.config/environment.d/gamescope-session-plus.conf" ]; then
echo "Loading gamescope config from environment.d..."
set -a
source "$HOME/.config/environment.d/gamescope-session-plus.conf"
set +a
fi
# Check for the executable
if command -v gamescope-session-plus &> /dev/null; then
# Use the constructed variable from the conf file
echo "Executing Command: $GAMESCOPECMD"
# Strip the leading binary path to get just the args
# We strip "/usr/bin/gamescope" OR just "gamescope" to be safe
ARGS=$(echo "$GAMESCOPECMD" | sed 's|^/usr/bin/gamescope ||' | sed 's|^gamescope ||')
gamescope-session-plus steam -- $ARGS
else
echo "Error: gamescope-session-plus not found, falling back to Hyprland"
SESSION="hyprland"
fi
fi
# Note: We use a separate 'if' here to catch the fallback above
if [[ "$SESSION" != *"gamescope-session-steam"* ]]; then
echo "Starting Hyprland session with UWSM..."
# Run blocking, do not exec
uwsm start hyprland-uwsm.desktop
fi
echo "Session exited. Looping..."
# 4. CRASH PROTECTION
sleep 2
done
EOS
chmod +x "$XSESSION_PATH"
#=======================================================
# STEP 8: CREATE SWITCHING SCRIPT (WALKER EDITION)
#=======================================================
echo -e "${C_BLUE}==> Creating Session Switching Helper...${C_NC}"
mkdir -p "$(dirname "$SWITCH_SCRIPT_PATH")"
cat > "$SWITCH_SCRIPT_PATH" <<'EOSWITCH'
#!/bin/bash
export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-wayland-1}"
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
# Walker in dmenu mode
choice=$(printf "🎮 SteamOS" | walker --dmenu --placeholder "Switch Mode")
case "$choice" in
"🎮 SteamOS")
notify-send "Session Switcher" "Disabling Night Light..." -t 1000
pkill hyprsunset
pkill wlsunset
pkill gammastep
sleep 1
if echo "gamescope-session-steam.desktop" > "$HOME/.next-session" 2>/dev/null; then
notify-send "Session Switcher" "Switching to SteamOS..." -t 2000
else
notify-send "Session Switcher" "Error: Failed to write session file" -t 3000
exit 1
fi
;;
*)
echo "No valid choice made"
exit 1
;;
esac
cleanup_session() {
local max_wait=5
local wait_count=0
if pgrep -x "gamescope" > /dev/null || pgrep -f "gamescope-session" > /dev/null; then
echo "Detected Gamescope session, shutting down..."
systemctl --user stop gamescope-session-plus@steam 2>/dev/null || true
sleep 1
if pgrep -x "gamescope" > /dev/null; then
pkill -TERM gamescope
sleep 0.5
pkill -KILL gamescope 2>/dev/null || true
fi
elif [ -n "$HYPRLAND_INSTANCE_SIGNATURE" ] || pgrep -x "Hyprland" > /dev/null; then
echo "Detected Hyprland session, shutting down..."
if command -v hyprctl &> /dev/null && [ -n "$HYPRLAND_INSTANCE_SIGNATURE" ]; then
hyprctl dispatch exit 2>/dev/null || true
else
pkill -TERM Hyprland 2>/dev/null || true
fi
sleep 1
if pgrep -x "Hyprland" > /dev/null; then
pkill -KILL Hyprland 2>/dev/null || true
fi
else
pkill -u $USER Hyprland 2>/dev/null || true
pkill -u $USER gamescope 2>/dev/null || true
systemctl --user stop gamescope-session-plus@steam 2>/dev/null || true
sleep 1
fi
pkill -u $USER -f "gamescope-session" 2>/dev/null || true
pkill -u $USER -f "steam" 2>/dev/null || true
sleep 0.5
}
cleanup_session
EOSWITCH
chmod +x "$SWITCH_SCRIPT_PATH"
#=======================================================
# STEP 9: CONFIGURE HYPRLAND KEYBINDING
#=======================================================
echo -e "${C_BLUE}==> Configuring Hyprland Keybinding...${C_NC}"
mkdir -p "$(dirname "$HYPR_CONF")"
if [ ! -f "$HYPR_CONF" ]; then echo "" > "$HYPR_CONF"; fi
sed -i '/# Session Switcher Keybinding/d' "$HYPR_CONF"
sed -i '/bindd = SUPER, F12, Switch to SteamOS, exec,.*switch-session.sh/d' "$HYPR_CONF"
cat >> "$HYPR_CONF" <<EOF
# Session Switcher Keybinding
bindd = SUPER, F12, Switch to SteamOS, exec, $SWITCH_SCRIPT_PATH
EOF
echo -e "${C_GREEN}Added SUPER+F12 keybinding to $HYPR_CONF${C_NC}"
#=======================================================
# FINALIZATION
#=======================================================
echo -e "${C_GREEN}✅ Setup Complete! ✅${C_NC}\n"
echo -e "${C_YELLOW}Restored Functionality:${C_NC}"
echo "1. REMOVED systemd-run wrapper (it was causing permissions crashes)."
echo "2. ADDED safe priority boost (renice) for smoother performance."
echo "3. FIXED environment.d directory creation error."
echo -e "\n${C_YELLOW}Run this script, then REBOOT.${C_NC}\n"
+119
View File
@@ -0,0 +1,119 @@
#!/bin/bash
#
# Uninstaller for Hyprland <-> Gamescope Session Switcher
#
set -e
# --- Colors ---
C_GREEN='\033[0;32m'
C_YELLOW='\033[1;33m'
C_RED='\033[0;31m'
C_BLUE='\033[0;34m'
C_NC='\033[0m'
if [ "$EUID" -eq 0 ]; then
echo -e "${C_RED}Error: Do not run this script as root! It will use 'sudo' as needed.${C_NC}"
exit 1
fi
USER_NAME=$(whoami)
USER_HOME=$(eval echo "~$USER_NAME")
# --- Banner ---
echo -e "${C_BLUE}===================================================================${C_NC}"
echo -e "${C_BLUE} Hyprland <-> Gamescope Session Switcher Uninstaller${C_NC}"
echo -e "${C_BLUE}===================================================================${C_NC}\n"
# --- Confirmation ---
echo -e "${C_YELLOW}This will remove:${C_NC}"
echo " - Session switching scripts only"
echo " - SDDM autologin configuration"
echo " - Systemd service overrides for gamescope"
echo " - Wofi custom styling for the switcher"
echo " - ONLY the SUPER+F12 switcher keybinding from Hyprland"
echo ""
echo -e "${C_YELLOW}This will NOT remove:${C_NC}"
echo " - Hyprland (kept completely intact)"
echo " - UWSM (kept completely intact)"
echo " - Your Hyprland configuration files"
echo " - Any installed packages"
echo " - Steam, MangoHud, or other apps"
echo ""
echo -e "${C_RED}Continue with uninstallation? [y/N]:${C_NC} "
read -r CONFIRM
if [[ ! "$CONFIRM" =~ ^[Yy]$ ]]; then
echo -e "${C_YELLOW}Uninstallation cancelled.${C_NC}"
exit 0
fi
# --- Start Uninstallation ---
echo -e "\n${C_BLUE}==> Starting uninstallation...${C_NC}"
# 1. Remove session switching scripts
echo -e "${C_BLUE}==> Removing session switching scripts...${C_NC}"
rm -f "$USER_HOME/.local/bin/switch-session.sh"
rm -f "$USER_HOME/.xsession"
rm -f "$USER_HOME/.next-session"
# 2. Remove SDDM configuration
echo -e "${C_BLUE}==> Removing SDDM autologin configuration...${C_NC}"
if [ -f /etc/sddm.conf ]; then
sudo rm -f /etc/sddm.conf
echo " - Removed SDDM configuration"
fi
# 3. Remove wayland session entry
echo -e "${C_BLUE}==> Removing session switcher entry...${C_NC}"
sudo rm -f /usr/share/wayland-sessions/switcher.desktop
# 4. Remove systemd service override
echo -e "${C_BLUE}==> Removing systemd service overrides...${C_NC}"
sudo rm -rf /etc/systemd/user/gamescope-session-plus@.service.d
sudo systemctl --user daemon-reload
# 5. Remove Wofi custom styling
echo -e "${C_BLUE}==> Removing Wofi custom styling...${C_NC}"
rm -f "$USER_HOME/.config/wofi/style.css"
# Remove wofi config directory if empty
rmdir "$USER_HOME/.config/wofi" 2>/dev/null || true
# 6. Remove Hyprland keybinding
echo -e "${C_BLUE}==> Removing Hyprland session switcher keybinding...${C_NC}"
HYPR_CONF="$USER_HOME/.config/hypr/hyprland.conf"
if [ -f "$HYPR_CONF" ]; then
# Remove session switcher keybinding and its comment
sed -i '/# Session Switcher Keybinding/d' "$HYPR_CONF"
sed -i '/bind = SUPER, F12, exec,.*switch-session.sh/d' "$HYPR_CONF"
echo " - Removed SUPER+F12 keybinding from Hyprland config"
fi
# --- Completion ---
echo -e "\n${C_GREEN}✅ Uninstallation Complete! ✅${C_NC}\n"
echo -e "${C_YELLOW}What was removed:${C_NC}"
echo " ✓ Session switching scripts and binaries"
echo " ✓ SDDM autologin configuration"
echo " ✓ Custom wayland session entry"
echo " ✓ Systemd service overrides"
echo " ✓ Wofi custom styling"
echo " ✓ Hyprland SUPER+F12 keybinding"
echo -e "\n${C_YELLOW}What remains:${C_NC}"
echo " • Hyprland (completely untouched)"
echo " • UWSM (completely untouched)"
echo " • All your Hyprland configurations"
echo " • All installed packages (gamescope, steam, wofi, etc.)"
echo " • Any other customizations you've made"
echo -e "\n${C_BLUE}Note:${C_NC} You may need to restart your session or reboot for all changes to take effect."
echo ""
echo -e "${C_RED}IMPORTANT:${C_NC} This uninstaller does NOT remove:"
echo " • Hyprland or UWSM (these are kept intact)"
echo " • Your Hyprland configurations (only the switcher keybinding was removed)"
echo " • Any core system components"
echo ""
echo -e "${C_BLUE}If you want to remove only the gamescope/gaming components, you can run:${C_NC}"
echo " yay -R gamescope gamescope-session-git"
echo ""
+103
View File
@@ -0,0 +1,103 @@
---
# List of ticker symbols to start app with
symbols:
- SPY
- AMD
- NVDA
- GOOGL
- SLV
- BTC-USD
- AMZN
- AAPL
- MSFT
- TSLA
# Chart type to start app with
# Default is line
# Possible values: line, candle, kagi
chart_type: candle
# Use specified time frame when starting program and when new stocks are added
# Default is 1D
# Possible values: 1D, 1W, 1M, 3M, 6M, 1Y, 5Y
time_frame: 1D
# Interval to update data from API (seconds)
# Default is 1
update_interval: 1
# Enable pre / post market hours for graphs
enable_pre_post: true
# Hide help icon in top right
hide_help: true
# Hide previous close line on 1D chart
hide_prev_close: true
# Hide toggle block
hide_toggle: true
# Show volumes graph
show_volumes: true
# Show x-axis labels
show_x_labels: true
# Start in summary mode
summary: true
# Truncate pre market graphing to only 30 minutes prior to markets opening
trunc_pre: true
# Ticker options for Kagi charts
#
# A map of each ticker with reversal and/or price fields (both optional). If no
# entry is defined for a symbol, a default of 'close' price and 1% for 1D and 4%
# for non-1D timeframes is used. This can be updated in the GUI by pressing 'e'
#
# reversal can be supplied as a single value, or a map on time frame to give each
# time frame a different reversal amount
#
# reversal.type can be 'amount' or 'pct'
#
# price can be 'close' or 'high_low'
#
#kagi_options:
# SPY:
# reversal:
# type: amount
# value: 5.00
# price: close
# AMD:
# price: high_low
# TSLA:
# reversal:
# type: pct
# value: 0.08
# NVDA:
# reversal:
# 1D:
# type: pct
# value: 0.02
# 5Y:
# type: pct
# value: 0.10
# Apply a custom theme
#
# All colors are optional. If commented out / omitted, the color will get sourced
# from your terminal color scheme
#theme:
# background: '#403E41'
# gray: '#727072'
# profit: '#ADD977'
# loss: '#FA648A'
# text_normal: '#FCFCFA'
# text_primary: '#FFDA65'
# text_secondary: '#79DBEA'
# border_primary: '#FC9766'
# border_secondary: '#FCFCFA'
# border_axis: '#FC9766'
# highlight_focused: '#FC9766'
# highlight_unfocused: '#727072'