From 1b0589cb335a749bbe853b8bffe43f8114bfba66 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Thu, 23 Sep 2021 13:02:40 +0200 Subject: [PATCH] Prettified i3 config file --- i3/.config/i3/config | 165 +++++++----------- .../i3/scripts/{deviceControl.sh => dev-ctrl} | 0 2 files changed, 66 insertions(+), 99 deletions(-) rename i3/.config/i3/scripts/{deviceControl.sh => dev-ctrl} (100%) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 5632f3d..ec78c59 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -18,16 +18,13 @@ client.background #ffffff # is used in the bar {} block below. font pango:monospace 8 -# 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 +# Polybar +bar { + i3bar_command $HOME/.config/polybar/launch.sh +} -# Before i3 v4.8, we used to recommend this one as the default: -# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 -# The font above is very space-efficient, that is, it looks good, sharp and -# clear in small sizes. However, its unicode glyph coverage is limited, the old -# X core fonts rendering does not support right-to-left and this being a bitmap -# font, it doesn’t scale on retina/hidpi displays. +default_border pixel 1 +default_floating_border normal # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod @@ -39,14 +36,8 @@ bindsym $mod+Return exec urxvt bindsym $mod+Shift+q kill # start dmenu (a program launcher) -#bindsym $mod+d exec dmenu_run bindsym $mod+d exec rofi -show drun -# 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 - # change focus bindsym $mod+j focus left bindsym $mod+k focus down @@ -71,10 +62,8 @@ bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right -# split in horizontal orientation +# split in horizontal/veritcal orientation bindsym $mod+h split h - -# split in vertical orientation bindsym $mod+v split v # enter fullscreen mode for the focused container @@ -85,20 +74,12 @@ bindsym $mod+s layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split -# toggle tiling / floating +# actions between tiling/floating windows/containers bindsym $mod+Shift+space floating toggle - -# change focus between tiling / floating windows bindsym $mod+space focus mode_toggle - -# focus the parent container bindsym $mod+a focus parent -# focus the child container -#bindsym $mod+d focus child - -# Define names for default workspaces for which we configure key bindings later on. -# We use variables to avoid repeating the names in multiple places. +# Define names for default workspaces for which we configure key bindings. set $ws1 "1" set $ws2 "2" set $ws3 "3" @@ -139,78 +120,72 @@ bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) bindsym $mod+Shift+r restart # exit i3 (logs you out of your X session) -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" +bindsym $mod+Shift+e exec "i3-nagbar \ + -t warning \ + -m 'You pressed the exit shortcut. \ +Do you really want to exit i3? This will end your X session.' \ + -B 'Yes, exit i3' 'i3-msg exit'" # resize window (you can also use the mouse for that) +# These bindings trigger as soon as you enter the resize mode 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 j resize shrink width 10 px or 10 ppt - bindsym k resize grow height 10 px or 10 ppt - bindsym l resize shrink height 10 px or 10 ppt - bindsym ograve 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 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 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" + # vi keybindings + bindsym j resize shrink width 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym l resize shrink height 10 px or 10 ppt + bindsym ograve 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 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 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 "resize" -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) -#bar { -# status_command i3status -#} - -#bar { -# status_command i3blocks -#} - -bar { - i3bar_command $HOME/.config/polybar/launch.sh -} - -default_border pixel 1 -default_floating_border normal - # Status Control # `dm-tool` works with lightdm greeters only bindsym XF86ScreenSaver exec "dm-tool lock" # Screenshot -# (it deletes the screenshot file in `/tmp/` right after copying it to the clipboard) -# Note1: `scrot` doesn't work well with `compton` -# Note2: `gnome-screenshot` has problems too when runs in CLI mode -# Note3: `deepin-screenshot` ignores the `--no-notification` option -##bindsym Print --release exec "scrot -s /tmp/screenshot-$(date +%F_%T).png -zq 100 -e '$(xclip -selection c -t image/png < $f); rm $f'" -##bindsym Print --release exec gnome-screenshot -ac -d 0 -bindsym Print --release exec "screenshot_image=$(date +%F_%T).png && deepin-screenshot --no-notification -s /tmp/$screenshot_image && xclip -selection c -t image/png < /tmp/$screenshot_image && rm /tmp/$screenshot_image && unset screenshot_image" +# It deletes the screenshot file in `/tmp/` right after copying it to the +# clipboard. +# Notes: +# - `scrot` doesn't work well with `compton` +# - `gnome-screenshot` has problems too when runs in CLI mode +# - `deepin-screenshot` ignores the `--no-notification` option +bindsym Print --release exec "screenshot_image=$(date +%F_%T).png && \ + deepin-screenshot --no-notification \ + -s /tmp/$screenshot_image && \ + xclip -selection c \ + -t image/png < /tmp/$screenshot_image && \ + rm /tmp/$screenshot_image && \ + unset screenshot_image" # Speakers and Mic Controls -bindsym XF86AudioRaiseVolume exec --no-startup-id ~/.config/i3/scripts/deviceControl.sh audio up -bindsym XF86AudioLowerVolume exec --no-startup-id ~/.config/i3/scripts/deviceControl.sh audio down -bindsym XF86AudioMute exec --no-startup-id ~/.config/i3/scripts/deviceControl.sh audio mute -bindsym XF86AudioMicMute exec --no-startup-id ~/.config/i3/scripts/deviceControl.sh mic mute +set $scripts ~/.config/i3/scripts +bindsym XF86AudioRaiseVolume exec --no-startup-id $scripts/dev-ctrl audio up +bindsym XF86AudioLowerVolume exec --no-startup-id $scripts/dev-ctrl audio down +bindsym XF86AudioMute exec --no-startup-id $scripts/dev-ctrl audio mute +bindsym XF86AudioMicMute exec --no-startup-id $scripts/dev-ctrl mic mute # Screen brightness controls -bindsym XF86MonBrightnessUp exec --no-startup-id ~/.config/i3/scripts/deviceControl.sh brightness up -bindsym XF86MonBrightnessDown exec --no-startup-id ~/.config/i3/scripts/deviceControl.sh brightness down +bindsym XF86MonBrightnessUp exec --no-startup-id $scripts/dev-ctrl brightness up +bindsym XF86MonBrightnessDown exec --no-startup-id $scripts/dev-ctrl brightness down # Turn screen off bindsym XF86Launch1 exec --no-startup-id xset dpms force off +# swap two windows places +bindsym $mod+Mod1+x mark --add quickswap +bindsym $mod+x swap container with mark quickswap; [con_mark="quickswap"] focus + # Webcam 1 dropdown for_window [title="video0 - mpv"] floating enable for_window [title="video0 - mpv"] sticky enable @@ -224,25 +199,24 @@ exec_always --no-startup-id numlockx on # Note: # `exec` commands are executed in order, but asynchronously; -# In other words the commands are launched in sequence without waiting the previous command to finish. -# In case a syncronous behaviour is desired, chain the commands with `&&` or group them in a script to be -# launched an `exec` command. +# In other words the commands are launched in sequence without waiting the +# previous command to finish. +# In case a syncronous behaviour is desired, chain the commands with `&&` or +# group them in a script to be launched an `exec` command. # Background -exec --no-startup-id xwallpaper --daemon --output all --zoom "$(shuf -n1 -e $HOME/.local/share/backgrounds/*)" +exec --no-startup-id xwallpaper --daemon \ + --output all \ + --zoom "$(shuf -n1 -e $HOME/.local/share/backgrounds/*)" # Compositor exec --no-startup-id picom --config ~/.config/picom/config # Notification Manager (dunst) -exec --no-startup-id envsubst < ~/.config/dunst/dunstrc.template > ~/.config/dunst/dunstrc && dunst --config $HOME/.config/dunst/dunstrc - -# Pulseaudio -## Necessary if you have no DE (gnome, xfce, etc...) under i3. -#exec --no-startup-id pulseaudio --kill && sleep 1 && pulseaudio --start - -# Nextcloud Desktop -#exec --no-startup-id nextcloud +exec --no-startup-id envsubst < \ + ~/.config/dunst/dunstrc.template > \ + ~/.config/dunst/dunstrc && \ + dunst --config $HOME/.config/dunst/dunstrc ## Use `xprop` to determine windows paramenters. Guide below: ## https://i3wm.org/docs/userguide.html#list_of_commands @@ -295,10 +269,3 @@ for_window [instance="Steam" title="Allow game launch?"] floating enable for_window [instance="Steam" title="Allow game launch?"] border normal for_window [instance="Steam" title="Screenshot Uploader"] floating enable for_window [instance="Steam" title="Screenshot Uploader"] border normal - - - -## Custom Keybindings -# Swap Two Windows Places -bindsym $mod+Mod1+x mark --add quickswap -bindsym $mod+x swap container with mark quickswap; [con_mark="quickswap"] focus diff --git a/i3/.config/i3/scripts/deviceControl.sh b/i3/.config/i3/scripts/dev-ctrl similarity index 100% rename from i3/.config/i3/scripts/deviceControl.sh rename to i3/.config/i3/scripts/dev-ctrl