From a2290edec257829ba0f7d1aff6ce66b4c0bc5c95 Mon Sep 17 00:00:00 2001 From: Wryn Wagner Date: Thu, 17 Sep 2020 22:12:05 -0600 Subject: [PATCH] i3 config revamp; updated wallpaper references to live in ~/.config/wryn --- config/i3/config | 155 +++++++++++------------- config/i3/utils/gmux-backlight-down.sh | 1 + config/i3/utils/gmux-backlight-up.sh | 1 + config/i3/utils/lock-screen.sh | 28 +++++ config/i3/utils/xbacklight-down.sh | 1 + config/i3/utils/xbacklight-up.sh | 1 + config/xserver/screenlayout/gamedock.sh | 2 +- config/xserver/screenlayout/hdmidock.sh | 9 +- config/xserver/screenlayout/homedock.sh | 2 +- config/xserver/screenlayout/undock.sh | 2 +- config/xserver/set_randr_layout | 19 +-- config/xserver/xinitrc | 2 +- 12 files changed, 116 insertions(+), 107 deletions(-) create mode 100755 config/i3/utils/gmux-backlight-down.sh create mode 100755 config/i3/utils/gmux-backlight-up.sh create mode 100755 config/i3/utils/lock-screen.sh create mode 100755 config/i3/utils/xbacklight-down.sh create mode 100755 config/i3/utils/xbacklight-up.sh diff --git a/config/i3/config b/config/i3/config index 469545c..8198410 100644 --- a/config/i3/config +++ b/config/i3/config @@ -1,93 +1,98 @@ -# This file has been auto-generated by i3-config-wizard(1). -# It will not be overwritten, so edit it as you like. -# -# Should you change your keyboard layout some time, delete -# this file and re-run i3-config-wizard(1). -# - # i3 config file (v4) # # Please see https://i3wm.org/docs/userguide.html for a complete reference! set $mod Mod4 +set $CONFIG /home/w0ryn/.config/wryn -# 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 6 -# 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 Mono 8 +################################################################################ +## Media Keys ################################################################## +################################################################################ -# 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 --nofork - -# NetworkManager is the most popular way to manage wireless networks on Linux, -# and nm-applet is a desktop environment-independent system tray GUI for it. -exec --no-startup-id nm-applet - -# Use pactl to adjust volume in PulseAudio. +# Audio set $refresh_i3status killall -SIGUSR1 i3status + bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status -bindsym XF86AudioRewind exec --no-startup-id youtube-media-controls prev -bindsym XF86AudioForward exec --no-startup-id youtube-media-controls next -bindsym XF86AudioPlay exec --no-startup-id youtube-media-controls playpause +bindsym XF86AudioRewind exec --no-startup-id $CONFIG/prev +bindsym XF86AudioPrev exec --no-startup-id $CONFIG/prev + +bindsym XF86AudioForward exec --no-startup-id $CONFIG/next +bindsym XF86AudioNext exec --no-startup-id $CONFIG/next + +bindsym XF86AudioPlay exec --no-startup-id $CONFIG/playpause + +bindsym $mod+backslash exec pactl set-source-mute @DEFAULT_SOURCE@ toggle -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod +# Screen brightness +bindsym XF86MonBrightnessUp exec $CONFIG/backlightup +bindsym XF86MonBrightnessDown exec $CONFIG/backlightdown -# start a terminal -bindsym $mod+Return exec i3-sensible-terminal -# kill focused window +################################################################################ +## Window Management and Navigation ############################################ +################################################################################ + bindsym $mod+q kill -# start dmenu (a program launcher) -bindsym $mod+space exec --no-startup-id dmenu_run - -# change focus and move window bindsym $mod+h focus left bindsym $mod+j focus down bindsym $mod+k focus up bindsym $mod+l focus right + bindsym $mod+Shift+h move left bindsym $mod+Shift+j move down bindsym $mod+Shift+k move up bindsym $mod+Shift+l move right -# split in horizontal/vertical orientation bindsym $mod+b split h bindsym $mod+v split v -# enter fullscreen mode for the focused container bindsym $mod+f fullscreen toggle +bindsym $mod+Shift+f focus parent; fullscreen; focus child + + +mode "resize" { + bindsym h resize grow width 10 px or 10 ppt + bindsym j resize shrink height 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym l resize shrink width 10 px or 10 ppt + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + # change container layout (stacked, tabbed, toggle split) bindsym $mod+s layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split + # toggle tiling / floating bindsym $mod+Shift+space floating toggle +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + # change focus between tiling / floating windows bindsym $mod+d focus mode_toggle -# focus the parent container -bindsym $mod+a focus parent -# focus the child container -#bindsym $mod+d focus child +################################################################################ +## Workspace Management and Navigation ######################################### +################################################################################ -# 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" @@ -99,7 +104,6 @@ set $ws8 "8" set $ws9 "9" set $ws10 "10" -# switch to workspace bindsym $mod+1 workspace number $ws1 bindsym $mod+2 workspace number $ws2 bindsym $mod+3 workspace number $ws3 @@ -111,7 +115,6 @@ bindsym $mod+8 workspace number $ws8 bindsym $mod+9 workspace number $ws9 bindsym $mod+0 workspace number $ws10 -# move focused container to workspace bindsym $mod+Shift+1 move container to workspace number $ws1 bindsym $mod+Shift+2 move container to workspace number $ws2 bindsym $mod+Shift+3 move container to workspace number $ws3 @@ -123,56 +126,40 @@ bindsym $mod+Shift+8 move container to workspace number $ws8 bindsym $mod+Shift+9 move container to workspace number $ws9 bindsym $mod+Shift+0 move container to workspace number $ws10 -# reload the configuration file -bindsym $mod+Shift+c reload -# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) + +################################################################################ +## i3 Settings ################################################################# +################################################################################ + +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Do you really want to exit i3?' -B 'Yes' 'i3-msg exit'" bindsym $mod+Shift+r restart -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Do you really want to exit i3 and end X session?' -B 'Yes' 'i3-msg exit'" +bindsym $mod+Shift+c reload -# resize window (you can also use the mouse for that) -mode "resize" { - # 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 h resize grow width 10 px or 10 ppt - bindsym j resize shrink height 10 px or 10 ppt - bindsym k resize grow height 10 px or 10 ppt - bindsym l resize shrink width 10 px or 10 ppt +# i3-gaps settings - # back to normal: Enter or Escape or $mod+r - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+r mode "default" -} +for_window [class="^.*"] border pixel 2 +gaps inner 5 +gaps outer 5 -bindsym $mod+r mode "resize" - -bindsym $mod+p exec --no-startup-id feh --recursive --randomize --bg-fill /home/w0ryn/.wallpaper/* - -# Set parent container to full screen -bindsym $mod+Shift+f focus parent; fullscreen; focus child - -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) bar { status_command i3status } -# Use gmux_backlight to increase/decrease brightness -bindsym XF86MonBrightnessUp exec gmux_backlight +100 -bindsym XF86MonBrightnessDown exec gmux_backlight -100 -# Microphone Toggle -bindsym $mod+backslash exec pactl set-source-mute @DEFAULT_SOURCE@ toggle +# Terminal / Application Launcher -# Composite -exec --no-startup-id compton +bindsym $mod+Return exec i3-sensible-terminal -# Settings for gaps -for_window [class="^.*"] border pixel 2 -gaps inner 5 -gaps outer 5 +bindsym $mod+space exec --no-startup-id dmenu_run -fn 'DejaVu Sans Mono-25' + + +################################################################################ +## Miscellaneous ############################################################### +################################################################################ + +exec --no-startup-id nm-applet # network-manager-applet +exec --no-startup-id compton # composite + +bindsym $mod+p exec feh --recursive --randomize --bg-fill $CONFIG/wallpaper/* +bindsym $mod+Shift+minus exec $CONFIG/lock diff --git a/config/i3/utils/gmux-backlight-down.sh b/config/i3/utils/gmux-backlight-down.sh new file mode 100755 index 0000000..7ea3dd4 --- /dev/null +++ b/config/i3/utils/gmux-backlight-down.sh @@ -0,0 +1 @@ +gmux_backlight -100 diff --git a/config/i3/utils/gmux-backlight-up.sh b/config/i3/utils/gmux-backlight-up.sh new file mode 100755 index 0000000..83f5a21 --- /dev/null +++ b/config/i3/utils/gmux-backlight-up.sh @@ -0,0 +1 @@ +gmux_backlight +100 diff --git a/config/i3/utils/lock-screen.sh b/config/i3/utils/lock-screen.sh new file mode 100755 index 0000000..d84e1df --- /dev/null +++ b/config/i3/utils/lock-screen.sh @@ -0,0 +1,28 @@ +# requires i3lock-color +INSIDE_VER='001020' +RING_VER='004040' + +INSIDE_WRONG='200010' +RING_WRONG='4a0020' + +INSIDE='002010' +RING='103020' +LINE='8888ff' +KEYDOWN='44ff44' +KEYREMOVE='4444ff' + +TIME='aaaaaa' +DATE='888888' + +i3lock\ + -e\ + --pass-screen-keys --pass-media-keys --pass-volume-keys --pass-power-keys\ + -B 6\ + --force-clock\ + --insidevercolor=$INSIDE_VER --ringvercolor=$RING_VER --verifcolor=$INSIDE_VER\ + --insidewrongcolor=$INSIDE_WRONG --ringwrongcolor=$RING_WRONG --wrongcolor=$INSIDE_WRONG\ + --insidecolor=002010 --ringcolor=103020\ + --linecolor=$LINE\ + --timecolor=$TIME --datecolor=$DATE\ + --keyhlcolor=$KEYDOWN --bshlcolor=$KEYREMOVE\ + ; diff --git a/config/i3/utils/xbacklight-down.sh b/config/i3/utils/xbacklight-down.sh new file mode 100755 index 0000000..168215a --- /dev/null +++ b/config/i3/utils/xbacklight-down.sh @@ -0,0 +1 @@ +xbacklight - 10 diff --git a/config/i3/utils/xbacklight-up.sh b/config/i3/utils/xbacklight-up.sh new file mode 100755 index 0000000..6a591d6 --- /dev/null +++ b/config/i3/utils/xbacklight-up.sh @@ -0,0 +1 @@ +xbacklight + 10 diff --git a/config/xserver/screenlayout/gamedock.sh b/config/xserver/screenlayout/gamedock.sh index 0bdc192..1b7c19d 100755 --- a/config/xserver/screenlayout/gamedock.sh +++ b/config/xserver/screenlayout/gamedock.sh @@ -17,4 +17,4 @@ for display in $(xrandr | grep connect | awk '{print $1;}' | grep -v "$CURRENT_M xrandr --output $display --off; done; -feh --bg-fill --randomize $HOME/.wallpaper; +feh --bg-fill --randomize $HOME/.config/wryn/wallpaper; diff --git a/config/xserver/screenlayout/hdmidock.sh b/config/xserver/screenlayout/hdmidock.sh index 5c6f011..69a9474 100755 --- a/config/xserver/screenlayout/hdmidock.sh +++ b/config/xserver/screenlayout/hdmidock.sh @@ -1,5 +1,4 @@ -#!/bin/sh -NATIVE_MONITOR='eDP1'; +#!/bin/sh NATIVE_MONITOR='eDP1'; CONNECTED_MONITOR=$(xrandr | grep ' connect' | awk '{print $1;}' | grep -v "$NATIVE_MONITOR" | head -n 1); MONITOR_DIRECTION='--above'; # left-of, below, above, right-of @@ -14,11 +13,13 @@ xrandr\ --mode $(xrandr | grep -A 2 "$NATIVE_MONITOR" | sed -n '2 p' | awk '{print $1;}')\ ; +sleep 0.5 + xrandr\ --output "$CONNECTED_MONITOR"\ --rotate normal\ $MONITOR_DIRECTION $NATIVE_MONITOR\ - --mode $(xrandr | grep -A 2 "$CONNECTED_MONITOR" | sed -n '2 p' | awk '{print $1;}')\ + --mode $(xrandr | grep -A 2 "^$CONNECTED_MONITOR" | sed -n '2 p' | awk '{print $1;}')\ ; @@ -26,4 +27,4 @@ for display in $(xrandr | grep connect | awk '{print $1;}' | grep -v "$NATIVE_MO xrandr --output $display --off; done; -feh --recursive --bg-fill --randomize $HOME/.wallpaper; +feh --recursive --bg-fill --randomize $HOME/.config/wryn/wallpaper; diff --git a/config/xserver/screenlayout/homedock.sh b/config/xserver/screenlayout/homedock.sh index 722ec87..e6ca043 100755 --- a/config/xserver/screenlayout/homedock.sh +++ b/config/xserver/screenlayout/homedock.sh @@ -15,4 +15,4 @@ for display in $(xrandr | grep connect | awk '{print $1;}' | grep -v "$HOMEDOCK_ xrandr --output $display --off; done; -feh --bg-fill --randomize $HOME/.wallpaper; +feh --bg-fill --randomize $HOME/.config/wryn/wallpaper; diff --git a/config/xserver/screenlayout/undock.sh b/config/xserver/screenlayout/undock.sh index ad6461d..973f03d 100755 --- a/config/xserver/screenlayout/undock.sh +++ b/config/xserver/screenlayout/undock.sh @@ -12,4 +12,4 @@ for display in $(xrandr | grep connect | awk '{print $1;}' | grep -v "$NATIVE_MO xrandr --output $display --off; done; -feh --bg-fill --randomize $HOME/.wallpaper; +feh --bg-fill --randomize $HOME/.config/wryn/wallpaper; diff --git a/config/xserver/set_randr_layout b/config/xserver/set_randr_layout index 755ab2c..6b8af1d 100755 --- a/config/xserver/set_randr_layout +++ b/config/xserver/set_randr_layout @@ -2,29 +2,18 @@ source $HOME/.wryn/env/env.zsh XSERVER_DIR="$DOTWRYN/config/xserver" - AT_HOME(){ - xrandr -q | grep -q 'HDMI-0 connected' && xrandr -q | grep -q '3840'; + xrandr -q | grep -q 'DP2-1 connected' && xrandr -q | grep -q '3840'; } CONNECTED_TO_MONITOR() { - xrandr -q | grep -q 'HDMI-0 connected'; -} - -AT_RENT() { - xrandr -q | grep -q 'DP-[0134] connected'; + xrandr -q | grep ' connected' | grep -v 'eDP1' -q; } if AT_HOME; then - "$XSERVER_DIR/screenlayout/homedock_hdmionly.sh"; + "$XSERVER_DIR/screenlayout/homedock.sh"; elif CONNECTED_TO_MONITOR; then - if AT_RENT; then - "$XSERVER_DIR/screenlayout/workplus.sh"; - else - "$XSERVER_DIR/screenlayout/hdmidock.sh"; - fi -elif AT_RENT; then - "$XSERVER_DIR/screenlayout/workdock.sh"; + "$XSERVER_DIR/screenlayout/hdmidock.sh" '--right-of'; else; "$XSERVER_DIR/screenlayout/undock.sh"; fi diff --git a/config/xserver/xinitrc b/config/xserver/xinitrc index 8dc7f1c..dd28ca5 100644 --- a/config/xserver/xinitrc +++ b/config/xserver/xinitrc @@ -1,6 +1,6 @@ #!/bin/sh CUSTOM_DMENU_COMMANDS="$HOME/.local/custom_dmenu" -[ ! -d $CUSTOM_DMENU_COMMANDS] && mkdir $CUSTOM_DMENU_COMMANDS +[ ! -d $CUSTOM_DMENU_COMMANDS ] && mkdir $CUSTOM_DMENU_COMMANDS export PATH="$CUSTOM_DMENU_COMMANDS:$PATH"