mirror of
https://github.com/rywng/dotfiles.git
synced 2024-11-24 20:01:49 +08:00
SwayWM
This commit is contained in:
parent
fa14f7c34e
commit
d4c4898bc4
3
.config/sway/conf.d/custom
Normal file
3
.config/sway/conf.d/custom
Normal file
@ -0,0 +1,3 @@
|
||||
# vim: filetype=swayconfig
|
||||
|
||||
include ~/.config/sway/conf.d/custom.d/*
|
@ -1,18 +1,18 @@
|
||||
output * adaptive_sync on
|
||||
|
||||
# 75hz monitor
|
||||
output 'Lectron Company Ltd LECOO M2412HL GG30A137' mode 2560x1440@74.968Hz
|
||||
output 'Lectron Company Ltd LECOO M2412HL GG30A137' subpixel rgb
|
||||
output 'Lectron Company Ltd LECOO M2412HL GG30A137' pos 0 500
|
||||
# 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
|
||||
output 'Lectron Company Ltd LECOO M2412HL GG30A137' render_bit_depth 10
|
||||
|
||||
# laptop screen
|
||||
output 'Thermotrex Corporation TL160ADMP03-0 Unknown' subpixel rgb
|
||||
# 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' mode 2560x1600@240.000Hz
|
||||
output 'Thermotrex Corporation TL160ADMP03-0 Unknown' max_render_time 8
|
||||
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' render_bit_depth 10
|
||||
|
||||
# TV at home
|
||||
@ -20,9 +20,10 @@ output 'Unknown HUAWEI INC 0x00000000' mode 3840x2160@60.000Hz
|
||||
output 'Unknown HUAWEI INC 0x00000000' scale 2
|
||||
|
||||
# lab screen
|
||||
# output "XMI Redmi 27 NU 3948622WH08F4" mode 1920x1080@60.000Hz
|
||||
output "XMI Redmi 27 NU 3948622WH08F4" mode --custom 2560x1440@75.000Hz
|
||||
output "XMI Redmi 27 NU 3948622WH08F4" transform 90
|
||||
output "XMI Redmi 27 NU 3948622WH08F4" max_render_time 3
|
||||
output "XMI Redmi 27 NU 3948622WH08F4" subpixel rgb
|
||||
output "XMI Redmi 27 NU 3948622WH08F4" scale 1.5
|
||||
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 off
|
||||
# output "XMI Redmi 27 NU 3948622WH08F4" scale 1.5
|
||||
output "XMI Redmi 27 NU 3948622WH08F4" render_bit_depth 10
|
@ -11,8 +11,8 @@ set $menu wofi
|
||||
# my keybinds
|
||||
|
||||
# screenshot
|
||||
bindsym $mod+Print exec ~/.config/sway/scripts/grimshot-ui.sh
|
||||
bindsym $mod+Shift+s exec ~/.config/sway/scripts/grimshot-ui.sh
|
||||
bindsym $mod+Print exec grimshot --cursor copy area
|
||||
bindsym $mod+Shift+s exec grimshot --cursor copy area
|
||||
# notification client
|
||||
bindsym $mod+m exec swaync-client -t -sw
|
||||
# Logout
|
||||
@ -36,8 +36,8 @@ bindsym --whole-window $mod+button9 workspace next
|
||||
# bind fn keys
|
||||
bindsym XF86AudioMicMute exec amixer set Capture toggle
|
||||
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 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 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 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 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
|
3
.config/sway/conf.d/theme
Normal file
3
.config/sway/conf.d/theme
Normal file
@ -0,0 +1,3 @@
|
||||
# vim: filetype=swayconfig
|
||||
|
||||
include ~/.config/sway/conf.d/themes/dark
|
@ -4,7 +4,7 @@
|
||||
set $gnome-schema org.gnome.desktop.interface
|
||||
exec_always {
|
||||
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 cursor-theme 'Adwaita'
|
||||
gsettings set $gnome-schema font-name 'ibm-plex 12'
|
@ -1,7 +1,5 @@
|
||||
include ~/.config/sway/config.d/display
|
||||
include ~/.config/sway/config.d/theme
|
||||
include ~/.config/sway/config.d/keybinds
|
||||
include ~/.config/sway/config.d/custom
|
||||
include ~/.config/sway/config.d/exec
|
||||
|
||||
exec kitty
|
||||
include ~/.config/sway/conf.d/display
|
||||
include ~/.config/sway/conf.d/theme
|
||||
include ~/.config/sway/conf.d/keybinds
|
||||
include ~/.config/sway/conf.d/custom
|
||||
include ~/.config/sway/conf.d/exec
|
||||
|
@ -1,3 +0,0 @@
|
||||
# vim: filetype=swayconfig
|
||||
|
||||
include ~/.config/sway/config.d/custom.d/*
|
@ -1,3 +0,0 @@
|
||||
# vim: filetype=swayconfig
|
||||
|
||||
include ~/.config/sway/config.d/themes/dark
|
@ -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
|
@ -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
|
@ -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
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# Modified from sway's locking script
|
||||
|
||||
@ -8,7 +8,8 @@ if [[ ! $(which swayidle 2> /dev/null) ]]; then
|
||||
exit 1
|
||||
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
|
||||
|
@ -10,7 +10,7 @@ else
|
||||
fi
|
||||
|
||||
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/waybar/style.css
|
||||
sed -i $command ~/.config/wofi/config
|
||||
|
Loading…
Reference in New Issue
Block a user