wayland migration

This commit is contained in:
dogeystamp 2024-11-08 14:03:32 -05:00
parent 8674b4b495
commit a4a7218880
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
22 changed files with 470 additions and 59 deletions

View File

@ -42,5 +42,3 @@ chezmoi will prompt you for a choice.
**Desktop Preview**
![preview](https://raw.githubusercontent.com/DogeyStamp/dots/main/preview.png)
![preview](https://raw.githubusercontent.com/DogeyStamp/dots/main/preview2.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 845 KiB

After

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 KiB

View File

@ -195,6 +195,25 @@ patch
pkgconf
texinfo
#
# wayland
#
niri
fuzzel
swaylock
swayidle
swaybg
waybar
# utilities
wlr-randr
wl-clipboard
swayimg
wev
#
# for new systems
#

View File

@ -27,7 +27,7 @@
gap_size = 5
frame_width = 2
corner_radius = 0
corner_radius = 5
origin = bottom-right
offset = 60x70

View File

@ -1,21 +1,23 @@
# dynamic swallow (dwm patch)
function swal
if command -v dwmswallow > /dev/null
dwmswallow "$WINDOWID" $argv
# dynamic swallow
function hide
if test -n "$NIRI_SOCKET"
niri-swal.sh $argv
else if command -v dwmswallow > /dev/null; then
dwmswallow "$WINDOWID" $argv[2..-1]
else
eval $argv[2..-1]
end
end
alias mpv='command mpv'
alias mpv='hide mpv mpv'
alias imvi='hide swayimg imgv.sh'
# prevent clobbering files
alias mv='mv -n'
alias cp='cp -n'
# run this before opening, e.g., mpv or zathura
abbr -a -- ds swal;
# zathura
alias thur='swal -c Zathura; zathura'
alias thur='hide org.pwmt.zathura zathura'
# stricter sandbox zathura
alias zathsec='/usr/bin/zathura-sandbox -c ~/.config/zathura-sec'
@ -23,7 +25,7 @@ alias zathsec='/usr/bin/zathura-sandbox -c ~/.config/zathura-sec'
function tmx; tmux -u -2 $argv; end
# Run mpv from clipboard
function mpvy; mpv $argv (xsel -b); end
function mpvy; mpv $argv (cb -b); end
# Set gpg tty so curses pinentry works
function gpgt; export GPG_TTY=(tty); end

View File

@ -37,4 +37,7 @@ if status is-login
if test -z "$DISPLAY" -a "$XDG_VTNR" = 1
exec startx
end
if test -z "$WAYLAND_DISPLAY" -a "$XDG_VTNR" = 2
exec niri --session
end
end

View File

@ -0,0 +1,16 @@
font="Roboto"
icons-enabled=no
prompt=""
[colors]
background=222222dd
text=ddddddff
prompt=ddddddff
input=ddddddff
match=AAAAAAff
selection-match=AAAAAAFF
border="777777aa"
[border]
width=2
radius=0

View File

@ -4,9 +4,9 @@ application/pdf=org.pwmt.zathura.desktop
x-scheme-handler/pdfref=copy_ref
x-scheme-handler/http=org.qutebrowser.qutebrowser.desktop
x-scheme-handler/https=org.qutebrowser.qutebrowser.desktop
image/jpeg=nsxiv.desktop
image/png=nsxiv.desktop
image/webp=nsxiv.desktop
image/jpeg=imgv.desktop
image/png=imgv.desktop
image/webp=imgv.desktop
image/gif=mpv.desktop
video/mp4=mpv.desktop
video/mpeg=mpv.desktop

View File

@ -0,0 +1,261 @@
// https://github.com/YaLTeR/niri/wiki/Configuration:-Overview
input {
keyboard {
xkb {
options "caps:swapescape, compose:rctrl"
}
repeat-delay 300
repeat-rate 50
}
touchpad {
tap
}
mouse {}
warp-mouse-to-focus
}
output "HDMI-A-1" {
// off
mode "2560x1440@143.912"
}
layout {
gaps 36
struts {
left 4
right 4
top 4
bottom 4
}
default-column-width { proportion 0.5; }
focus-ring {
// off
width 2
active-color "#cceeee"
inactive-color "#505050"
}
}
spawn-at-startup "waybar"
spawn-at-startup "wallpaper"
spawn-at-startup "swayidle" "-w" "timeout" "600" "swaylock -f & niri msg action power-off-monitors" "before-sleep" "swaylock -f" "lock" "swaylock -f"
// no client side decoration
prefer-no-csd
// screenshot-path "~/med/screen/niri-%Y-%m-%d %H-%M-%S.png"
// You can also set this to null to disable saving screenshots to disk.
screenshot-path null
window-rule {
match app-id=r#"qutebrowser"#
opacity 0.8
}
animations {
window-resize {
custom-shader r"
// Example: cropped next texture if it's bigger than the current geometry, and
// crossfade between previous and next texture otherwise.
vec4 crossfade_or_crop_next(vec3 coords_curr_geo, vec3 size_curr_geo) {
vec3 coords_next_geo = niri_curr_geo_to_next_geo * coords_curr_geo;
vec3 coords_prev_geo = niri_curr_geo_to_prev_geo * coords_curr_geo;
vec3 coords_crop = niri_geo_to_tex_next * coords_next_geo;
vec3 coords_stretch = niri_geo_to_tex_next * coords_curr_geo;
vec3 coords_stretch_prev = niri_geo_to_tex_prev * coords_curr_geo;
// We can crop if the current window size is smaller than the next window
// size. One way to tell is by comparing to 1.0 the X and Y scaling
// coefficients in the current-to-next transformation matrix.
bool can_crop_by_x = niri_curr_geo_to_next_geo[0][0] <= 1.0;
bool can_crop_by_y = niri_curr_geo_to_next_geo[1][1] <= 1.0;
bool crop = can_crop_by_x && can_crop_by_y;
vec4 color;
if (crop) {
// However, when we crop, we also want to crop out anything outside the
// current geometry. This is because the area of the shader is unspecified
// and usually bigger than the current geometry, so if we don't fill pixels
// outside with transparency, the texture will leak out.
//
// When crossfading, this is not an issue because the area outside will
// correspond to client-side decoration shadows, which are already supposed
// to be outside.
if (coords_curr_geo.x < 0.0 || 1.0 < coords_curr_geo.x ||
coords_curr_geo.y < 0.0 || 1.0 < coords_curr_geo.y) {
color = vec4(0.0);
} else {
color = texture2D(niri_tex_next, coords_crop.st);
}
} else {
// If we can't crop, then crossfade.
color = texture2D(niri_tex_next, coords_stretch.st);
vec4 color_prev = texture2D(niri_tex_prev, coords_stretch_prev.st);
color = mix(color_prev, color, niri_clamped_progress);
}
return color;
}
vec4 resize_color(vec3 coords_curr_geo, vec3 size_curr_geo) {
// You can pick one of the example functions or write your own.
return crossfade_or_crop_next(coords_curr_geo, size_curr_geo);
}
"
}
}
window-rule {
match app-id=r#"^org\.keepassxc\.KeePassXC$"#
match app-id=r#"^org\.gnome\.World\.Secrets$"#
block-out-from "screen-capture"
}
binds {
Alt+Shift+Slash { show-hotkey-overlay; }
Alt+Shift+Return { spawn "newterm.sh"; }
Alt+P { spawn "fuzzel"; }
Alt+Shift+B { spawn "qutebrowser"; }
Alt+Shift+P { spawn "keepassxc"; }
Alt+Shift+D { spawn "qbprof" "dsc"; }
Ctrl+Alt+L { spawn "swaylock"; }
XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; }
XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; }
XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; }
XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; }
XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
Alt+Shift+C { close-window; }
Alt+K { focus-column-left; }
Alt+Period { focus-window-down; }
Alt+Comma { focus-window-up; }
Alt+J { focus-column-right; }
Alt+Shift+Left { move-column-left; }
Alt+Shift+Down { move-window-down; }
Alt+Shift+Up { move-window-up; }
Alt+Shift+Right { move-column-right; }
Alt+Shift+K { move-column-left; }
Alt+Return { move-column-left; } // dwm muscle memory
Alt+Shift+Period { move-window-down; }
Alt+Shift+Comma { move-window-up; }
Alt+Shift+J { move-column-right; }
Alt+Home { focus-column-first; }
Alt+End { focus-column-last; }
Alt+Ctrl+Home { move-column-to-first; }
Alt+Ctrl+End { move-column-to-last; }
Alt+H { focus-monitor-left; }
Alt+L { focus-monitor-right; }
Alt+Shift+H { move-column-to-monitor-left; }
Alt+Shift+L { move-column-to-monitor-right; }
Alt+Page_Down { focus-workspace-down; }
Alt+Page_Up { focus-workspace-up; }
Alt+U { focus-workspace-down; }
Alt+I { focus-workspace-up; }
Alt+Ctrl+Page_Down { move-column-to-workspace-down; }
Alt+Ctrl+Page_Up { move-column-to-workspace-up; }
Alt+Ctrl+U { move-column-to-workspace-down; }
Alt+Ctrl+I { move-column-to-workspace-up; }
Alt+Shift+Page_Down { move-workspace-down; }
Alt+Shift+Page_Up { move-workspace-up; }
Alt+Shift+U { move-workspace-down; }
Alt+Shift+I { move-workspace-up; }
// You can bind mouse wheel scroll ticks using the following syntax.
// These binds will change direction based on the natural-scroll setting.
//
// To avoid scrolling through workspaces really fast, you can use
// the cooldown-ms property. The bind will be rate-limited to this value.
// You can set a cooldown on any bind, but it's most useful for the wheel.
Alt+WheelScrollDown cooldown-ms=150 { focus-workspace-down; }
Alt+WheelScrollUp cooldown-ms=150 { focus-workspace-up; }
Alt+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; }
Alt+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; }
Alt+WheelScrollRight { focus-column-right; }
Alt+WheelScrollLeft { focus-column-left; }
Alt+Ctrl+WheelScrollRight { move-column-right; }
Alt+Ctrl+WheelScrollLeft { move-column-left; }
Alt+Shift+WheelScrollDown { focus-column-right; }
Alt+Shift+WheelScrollUp { focus-column-left; }
Alt+Ctrl+Shift+WheelScrollDown { move-column-right; }
Alt+Ctrl+Shift+WheelScrollUp { move-column-left; }
// Mod+TouchpadScrollDown { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02+"; }
// Mod+TouchpadScrollUp { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02-"; }
Alt+1 { focus-workspace 1; }
Alt+2 { focus-workspace 2; }
Alt+3 { focus-workspace 3; }
Alt+4 { focus-workspace 4; }
Alt+5 { focus-workspace 5; }
Alt+6 { focus-workspace 6; }
Alt+7 { focus-workspace 7; }
Alt+8 { focus-workspace 8; }
Alt+9 { focus-workspace 9; }
Alt+0 { focus-workspace 10; }
Alt+Shift+1 { move-column-to-workspace 1; }
Alt+Shift+2 { move-column-to-workspace 2; }
Alt+Shift+3 { move-column-to-workspace 3; }
Alt+Shift+4 { move-column-to-workspace 4; }
Alt+Shift+5 { move-column-to-workspace 5; }
Alt+Shift+6 { move-column-to-workspace 6; }
Alt+Shift+7 { move-column-to-workspace 7; }
Alt+Shift+8 { move-column-to-workspace 8; }
Alt+Shift+9 { move-column-to-workspace 9; }
Alt+Shift+0 { move-column-to-workspace 10; }
Mod+Tab { focus-workspace-previous; }
Alt+Ctrl+Comma { consume-window-into-column; }
Alt+Ctrl+Period { expel-window-from-column; }
Alt+BracketLeft { consume-or-expel-window-left; }
Alt+BracketRight { consume-or-expel-window-right; }
Alt+R { switch-preset-column-width; }
Alt+Shift+R { switch-preset-window-height; }
Alt+Ctrl+R { reset-window-height; }
Alt+F { maximize-column; }
Alt+Shift+F { fullscreen-window; }
Alt+C { center-column; }
Alt+Minus { set-column-width "-10%"; }
Alt+Equal { set-column-width "+10%"; }
Alt+Shift+Minus { set-window-height "-10%"; }
Alt+Shift+Equal { set-window-height "+10%"; }
Print { screenshot; }
Ctrl+Print { screenshot-screen; }
Alt+Print { screenshot-window; }
Alt+Shift+Q { quit; }
Alt+Shift+S { spawn "suspend.sh"; }
}

