sway: update to latest downstream

This commit is contained in:
Vladan Popovic 2024-09-30 03:35:41 +02:00
parent 8ae09c9c07
commit 34d5db95aa
15 changed files with 44 additions and 168 deletions

View file

@ -1,2 +0,0 @@
bkg.jpg
bkg2.jpg

View file

@ -1,42 +0,0 @@
#!/usr/bin/env python
# This script keeps track of active keyboard layouts per window.
#
# This script requires i3ipc-python package (install it from a system package
# manager or pip).
#
# https://github.com/swaywm/sway/pull/4504/files
import i3ipc
sway = i3ipc.Connection()
prev_focused = sway.get_tree().find_focused().id
windows = {}
def on_window_focus(ipc, event):
global windows, prev_focused
# Save current layouts
layouts = {input.identifier: input.xkb_active_layout_index for input in sway.get_inputs()}
windows[prev_focused] = layouts
# Restore layout of the newly focused window
if event.container.id in windows:
for (input_id, layout_index) in windows[event.container.id].items():
if layout_index != layouts[input_id]:
sway.command(f'input "{input_id}" xkb_switch_layout {layout_index}')
prev_focused = event.container.id
def on_window_close(ipc, event):
global windows
if event.container.id in windows:
del(windows[event.container.id])
def on_window(ipc, event):
if event.change == "focus":
on_window_focus(ipc, event)
elif event.change == "close":
on_window_close(ipc, event)
sway.on("window", on_window)
sway.main()

View file

@ -1 +1,2 @@
include /etc/sway/config.d/*
include ~/.config/sway/config.d/* include ~/.config/sway/config.d/*

View file

@ -14,45 +14,35 @@ output "eDP-1" {
scale_filter nearest scale_filter nearest
adaptive_sync off adaptive_sync off
dpms on dpms on
bg ~/.config/sway/bkg.jpg fill bg ~/.config/sway/screen.png fill
} }
output "DP-1" { output "DP-1" {
mode 3840x2160@59.997Hz mode 3840x2160@59.997Hz
pos 1920 0 pos 1920 0
transform normal transform normal
scale 1.1 scale 1.2
scale_filter linear scale_filter linear
adaptive_sync off adaptive_sync off
dpms on dpms on
bg ~/.config/sway/bkg2.jpg fill bg ~/.config/sway/screen.png fill
} }
output "DP-2" { output "DP-2" {
mode 3840x2160@59.997Hz mode 3840x2160@59.997Hz
pos 1920 0 pos 1920 0
transform normal transform normal
scale 1.1 scale 1.2
scale_filter linear scale_filter linear
adaptive_sync off adaptive_sync off
dpms on dpms on
bg ~/.config/sway/bkg2.jpg fill bg ~/.config/sway/screen.png fill
}
output "DP-3" {
mode 3840x2160@59.997Hz
pos 1920 0
transform normal
scale 1.1
scale_filter linear
adaptive_sync off
dpms on
bg ~/.config/sway/bkg2.jpg fill
} }
output "HDMI-A-1" { output "HDMI-A-1" {
mode 3840x2160@59.997Hz mode 3840x2160@59.997Hz
pos 1920 0 pos 1920 0
transform normal transform normal
scale 1.1 scale 1.2
scale_filter linear scale_filter linear
adaptive_sync off adaptive_sync off
dpms on dpms on
bg ~/.config/sway/bkg2.jpg fill bg ~/.config/sway/screen.png fill
} }

View file

@ -1,11 +0,0 @@
# Automatically assign a dedicated systemd scope to the GUI applications
# launched in the same cgroup as the compositor. This could be helpful for
# implementing cgroup-based resource management and would be necessary when
# `systemd-oomd` is in use.
#
# Limitations: The script is using i3ipc window:new event to detect application
# launches and would fail to detect background apps or special surfaces.
# Therefore it's recommended to supplement the script with use of systemd user
# services for such background apps.
#
exec $exedir/assign-cgroups.py

View file

@ -1,31 +0,0 @@
# Address several issues with DBus activation and systemd user sessions
#
# 1. DBus-activated and systemd services do not share the environment with user
# login session. In order to make the applications that have GUI or interact
# with the compositor work as a systemd user service, certain variables must
# be propagated to the systemd and dbus.
# Possible (but not exhaustive) list of variables:
# - DISPLAY - for X11 applications that are started as user session services
# - WAYLAND_DISPLAY - similarly, this is needed for wayland-native services
# - I3SOCK/SWAYSOCK - allow services to talk with sway using i3 IPC protocol
#
# 2. `xdg-desktop-portal` requires XDG_CURRENT_DESKTOP to be set in order to
# select the right implementation for screenshot and screencast portals.
# With all the numerous ways to start sway, it's not possible to rely on the
# right value of the XDG_CURRENT_DESKTOP variable within the login session,
# therefore the script will ensure that it is always set to `sway`.
#
# 3. GUI applications started as a systemd service (or via xdg-autostart-generator)
# may rely on the XDG_SESSION_TYPE variable to select the backend.
# Ensure that it is always set to `wayland`.
#
# 4. The common way to autostart a systemd service along with the desktop
# environment is to add it to a `graphical-session.target`. However, systemd
# forbids starting the graphical session target directly and encourages use
# of an environment-specific target units. Therefore, the integration
# package here provides and uses `sway-session.target` which would bind to
# the `graphical-session.target`.
#
# 5. Stop the target and unset the variables when the compositor exits.
#
exec $exedir/session.sh

View file

@ -11,5 +11,5 @@ set $right l
set $term alacritty set $term alacritty
# Your preferred application launcher # Your preferred application launcher
# Note: it's recommended that you pass the final command to sway # Note: it's recommended that you pass the final command to sway
set $menu /usr/bin/fuzzel # set $menu wofi -c $HOME/.config/wofi/config -s $HOME/.config/wofi/style.css | xargs swaymsg exec --
set $exedir /home/vladanpopovic/.local/bin set $menu ~/src/wldash/target/release/wldash

View file

@ -12,9 +12,11 @@
# You can get the names of your inputs by running: swaymsg -t get_inputs # You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section. # Read `man 5 sway-input` for more information about this section.
input * xkb_layout "us,mk" input 1:1:AT_Translated_Set_2_keyboard {
input * xkb_variant "typewriter" xkb_layout "us,mk"
input * xkb_options "grp:caps_toggle" xkb_variant "typewriter"
xkb_options "grp:caps_toggle"
}
# Pulse Audio controls # Pulse Audio controls
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5% #increase sound volume bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5% #increase sound volume

View file

@ -1,8 +1,3 @@
# Ignore the status bar here, it's started by systemd.
#
bar {
swaybar_command /dev/null
}
# Remove title from windows # Remove title from windows
default_border pixel 1 default_border pixel 1
@ -36,6 +31,6 @@ client.background $bg
gaps inner 0 gaps inner 0
gaps outer 0 gaps outer 0
smart_gaps on #smart_gaps on
for_window [app_id=".*"] border normal for_window [app_id=".*"] border normal

View file

@ -16,7 +16,7 @@
# Despite the name, also works for non-floating windows. # Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right # Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging. # mouse button for dragging.
# floating_modifier $mod normal floating_modifier $mod normal
# reload the configuration file # reload the configuration file
bindsym $mod+Shift+c reload bindsym $mod+Shift+c reload
@ -120,7 +120,7 @@ bindsym $mod+z exec swaylock -c 000000
# Take full screen screenshot with PrtScr # Take full screen screenshot with PrtScr
bindsym Print exec grim -t png /tmp/screen.png bindsym Print exec grim -t png /tmp/screen.png
# Take area screenshot with Shift+PrtScr # Take area screenshot with Shift+PrtScr
bindsym Shift+Print exec grim -g "$(slurp)" "/tmp/screenshot-$(date +%Y%m%d%H%M%S).png" bindsym Shift+Print exec grim -g "$(slurp)" /tmp/screen.png
# #
# Resizing containers: # Resizing containers:

View file

@ -9,16 +9,16 @@ unbindsym $mod+7
unbindsym $mod+8 unbindsym $mod+8
unbindsym $mod+9 unbindsym $mod+9
unbindsym $mod+0 unbindsym $mod+0
bindsym $mod+1 exec "/home/vladanpopovic/.local/bin/swaysome focus 1" bindsym $mod+1 exec "swaysome focus 1"
bindsym $mod+2 exec "/home/vladanpopovic/.local/bin/swaysome focus 2" bindsym $mod+2 exec "swaysome focus 2"
bindsym $mod+3 exec "/home/vladanpopovic/.local/bin/swaysome focus 3" bindsym $mod+3 exec "swaysome focus 3"
bindsym $mod+4 exec "/home/vladanpopovic/.local/bin/swaysome focus 4" bindsym $mod+4 exec "swaysome focus 4"
bindsym $mod+5 exec "/home/vladanpopovic/.local/bin/swaysome focus 5" bindsym $mod+5 exec "swaysome focus 5"
bindsym $mod+6 exec "/home/vladanpopovic/.local/bin/swaysome focus 6" bindsym $mod+6 exec "swaysome focus 6"
bindsym $mod+7 exec "/home/vladanpopovic/.local/bin/swaysome focus 7" bindsym $mod+7 exec "swaysome focus 7"
bindsym $mod+8 exec "/home/vladanpopovic/.local/bin/swaysome focus 8" bindsym $mod+8 exec "swaysome focus 8"
bindsym $mod+9 exec "/home/vladanpopovic/.local/bin/swaysome focus 9" bindsym $mod+9 exec "swaysome focus 9"
bindsym $mod+0 exec "/home/vladanpopovic/.local/bin/swaysome focus 0" bindsym $mod+0 exec "swaysome focus 0"
# Move containers between workspaces # Move containers between workspaces
unbindsym $mod+Shift+1 unbindsym $mod+Shift+1
@ -31,22 +31,22 @@ unbindsym $mod+Shift+7
unbindsym $mod+Shift+8 unbindsym $mod+Shift+8
unbindsym $mod+Shift+9 unbindsym $mod+Shift+9
unbindsym $mod+Shift+0 unbindsym $mod+Shift+0
bindsym $mod+Shift+1 exec "/home/vladanpopovic/.local/bin/swaysome move 1" bindsym $mod+Shift+1 exec "swaysome move 1"
bindsym $mod+Shift+2 exec "/home/vladanpopovic/.local/bin/swaysome move 2" bindsym $mod+Shift+2 exec "swaysome move 2"
bindsym $mod+Shift+3 exec "/home/vladanpopovic/.local/bin/swaysome move 3" bindsym $mod+Shift+3 exec "swaysome move 3"
bindsym $mod+Shift+4 exec "/home/vladanpopovic/.local/bin/swaysome move 4" bindsym $mod+Shift+4 exec "swaysome move 4"
bindsym $mod+Shift+5 exec "/home/vladanpopovic/.local/bin/swaysome move 5" bindsym $mod+Shift+5 exec "swaysome move 5"
bindsym $mod+Shift+6 exec "/home/vladanpopovic/.local/bin/swaysome move 6" bindsym $mod+Shift+6 exec "swaysome move 6"
bindsym $mod+Shift+7 exec "/home/vladanpopovic/.local/bin/swaysome move 7" bindsym $mod+Shift+7 exec "swaysome move 7"
bindsym $mod+Shift+8 exec "/home/vladanpopovic/.local/bin/swaysome move 8" bindsym $mod+Shift+8 exec "swaysome move 8"
bindsym $mod+Shift+9 exec "/home/vladanpopovic/.local/bin/swaysome move 9" bindsym $mod+Shift+9 exec "swaysome move 9"
bindsym $mod+Shift+0 exec "/home/vladanpopovic/.local/bin/swaysome move 0" bindsym $mod+Shift+0 exec "swaysome move 0"
# Move focused container to next output # Move focused container to next output
bindsym $mod+o exec "/home/vladanpopovic/.local/bin/swaysome next-output" bindsym $mod+o exec "swaysome next_output"
# Move focused container to previous output # Move focused container to previous output
bindsym $mod+Shift+o exec "/home/vladanpopovic/.local/bin/swaysome prev-output" bindsym $mod+Shift+o exec "swaysome prev_output"
# Init workspaces for every screen # Init workspaces for every screen
exec "/home/vladanpopovic/.local/bin/swaysome init 1" exec "swaysome init 1"

View file

@ -1,9 +0,0 @@
# Apply system-wide XKB configuration stored in systemd-localed.
#
# The configuration can be viewed with `localectl` and modified
# with `localectl set-x11-keymap`.
#
# Normal mode will pick up the configuration changes immediately
# and oneshot mode will require a Sway config reload.
exec_always $exedir/locale1-xkb-config --oneshot

View file

@ -1,14 +0,0 @@
# Wait until a StatusNotifierItem tray implementation is available and
# process XDG autostart entries.
#
# This horror has to exist because
#
# - SNI spec mandates that if `IsStatusNotifierHostRegistered` is not set,
# the client should fall back to the Freedesktop System Tray specification
# (XEmbed).
# - There are actual implementations that take this seriously and implement
# a fallback *even if* StatusNotifierWatcher is already DBus-activated.
# - https://github.com/systemd/systemd/issues/3750
#
exec $exedir/wait-sni-ready && \
systemctl --user start sway-xdg-autostart.target

View file

@ -1,6 +1,3 @@
#exec "~/.config/sway/bin/keyboard-layout-per-window.py" exec "~/.config/sway/bin/keyboard-layout-per-window.py"
# exec "systemctl --user start sway-session.target"
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP=sway exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB