diff --git a/.config/sway/apps b/.config/sway/apps new file mode 100644 index 0000000..e5221e2 --- /dev/null +++ b/.config/sway/apps @@ -0,0 +1,34 @@ +for_window [class="Firefox"] mark Browser +for_window [class="Firefox" window_role="Browser"] { + border normal 0 +} +# firefox floating menus +for_window [window_role="pop-up"] floating enable +for_window [window_role="task_dialog"] floating enable +for_window [window_role="pop-up"] floating enable +for_window [window_role="bubble"] floating enable +for_window [window_role="task_dialog"] floating enable +for_window [window_role="Preferences"] floating enable +for_window [window_type="dialog"] floating enable +for_window [window_type="menu"] floating enable +for_window [title="About Mozilla Firefox"] floating enabled +for_window [title="Password Required - Mozilla Firefox"] floating enabled +for_window [app_id="pinentry-qt"] { + move position center + floating enable +} +for_window [app_id="pavucontrol"] { + move position center + floating enable +} +for_window [app_id="wdisplays"] { + floating enable +} +for_window [app_id="com.nextcloud.desktopclient.nextcloud"] { + border normal 1 + floating enable +} + +for_window [app_id="avizo-service"] border pixel 0 +for_window [app_id="avizo-service"] sticky toggle +no_focus [app_id="avizo-service"] diff --git a/.config/sway/bar b/.config/sway/bar new file mode 100644 index 0000000..2e3e788 --- /dev/null +++ b/.config/sway/bar @@ -0,0 +1,17 @@ +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +bar { + position bottom + + # When the status_command prints a new line to stdout, swaybar updates. + # The default just shows the current date and time. + status_command i3status + + colors { + statusline #ffffff + background #323232 + inactive_workspace #32323200 #32323200 #5c5c5c + } +} diff --git a/.config/sway/bindings b/.config/sway/bindings new file mode 100644 index 0000000..0049b77 --- /dev/null +++ b/.config/sway/bindings @@ -0,0 +1,140 @@ +# lock screen +bindsym $mod+z exec systemctl kill swayidle.service --user --signal USR1 --kill-who=main +bindsym $mod+Shift+t sticky toggle +bindsym $mod+Print exec grim screenshot-$(date --iso-8601=ns).png + +# Pulse Audio controls +bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5% #increase sound volume +bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -5% #decrease sound volume +bindsym XF86AudioMute exec pactl set-sink-mute 0 toggle # mute sound +bindsym XF86AudioMicMute exec pactl set-source-mute alsa_input.pci-0000_00_1b.0.analog-stereo toggle # mute mic + +# Sreen brightness controls +bindsym XF86MonBrightnessUp exec brightnessctl -q s +10% +bindsym XF86MonBrightnessDown exec brightnessctl -q s 10%- + +### Key bindings +# +# Basics: +# + # start a terminal + bindsym $mod+Return exec systemd-run --user $term + + # Kill focused window + bindsym $mod+Shift+q 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+Alt+Delete exec swaynag -t warning -m 'You pressed the mod4+alt+del. Do you really want to: ' \ + -b 'Exit sway' 'swaymsg exit' \ + -b 'Reboot' 'systemctl reboot' \ + -b 'Shutdown' 'systemctl poweroff' +# +# Moving around: +# + # Move your focus around + bindsym $mod+h focus left + bindsym $mod+j focus down + bindsym $mod+k focus up + bindsym $mod+l focus right + + # _move_ the focused window with the same, but add Shift + bindsym $mod+Shift+h move left + bindsym $mod+Shift+j move down + bindsym $mod+Shift+k move up + bindsym $mod+Shift+l move right +# +# Workspaces: +# + # switch to workspace + bindsym $mod+1 workspace 1 + bindsym $mod+2 workspace 2 + bindsym $mod+3 workspace 3 + bindsym $mod+4 workspace 4 + bindsym $mod+5 workspace 5 + bindsym $mod+6 workspace 6 + bindsym $mod+7 workspace 7 + bindsym $mod+8 workspace 8 + bindsym $mod+9 workspace 9 + bindsym $mod+0 workspace 10 + # move focused container to workspace + bindsym $mod+Shift+1 move container to workspace 1 + bindsym $mod+Shift+2 move container to workspace 2 + bindsym $mod+Shift+3 move container to workspace 3 + bindsym $mod+Shift+4 move container to workspace 4 + bindsym $mod+Shift+5 move container to workspace 5 + bindsym $mod+Shift+6 move container to workspace 6 + bindsym $mod+Shift+7 move container to workspace 7 + bindsym $mod+Shift+8 move container to workspace 8 + bindsym $mod+Shift+9 move container to workspace 9 + bindsym $mod+Shift+0 move container to workspace 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+b 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 + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # move focus to the parent container + bindsym $mod+a focus parent +# +# Scratchpad: +# + # 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 Print scratchpad show +# +# 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 + + # return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+Shift+R mode "resize" + diff --git a/.config/sway/config b/.config/sway/config index 87b72e8..845f9f4 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -17,7 +17,8 @@ set $right l set $term alacritty # Your preferred application launcher # Note: it's recommended that you pass the final command to sway -set $menu wofi -c $HOME/.config/wofi/config -s $HOME/.config/wofi/style.css | xargs swaymsg exec -- +# set $menu wofi -c $HOME/.config/wofi/config -s $HOME/.config/wofi/style.css | xargs swaymsg exec -- +set $menu ~/src/wldash/target/release/wldash ### Output configuration # @@ -62,6 +63,16 @@ input * xkb_layout "us,mk" input * xkb_variant "typewriter" input * xkb_options "grp:caps_toggle" +# Pulse Audio controls +bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5% #increase sound volume +bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -5% #decrease sound volume +bindsym XF86AudioMute exec pactl set-sink-mute 0 toggle # mute sound +bindsym XF86AudioMicMute exec pactl set-source-mute alsa_input.pci-0000_00_1b.0.analog-stereo toggle # mute mic + +# Sreen brightness controls +bindsym XF86MonBrightnessUp exec brightnessctl -q s +10% +bindsym XF86MonBrightnessDown exec brightnessctl -q s 10%- + ### Key bindings # # Basics: @@ -222,8 +233,11 @@ bindsym Shift+Print exec grim -g "$(slurp)" /tmp/screen.png # Remove title from windows default_border pixel 1 +default_floating_border normal bindsym $mod+t border toggle +hide_edge_borders smart + # Background set $bg #232425 # Background active @@ -235,7 +249,7 @@ set $fa #eff1f5 # Foreground inactive set $fi #646464 # Border active -set $bra #7a7a7a +set $bra #5a5a5a # Border inactive set $bri #000000 @@ -252,3 +266,7 @@ gaps outer 0 #smart_gaps on include /etc/sway/config.d/* +include apps + +exec "~/.config/sway/keyboard-layout-per-window.py" +exec "systemctl --user import-environment ; systemctl --user start sway-session.target" diff --git a/.config/sway/env b/.config/sway/env new file mode 100644 index 0000000..534eeee --- /dev/null +++ b/.config/sway/env @@ -0,0 +1,9 @@ +MOZ_ENABLE_WAYLAND=1 +SDL_VIDEODRIVER=wayland +SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh +XDG_CURRENT_DESKTOP=KDE +KDE_SESSION_VERSION=5 +# QT_WAYLAND_DISABLE_WINDOWDECORATION=1 +# CLUTTER_BACKEND=wayland +FREETYPE_PROPERTIES="truetype:interpreter-version=35" +_JAVA_AWT_WM_NONREPARENTING=1 diff --git a/.config/sway/input b/.config/sway/input new file mode 100644 index 0000000..0a41fb0 --- /dev/null +++ b/.config/sway/input @@ -0,0 +1,4 @@ +input 1:1:AT_Translated_Set_2_keyboard { + xkb_layout us,mk + xkb_options grp:switch,grp:caps_toggle +} diff --git a/.config/sway/keyboard-layout-per-window.py b/.config/sway/keyboard-layout-per-window.py new file mode 100755 index 0000000..15e5dfb --- /dev/null +++ b/.config/sway/keyboard-layout-per-window.py @@ -0,0 +1,42 @@ +#!/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() diff --git a/.config/sway/normal.json b/.config/sway/normal.json new file mode 100644 index 0000000..e263626 --- /dev/null +++ b/.config/sway/normal.json @@ -0,0 +1,57 @@ +{ + "id": 78, + "name": "Close tabs? — Mozilla Firefox", + "rect": { + "x": 0, + "y": 26, + "width": 1920, + "height": 1024 + }, + "focused": false, + "focus": [ + ], + "border": "normal", + "current_border_width": 0, + "layout": "none", + "orientation": "none", + "percent": 1.0, + "window_rect": { + "x": 0, + "y": 0, + "width": 1920, + "height": 1024 + }, + "deco_rect": { + "x": 1440, + "y": 0, + "width": 480, + "height": 26 + }, + "geometry": { + "x": 0, + "y": 0, + "width": 528, + "height": 147 + }, + "window": null, + "urgent": false, + "marks": [ + ], + "fullscreen_mode": 0, + "nodes": [ + ], + "floating_nodes": [ + ], + "sticky": false, + "type": "con", + "pid": 906, + "app_id": "firefox", + "visible": false, + "max_render_time": 0, + "shell": "xdg_shell", + "inhibit_idle": false, + "idle_inhibitors": { + "user": "fullscreen", + "application": "none" + } +} diff --git a/.config/sway/output b/.config/sway/output new file mode 100644 index 0000000..37efb35 --- /dev/null +++ b/.config/sway/output @@ -0,0 +1,11 @@ +### Output configuration +# +# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) +output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill +# +# Example configuration: +# +# output HDMI-A-1 resolution 1920x1080 position 1920,0 +# +# You can get the names of your outputs by running: swaymsg -t get_outputs + diff --git a/.config/sway/tabs.json b/.config/sway/tabs.json new file mode 100644 index 0000000..a4276d8 --- /dev/null +++ b/.config/sway/tabs.json @@ -0,0 +1,57 @@ +{ + "id": 8, + "name": "extrawurst\/gitui: Blazing 💥 fast terminal-ui for git written in rust 🦀 — Mozilla Firefox", + "rect": { + "x": 0, + "y": 26, + "width": 1920, + "height": 1024 + }, + "focused": false, + "focus": [ + ], + "border": "normal", + "current_border_width": 0, + "layout": "none", + "orientation": "none", + "percent": 1.0, + "window_rect": { + "x": 0, + "y": 0, + "width": 1920, + "height": 1024 + }, + "deco_rect": { + "x": 960, + "y": 0, + "width": 480, + "height": 26 + }, + "geometry": { + "x": 0, + "y": 0, + "width": 1920, + "height": 235 + }, + "window": null, + "urgent": false, + "marks": [ + ], + "fullscreen_mode": 0, + "nodes": [ + ], + "floating_nodes": [ + ], + "sticky": false, + "type": "con", + "pid": 906, + "app_id": "firefox", + "visible": false, + "max_render_time": 0, + "shell": "xdg_shell", + "inhibit_idle": false, + "idle_inhibitors": { + "user": "fullscreen", + "application": "none" + } +} diff --git a/.config/swayidle/config b/.config/swayidle/config new file mode 100644 index 0000000..a8f314c --- /dev/null +++ b/.config/swayidle/config @@ -0,0 +1,7 @@ +# ~/.config/swayidle/config +timeout 300 'swaylock -f' +timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' +before-sleep 'swaylock -f' +after-resume 'swaymsg "output * dpms on"' +unlock 'swaymsg "output * dpms on"' +lock 'swaylock -f' diff --git a/.config/swaylock/config b/.config/swaylock/config new file mode 100644 index 0000000..46471b7 --- /dev/null +++ b/.config/swaylock/config @@ -0,0 +1 @@ +color=222222