View File

@ -0,0 +1,15 @@
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/quar/"
XDG_DOWNLOAD_DIR="$HOME/quar/"
XDG_TEMPLATES_DIR="$HOME/quar/"
XDG_PUBLICSHARE_DIR="$HOME/zoo/"
XDG_DOCUMENTS_DIR="$HOME/quar/"
XDG_MUSIC_DIR="$HOME/quar/"
XDG_PICTURES_DIR="$HOME/quar/"
XDG_VIDEOS_DIR="$HOME/quar/"

View File

@ -0,0 +1,25 @@
[viewer]
window = #000000ff
fixed = no
[font]
name = JetBrains Mono
[keys.gallery]
h = step_left
l = step_right
j = step_down
k = step_up
g = first_file
Shift+g = last_file
Ctrl+u = page_up
Ctrl+d = page_down
[keys.viewer]
h = step_left
l = step_right
j = step_down
k = step_up
n = next_file
p = prev_file
Shift+plus = zoom +10

View File

@ -0,0 +1,10 @@
color=000000
line-uses-ring
indicator-thickness=20
indicator-radius=10
font-size=1
key-hl-color=99AABB
ring-color=99AABB
separator-color=99AABB

View File

@ -72,6 +72,10 @@ if [ -r "$XDG_CONFIG_HOME"/identity ]; then
. "$XDG_CONFIG_HOME"/identity
fi
if command -v gsettings > /dev/null; then
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
fi
# Profile to enable/disable features on certain devices
export SYSTEM_PROFILE={{ .systemprofile | quote }}

View File

@ -0,0 +1,9 @@
#!/bin/sh
# Wrapper to view images in either X11 or Wayland.
# Requires: swayimg, nsxiv
if [ -n "$WAYLAND_DISPLAY" ]; then
swayimg $@
else
nsxiv $@
fi

View File

@ -0,0 +1,11 @@
#!/bin/sh
# Example of per-host device configuration
# Map screens
# xrandr --output eDP-1 --primary --scale 0.75 --mode 2560x1600 --below HDMI-1
# xrandr --output eDP-1 --primary --scale 0.75 --mode 2560x1600 --left-of HDMI-1 --output HDMI-1 --mode 2560x1440 --rate 144 --left-of DP-1 --output DP-1 --mode 2560x1440
# xinput set-prop "DLL0A81:00 04F3:314B Touchpad" "libinput Accel Speed" 0.5
# xinput set-prop "DLL0A81:00 04F3:314B Touchpad" "libinput Tapping Enabled" 1
# xinput set-prop "DLL0A81:00 04F3:314B Touchpad" "libinput Disable While Typing Enabled" 1

View File

@ -1,23 +0,0 @@
#!/bin/sh
# Example of per-host device configuration
# Map screens
xrandr --output eDP1 --primary --mode 1920x1080 --right-of DP1 --output DP1 --mode 2560x1440 --right-of DP2-1 --output DP2-1 --mode 2560x1440
# Map touchscreen to proper screen
xsetwacom set 17 MapToOutput eDP1
xsetwacom set 18 MapToOutput eDP1
xsetwacom set 23 MapToOutput eDP1
# Configure touchpad sensitivity
# To change this:
# xinput list
# to find the device name of your mouse.
# xinput list-props <device name>
# to find the property name.
# xinput set-prop <device name> <property name> <value>
xinput set-prop "MSFT0001:01 06CB:CD3E Touchpad" "Device Accel Constant Deceleration" 1

View File

@ -0,0 +1,46 @@
#!/bin/bash
# window swallow emulation for Niri
# (https://github.com/YaLTeR/niri/discussions/762)
# requires at least commit d5cbc35
#
# this script shrinks the terminal into a column with the new window.
# bind it in your shell as an alias like "hide".
#
# example:
#
# niri-swal.sh mpv mpv video.mp4
# niri-swal.sh org.pwmt.zathura zathura document.pdf
#
# an app_id argument is required to ensure the right window is being swallowed.
# to get this argument, use `niri msg windows`.
set -e
TERM_ID="$(niri msg --json focused-window | jq -r .id)"
APP_ID="$1"
shift
{
# if within 7 events, we don't see the window open, give up to avoid swallowing unexpectedly later
APP_WIN_ID=$(
# head -n 1 will wait for a second event before terminating
# https://superuser.com/a/275962
head -n 1 <(
niri msg --json event-stream | jq --unbuffered --null-input --raw-output "range(7) as \$i | input | .WindowOpenedOrChanged | select(.) | select (.window.app_id == \"$APP_ID\") | .window.id"
)
)
if [ -z "$APP_WIN_ID" ]; then
exit 1
fi
niri msg action focus-window --id "$TERM_ID"
niri msg action consume-or-expel-window-left --id "$APP_WIN_ID"
niri msg action move-window-down
niri msg action set-window-height --id "$TERM_ID" 0%
niri msg action focus-window-up
} &
"$@"
niri msg action set-window-height --id "$TERM_ID" 100%

