i3 / i3

A tiling window manager for X11
https://i3wm.org/
BSD 3-Clause "New" or "Revised" License
9.54k stars 778 forks source link

Floating window fixed ratio resize considers titlebar as part of window. #4683

Open alijadidahari opened 2 years ago

alijadidahari commented 2 years ago

I'm submitting a…

[x] Bug
[ ] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

Currently when using the fixed ratio resize (Mod+Shift+RMB) of a floating window, the ratio is calculated WITH the title bar. This results in the window getting taller when growing & getting horizontal black bars on the videos. This is not a serious issue as it can be circumvented by players that force the aspect ratio of the content to the window (like mpv) or using floating windows without title bar or even borders.

Expected Behavior

The ratio of the window resizing should ignore the title bar & keep the content aspect ratio fixed.

Reproduction Instructions

Open a video in firefox & use the pop out player(picture-in-picture) mode. Toggle the border & title bar on for the player. Resize in fixed ratio mode (by holding Mod+Shift when resizing).

Environment

Output of i3 --moreversion 2>&-:

zsh 1028 [130] % i3 --moreversion 2>&-
Binary i3 version:  4.20.1 (2021-11-03) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.20.1 (2021-11-03) (pid 714)
Loaded i3 config:
  /home/ali/.config/i3/config (main) (last modified: Sat 13 Nov 2021 09:02:12 PM +0330, 268515 seconds ago)
  /home/ali/.config/i3/modes.conf (included) (last modified: Sun 31 Oct 2021 12:37:48 PM +0330, 1421979 seconds ago)
  /home/ali/.config/i3/manip.conf (included) (last modified: Sat 30 Oct 2021 10:42:57 PM +0330, 1472070 seconds ago)
  /home/ali/.config/i3/start.conf (included) (last modified: Mon 15 Nov 2021 06:14:48 PM +0330, 105759 seconds ago)
  /home/ali/.config/i3/test.conf (included) (last modified: Fri 12 Nov 2021 06:04:06 PM +0330, 365601 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3
Main config file

# Variable Definitions
#Please see https://i3wm.org/docs/userguide.html for a complete reference!
#Should you change your keyboard layout some time, delete
#this file and re-run i3-config-wizard(1).
set $mod Mod4
set $ter 'kitty'
set $logout_menu "i3-nagbar -t warning -m 'Logout Options' -B 'Lock' 'i3lock -i .config/i3/lock.png --nofork -p win -e -f' -B 'Sleep' 'systemctl suspend' -B 'Logout' 'i3-msg exit' -B 'Reboot' 'systemctl reboot' -B 'Shutdown' 'shutdown now'"
set $mode_system (l)ock, (c)lose X, (s)leep, (h)ibernate, (r)eboot, (S)hutdown

## increase touchpad speed by increasing sensitivity
exec --no-startup-id 'libinput --set-prop 15 "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 0.8'

## auto backup of config files 
#exec --no-startup-id "cd /home/Config_Backup/; ./config_exporter.sh"

## Set BG color
exec_always --no-startup-id "feh --no-fehbg --bg-scale .config/i3/Black.png"

## screen shot
bindsym Print exec ksnip -r

## open file browser
#bindsym $mod+e exec nemo

## display & switch keyboard layout
bindsym $mod+Menu exec --no-startup-id setxkbmap ir
bindsym Control+Menu exec setxkbmap us

## open calculator
bindsym $mod+KP_Add exec --no-startup-id xcalc

## Use amixer to adjust volume and start volume icon
bindsym XF86AudioRaiseVolume exec --no-startup-id amixer set Master 5%+
bindsym XF86AudioLowerVolume exec --no-startup-id amixer set Master 5%-
bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle
bindsym XF86AudioPlay exec --no-startup-id "playerctl play-pause"
bindsym XF86AudioPrev exec --no-startup-id "playerctl position 5-"
bindsym XF86AudioNext exec --no-startup-id "playerctl position 5+"
bindsym Control+XF86AudioPrev exec --no-startup-id "playerctl previous"
bindsym Control+XF86AudioNext exec --no-startup-id "playerctl next"
bindsym XF86AudioStop exec --no-startup-id "playerctl pause -a"
#bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle
#bindsym KEY_VOLUMEUP exec --no-startup-id amixer set Master 5%+
#bindsym KEY_VOLUMEDOWN exec --no-startup-id amixer set Master 5%-

## Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

## start a terminal
bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+z exec i3-sensible-terminal

## start dmenu (a program launcher)
bindsym $mod+Control+d exec dmenu_run
#There also is the (new) i3-dmenu-desktop which only displays applications
#shipping a .desktop file. It is a wrapper around dmenu, so you need that
#installed.
#bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
#bindsym $mod+d exec j4-dmenu-desktop --dmenu="dmenu -i -fn 'DejaVu Sans-10' -nf '#FFFFFF' -nb '#000000' -sb '#2EBB75' -sf '#000000'"

## WorkSpace Variable
#Define names for default workspaces for which we configure key bindings later on.
#We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

## config reload & i3 restart
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart

## open always floating & no border
for_window [class="firefox" instance="Toolkit"] border none, exec i3-msg sticky toggle
for_window [class="mpv" instance="gl"] floating enable, border none, exec i3-msg sticky toggle
for_window [class="XCalc" instance="xcalc"] floating enable, border none
for_window [class="Pavucontrol" instance="pavucontrol"] floating enable, border none
for_window [class="Yad" instance="yad"] floating enable, border none
for_window [class="copyq" instance="copyq"] floating enable, border none

## sticky window
bindsym $mod+Control+space sticky toggle

## urgent workspace
force_display_urgency_hint 2500 ms
bindsym $mod+Shift+x [urgent=latest] focus

#template for running command from terminal
#bindsym $mod+q exec "$ter -e iwctl"

## window title icons
#for_window [all] title_window_icon on
for_window [all] title_window_icon padding 5px

# clipboard manager
bindsym Menu exec copyq toggle

include modes.conf
include manip.conf
include start.conf
#include Default_Colours.conf
include test.conf

bindsym $mod+m bar mode toggle
bindsym XF86WebCam exec ./cam.sh
bindsym $mod+n exec --no-startup-id ./cam.sh
#bindsym $mod+n exec 'mpv av://v4l2:/dev/video0 --profile=low-latency --untimed'
#bindsym XF86WebCam exec $ter

## i3bar
#Start i3bar to display a workspace bar (plus the system information i3status
#finds out, if available)
bar {
    colors {
   background #000000
   statusline #FFFFFF
   separator  #FFFFFF
####                 
   focused_workspace  #000088 #000088 #FFFFFF
   active_workspace   #333333 #222222 #FFFFFF
   inactive_workspace #333333 #222222 #FFFFFF
   urgent_workspace   #2F343A #900000 #FFFFFF
   binding_mode       #2EBB75 #2EBB75 #000000
 }

    font pango:monospace Bold comdensed 8
#    network monitor code from https://raw.githubusercontent.com/i3/i3status/master/contrib/net-speed.sh
#   status_command exec /home/ali/.config/i3/net-speed.sh
#   status_command exec /home/ali/.config/i3/net-speed-py.sh
#   for setup without network monitor use i3status
#   status_command i3status
    position top
    mode hide
    status_command py3status
    bindsym button3 exec $ter
#   bindsym button2 exec $logout_menu
    bindsym button2 mode "$mode_system"
    bindsym button8 exec i3-dmenu-desktop
    bindsym button1 exec nop
#   bindsym button3 move container to workspace number $ws6
}
Modes.conf include file
# resize window (you can also use the mouse for that)
mode "Resizer" {
        #These bindings trigger as soon as you enter the resize mode
        #Pressing left will shrink the window’s width.
        #Pressing right will grow the window’s width.
        #Pressing up will shrink the window’s height.
        #Pressing down will grow the window’s height.
        bindsym j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 5 px or 5 ppt
        bindsym l resize shrink height 5 px or 5 ppt
        bindsym semicolon resize grow width 10 px or 10 ppt

        #same bindings, but for the arrow keys
        bindsym Left resize shrink width 10 px or 10 ppt
        bindsym Down resize grow height 5 px or 5 ppt
        bindsym Up resize shrink height 5 px or 5 ppt
        bindsym Right resize grow width 10 px or 10 ppt

        #back to normal: Enter or Escape or $mod+r
        bindsym Return mode "default"
        bindsym Escape mode "default"
        bindsym $mod+r mode "default"
}
bindsym $mod+r mode "Resizer"

# Application openner mode
mode "Openner" {
    bindsym f exec firefox
    bindsym t exec $ter
    bindsym x kill
    bindsym g exec telegram-desktop
    bindsym i exec $ter -e iwctl
    bindsym c exec xcalc
    bindsym e exec nemo
    bindsym n exec notepadpp
    bindsym s exec steam
    bindsym r exec retroarch

    bindsym $mod+1 workspace number $ws1
    bindsym $mod+2 workspace number $ws2
    bindsym $mod+3 workspace number $ws3
    bindsym $mod+4 workspace number $ws4
    bindsym $mod+5 workspace number $ws5
    bindsym $mod+6 workspace number $ws6
    bindsym $mod+7 workspace number $ws7
    bindsym $mod+8 workspace number $ws8
    bindsym $mod+9 workspace number $ws9
    bindsym $mod+0 workspace number $ws10

    #exit Openner mode: "Enter" or "Escape"
    bindsym Return mode "default"
    bindsym Escape mode "default"
    bindsym $mod+o mode "default"
}
bindsym $mod+o mode "Openner"

# Shutdown mode
mode "$mode_system" {
    bindsym l exec "playerctl pause -a", exec --no-startup-id "i3lock -i .config/i3/lock.png --nofork -p win -e -f", mode "default"
    bindsym Shift+l exec --no-startup-id "i3lock -i .config/i3/lock.png --nofork -p win -e -f", mode "default"
    bindsym s exec --no-startup-id systemctl suspend, mode "default"
    bindsym c exec --no-startup-id i3-msg exit, mode "default"
    bindsym h exec --no-startup-id i3exit hibernate, mode "default"
    bindsym r exec --no-startup-id reboot, mode "default"
    bindsym Shift+s exec --no-startup-id systemctl shutdown, mode "default"
    #bindsym u exec --no-startup-id i3exit switch_user, mode "default"

    #exit Shutdown mode: "Enter" or "Escape"
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+Shift+e mode "$mode_system"

start.conf include file
# xss-lock grabs
#xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
#screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -i .config/i3/lock.png --nofork -p win -e -f

# start touchpad gestures
exec --no-startup-id libinput-gestures-setup start

# start qjackctl
#exec --no-startup-id qjackctl

# start clipboard monitor
#exec --no-startup-id clipmenud
#exec --no-startup-ip parcellite
#exec --no-startup-id xfce4-clipman
exec --no-startup-id copyq

# display & switch keyboard layout
exec_always --no-startup-id sbxkb

# volume control
#exec --no-startup-id volumeicon
exec --no-startup-id volctl

# GUAKE dropdown terminal
exec --no-startup-id guake

# Starting workspaces
#exec --no-startup-id i3-msg "workspace 4; exec $ter -e "ping 146.66.155.1"; exec $ter -e "ping 192.168.1.1"; exec $ter -e "htop"; workspace 2; exec firefox; workspace 1; exec $ter -e mc"
exec --no-startup-id i3-msg "workspace 2; exec firefox; workspace 1; exec $ter -e mc"

# Telegram
exec --no-startup-id telegram-desktop

# compositor xcompmgr
exec --no-startup-id xcompmgr -f -D 10 -I 0.1
manip.conf include file
#bindsym to bindcode table from top left on keyboard
#1~0 ----> 10~19
#q~p ----> 24~33
#a~l ----> 38~46
#z~m ---> 52~58

## kill focused window
bindsym $mod+Shift+q kill
bindsym $mod+x kill
bindsym --release button2 kill
bindsym --whole-window $mod+button2 kill

## change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
bindsym --whole-window $mod+button4 focus right
bindsym --whole-window $mod+button5 focus left
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

## move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

# cycle through workspaces
bindsym $mod+Control+Left workspace prev
bindsym $mod+Control+Right workspace next
bindsym --whole-window $mod+control+button4 workspace prev
bindsym --whole-window $mod+control+button5 workspace next
workspace_auto_back_and_forth yes

# switch to workspace
bindcode $mod+10 workspace number $ws1
bindcode $mod+11 workspace number $ws2
bindcode $mod+12 workspace number $ws3
bindcode $mod+13 workspace number $ws4
bindcode $mod+14 workspace number $ws5
bindcode $mod+15 workspace number $ws6
bindcode $mod+16 workspace number $ws7
bindcode $mod+17 workspace number $ws8
bindcode $mod+18 workspace number $ws9
bindcode $mod+19 workspace number $ws10

# move focused container to workspace & switch
bindcode $mod+Control+10 move container to workspace number $ws1  ; workspace number $ws1
bindcode $mod+Control+11 move container to workspace number $ws2  ; workspace number $ws2
bindcode $mod+Control+12 move container to workspace number $ws3  ; workspace number $ws3
bindcode $mod+Control+13 move container to workspace number $ws4  ; workspace number $ws4
bindcode $mod+Control+14 move container to workspace number $ws5  ; workspace number $ws5
bindcode $mod+Control+15 move container to workspace number $ws6  ; workspace number $ws6
bindcode $mod+Control+16 move container to workspace number $ws7  ; workspace number $ws7
bindcode $mod+Control+17 move container to workspace number $ws8  ; workspace number $ws8
bindcode $mod+Control+18 move container to workspace number $ws9  ; workspace number $ws9
bindcode $mod+Control+19 move container to workspace number $ws10; workspace number $ws10 

# move focused container to workspace
bindcode $mod+Shift+10 move container to workspace number $ws1
bindcode $mod+Shift+11 move container to workspace number $ws2
bindcode $mod+Shift+12 move container to workspace number $ws3
bindcode $mod+Shift+13 move container to workspace number $ws4
bindcode $mod+Shift+14 move container to workspace number $ws5
bindcode $mod+Shift+15 move container to workspace number $ws6
bindcode $mod+Shift+16 move container to workspace number $ws7
bindcode $mod+Shift+17 move container to workspace number $ws8
bindcode $mod+Shift+18 move container to workspace number $ws9
bindcode $mod+Shift+19 move container to workspace number $ws10

# move focused container to next workspace and switch
bindsym $mod+Mod1+Right move container workspace next; workspace next
bindsym $mod+Mod1+Left move container workspace prev; workspace prev
bindcode $mod+Mod1+38 move container workspace prev; workspace prev
bindcode $mod+Mod1+40 move container workspace next; workspace next
#bindsym $mod+Mod1+button4 move container workspace next; workspace next
#bindsym $mod+Mod1+button5 move container workspace prev; workspace prev
bindsym $mod+Mod1+button4 exec .config/i3/i3MoveNext.sh 1
bindsym $mod+Mod1+button5 exec .config/i3/i3MoveNext.sh -1

# focus the parent & child container
bindsym $mod+a focus parent
bindsym $mod+Shift+a focus child

# split in horizontal & vertical orientation
bindsym $mod+h split h
bindsym $mod+v split v

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+t layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+z floating toggle
bindsym $mod+button3 floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# toggle border
bindsym $mod+Control+b border none
bindsym $mod+b border toggle

# windows alt+tab
bindsym $mod+Tab workspace back_and_forth
bindsym Mod1+Tab workspace back_and_forth

# move to last workspace
bindsym $mod+Control+Tab move container to workspace back_and_forth;  workspace back_and_forth
theme test.conf include file
#test.conf
#https://thomashunter.name/i3-configurator/

# Fonts
#Font for window titles. Will also be used by the bar unless a different font
#is used in the bar {} block below.
#font pango:monospace Bold Condensed 9

#This font is widely installed, provides lots of unicode glyphs, right-to-left
#text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:DejaVu Sans Bold Mono 8

# screen Lock
bindsym $mod+control+l exec i3lock -i .config/i3/lock.png --nofork -p win -e -f

# Window Colours
#                                              
client.focused           #000088    #000088     #ffffff     #2e9ef4     #000088
client.focused_inactive  #333333    #5f676a     #ffffff     #484e50     #5f676a
client.unfocused         #333333    #333333     #ffffff     #292d2e     #333333
client.urgent            #900000    #900000     #ffffff     #900000     #900000
client.placeholder       #000000    #0c0c0c     #ffffff     #000000     #0c0c0c
client.background        #ffffff

# Dmenu colours
bindsym $mod+d exec j4-dmenu-desktop --dmenu="dmenu -i -fn 'DejaVu Sans-10' -nf '#FFFFFF' -nb '#000000' -sb '#2EBB75' -sf '#000000'"
#bindsym $mod+n exec "i3-dmenu-desktop -nf '#FFFFFF' -nb '#000000' -sb '#2EBB75' -sf '#000000' -fn 'monospace-10'"
#bindsym $mod+m exec j4-dmenu-desktop

Logfile URL: 
- Linux Distribution & Version: Arch linux, latest of both normal(5.15.2) & lts(5.10.79) kernels , Problem existed since around 5.13ish (My install date of i3)
- Are you using a compositor (e.g., xcompmgr or compton): problem exist with and without xcompmgr 
i3bot commented 2 years ago

I don’t see a link to logs.i3wm.org. Did you follow https://i3wm.org/docs/debugging.html? (In case you actually provided a link to a logfile, please ignore me.)