Preparation to merge.

This commit is contained in:
Bartek Stalewski 2023-02-21 11:52:58 +01:00
parent d88cb48855
commit 9ddbe48503
9 changed files with 104 additions and 69 deletions

View file

@ -0,0 +1,56 @@
#!/bin/sh
twoscreen() {
mirror=$(printf "no\\nyes" | dmenu -c -l 2 -i -p "mirror?")
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -c -l 2 -i)
internal=$(echo "$screens" | grep -v "$external")
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
res_int_x=$(echo "$res_internal" | sed 's/x.*//')
res_int_y=$(echo "$res_internal" | sed 's/.*x//')
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
xrandr --output "$external" --auto --scale 1.0x1.0 \
--output "$internal" --auto --same-as "$external" \
--scale "$scale_x"x"$scale_y"
else
primary=$(echo "$screens" | dmenu -c -l 50 -i -p "select primary output")
secondary=$(echo "$screens" | grep -v "$primary")
direction=$(printf "left\\nright" | dmenu -c -l 2 -i -p "secondary display location")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
fi
}
onescreen() {
if [ "$2" = "native" ]; then
xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)
else
scale=$(printf "native\\n0.75\\n0.5" | dmenu -c -l 3 -i -p "scale") &&
case "$scale" in
"native") xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -);;
*) xrandr --output "$1" --auto --scale ${scale}x${scale} $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -);;
esac
fi
}
# Get all possible displays
allposs=$(xrandr -q | grep "connected")
# Get all connected screens.
screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
# If there's only one screen
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
{ onescreen "$screens" "native"; notify-send -t 2000 -u critical ' no device to switch'; exit ;}
# Get user choice including both and manual selection:
chosen=$(printf -- "%s\\nmulti" "$screens" | dmenu -c -l 5 -i -p "select output") &&
case "$chosen" in
"multi") twoscreen ;;
*) onescreen "$chosen" ;;
esac

View file

@ -1,20 +0,0 @@
output HDMI-A-0
off
output DisplayPort-1
off
output eDP
off
output DisplayPort-0
crtc 1
filter bilinear
mode 3840x2160
pos 0x0
rate 60.00
transform 0.700000,0.000000,0.000000,0.000000,0.700000,0.000000,0.000000,0.000000,1.000000
x-prop-max_bpc 8
x-prop-non_desktop 0
x-prop-scaling_mode None
x-prop-tearfree on
x-prop-underscan off
x-prop-underscan_hborder 0
x-prop-underscan_vborder 0

View file

@ -1,2 +0,0 @@
DisplayPort-0 00ffffffffffff001e6d0777dadb04000c1d0104b53c22789e3e31ae5047ac270c50542108007140818081c0a9c0d1c08100010101014dd000a0f0703e803020650c58542100001a286800a0f0703e800890650c58542100001a000000fd00383d1e8738000a202020202020000000fc004c472048445220344b0a20202001aa0203197144900403012309070783010000e305c000e3060501023a801871382d40582c450058542100001e565e00a0a0a029503020350058542100001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029
eDP 00ffffffffffff0006af3d5700000000001c0104a51f1178022285a5544d9a270e505400000001010101010101010101010101010101b43780a070383e401010350035ae100000180000000f0000000000000000000000000020000000fe0041554f0a202020202020202020000000fe004231343048414e30352e37200a0070

View file

@ -1,19 +0,0 @@
output HDMI-A-0
off
output DisplayPort-0
off
output DisplayPort-1
off
output eDP
crtc 0
mode 1920x1080
pos 0x0
primary
rate 60.03
x-prop-max_bpc 16
x-prop-non_desktop 0
x-prop-scaling_mode None
x-prop-tearfree on
x-prop-underscan off
x-prop-underscan_hborder 0
x-prop-underscan_vborder 0

View file

@ -1 +0,0 @@
eDP 00ffffffffffff0006af3d5700000000001c0104a51f1178022285a5544d9a270e505400000001010101010101010101010101010101b43780a070383e401010350035ae100000180000000f0000000000000000000000000020000000fe0041554f0a202020202020202020000000fe004231343048414e30352e37200a0070

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="scan">
<test name="family">
<string>RobotoMono Nerd Font</string>
</test>
<edit name="spacing">
<int>90</int>
</edit>
</match>
</fontconfig>

View file

@ -4,7 +4,7 @@
mkdir -p ~/.config ~/.local/bin mkdir -p ~/.config ~/.local/bin
# link config # link config
for i in autorandr clipit gtk-3.0 neofetch qtile zathura; do for i in clipit gtk-3.0 neofetch qtile zathura; do
rm -rf ~/.config/${i} rm -rf ~/.config/${i}
ln -sf $(pwd)/${i} ~/.config ln -sf $(pwd)/${i} ~/.config
done done

View file