View File

@ -2,14 +2,16 @@
# Small wrapper over neovide/neovim
swal() {
if command -v dwmswallow > /dev/null && [ -n "$DISPLAY" ]; then
dwmswallow "$WINDOWID" -c neovide
if [ -n "$NIRI_SOCKET" ]; then
niri-swal.sh neovide neovide "$@"
elif command -v dwmswallow > /dev/null && [ -n "$DISPLAY" ]; then
dwmswallow "$WINDOWID"
neovide --no-vsync "$@"
fi
}
if ! command -v neovide > /dev/null || [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
nvim "$@"
else
swal
neovide --no-vsync "$@"
swal "$@"
fi

View File

@ -0,0 +1,22 @@
#!/bin/sh
# Per host wallpaper configuration example
PREFIX="$HOME/med/wall"
if [ -z "$1" ]; then
WALL="landscape"
else
WALL="$1"
fi
FOLDER="$PREFIX"/"$WALL"
if [ -n "$WAYLAND_DISPLAY" ]; then
swaybg -o HDMI-A-1 -m center -i "$FOLDER"/l.jpg &
swaybg -o DP-1 -m center -i "$FOLDER"/r.jpg &
swaybg -o eDP-1 -m fill -i "$FOLDER"/s.jpg &
else
xwallpaper --output HDMI-1 --center "$FOLDER"/l.jpg \
--output DP-1 --center "$FOLDER"/r.jpg \
--output eDP-1 --zoom "$FOLDER"/s.jpg
fi

View File

@ -1,16 +0,0 @@
#!/bin/sh
# Per host wallpaper configuration example
PREFIX="$HOME/med/wall"
if [ -z "$1" ]; then
WALL="coastline_black"
else
WALL="$1"
fi
FOLDER="$PREFIX"/"$WALL"
xwallpaper --output DP2-1 --center "$FOLDER"/l.jpg \
--output DP1 --center "$FOLDER"/r.jpg \
--output eDP1 --center "$FOLDER"/s.jpg

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Type=Application
Name=imgv
GenericName=Image Viewer
Exec=imgv.sh %F
NoDisplay=True
MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;image/x-bmp;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-tga;image/x-xpixmap;image/webp;image/heic;image/svg+xml;application/postscript;image/jp2;image/jxl;image/avif;image/heif;