mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-18 10:47:31 -08:00
update for dynamic workspace and polybar switching
This commit is contained in:
parent
3488a3b4b3
commit
d6af01cec9
@ -3,4 +3,4 @@ readme.md
|
|||||||
.git
|
.git
|
||||||
provision
|
provision
|
||||||
additional-setup.md
|
additional-setup.md
|
||||||
vars
|
.gen
|
||||||
|
41
.chezmoiscripts/run_before_00_i3_gen.py.tmpl
Executable file
41
.chezmoiscripts/run_before_00_i3_gen.py.tmpl
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import json
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
# save needed information in a dictionary
|
||||||
|
i3_dict = {}
|
||||||
|
|
||||||
|
def pri_sec_monitor():
|
||||||
|
# save output of xrandr
|
||||||
|
output = str(subprocess.check_output("xrandr", shell=True))
|
||||||
|
primary = []
|
||||||
|
secondary = []
|
||||||
|
# Get name of primary and secondary monitor
|
||||||
|
for row in output.split('\\n'):
|
||||||
|
if " connected" in row and "primary" in row:
|
||||||
|
primary.append(row.split(" ")[0])
|
||||||
|
if " connected" in row and "primary" not in row:
|
||||||
|
secondary.append(row.split(" ")[0])
|
||||||
|
# If we only have on monitor set primary and secondary
|
||||||
|
# to the one monitor
|
||||||
|
if len(primary) == 1 and len(secondary) == 0:
|
||||||
|
secondary = primary
|
||||||
|
elif len(primary) == 0 and len(secondary) == 1:
|
||||||
|
primary = secondary
|
||||||
|
elif len(primary) != 1 or len(secondary) != 1:
|
||||||
|
print("Error: i3_gen/pri_sec_monitor")
|
||||||
|
return "ERROR", "ERROR"
|
||||||
|
return primary[0], secondary[0]
|
||||||
|
|
||||||
|
# pri_sec_monitor
|
||||||
|
monitors = pri_sec_monitor()
|
||||||
|
i3_dict["disp_pri"] = monitors[0]
|
||||||
|
i3_dict["disp_sec"] = monitors[1]
|
||||||
|
|
||||||
|
# write result to json
|
||||||
|
p = pathlib.Path('{{ .chezmoi.sourceDir }}/.gen/i3.json')
|
||||||
|
p.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with open(p, 'w') as f:
|
||||||
|
json.dump(i3_dict, f, indent=4, sort_keys=True)
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1 @@
|
|||||||
vars/*
|
.gen
|
||||||
!vars/.keep
|
|
||||||
|
@ -28,5 +28,5 @@ alias n="nnn -d -e -H -r"
|
|||||||
# Chezmoi
|
# Chezmoi
|
||||||
alias cmc="chezmoi cd"
|
alias cmc="chezmoi cd"
|
||||||
alias cmd="chezmoi apply --verbose --dry-run"
|
alias cmd="chezmoi apply --verbose --dry-run"
|
||||||
alias cma="chezmoi apply --verbose"
|
alias cma="chezmoi apply"
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{{- $i3:= include ".gen/i3.json" | mustFromJson -}}
|
||||||
|
|
||||||
# i3 config file (v4)
|
# i3 config file (v4)
|
||||||
# TODO: add scratchpads (terminal, password manager, discord, task)
|
# TODO: add scratchpads (terminal, password manager, discord, task)
|
||||||
|
|
||||||
@ -5,19 +7,13 @@
|
|||||||
#----- VARIABLES
|
#----- VARIABLES
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
set $HOME /home/tstarr
|
set $HOME {{ .chezmoi.homeDir }}
|
||||||
|
|
||||||
#set $DISP_PRI DP-4
|
set $DISP_PRI {{ $i3.disp_pri }}
|
||||||
#set $DISP_SEC HDMI-0
|
set $DISP_SEC {{ $i3.disp_sec }}
|
||||||
|
|
||||||
set $DISP_PRI HDMI-0
|
set $BOR_WIDTH 4
|
||||||
set $DISP_SEC DP-4
|
set $GAP_INNER 4
|
||||||
|
|
||||||
#set $DISP_PRI HDMI-0
|
|
||||||
#set $DISP_SEC HDMI-0
|
|
||||||
|
|
||||||
set $BOR_WIDTH 2
|
|
||||||
set $GAP_INNER 2
|
|
||||||
|
|
||||||
set $mod Mod4
|
set $mod Mod4
|
||||||
|
|
||||||
@ -111,7 +107,7 @@ for_window [class="Steam"] move container to workspace "1:game"
|
|||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
# i3 utility commands
|
# i3 utility commands
|
||||||
bindsym $mod+Ctrl+r restart
|
bindsym $mod+Ctrl+r exec chezmoi apply && i3-msg restart
|
||||||
bindsym $mod+Ctrl+q exit
|
bindsym $mod+Ctrl+q exit
|
||||||
bindsym $mod+Ctrl+h resize shrink width 50
|
bindsym $mod+Ctrl+h resize shrink width 50
|
||||||
bindsym $mod+Ctrl+j resize shrink height 50
|
bindsym $mod+Ctrl+j resize shrink height 50
|
||||||
@ -190,6 +186,8 @@ bindsym $mod+b exec --no-startup-id $HOME/.config/i3/scripts/scratch.sh \
|
|||||||
#----- AUTOSTART WITH I3
|
#----- AUTOSTART WITH I3
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
exec --no-startup-id $HOME/.config/i3/scripts/xrandr.sh
|
exec --no-startup-id "$HOME/.config/i3/scripts/xrandr.sh && \
|
||||||
exec_always --no-startup-id $HOME/.config/i3/scripts/polybar.sh
|
chezmoi apply && \
|
||||||
exec_always --no-startup-id nitrogen --restore
|
i3-msg restart && \
|
||||||
|
$HOME/.config/i3/scripts/polybar.sh"
|
||||||
|
exec_always --no-startup-id nitrogen --restore
|
||||||
|
@ -7,4 +7,4 @@ killall -q polybar
|
|||||||
while pgrep -x polybar >/dev/null; do sleep 1; done
|
while pgrep -x polybar >/dev/null; do sleep 1; done
|
||||||
|
|
||||||
# Launch polybar
|
# Launch polybar
|
||||||
polybar -c ~/.config/polybar/dracula &
|
polybar -c {{ .chezmoi.homeDir }}/.config/polybar/dracula &
|
@ -1,5 +1,7 @@
|
|||||||
|
{{- $i3:= include ".gen/i3.json" | mustFromJson -}}
|
||||||
|
|
||||||
[bar/fullbar]
|
[bar/fullbar]
|
||||||
monitor = HDMI-0
|
monitor = {{ $i3.disp_sec }}
|
||||||
include-file = ~/.config/polybar/common
|
include-file = ~/.config/polybar/common
|
||||||
|
|
||||||
background = #bb282a36
|
background = #bb282a36
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
echo "Hello World!"
|
|
@ -1 +0,0 @@
|
|||||||
keep
|
|
Loading…
x
Reference in New Issue
Block a user