Last active
October 1, 2023 09:13
-
-
Save taoy/8b44beef41f833280e0edc96c8e3306a to your computer and use it in GitHub Desktop.
vcxsrv + i3 on WSL/WSL2 Debian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .config/i3/config | |
# 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 somewhen, delete | |
# this file and re-run i3-config-wizard(1). | |
# | |
# i3 config file (v4) | |
# | |
# Please see http://i3wm.org/docs/userguide.html for a complete reference! | |
set $mod Control+Mod1 | |
# Font for window titles. Will also be used by the bar unless a different font | |
# is used in the bar {} block below. ISO 10646 = Unicode | |
# The font above is very space-efficient, that is, it looks good, sharp and | |
# clear in small sizes. However, if you need a lot of unicode glyphs or | |
# right-to-left text rendering, you should instead use pango for rendering and | |
# chose a FreeType font, such as: | |
font pango:IBM 3270 Medium | |
# set desktop background | |
exec --no-startup-id feh --bg-fill -z /home/taoy/Pictures/Desktop/*.jpg | |
exec --no-startup-id compton -bCG | |
# Use Mouse+$mod to drag floating windows to their wanted position | |
floating_modifier $mod | |
# start a terminal and other applications | |
bindsym $mod+Return exec i3-sensible-terminal | |
bindsym $mod+t exec thunar | |
bindsym $mod+w exec --no-startup-id feh --bg-fill -z /home/taoy/Pictures/Desktop/*.jpg | |
# kill focused window | |
bindsym $mod+Shift+q kill | |
# start dmenu (a program launcher) | |
bindsym $mod+d exec --no-startup-id j4-dmenu-desktop --dmenu="dmenu -b" | |
# change focus | |
bindsym $mod+h focus left | |
bindsym $mod+j focus down | |
bindsym $mod+k focus up | |
bindsym $mod+l focus right | |
# alternatively, you can use the cursor keys: | |
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+h move left | |
bindsym $mod+Shift+j move down | |
bindsym $mod+Shift+k move up | |
bindsym $mod+Shift+l move right | |
# alternatively, you can use the cursor keys: | |
bindsym $mod+Shift+Left move left | |
bindsym $mod+Shift+Down move down | |
bindsym $mod+Shift+Up move up | |
bindsym $mod+Shift+Right move right | |
# split in horizontal orientation | |
bindsym $mod+g split h | |
# split in vertical orientation | |
bindsym $mod+v split v | |
# enter fullscreen mode for the focused container | |
bindsym $mod+f fullscreen | |
# change container layout (stacked, tabbed, toggle split) | |
bindsym $mod+s layout stacking | |
bindsym $mod+e layout toggle split | |
# toggle tiling / floating | |
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 | |
# 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 | |
#scratchpad and other settings | |
bindsym $mod+minus scratchpad show | |
bindsym $mod+Shift+minus move scratchpad | |
bindsym Mod1+Tab workspace next | |
bindsym Mod1+Shift+Tab workspace prev | |
workspace_auto_back_and_forth yes | |
bindsym $mod+y border toggle | |
bindsym $mod+u border normal | |
#new_window pixel 2 | |
new_float normal | |
focus_follows_mouse no | |
for_window [window_role="xfce4-terminal"] border normal | |
for_window [window_role="browser"] border pixel 4 | |
for_window [window_role="pop-up"] floating enable border normal | |
for_window [class="Smuxi-frontend-gnome"] border normal 0 px | |
for_window [class="Hamster-time-tracker"] floating enable, border normal 1px | |
for_window [title="Time Tracker"] floating enable | |
hide_edge_borders vertical | |
#Colours | |
# class border backgr. text indicator | |
# 1FCF59 | |
client.focused #1fcf59 #1fcf59 #ffffff #1fcf59 | |
client.focused_inactive #123456 #123456 #ffffff #123456 | |
client.unfocused #123456 #123456 #ffffff #123456 | |
client.urgent #F86A59 #F86A59 #ffffff #000000 | |
# Reload the configuration file | |
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'" | |
# Exit i3 and VcxSrv Together (Thanks for https://gist.github.com/marfillaster/85a3da3a19902236655db1232fa9d8df) | |
bindsym $mod+Shift+e exec "taskkill.exe /IM vcxsrv.exe /T" | |
# 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 shrink width 15 px or 15 ppt | |
bindsym j resize grow height 15 px or 15 ppt | |
bindsym k resize shrink height 15 px or 15 ppt | |
bindsym l resize grow width 15 px or 15 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 | |
bindsym Return mode "default" | |
bindsym Escape mode "default" | |
} | |
bindsym $mod+r mode "resize" | |
#move floating windows with keys | |
mode "move" { | |
bindsym $mod+Tab focus right | |
bindsym h move left | |
bindsym j move down | |
bindsym k move up | |
bindsym l move right | |
bindsym Return mode "default" | |
bindsym Escape mode "default" | |
} | |
bindsym $mod+m mode "move" | |
# i3pystatus | |
bar { | |
font pango:FontAwesome Regular 10 | |
status_command ~/.config/i3pystatus/config.py | |
} | |
# Autostart | |
exec --no-startup-id i3-msg "exec uim-toolbar-gtk3" | |
exec --no-startup-id i3-msg "workspace 1;exec i3-sensible-terminal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# .config/i3pystatus/config.py | |
# | |
import subprocess | |
import os | |
import os.path | |
from i3pystatus import Status | |
status = Status() | |
status.register("clock", | |
format=" - %a %d-%m-%Y ", | |
color='#61AEEE', | |
interval=120,) | |
status.register("clock", | |
format=" %H:%M", | |
color='#C678DD', | |
interval=30,) | |
status.register("mem", | |
color="#999999", | |
warn_color="#E5E500", | |
alert_color="#FF1919", | |
format=" {avail_mem}/{total_mem} GB", | |
divisor=1073741824,) | |
status.register("load", | |
format=" {tasks}",) | |
status.register("load", | |
format=" {avg5}/{avg15}",) | |
status.register("cpu_usage", | |
format=" {usage}%",) | |
status.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aunch.bat | |
@echo off | |
pwsh -f "C:\PATH\TO\I3Launch.pwsh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Env:PATH += ";C:\Program Files\VcXSrv" | |
vcxsrv :0 -fullscreen -wgl -clipboard -ac +xinerama | |
debian run ~/.scripts/wm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Env:PATH += ";C:\Program Files\VcXSrv" | |
vcxsrv :0 -fullscreen -wgl -clipboard -ac | |
debian run ~/.scripts/wm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set shell = CreateObject("WScript.Shell" ) | |
shell.Run """C:\Program Files\VcXsrv\vcxsrv.exe"" :0 -fullscreen -wgl", 0, false | |
shell.Run "debian -c "" ~/.scripts/wm""", 0, false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# .scripts/wm | |
export DISPLAY=:0 | |
source ~/.bashrc | |
cd | |
i3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# .scripts/wm | |
# set -euo pipefail | |
source ~/.bashrc | |
dbus_status=$(service dbus status) | |
if [[ $dbus_status = *"is not running"* ]]; then | |
sudo service dbus --full-restart | |
fi | |
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0 | |
export LIBGL_ALWAYS_INDIRECT=1 | |
cd | |
i3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment