Compare commits

...

9 commits

12 changed files with 130 additions and 118 deletions

81
bin/x11-toggle-primary-gpu Executable file
View file

@ -0,0 +1,81 @@
#!/bin/bash
SHARED_DIR='/home/gaspard/.local/share/x11-toggle-gpu'
XORG_DIR='/etc/X11/xorg.conf.d'
AMD_CONF_FILE='20-amdgpu.conf'
NVIDIA_CONF_FILE='10-nvidia-drm-outputclass.conf'
get-mode () {
if [ -f "$XORG_DIR/$NVIDIA_CONF_FILE" ]; then
echo 'NVIDIA'
else
echo 'AMD'
fi
}
check-config () {
if [ ! -d "$SHARED_DIR" ]; then
echo "[ERROR] Shared dir could not be found."
exit 1
fi
if [ ! -d "$XORG_DIR" ]; then
echo "[ERROR] X11 config dir could not be found."
exit 2
fi
if [ -f "$XORG_DIR/$AMD_CONF_FILE" ] && [ -f "$XORG_DIR/$NVIDIA_CONF_FILE" ]; then
echo "[ERROR] Corrupted configuration folder."
exit 3
fi
CONF_FILE="$AMD_CONF_FILE"
if [ "$(get-mode)" == "NVIDIA" ]; then
CONF_FILE="$NVIDIA_CONF_FILE"
fi
if ! cmp --silent $SHARED_DIR/$CONF_FILE $XORG_DIR/$CONF_FILE ; then
echo "[ERROR] Corrupted configuration file."
exit 4
fi
}
gpu-toggle () {
MODE="$(get-mode)"
if [ "$MODE" == "AMD" ]; then
rm "$XORG_DIR/$AMD_CONF_FILE"
cp "$SHARED_DIR/$NVIDIA_CONF_FILE" "$XORG_DIR/$NVIDIA_CONF_FILE"
elif [ "$MODE" == "NVIDIA" ]; then
rm "$XORG_DIR/$NVIDIA_CONF_FILE"
cp "$SHARED_DIR/$AMD_CONF_FILE" "$XORG_DIR/$AMD_CONF_FILE"
fi
echo "[INFO] Primary GPU configuration toggled to $(get-mode)."
}
check-config
if [ "$1" == "get" ]; then
echo "$(get-mode)"
exit 0
fi
if [ "$1" == "toggle" ]; then
# ROOT NEEDED
if [ "$EUID" -ne 0 ]
then echo "[ERROR] Please run as root"
exit
fi
gpu-toggle
exit 0
fi
echo "Usage: $0 {get, toggle}"
exit 1

View file

@ -31,8 +31,8 @@ gaps inner 10
gaps outer 0
# show window title bars (not officially supported with i3gaps)
# default_border normal
# default_floating_border pixel 0
default_border normal
default_floating_border pixel 0
# window title alignment
title_align center

View file

@ -13,10 +13,11 @@ bindsym $mod+t exec rofi -show window \
-config ~/.config/rofi/rofidmenu.rasi
bindsym $mod+b exec $browser
bindsym $mod+n exec /usr/bin/thunar
bindsym $mod+o exec /usr/bin/obsidian
bindsym $mod+q kill
bindsym $mod+Shift+e exec ~/.config/i3/scripts/powermenu
bindsym $mod+Shift+e exit
bindsym $mod+l exec ~/.config/i3/scripts/blur-lock
bindsym $mod+Shift+n exec ~/.config/i3/scripts/empty_workspace

View file

@ -1,5 +1,6 @@
# Window rules
assign [class="(?i)discord"] $ws9
assign [class="(?i)element"] $ws9
for_window [class="Pavucontrol" instance="pavucontrol"] floating enable

View file

@ -1,106 +0,0 @@
EndeavourOS i3wm Keybindings cheat sheet:
--> to update this run the following command:
wget --backups=1 https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/keybindings -P ~/.config/i3/
All sources and updates are available at GitHub:
https://github.com/endeavouros-team/endeavouros-i3wm-setup
For reference consult our WIKI:
https://discovery.endeavouros.com/window-tiling-managers/i3-wm/
 = windows key
# start xfce4-terminal
+Return
# kill focused window
+q
# Application menu search by typing (fancy Rofi menu):
+r
# Window switcher menu (fancy Rofi menu):
+t
# fancy exit-menu on bottom right:
+Shift+e
# Lock the system
# lock with a picture or blurring the screen (options in config)
+l
# reload the configuration file
+Shift+c
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
+Shift+r
# keybinding in fancy rofi (automated)
F1
# full keybinding list in editor:
+F1
# change window focus
+j focus left
+k focus down
+b focus up
+o focus right
# alternatively, you can use the cursor keys:
+Left focus left
+Down focus down
+Up focus up
+Right focus right
# move a focused window
+Shift+j move left
+Shift+k move down
+Shift+b move up
+Shift+o move right
# alternatively, you can use the cursor keys:
+Shift+Left move left
+Shift+Down move down
+Shift+Up move up
+Shift+Right move right
# split in horizontal orientation
+h split h
# split in vertical orientation
+v split v
# enter fullscreen mode for the focused container
+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
+s layout stacking
+g layout tabbed
+e layout toggle split
# toggle tiling / floating
+v floating toggle
# change focus between tiling / floating windows
+space focus mode_toggle
# focus the parent container
+a focus parent
# focus the child container
#+d focus child
# resize floating window
+right mouse button
## Multimedia Keys
# Redirect sound to headphones
+p
## App shortcuts
+b starts Firefox
+e starts Thunar
 Button screenshot

View file

@ -29,11 +29,18 @@ if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
# if [ -d /etc/X11/xinit/xinitrc.d ] ; then
# for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
# [ -x "$f" ] && . "$f"
# done
# unset f
# fi
if type "x11-toggle-primary-gpu" > /dev/null; then
if [ "$(x11-toggle-primary-gpu get)" == "NVIDIA" ]; then
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
fi
fi
setxkbmap fr

View file

@ -215,6 +215,9 @@ blur-background-exclude = [
# backend = "glx"
backend = "xrender";
glx-no-stencil = true;
glx-copy-from-front = false;
# Enable/disable VSync.
# vsync = false
vsync = true;
@ -254,7 +257,7 @@ detect-client-opacity = true;
# to maximize performance for full-screen windows. Known to cause flickering
# when redirecting/unredirecting windows.
#
# unredir-if-possible = false
unredir-if-possible = false
# Delay before unredirecting the window, in milliseconds. Defaults to 0.
# unredir-if-possible-delay = 0
@ -298,7 +301,6 @@ detect-transient = true;
# practically happened) and may not work with blur-background.
# My tests show a 15% performance boost. Recommended.
#
glx-no-stencil = true;
# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes,
@ -313,7 +315,6 @@ glx-no-stencil = true;
# The opposing option is use-damage
#
# no-use-damage = false
use-damage = false;
# Use X Sync fence to sync clients' draw calls, to make sure all draw
# calls are finished before picom starts drawing. Needed on nvidia-drivers

View file

@ -0,0 +1,15 @@
Section "OutputClass"
Identifier "AMD Graphics"
MatchDriver "amdgpu"
Driver "modesetting"
EndSection
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "PrimaryGPU" "yes"
ModulePath "/usr/lib/nvidia/xorg"
ModulePath "/usr/lib/xorg/modules"
EndSection

View file

@ -0,0 +1,5 @@
Section "Device"
Identifier "AMD Graphics"
Driver "amdgpu"
Option "TearFree" "true"
EndSection

View file

@ -17,7 +17,7 @@ alias life-push="rsync -r ~/Documents/Obsidian/Life/ pixel:~/storage/shared/Docu
alias life-pull="rsync -r pixel:~/storage/shared/Documents/Obsidian/Life/ ~/Documents/Obsidian/Life/"
# Config
alias editconf-i3="hx ~/.config/i3"
alias confedit-i3="hx ~/.config/i3"
# Generic stuff
alias ls="ls --color=auto"

View file

@ -43,3 +43,8 @@ fi
if [ -f ~/.bash_exec ]; then
source ~/.bash_exec
fi
FLUTTER_PATH="/opt/flutter/bin"
if test -d "$FLUTTER_PATH"; then
export PATH="$FLUTTER_PATH:$PATH"
fi

2
sync
View file

@ -26,6 +26,7 @@ synced_files = [
('home/xinitrc', '~/.xinitrc'),
('misc/picom/', '~/.config/picom/'),
('misc/runst/', '~/.config/runst/'),
('misc/x11-toggle-gpu/', '~/.local/share/x11-toggle-gpu/'),
('bin/swaylock-hyprland', '~/.local/bin/swaylock-hyprland'),
('bin/Hyprland', '~/.local/bin/Hyprland'),
@ -34,6 +35,7 @@ synced_files = [
('bin/wtoggle-touchpad', '~/.local/bin/wtoggle-touchpad'),
('bin/togglescreen', '~/.local/bin/togglescreen'),
('bin/mc-key-fix', '~/.local/bin/mc-key-fix'),
('bin/x11-toggle-primary-gpu', '~/.local/bin/x11-toggle-primary-gpu'),
]
def save():