1
1
mirror of https://github.com/rywng/dotfiles.git synced 2024-11-22 19:01:50 +08:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Ryan
3eac1701ca sway keybinds 2024-01-08 10:29:15 +08:00
Ryan
d4c4898bc4 SwayWM 2024-01-06 11:35:43 +08:00
Ryan
fa14f7c34e swayWM, ditch hyprland 2024-01-05 18:34:36 +08:00
20 changed files with 47 additions and 230 deletions

View File

@ -0,0 +1,3 @@
# vim: filetype=swayconfig
include ~/.config/sway/conf.d/custom.d/*

View File

@ -1,24 +1,28 @@
output * adaptive_sync on
# 75hz monitor # 75hz monitor
output 'Lectron Company Ltd LECOO M2412HL GG30A137' mode 2560x1440@74.968Hz output 'Lectron Company Ltd LECOO M2412HL GG30A137' mode 2560x1440@75Hz
output 'Lectron Company Ltd LECOO M2412HL GG30A137' pos 0 500
output 'Lectron Company Ltd LECOO M2412HL GG30A137' subpixel rgb output 'Lectron Company Ltd LECOO M2412HL GG30A137' subpixel rgb
# output 'Lectron Company Ltd LECOO M2412HL GG30A137' max_render_time 5 # output 'Lectron Company Ltd LECOO M2412HL GG30A137' max_render_time 5
# output 'Lectron Company Ltd LECOO M2412HL GG30A137' render_bit_depth 10
output * adaptive_sync on # lab screen
output "XMI Redmi 27 NU 3948622WH08F4" mode --custom 3840x2160@35.000Hz
output "XMI Redmi 27 NU 3948622WH08F4" scale 1.5
output "XMI Redmi 27 NU 3948622WH08F4" transform 90
output "XMI Redmi 27 NU 3948622WH08F4" pos 2560 0
output "XMI Redmi 27 NU 3948622WH08F4" subpixel rgb
output "XMI Redmi 27 NU 3948622WH08F4" max_render_time 3
output "XMI Redmi 27 NU 3948622WH08F4" render_bit_depth 10
# laptop screen # laptop screen
output 'Thermotrex Corporation TL160ADMP03-0 Unknown' subpixel rgb output 'Thermotrex Corporation TL160ADMP03-0 Unknown' subpixel rgb
# output 'Thermotrex Corporation TL160ADMP03-0 Unknown' mode 2560x1600@60.000Hz # output 'Thermotrex Corporation TL160ADMP03-0 Unknown' mode 2560x1600@60.000Hz
# output 'Thermotrex Corporation TL160ADMP03-0 Unknown' max_render_time 5 # output 'Thermotrex Corporation TL160ADMP03-0 Unknown' max_render_time 5
output 'Thermotrex Corporation TL160ADMP03-0 Unknown' mode 2560x1600@240.000Hz output 'Thermotrex Corporation TL160ADMP03-0 Unknown' mode 2560x1600@60.000Hz
output 'Thermotrex Corporation TL160ADMP03-0 Unknown' max_render_time 8 # output 'Thermotrex Corporation TL160ADMP03-0 Unknown' max_render_time 8
# output 'Thermotrex Corporation TL160ADMP03-0 Unknown' render_bit_depth 10 # output 'Thermotrex Corporation TL160ADMP03-0 Unknown' render_bit_depth 10
# TV at home # TV at home
output 'Unknown HUAWEI INC 0x00000000' mode 3840x2160@60.000Hz output 'Unknown HUAWEI INC 0x00000000' mode 3840x2160@60.000Hz
output 'Unknown HUAWEI INC 0x00000000' scale 2 output 'Unknown HUAWEI INC 0x00000000' scale 2
# lab screen
output "XMI Redmi 27 NU 3948622WH08F4" transform 90
# output "XMI Redmi 27 NU 3948622WH08F4" max_render_time 5
# output "XMI Redmi 27 NU 3948622WH08F4" subpixel rgb

View File

@ -11,8 +11,8 @@ set $menu wofi
# my keybinds # my keybinds
# screenshot # screenshot
bindsym $mod+Print exec ~/.config/sway/scripts/grimshot-ui.sh bindsym $mod+Print exec grimshot --cursor copy area
bindsym $mod+Shift+s exec ~/.config/sway/scripts/grimshot-ui.sh bindsym $mod+Shift+s exec grimshot --cursor copy area
# notification client # notification client
bindsym $mod+m exec swaync-client -t -sw bindsym $mod+m exec swaync-client -t -sw
# Logout # Logout
@ -36,8 +36,8 @@ bindsym --whole-window $mod+button9 workspace next
# bind fn keys # bind fn keys
bindsym XF86AudioMicMute exec amixer set Capture toggle bindsym XF86AudioMicMute exec amixer set Capture toggle
exec mkfifo $SWAYSOCK.wob && tail -f $SWAYSOCK.wob | wob exec mkfifo $SWAYSOCK.wob && tail -f $SWAYSOCK.wob | wob
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +3% && pactl get-sink-volume @DEFAULT_SINK@ | head -n 1| awk '{print substr($5, 1, length($5)-1)}' > $SWAYSOCK.wob bindsym XF86AudioRaiseVolume exec wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+ && pactl get-sink-volume @DEFAULT_SINK@ | head -n 1| awk '{print substr($5, 1, length($5)-1)}' > $SWAYSOCK.wob
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -3% && pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk '{print substr($5, 1, length($5)-1)}' > $SWAYSOCK.wob bindsym XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- && pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk '{print substr($5, 1, length($5)-1)}' > $SWAYSOCK.wob
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && ~/.config/sway/scripts/getmute.sh > $SWAYSOCK.wob bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && ~/.config/sway/scripts/getmute.sh > $SWAYSOCK.wob
bindsym XF86MonBrightnessUp exec light -A 5 && light -G | cut -d'.' -f1 > $SWAYSOCK.wob bindsym XF86MonBrightnessUp exec light -A 5 && light -G | cut -d'.' -f1 > $SWAYSOCK.wob
bindsym XF86MonBrightnessDown exec light -U 5 && light -G | cut -d'.' -f1 > $SWAYSOCK.wob bindsym XF86MonBrightnessDown exec light -U 5 && light -G | cut -d'.' -f1 > $SWAYSOCK.wob

View File

@ -0,0 +1,3 @@
# vim: filetype=swayconfig
include ~/.config/sway/conf.d/themes/dark

View File

@ -4,7 +4,7 @@
set $gnome-schema org.gnome.desktop.interface set $gnome-schema org.gnome.desktop.interface
exec_always { exec_always {
gsettings set $gnome-schema color-scheme 'prefer-dark' gsettings set $gnome-schema color-scheme 'prefer-dark'
gsettings set $gnome-schema gtk-theme 'Adwaita-dark' gsettings set $gnome-schema gtk-theme 'Adwaita'
gsettings set $gnome-schema icon-theme 'Papirus-Dark' gsettings set $gnome-schema icon-theme 'Papirus-Dark'
gsettings set $gnome-schema cursor-theme 'Adwaita' gsettings set $gnome-schema cursor-theme 'Adwaita'
gsettings set $gnome-schema font-name 'ibm-plex 12' gsettings set $gnome-schema font-name 'ibm-plex 12'

View File

@ -1,7 +1,5 @@
include ~/.config/sway/config.d/display include ~/.config/sway/conf.d/display
include ~/.config/sway/config.d/theme include ~/.config/sway/conf.d/theme
include ~/.config/sway/config.d/keybinds include ~/.config/sway/conf.d/keybinds
include ~/.config/sway/config.d/custom include ~/.config/sway/conf.d/custom
include ~/.config/sway/config.d/exec include ~/.config/sway/conf.d/exec
exec kitty

View File

@ -1,3 +0,0 @@
# vim: filetype=swayconfig
include ~/.config/sway/config.d/custom.d/*

View File

@ -1,3 +0,0 @@
# vim: filetype=swayconfig
include ~/.config/sway/config.d/themes/dark

View File

@ -1,13 +0,0 @@
#!/bin/sh
# Take $1 as input, add a box shadow, output to $2
# you can change background color here
background_color=none
convert $1 \
\( -clone 0 -background black -shadow 40x5+12+16 \) \
\( -clone 0 -background black -shadow 40x5-4-4 \) \
\( -clone 0 -background black -shadow 40x12+12-4 \) \
\( -clone 0 -background black -shadow 40x12-4+16 \) \
-reverse -background $background_color -layers merge +repage \
$2

View File

@ -1,22 +0,0 @@
#!/bin/sh
SCRIPT_LOC=~/.config/sway/scripts/
FOLDER=~/Pictures/Screenshots/
# FILE="/tmp/share/screenshots/`date +'%y%m%d%H%M.png'`"
FILE="$FOLDER`date +'%y%m%d%H%M.png'`"
action=`echo -e "copy\nsave" | wofi -d -Oalphabetical --prompt="Select your action"`
target=`echo -e "active\nscreen\noutput\narea\nwindow" | wofi -d -Oalphabetical --prompt="Select the target"`
test $action || exit
test $target || exit
# test -d /tmp/share/screenshot || mkdir -p /tmp/share/screenshots
~/.config/sway/scripts/grimshot.sh --notify $action $target $FILE
if [ $target = "active" ] || [ $target = "window" ] || [ $target = "area" ]
then
$SCRIPT_LOC/boxshadow.sh "$FILE" "$FILE" || die "Unable to save screenshot"
echo -e "saved file"
fi

View File

@ -1,156 +0,0 @@
#!/bin/sh
## TAKEN FROM https://github.com/swaywm/sway/blob/master/contrib/grimshot
##
## Grimshot: a helper for screenshots within sway
## Requirements:
## - `grim`: screenshot utility for wayland
## - `slurp`: to select an area
## - `swaymsg`: to read properties of current window
## - `wl-copy`: clipboard utility
## - `jq`: json utility to parse swaymsg output
## - `notify-send`: to show notifications
## Those are needed to be installed, if unsure, run `grimshot check`
##
## See `man 1 grimshot` or `grimshot usage` for further details.
getTargetDirectory() {
test -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs && \
. ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs
echo ${XDG_SCREENSHOTS_DIR:-${XDG_PICTURES_DIR:-$HOME}}
}
if [ "$1" = "--notify" ]; then
NOTIFY=yes
shift 1
else
NOTIFY=no
fi
ACTION=${1:-usage}
SUBJECT=${2:-screen}
FILE=${3:-$(getTargetDirectory)/$(date +'%y%m%d%H%M.png')}
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
echo "Usage:"
echo " grimshot [--notify] (copy|save) [active|screen|output|area|window] [FILE|-]"
echo " grimshot check"
echo " grimshot usage"
echo ""
echo "Commands:"
echo " copy: Copy the screenshot data into the clipboard."
echo " save: Save the screenshot to a regular file or '-' to pipe to STDOUT."
echo " check: Verify if required tools are installed and exit."
echo " usage: Show this message and exit."
echo ""
echo "Targets:"
echo " active: Currently active window."
echo " screen: All visible outputs."
echo " output: Currently active output."
echo " area: Manually select a region."
echo " window: Manually select a window."
exit
fi
notify() {
notify-send -t 3000 -a grimshot "$@"
}
notifyOk() {
[ "$NOTIFY" = "no" ] && return
TITLE=${2:-"Screenshot"}
MESSAGE=${1:-"OK"}
notify-send "$TITLE" "$MESSAGE"
}
notifyError() {
if [ $NOTIFY = "yes" ]; then
TITLE=${2:-"Screenshot"}
MESSAGE=${1:-"Error taking screenshot with grim"}
notify -u critical "$TITLE" "$MESSAGE"
else
echo $1
fi
}
die() {
MSG=${1:-Bye}
notifyError "Error: $MSG"
exit 2
}
check() {
COMMAND=$1
if command -v "$COMMAND" > /dev/null 2>&1; then
RESULT="OK"
else
RESULT="NOT FOUND"
fi
echo " $COMMAND: $RESULT"
}
takeScreenshot() {
FILE=$1
GEOM=$2
OUTPUT=$3
if [ ! -z "$OUTPUT" ]; then
grim -o "$OUTPUT" "$FILE" || die "Unable to invoke grim"
elif [ -z "$GEOM" ]; then
grim "$FILE" || die "Unable to invoke grim"
else
grim -g "$GEOM" "$FILE" || die "Unable to invoke grim"
fi
}
if [ "$ACTION" = "check" ] ; then
echo "Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH..."
check grim
check slurp
check swaymsg
check wl-copy
check jq
check notify-send
exit
elif [ "$SUBJECT" = "area" ] ; then
GEOM=$(slurp -d)
# Check if user exited slurp without selecting the area
if [ -z "$GEOM" ]; then
exit 1
fi
WHAT="Area"
elif [ "$SUBJECT" = "active" ] ; then
FOCUSED=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)')
GEOM=$(echo "$FOCUSED" | jq -r '.rect | "\(.x),\(.y) \(.width)x\(.height)"')
APP_ID=$(echo "$FOCUSED" | jq -r '.app_id')
WHAT="$APP_ID window"
elif [ "$SUBJECT" = "screen" ] ; then
GEOM=""
WHAT="Screen"
elif [ "$SUBJECT" = "output" ] ; then
GEOM=""
OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name')
WHAT="$OUTPUT"
elif [ "$SUBJECT" = "window" ] ; then
GEOM=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)
# Check if user exited slurp without selecting the area
if [ -z "$GEOM" ]; then
exit 1
fi
WHAT="Window"
else
die "Unknown subject to take a screen shot from" "$SUBJECT"
fi
if [ "$ACTION" = "copy" ] ; then
takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error"
notifyOk "$WHAT copied to buffer"
else
if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
TITLE="Screenshot of $SUBJECT"
MESSAGE=$(basename "$FILE")
notifyOk "$MESSAGE" "$TITLE"
echo $FILE
else
notifyError "Error taking screenshot with grim"
fi
fi

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Modified from sway's locking script # Modified from sway's locking script
@ -8,7 +8,8 @@ if [[ ! $(which swayidle 2> /dev/null) ]]; then
exit 1 exit 1
fi fi
choice=$(echo -e "suspend\nshutdown\npoweroff\nreboot\nlock" | wofi -d --prompt "󰚥 Choose power option" -Oalphabetical) choices=("suspend" "shutdown" "poweroff" "reboot" "lock")
choice=$(printf "%s\n" "${choices[@]}" | wofi -d --prompt "󰚥 Choose power option" -Oalphabetical )
if test "$choice" = lock ; then if test "$choice" = lock ; then
@ -27,7 +28,11 @@ if test "$choice" = lock ; then
timeout $sleep_time 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ timeout $sleep_time 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
& &
idlepid=$! idlepid=$!
swaylock -e -c 282828 --inside-color 00000003
# swaylock -e -c 282828 --inside-color 00000003
swaylock -S --effect-blur "12x12" --effect-greyscale --effect-vignette 0.5:0.5 --inside-color 28282860 \
-e --ring-color 00000000 --line-color 00000000 --indicator --clock --text-color ebdbb2
kill $idlepid kill $idlepid
swaymsg "output * power on" swaymsg "output * power on"
light -S $bright light -S $bright

View File

@ -10,7 +10,7 @@ else
fi fi
sed -i $command ~/.config/kitty/kitty.conf sed -i $command ~/.config/kitty/kitty.conf
sed -i $command ~/.config/sway/config.d/theme sed -i $command ~/.config/sway/conf.d/theme
sed -i $command ~/.config/swaync/style.css sed -i $command ~/.config/swaync/style.css
sed -i $command ~/.config/waybar/style.css sed -i $command ~/.config/waybar/style.css
sed -i $command ~/.config/wofi/config sed -i $command ~/.config/wofi/config

View File

@ -1,11 +1,11 @@
{ {
"layer": "top", "layer": "top",
"modules-left": [ "modules-left": [
"hyprland/workspaces" "sway/workspaces"
], ],
"fixed-center": false, "fixed-center": false,
"modules-center": [ "modules-center": [
"hyprland/window" "sway/window"
], ],
"modules-right": [ "modules-right": [
"tray", "tray",
@ -17,16 +17,14 @@
"battery", "battery",
"clock" "clock"
], ],
"hyprland/workspaces": { "sway/workspaces": {
"on-scroll-up": "hyprctl dispatch workspace e-1",
"on-scroll-down": "hyprctl dispatch workspace e+1",
"show_special": true, "show_special": true,
"on-click": "activate", "on-click": "activate",
"persistent_workspaces": { "persistent_workspaces": {
"9": ["HDMI-A-1"] "9": ["HDMI-A-1"]
} }
}, },
"hyprland/window": { "sway/window": {
"max-length": 50, "max-length": 50,
"separate-outputs": true "separate-outputs": true
}, },

5
.zshrc
View File

@ -129,9 +129,12 @@ export MANROFFOPT="-c"
export BAT_THEME="base16" export BAT_THEME="base16"
#local path #local path
export PATH="${PATH}:${HOME}/.local/bin:${HOME}/.scripts:${HOME}/cargo/bin:${HOME}/.cache/go/bin:${HOME}/.local/share/nvim/mason/bin}" export PATH="${PATH}:${HOME}/.local/bin:${HOME}/.scripts:${HOME}/cargo/bin:${HOME}/.cache/go/bin:${HOME}/.local/share/nvim/mason/bin"
export MANPATH="${MANPATH}:${HOME}/.local/share/man" export MANPATH="${MANPATH}:${HOME}/.local/share/man"
#ccache support #ccache support
export USE_CCACHE=1 export USE_CCACHE=1
export PATH="/usr/lib/ccache/bin${PATH:+:}$PATH" export PATH="/usr/lib/ccache/bin${PATH:+:}$PATH"
# ssh-agent
export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket