This commit is contained in:
pivodevat 2025-03-25 01:47:41 +03:00
commit b86757b1f8
14 changed files with 368 additions and 0 deletions

26
README.md Normal file
View File

@ -0,0 +1,26 @@
# Install
> ## Sway config
> ``` bash
> cd .config
> git clone https://root-kit.ru/PIVODEVAT/SexiSway.git sway; echo \
> "\e[33m==== Requirements ====\e[0m\n"\
> "jq - parser tool\n"\
> "brightnessctl - display brightness control\n"\
> "notify-send, mako - notification services\n"\
> "\e[33m==== Requirements ====\e[0m"
> ```
> ## SimpleTerminal
> (or change $term in ~/.config/sway/config to your term)
> ``` bash
> mkdir ~/src
> cd ~/src
> git clone git://git.suckless.org/st
> cd st
> cp config.def.h config.h
> sed -i 's/^static char \*font = .*;/static char \*font = "monospace:bold:size=16:antialias=true:autohint=true";/' config.h
> sed -i 's/^\t"gray90", \/\* default foreground colour \*\//\t"#ffffff", \/\* default foreground colour \*\//' config.h
> sed -i 's/^\t"black", \/\* default background colour \*\//\t"#242424", \/\* default background colour \*\//' config.h
> make
> sudo make install
> ```

24
conf.d/binds/common Normal file
View File

@ -0,0 +1,24 @@
# Start a terminal
bindsym $mod+Return exec $term
bindsym Control+Alt+t exec $term
bindsym $mod+Shift+r reload
# Kill focused window
bindsym Alt+F4 kill
# Start your launcher
bindsym $mod+d exec $menu
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'

72
conf.d/binds/movement Normal file
View File

@ -0,0 +1,72 @@
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode. $mod+click to move.
bindsym $mod+Shift+space floating toggle
# Move focus to the parent container
bindsym $mod+a focus parent
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
#
# Focus
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
#
# Split
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+h splith
bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

9
conf.d/binds/scratchpad Normal file
View File

@ -0,0 +1,9 @@
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
#bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
#bindsym $mod+minus scratchpad show

12
conf.d/binds/utilites Normal file
View File

@ -0,0 +1,12 @@
# Special keys to adjust volume via PulseAudio
bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym --locked XF86AudioRaiseVolume exec ~/.config/sway/scripts/volume +
bindsym --locked XF86AudioLowerVolume exec ~/.config/sway/scripts/volume -
bindsym --locked XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
# Special keys to adjust brightness via brightnessctl
bindsym XF86MonBrightnessUp exec ~/.config/sway/scripts/brightness +
bindsym XF86MonBrightnessDown exec ~/.config/sway/scripts/brightness -
# Special key to take a screenshot with grim
bindsym Print exec grim -g "$(slurp)" - | wl-copy

46
conf.d/binds/workspaces Normal file
View File

