From 76196f760716990ee239a2455ce62b07425e0540 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Mon, 22 Jan 2024 19:35:09 -0500 Subject: Initial --- alacritty/alacritty.toml | 74 ++++++++++++++++++ bldRiver.sh | 14 ++++ bldSession.sh | 11 +++ foot/foot.ini | 88 +++++++++++++++++++++ link.sh | 25 ++++++ river/init | 200 +++++++++++++++++++++++++++++++++++++++++++++++ river/pointer | 23 ++++++ swaylock/config | 29 +++++++ waybar/config | 89 +++++++++++++++++++++ waybar/custom/network | 33 ++++++++ waybar/style.css | 101 ++++++++++++++++++++++++ waylandrc | 16 ++++ 12 files changed, 703 insertions(+) create mode 100644 alacritty/alacritty.toml create mode 100755 bldRiver.sh create mode 100755 bldSession.sh create mode 100644 foot/foot.ini create mode 100755 link.sh create mode 100755 river/init create mode 100755 river/pointer create mode 100644 swaylock/config create mode 100644 waybar/config create mode 100755 waybar/custom/network create mode 100644 waybar/style.css create mode 100755 waylandrc diff --git a/alacritty/alacritty.toml b/alacritty/alacritty.toml new file mode 100644 index 0000000..7575bd1 --- /dev/null +++ b/alacritty/alacritty.toml @@ -0,0 +1,74 @@ +[colors.bright] +black = "#4c566a" +blue = "#81a1c1" +cyan = "#8fbcbb" +green = "#a3be8c" +magenta = "#b48ead" +red = "#bf616a" +white = "#eceff4" +yellow = "#ebcb8b" + +[colors.cursor] +cursor = "#d8dee9" +text = "#2e3440" + +[colors.dim] +black = "#373e4d" +blue = "#68809a" +cyan = "#6d96a5" +green = "#809575" +magenta = "#8c738c" +red = "#94545d" +white = "#aeb3bb" +yellow = "#b29e75" + +[colors.normal] +black = "#3b4252" +blue = "#81a1c1" +cyan = "#88c0d0" +green = "#a3be8c" +magenta = "#b48ead" +red = "#bf616a" +white = "#e5e9f0" +yellow = "#ebcb8b" + +[colors.primary] +background = "#2e3440" +dim_foreground = "#a5abb6" +foreground = "#d8dee9" + +# [colors.search.footer_bar] +# background = "#434c5e" +# foreground = "#d8dee9" + +[colors.search.matches] +background = "#88c0d0" +foreground = "CellBackground" + +[colors.selection] +background = "#4c566a" +text = "CellForeground" + +[colors.vi_mode_cursor] +cursor = "#d8dee9" +text = "#2e3440" + +[font] +size = 10 +# size = 11 + +# ; family: Curie +# ; style: Italic +# ; family: IBM 3270 +[font.normal] +# family = "IBM Plex Mono" +# family = "Iosevka Fixed" +# family = "Iosevka Term" +# family = "Iosevka Term Heavy" +family = "Iosevka Term" +# family = "IBM 3270" + + +[window] +# opacity = 0.8 +opacity = 1 diff --git a/bldRiver.sh b/bldRiver.sh new file mode 100755 index 0000000..d2522ef --- /dev/null +++ b/bldRiver.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -ex +codedir="$HOME/scm/wl/river" + +if ! [ -d "$codedir" ] ; then + mkdir -p "$(basename "$codedir")" + git clone https://github.com/riverwm/river/ "$codedir" +fi + +cd "$codedir" +git submodule init +git submodule update +zig build -Dxwayland -Doptimize=ReleaseSafe --prefix ~/.local install + diff --git a/bldSession.sh b/bldSession.sh new file mode 100755 index 0000000..e30f171 --- /dev/null +++ b/bldSession.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -ex +codedir="$HOME/scm/wl/wlcustom" + +if ! [ -d "$codedir" ] ; then + mkdir -p "$(basename "$codedir")" + git clone https://git.riedstra.dev/wl/wlcustom/ "$codedir" +fi + +cd "$codedir" +sudo make install diff --git a/foot/foot.ini b/foot/foot.ini new file mode 100644 index 0000000..08868b6 --- /dev/null +++ b/foot/foot.ini @@ -0,0 +1,88 @@ +term=xterm-256color +# font=JetbrainsMono Nerd Font:Regular:size=11 +# font=IBM 3270:Regular:size=8 +font=IBM 3270:Regular:size=12 +# font=CozetteHiDpi:style=Medium:size=14 +# font=Iosevka Term:style=Regular:size=5.5 +dpi-aware=no +pad=20x20 +# pad=10x10 +# pad=5x5 +notify=notify-send -a ${app-id} -i ${app-id} ${title} ${body} + +[bell] +urgent=no +notify=no + +[scrollback] +lines=20000 +multiplier=3.0 +indicator-position=relative + +[mouse] +# hide-when-typing=no +hide-when-typing=yes + +[cursor] +color = 282C34 d8dee9 + +[colors] +alpha = 0.90 +foreground = d8dee9 +background = 282C34 + +regular0 = 3b4252 +regular1 = bf616a +regular2 = a3be8c +regular3 = ebcb8b +regular4 = 81a1c1 +regular5 = b48ead +regular6 = 88c0d0 +regular7 = e5e9f0 + +bright0 = 4c566a +bright1 = bf616a +bright2 = a3be8c +bright3 = ebcb8b +bright4 = 81a1c1 +bright5 = b48ead +bright6 = 8fbcbb +bright7 = eceff4 + +dim0 = 373e4d +dim1 = 94545d +dim2 = 809575 +dim3 = b29e75 +dim4 = 68809a +dim5 = 8c738c +dim6 = 6d96a5 +dim7 = aeb3bb + +[csd] + +[key-bindings] +# scrollback-up-half-page=Mod1+u +# scrollback-up-line=Mod1+k +# scrollback-down-half-page=Mod1+d +# scrollback-down-line=Mod1+j +clipboard-copy=Control+Shift+c +clipboard-paste=Control+Shift+v +primary-paste=Shift+Insert +# search-start=Control+f +font-increase=Control+plus Control+equal Control+KP_Add Mod1+Shift+k +font-decrease=Control+minus Control+KP_Subtract Mod1+Shift+j +font-reset=Control+0 Control+KP_0 +show-urls-launch=Control+Shift+i +show-urls-copy=Control+Shift+o + +[search-bindings] +cancel=Control+g Control+c Escape +commit=Return +find-prev=Control+p +find-next=Control+n +clipboard-paste=Control+v Control+y +primary-paste=Shift+Insert + +[url-bindings] + +[mouse-bindings] diff --git a/link.sh b/link.sh new file mode 100755 index 0000000..41a7b5c --- /dev/null +++ b/link.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -e +timestamp="$(date +%m.%d.%Y)" + +if ! [ -L "$HOME/.waylandrc" ] ; then + mv "$HOME"/.waylandrc "$HOME"/.waylandrc-"$timestamp" +fi + +if [ -L "$HOME/.waylandrc" ] ; then + rm "$HOME/.waylandrc" +fi + +ln -sv "$(pwd)"/waylandrc "$HOME"/.waylandrc + +for _d in * ; do + ! [ -d "$_d" ] && continue + + dest="$HOME"/.config/"$_d" + if ! [ -L "$dest" ] && [ -d "$dest" ] ; then + mv "$dest" "$dest-$timestamp" + elif [ -L "$dest" ] ; then + rm "$dest" + fi + ln -sv "$(pwd)"/"$_d" "$dest" +done diff --git a/river/init b/river/init new file mode 100755 index 0000000..618453d --- /dev/null +++ b/river/init @@ -0,0 +1,200 @@ +#!/bin/sh + +# This is the example configuration file for river. +# +# If you wish to edit this, you will probably want to copy it to +# $XDG_CONFIG_HOME/river/init or $HOME/.config/river/init first. +# +# See the river(1), riverctl(1), and rivertile(1) man pages for complete +# documentation. + +# Note: the "Super" modifier is also known as Logo, GUI, Windows, Mod4, etc. + +# Super+Shift+Return to start an instance of foot (https://codeberg.org/dnkl/foot) +# riverctl map normal Super+Shift Return spawn foot +# riverctl map normal Super Return spawn alacritty +riverctl map normal Super Return spawn foot + +# Super+Q to close the focused view +riverctl map normal Super+Shift Q close + +# Super+Shift+E to exit river +riverctl map normal Super+Shift E exit + +# Super+J and Super+K to focus the next/previous view in the layout stack +riverctl map normal Super J focus-view next +riverctl map normal Super K focus-view previous + +# Super+Shift+J and Super+Shift+K to swap the focused view with the next/previous +# view in the layout stack +riverctl map normal Super+Shift J swap next +riverctl map normal Super+Shift K swap previous + +# Super+Period and Super+Comma to focus the next/previous output +riverctl map normal Super Period focus-output next +riverctl map normal Super Comma focus-output previous + +# Super+Shift+{Period,Comma} to send the focused view to the next/previous output +riverctl map normal Super+Shift Period send-to-output next +riverctl map normal Super+Shift Comma send-to-output previous + +# Super+Return to bump the focused view to the top of the layout stack +riverctl map normal Super+Shift F zoom + +# Super+H and Super+L to decrease/increase the main ratio of rivertile(1) +riverctl map normal Super H send-layout-cmd rivertile "main-ratio -0.05" +riverctl map normal Super L send-layout-cmd rivertile "main-ratio +0.05" + +# Super+Shift+H and Super+Shift+L to increment/decrement the main count of rivertile(1) +riverctl map normal Super+Shift H send-layout-cmd rivertile "main-count +1" +riverctl map normal Super+Shift L send-layout-cmd rivertile "main-count -1" + +# Super+Alt+{H,J,K,L} to move views +riverctl map normal Super+Alt H move left 100 +riverctl map normal Super+Alt J move down 100 +riverctl map normal Super+Alt K move up 100 +riverctl map normal Super+Alt L move right 100 + +# Super+Alt+Control+{H,J,K,L} to snap views to screen edges +riverctl map normal Super+Alt+Control H snap left +riverctl map normal Super+Alt+Control J snap down +riverctl map normal Super+Alt+Control K snap up +riverctl map normal Super+Alt+Control L snap right + +# Super+Alt+Shift+{H,J,K,L} to resize views +riverctl map normal Super+Alt+Shift H resize horizontal -100 +riverctl map normal Super+Alt+Shift J resize vertical 100 +riverctl map normal Super+Alt+Shift K resize vertical -100 +riverctl map normal Super+Alt+Shift L resize horizontal 100 + +# Super + Left Mouse Button to move views +riverctl map-pointer normal Super BTN_LEFT move-view + +# Super + Right Mouse Button to resize views +riverctl map-pointer normal Super BTN_RIGHT resize-view + +# Super + Middle Mouse Button to toggle float +riverctl map-pointer normal Super BTN_MIDDLE toggle-float + +for i in $(seq 1 9) +do + tags=$((1 << (i - 1))) + + # Super+[1-9] to focus tag [0-8] + riverctl map normal Super "$i" set-focused-tags $tags + + # Super+Shift+[1-9] to tag focused view with tag [0-8] + riverctl map normal Super+Shift "$i" set-view-tags $tags + + # Super+Control+[1-9] to toggle focus of tag [0-8] + riverctl map normal Super+Control "$i" toggle-focused-tags $tags + + # Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view + riverctl map normal Super+Shift+Control "$i" toggle-view-tags $tags +done + +# Super+0 to focus all tags +# Super+Shift+0 to tag focused view with all tags +all_tags=$(((1 << 32) - 1)) +riverctl map normal Super 0 set-focused-tags $all_tags +riverctl map normal Super+Shift 0 set-view-tags $all_tags + +# Super+Space to toggle float +riverctl map normal Super Space toggle-float + +# Super+F to toggle fullscreen +riverctl map normal Super F toggle-fullscreen + +# Super+{Up,Right,Down,Left} to change layout orientation +riverctl map normal Super Up send-layout-cmd rivertile "main-location top" +riverctl map normal Super Right send-layout-cmd rivertile "main-location right" +riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom" +riverctl map normal Super Left send-layout-cmd rivertile "main-location left" + +# Declare a passthrough mode. This mode has only a single mapping to return to +# normal mode. This makes it useful for testing a nested wayland compositor +riverctl declare-mode passthrough + +# Super+F11 to enter passthrough mode +riverctl map normal Super F11 enter-mode passthrough + +# Super+F11 to return to normal mode +riverctl map passthrough Super F11 enter-mode normal + +# Various media key mapping examples for both normal and locked mode which do +# not have a modifier +for mode in normal locked +do + # Eject the optical drive (well if you still have one that is) + riverctl map $mode None XF86Eject spawn 'eject -T' + + # Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer) + riverctl map $mode None XF86AudioRaiseVolume spawn 'pamixer -i 5' + riverctl map $mode None XF86AudioLowerVolume spawn 'pamixer -d 5' + riverctl map $mode None XF86AudioMute spawn 'pamixer --toggle-mute' + + # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl) + riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause' + riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause' + riverctl map $mode None XF86AudioPrev spawn 'playerctl previous' + riverctl map $mode None XF86AudioNext spawn 'playerctl next' + + # Control screen backlight brightness with light (https://github.com/haikarainen/light) + riverctl map $mode None XF86MonBrightnessUp spawn 'light -A 5' + riverctl map $mode None XF86MonBrightnessDown spawn 'light -U 5' +done + +# Set background and border color +riverctl background-color 0x002b36 +riverctl border-color-focused 0x93a1a1 +riverctl border-color-unfocused 0x586e75 + +# Set keyboard repeat rate +riverctl set-repeat 50 300 + +# Make all views with an app-id that starts with "float" and title "foo" start floating. +riverctl rule-add -app-id 'float*' -title 'foo' float + +# Make all views with app-id "bar" and any title use client-side decorations +riverctl rule-add -app-id "bar" csd + +# Set the default layout generator to be rivertile and start it. +# River will send the process group of the init executable SIGTERM on exit. +riverctl default-layout rivertile +rivertile -view-padding 6 -outer-padding 6 & + +riverctl map normal Super+Control L spawn swaylock +riverctl map normal Super D spawn bemenu-run +riverctl map normal Super B spawn 'pkill -SIGUSR1 waybar' +riverctl focus-follows-cursor normal + +riverctl map normal Super P spawn dpw-menu +riverctl map normal Super+Control P spawn 'dpw-menu -o' +riverctl map normal Super O spawn 'dpw-menu --type' +riverctl map normal Super+Shift O spawn 'dpw-menu -t -o' + + +# Only start these once... +if ! pgrep kanshi >/dev/null 2>&1 ; then + kanshi & + sh -c 'while true ; do sleep 5 ; kanshictl switch laptop ; done' & +fi +if ! pgrep waybar >/dev/null 2>&1 ; then + waybar & +fi + +"$HOME"/.config/river/pointer +if ! pgrep swaybg >/dev/null 2>&1 ; then + swaybg -i .wallpaper.jpg & +fi + +# If Chromium dialogs aren't working these are suspect +dbus-update-activation-environment --systemd WAYLAND_DISPLAY "XDG_CURRENT_DESKTOP=$XDG_CURRENT_DESKTOP" +systemctl --user restart xdg-desktop-portal + +riverctl rule-add -title '*Firefox*' ssd +riverctl rule-add -title '*paypal*' float + +riverctl rule-add -title "*mpd*" tags $((1 << (7 - 1))) +riverctl rule-add -app-id "*pavu*" tags $((1 << (7 - 1))) +riverctl rule-add -app-id "*evolution*" tags $((1 << (8 - 1))) diff --git a/river/pointer b/river/pointer new file mode 100755 index 0000000..caa6053 --- /dev/null +++ b/river/pointer @@ -0,0 +1,23 @@ +#!/bin/sh + +# All mice no acceleration +riverctl list-inputs | grep -i '^pointer' \ + | xargs -I{} riverctl input {} accel-profile flat + +setTouchpad() { + riverctl list-inputs | grep -i 'touchpad' | xargs -I{} riverctl input {} "$@" +} + +# But it's okay for touchpads +setTouchpad accel-profile adaptive +setTouchpad pointer-accel .3 +# Mac style two finger to right click +setTouchpad click-method clickfinger +# Tap click is buggy on some touchpads ( Notably my HP Elitebook ) +setTouchpad tap disabled + +# Thse are defaults, but I'm going to override them anyway: +setTouchpad scroll-method two-finger +setTouchpad natural-scroll disabled +setTouchpad middle-emulation enabled + diff --git a/swaylock/config b/swaylock/config new file mode 100644 index 0000000..3fb6c57 --- /dev/null +++ b/swaylock/config @@ -0,0 +1,29 @@ +# color=2e3440ff +color=00000000 +ignore-empty-password +show-failed-attempts +# show-keyboard-layout +bs-hl-color=b48eadff +caps-lock-bs-hl-color=d08770ff +caps-lock-key-hl-color=ebcb8bff +# font=JetbrainsMono +font=IBM 3270 +indicator-radius=125 +indicator-thickness=10 +# inside-color=2e3440ff +inside-color=00000000 +inside-clear-color=81a1c1ff +inside-ver-color=5e81acff +inside-wrong-color=bf616aff +key-hl-color=a3be8cff +layout-bg-color=2e3440ff +line-uses-ring +ring-color=3b4252ff +ring-clear-color=88c0d0ff +ring-ver-color=81a1c1ff +ring-wrong-color=d08770ff +separator-color=3b4252ff +text-color=eceff4ff +text-clear-color=3b4252ff +text-ver-color=3b4252ff +text-wrong-color=3b4252ff diff --git a/waybar/config b/waybar/config new file mode 100644 index 0000000..e9543fc --- /dev/null +++ b/waybar/config @@ -0,0 +1,89 @@ +{ + "layer": "top", + "modules-left": [ + "river/tags" + ], + "modules-center": ["river/window"], + "modules-right": [ + "custom/network", + "custom/cpuTemp", + "battery", + "custom/powerUsage", + "pulseaudio", + "tray", + "custom/date" + ], + "pulseaudio": { + "tooltip": false, + "scroll-step": 5, + "format": "vol: {volume}%", + "format-muted": "vol 0%" + }, + + "river/tags": { + "tag-labels":[ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "0" + ], + "disable-click": false, + "num-tags": 10 + }, + "river/window": { + "format": "{}", + "max-length": 90 + }, + "battery": { + "states": { + "good": 100, + "warning": 30, + "critical": 20 + }, + "format": "bat: {capacity}% discharging", + "format-charging": "bat: {capacity}% charging", + "format-plugged": "bat: {capacity}% AC" + }, + "upower": { + "show-icon": false, + "native-path": "BAT0", + "format": "bat: {percentage} {time}" + }, + "tray":{ + "icon-size":18, + "show-passive-items":true, + "spacing": 10, + "reverse-direction": true + }, + "custom/network": { + "class": "network", + "format": "{}", + "interval": 5, + "exec": "$HOME/.config/waybar/custom/network" + }, + "custom/cpuTemp": { + "class": "cpuTemp", + "format": " CPU: {}c", + "exec": "sensors | sed -n '/^k10/,/^$/p' | awk '/^Tctl/{print $2}' | sed -e's/+//g' -e's/\\.[0-9][^0-9]*$//g'", + "interval": 5 + }, + "custom/powerUsage": { + "class": "powerUsage", + "format": " {}", + "interval": 5, + "exec": "awk '{p=$1*10^-6; if (p>0) {print p \" W\"}}' /sys/class/power_supply/BAT0/power_now " + }, + "custom/date": { + "class": "date", + "format": " {}", + "interval": 60, + "exec": "date +%m.%d.%Y\\ %H:%M" + } + +} diff --git a/waybar/custom/network b/waybar/custom/network new file mode 100755 index 0000000..fc5d9d7 --- /dev/null +++ b/waybar/custom/network @@ -0,0 +1,33 @@ +wireless_info() { + _if="$1" + + printf "WiFi: %s %s %s %s" \ + "$_if" \ + "$(nmcli c | awk "/$_if/"'{print $1}')" \ + "$(ip -4 addr show dev "$_if" | awk '/inet /{print $2}')" \ + "$(awk "/^$_if/"'{print $4+0}' /proc/net/wireless)dbm" +} + +eth_info() { + _if="$1" + + printf "Eth: %s %s %s" \ + "$_if" \ + "$(ip -4 addr show dev "$_if" | awk '/inet /{print $2}')" \ + "" +} + +network_info() { + # default_if="$(netstat -rnf inet | awk '/^default/{print $8}')" + default_if="$(ip route | awk '/^default/{print $5;exit 0;}')" + + if [ -z "$default_if" ] ; then + echo "No conn" + elif [ -d "/sys/class/net/$default_if/wireless" ] ; then + wireless_info "$default_if" + else + eth_info "$default_if" + fi +} + +network_info diff --git a/waybar/style.css b/waybar/style.css new file mode 100644 index 0000000..58bae86 --- /dev/null +++ b/waybar/style.css @@ -0,0 +1,101 @@ +window.eDP-1 * { font-size: 18px; } + +* { + font-family: "IBM 3270"; + font-size: 12px; +} + +window#waybar { + background: none; + border-bottom: 3px solid #8FBCBB; +} + +window#waybar.hidden { + opacity: 0.2; +} + +#window { + color: #8FBCBB; + /* background: #2E3440; */ +} + +#tags { + /* background: #2e3440; */ +} + +#tags button { + /* transition: none; */ + color: #4c566a; + background: transparent; + border-radius: 0px; +} + +#tags button.occupied { + transition: none; + color: #a3be8c; + background: transparent; +} + +#tags button.focused { + color: #81a1c1; + /* border-bottom: 3px solid #81a1c1; */ + background: #4C566A; + + border-radius: inherit; +} + +#tags button:hover { + transition: none; + box-shadow: inherit; + text-shadow: inherit; + color: #81a1c1; +} + +#temperature { + background: #2e3440; + color: #81A1C1; + /* border-bottom: 3px solid #6a7796; */ +} + +#pulseaudio { + color: #D08770; + background: #2E3440; + /* border-bottom: 3px solid #6a7796; */ +} + +#battery { + color: #A3BE8C; + background: #2E3440; + /* border-bottom: 3px solid #6a7796; */ +} + +#network, #cpuTemp, #battery, #pulseaudio, #date, #powerUsage { + padding-left: 15px; +} + +#battery.critical:not(.charging) { + background-color: #d8dee9; + color: #2e3440; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +@keyframes blink { + to { + background-color: #bf616a; + color: #d8dee9; + } +} + +#tray { + color: #d8dee9; + background: #2E3440; + /* border-bottom: 3px solid #6a7796; */ +} + +#tags button.focused, #battery, #pulseaudio { + border-bottom: 3px solid #8FBCBB; +} diff --git a/waylandrc b/waylandrc new file mode 100755 index 0000000..e82b0d1 --- /dev/null +++ b/waylandrc @@ -0,0 +1,16 @@ +#!/bin/sh +# removes window outlines and stuff +export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 +# Firefox fix just in case +export MOZ_ENABLE_WAYLAND=1 + +# If Chromium dialogs aren't working these are suspect +# pacman -S xdg-desktop-portal-wlr +export XDG_CURRENT_DESKTOP=river + +export QT_QPA_PLATFORMTHEME=qt5ct +. ~/.kshrc + +export BEMENU_OPTS="--fn 'IBM 3270 14' --tb '#3B4252' --tf '#8FBCBB' --cf '#E5E9F0' --nb '#2e3440' --ab '#3b4252' --nf '#e5e9f0' --af '#e5e9f0' --fb '#2e3440' --ff '#a3be8c' --hb '#2e3440' --hf '#a3be8c' " + +exec river -- cgit v1.2.3