@ -1,15 +1,16 @@
import os import os
import psutil
import subprocess import subprocess
from libqtile import bar, extension, hook, layout, widget from libqtile import bar, extension, hook, layout, widget
from libqtile.lazy import lazy
from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen
from libqtile.dgroups import simple_key_binder
from libqtile.lazy import lazy
@hook.subscribe.startup_once @hook.subscribe.startup_once
def autostart(): def autostart():
home = os.path.expanduser('~/.config/qtile/autostart.sh') home = os.path.expanduser('~/.config/qtile/autostart.sh')
subprocess.Popen([home]) subprocess.Popen([home])
mod = "mod4"
groups = [ groups = [
Group("1", label="\uf292"), Group("1", label="\uf292"),
Group("2", label="\uf738", matches=[Match(wm_class=["firefox"])]), Group("2", label="\uf738", matches=[Match(wm_class=["firefox"])]),
@ -41,6 +42,7 @@ groups = [
]), ]),
] ]
mod = "mod4"
keys = [ keys = [
# switch between windows # switch between windows
Key([mod], "h", lazy.layout.left()), Key([mod], "h", lazy.layout.left()),
@ -70,7 +72,7 @@ keys = [
Key([mod, "shift"], "Return", lazy.spawn("sh -c 'terminal_profile=work BROWSER=workfx st'")), Key([mod, "shift"], "Return", lazy.spawn("sh -c 'terminal_profile=work BROWSER=workfx st'")),
Key([mod, "control"], "a", lazy.spawn("dmenu-audio")), Key([mod, "control"], "a", lazy.spawn("dmenu-audio")),
Key([mod, "control"], "b", lazy.spawn("dmenu-bluetooth")), Key([mod, "control"], "b", lazy.spawn("dmenu-bluetooth")),
Key([mod, "control"], "e", lazy.spawn("dmenu-chars")), Key([mod, "control"], "e", lazy.spawn("dmenu-emoji")),
Key([mod, "control"], "d", lazy.spawn("dmenu-display")), Key([mod, "control"], "d", lazy.spawn("dmenu-display")),
# WM control # WM control
Key([mod], "f", lazy.window.toggle_floating()), Key([mod], "f", lazy.window.toggle_floating()),
@ -78,7 +80,6 @@ keys = [
Key([mod, "control", "shift"], "l", lazy.spawn("physlock")), Key([mod, "control", "shift"], "l", lazy.spawn("physlock")),
Key([mod, "control", "shift"], "q", lazy.shutdown()), Key([mod, "control", "shift"], "q", lazy.shutdown()),
Key([mod, "control", "shift"], "r", lazy.reload_config()), Key([mod, "control", "shift"], "r", lazy.reload_config()),
Key([mod], "r", lazy.reload_config()),
# media keys # media keys
Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")), Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")),
Key([], "XF86AudioMicMute", lazy.spawn("key-micmute")), Key([], "XF86AudioMicMute", lazy.spawn("key-micmute")),
@ -88,22 +89,8 @@ keys = [
Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 10")), Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 10")),
] ]
for i in groups[:10]: dgroups_key_binder = simple_key_binder(mod)
keys.extend( dgroups_app_rules = [] # type: list
[
# mod1 + letter of group = switch to group
Key(
[mod], i.name, lazy.group[i.name].toscreen(),
desc="Switch to group {}".format(i.name),
),
# Key( [mod, "shift"], i.name, lazy.window.togroup(i.name, switch_group=True),
# desc="Switch to & move focused window to group {}".format(i.name),
# ),
Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
desc="move focused window to group {}".format(i.name)
),
]
)
layouts = [ layouts = [
layout.Columns( layout.Columns(
@ -117,10 +104,10 @@ layouts = [
] ]
widget_defaults = dict( widget_defaults = dict(
foreground='#c7c7c7',
background='#272822', background='#272822',
font="RobotoMono Nerd Font Medium", font="RobotoMono Nerd Font Medium",
fontsize=14, fontsize=14,
foreground='#c7c7c7',
) )
extension_defaults = widget_defaults.copy() extension_defaults = widget_defaults.copy()
@ -141,7 +128,6 @@ screens = [
urgent_border='#770000', urgent_border='#770000',
), ),
widget.Prompt( widget.Prompt(
bell_style=None,
prompt='open: ', prompt='open: ',
record_history=False, record_history=False,
), ),
@ -193,7 +179,7 @@ screens = [
24, 24,
margin=[5, 5, 0, 5] margin=[5, 5, 0, 5]
), ),
wallpaper=os.environ['XDG_CONFIG_HOME'] + '/qtile/wallpaper.img', wallpaper='~/.local/share/wallpaper.jpg',
wallpaper_mode='fill', wallpaper_mode='fill',
), ),
] ]
@ -209,14 +195,37 @@ floating_layout = layout.Floating(
*layout.Floating.default_float_rules, *layout.Floating.default_float_rules,
Match(wm_class='Authenticator'), Match(wm_class='Authenticator'),
], ],
border_focus='#005577', border_focus='#feffff',
border_normal="#272822", border_normal="#272822",
border_width=2, border_width=2,
) )
auto_fullscreen = False @hook.subscribe.client_new
def _swallow(window):
pid = window.window.get_net_wm_pid()
ppid = psutil.Process(pid).ppid()
cpids = {c.window.get_net_wm_pid(): wid for wid, c in window.qtile.windows_map.items()}
for i in range(5):
if not ppid:
return
if ppid in cpids:
parent = window.qtile.windows_map.get(cpids[ppid])
if parent.window.get_wm_class()[0] != "xterm-256color":
return
parent.minimized = True
window.parent = parent
return
ppid = psutil.Process(ppid).ppid()
@hook.subscribe.client_killed
def _unswallow(window):
if hasattr(window, 'parent'):
window.parent.minimized = False
auto_fullscreen = True
auto_minimize = True auto_minimize = True
bring_front_click = False
cursor_warp = False
focus_on_window_activation = "smart" focus_on_window_activation = "smart"
follow_mouse_focus = True follow_mouse_focus = True
reconfigure_screens = True reconfigure_screens = True
wmname = "LG3D"