@ -0,0 +1,46 @@
# Switch to workspace
bindsym $mod+1 exec ~/.config/sway/scripts/workspace-manager 1
bindsym $mod+2 exec ~/.config/sway/scripts/workspace-manager 2
bindsym $mod+3 exec ~/.config/sway/scripts/workspace-manager 3
bindsym $mod+4 exec ~/.config/sway/scripts/workspace-manager 4
bindsym $mod+5 exec ~/.config/sway/scripts/workspace-manager 5
bindsym $mod+6 exec ~/.config/sway/scripts/workspace-manager 6
bindsym $mod+7 exec ~/.config/sway/scripts/workspace-manager 7
bindsym $mod+8 exec ~/.config/sway/scripts/workspace-manager 8
bindsym $mod+9 exec ~/.config/sway/scripts/workspace-manager 9
bindsym $mod+0 exec ~/.config/sway/scripts/workspace-manager 0
bindsym $mod+F1 exec ~/.config/sway/scripts/workspace-manager F1
bindsym $mod+F2 exec ~/.config/sway/scripts/workspace-manager F2
bindsym $mod+F3 exec ~/.config/sway/scripts/workspace-manager F3
bindsym $mod+F4 exec ~/.config/sway/scripts/workspace-manager F4
bindsym $mod+F5 exec ~/.config/sway/scripts/workspace-manager F5
bindsym $mod+F6 exec ~/.config/sway/scripts/workspace-manager F6
bindsym $mod+F7 exec ~/.config/sway/scripts/workspace-manager F7
bindsym $mod+F8 exec ~/.config/sway/scripts/workspace-manager F8
bindsym $mod+F9 exec ~/.config/sway/scripts/workspace-manager F9
bindsym $mod+F10 exec ~/.config/sway/scripts/workspace-manager F10
bindsym $mod+F11 exec ~/.config/sway/scripts/workspace-manager F11
bindsym $mod+F12 exec ~/.config/sway/scripts/workspace-manager F12
# Move focused container to workspace
bindsym $mod+Shift+1 exec ~/.config/sway/scripts/workspace-manager 1 move
bindsym $mod+Shift+2 exec ~/.config/sway/scripts/workspace-manager 2 move
bindsym $mod+Shift+3 exec ~/.config/sway/scripts/workspace-manager 3 move
bindsym $mod+Shift+4 exec ~/.config/sway/scripts/workspace-manager 4 move
bindsym $mod+Shift+5 exec ~/.config/sway/scripts/workspace-manager 5 move
bindsym $mod+Shift+6 exec ~/.config/sway/scripts/workspace-manager 6 move
bindsym $mod+Shift+7 exec ~/.config/sway/scripts/workspace-manager 7 move
bindsym $mod+Shift+8 exec ~/.config/sway/scripts/workspace-manager 8 move
bindsym $mod+Shift+9 exec ~/.config/sway/scripts/workspace-manager 9 move
bindsym $mod+Shift+0 exec ~/.config/sway/scripts/workspace-manager 0 move
bindsym $mod+Shift+F1 exec ~/.config/sway/scripts/workspace-manager F1 move
bindsym $mod+Shift+F2 exec ~/.config/sway/scripts/workspace-manager F2 move
bindsym $mod+Shift+F3 exec ~/.config/sway/scripts/workspace-manager F3 move
bindsym $mod+Shift+F4 exec ~/.config/sway/scripts/workspace-manager F4 move
bindsym $mod+Shift+F5 exec ~/.config/sway/scripts/workspace-manager F5 move
bindsym $mod+Shift+F6 exec ~/.config/sway/scripts/workspace-manager F6 move
bindsym $mod+Shift+F7 exec ~/.config/sway/scripts/workspace-manager F7 move
bindsym $mod+Shift+F8 exec ~/.config/sway/scripts/workspace-manager F8 move
bindsym $mod+Shift+F9 exec ~/.config/sway/scripts/workspace-manager F9 move
bindsym $mod+Shift+F10 exec ~/.config/sway/scripts/workspace-manager F10 move
bindsym $mod+Shift+F11 exec ~/.config/sway/scripts/workspace-manager F11 move
bindsym $mod+Shift+F12 exec ~/.config/sway/scripts/workspace-manager F12 move

18
conf.d/common Normal file
View File

@ -0,0 +1,18 @@
# Window border
default_border none
# Keyboard
input type:keyboard {
xkb_layout "us,ru"
xkb_options "grp:alt_shift_toggle"
}
# Touchpad
input type:touchpad {
dwt enabled
tap enabled
middle_emulation enabled
}
# Wallpaper
#output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill

9
conf.d/startup Normal file
View File

@ -0,0 +1,9 @@
# Init workspace
exec echo "1" > /tmp/f_key_number
exec swaymsg 'workspace 11'
# Start your nontification daemon
exec mako
# Start your audio daemon
exec pulseaudio --start

12
conf.d/status-bar Normal file
View File

@ -0,0 +1,12 @@
bar {
status_command while date +'%Y-%m-%d %X'; do sleep 1; done
mode invisible
colors {
statusline #ffffff
background #323232
inactive_workspace #32323200 #32323200 #5c5c5c
}
}
bindsym $mod+b exec ~/.config/sway/scripts/bar-toggle

28
config Normal file
View File

@ -0,0 +1,28 @@
# Sexi-sway config
#
# Variables
#
# Super key.
# Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like SexNvim
set $left j
set $down k
set $up l
set $right semicolon
# Your preferred terminal emulator
set $term st
# Your preferred application launcher
set $menu wmenu-run
#
# Modules
#
include ~/.config/sway/conf.d/*
include ~/.config/sway/conf.d/binds/*

11
scripts/bar-toggle Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
bar_config=$(swaymsg -t get_bar_config "bar-0")
mode=$(echo "$bar_config" | jq -r '.mode')
if [ "$mode" == "dock" ]; then
swaymsg "bar mode invisible"
elif [ "$mode" == "invisible" ]; then
swaymsg "bar mode dock"
fi

19
scripts/brightness Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
NOTIFICATION_ID=9999
CURRENT_BRIGHTNESS=$(brightnessctl g)
MAX_BRIGHTNESS=$(brightnessctl m)
CURRENT_BRIGHTNESS_PERCENT=$((CURRENT_BRIGHTNESS * 100 / MAX_BRIGHTNESS))
if [ "$1" == "+" ]; then
brightnessctl set +1%
elif [ "$1" == "-" ]; then
brightnessctl set 10%-
else
notify-send -u normal -r $NOTIFICATION_ID "Ошибка" "Неверный параметр. Используйте '+' или '-'."
exit 1
fi
UPDATED_BRIGHTNESS=$(brightnessctl g)
UPDATED_BRIGHTNESS_PERCENT=$((UPDATED_BRIGHTNESS * 100 / MAX_BRIGHTNESS))
notify-send -u normal -i display-brightness-high -r $NOTIFICATION_ID "Уровень яркости" "${UPDATED_BRIGHTNESS_PERCENT}%" -t 400

22
scripts/volume Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
MAX_VOLUME=200
NOTIFICATION_ID=9999
CURRENT_VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\d+%' | head -1 | tr -d '%')
if [ "$1" == "+" ]; then
if [ "$CURRENT_VOLUME" -lt "$MAX_VOLUME" ]; then
pactl set-sink-volume @DEFAULT_SINK@ +10%
else
notify-send -u normal -r $NOTIFICATION_ID "Невозможно увеличить звук" "Достигнут лимит в $MAX_VOLUME%" -t 400
exit 0
fi
elif [ "$1" == "-" ]; then
pactl set-sink-volume @DEFAULT_SINK@ -10%
else
notify-send -u normal -r $NOTIFICATION_ID "Error" "Invalid parameter. Use '+' or '-'." -t 400
exit 1
fi
UPDATED_VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\d+%' | head -1 | tr -d '%')
notify-send -u normal -i audio-volume-high -r $NOTIFICATION_ID "Уровень звука" "${UPDATED_VOLUME}%" -t 400

60
scripts/workspace-manager Executable file
View File

@ -0,0 +1,60 @@
#!/bin/dash
key_input=$1
flag=$2
#
# Calc workspace swich
#
last_workspace=$(cat /tmp/last_workspace 2>/dev/null)
f_key_number=$(cat /tmp/f_key_number 2>/dev/null || echo 0)
digit_key_number=$(cat /tmp/digit_key_number 2>/dev/null || echo 0)
case $key_input in
F*) f_key_number=${key_input#F} ;;
0) digit_key_number=10;;
[1-9]) digit_key_number=$key_input ;;
*) echo "Invalid key input"; exit 1 ;;
esac
workspace_number=$((f_key_number * 10 + digit_key_number))
if [ "$workspace_number" -eq "$last_workspace" ]; then
exit 0
fi
#
# Hooks
#
case $workspace_number in
30) workspace_number=48 ;;
esac
#
# swich
#
if [ "$flag" = "move" ]; then
swaymsg move container to workspace number $workspace_number
exit 0
else
swaymsg workspace $workspace_number
fi
echo "$workspace_number" > /tmp/last_workspace
echo "$f_key_number" > /tmp/f_key_number
echo "$digit_key_number" > /tmp/digit_key_number
#
# Post swich | Game workspace - disable touchpad
#
case $workspace_number in
51)
swaymsg input type:touchpad events disabled
;;
*)
swaymsg input type:touchpad events enabled
;;
esac
case $workspace_number in
*)
swaymsg input type:keyboard xkb_switch_layout 0
;;
esac