diff options
| author | Akshay Nair <phenax5@gmail.com> | 2020-12-20 20:56:53 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2020-12-20 20:56:53 +0530 |
| commit | 6f32887a0ea07ea8d5a792c525ff66284cfac5e6 (patch) | |
| tree | daae583af282fc2421bdb16f6288bc763fc0f2a6 | |
| parent | 4e5ca7125a9709dc39709743e06522ec39656ebc (diff) | |
| download | nixos-config-6f32887a0ea07ea8d5a792c525ff66284cfac5e6.tar.gz nixos-config-6f32887a0ea07ea8d5a792c525ff66284cfac5e6.zip | |
Fixes autostart and x init stuff
| -rw-r--r-- | configuration.nix | 27 | ||||
| -rw-r--r-- | external/xconfig/Xmodmap | 8 | ||||
| -rw-r--r-- | external/xconfig/Xresources | 57 | ||||
| -rwxr-xr-x | external/xconfig/init.sh | 26 | ||||
| -rwxr-xr-x | packages/dwm/autostart.sh | 104 | ||||
| m--------- | packages/dwm/source | 0 |
6 files changed, 219 insertions, 3 deletions
diff --git a/configuration.nix b/configuration.nix index 4e31653..1f482c2 100644 --- a/configuration.nix +++ b/configuration.nix @@ -10,6 +10,13 @@ let shotkey = pkgs.callPackage ./packages/shotkey/pkg.nix {}; dwm = pkgs.callPackage ./packages/dwm/pkg.nix {}; st = pkgs.callPackage ./packages/st/pkg.nix {}; + windowManagers = { + dwm = '' + while true; do + (ssh-agent dwm &>> /tmp/dwm.log) || break; + done + ''; + }; in { imports = [ ./hardware-configuration.nix @@ -47,10 +54,19 @@ in { syntaxHighlighting.enable = true; histFile = "~/.config/zshhistory"; histSize = 50000; - interactiveShellInit = "source ~/nixos/external/zsh/zshrc"; + interactiveShellInit = ''source ~/nixos/external/zsh/zshrc''; promptInit = ""; - }; + loginShellInit = '' + setup_dwm() { + echo "~/nixos/external/xconfig/init.sh; ${windowManagers.dwm}" > ~/.xinitrc; + } + case "$(tty)" in + /dev/tty1) setup_dwm && startx ;; + *) echo "No tty for u" ;; + esac; + ''; + }; # X11 config services.xserver = { @@ -62,8 +78,12 @@ in { tapping = true; naturalScrolling = false; }; - # xkbOptions = "eurosign:e"; }; + fonts.fonts = with pkgs; [ + jetbrains-mono + cozette + noto-fonts-emoji + ]; # Enable CUPS to print documents. # services.printing.enable = true; @@ -125,6 +145,7 @@ in { firefox w3m xorg.xrandr + xorg.xmodmap mpv sxiv diff --git a/external/xconfig/Xmodmap b/external/xconfig/Xmodmap new file mode 100644 index 0000000..8516782 --- /dev/null +++ b/external/xconfig/Xmodmap @@ -0,0 +1,8 @@ +clear Lock + +keycode 66 = Escape NoSymbol Escape +! keycode 66 = Hyper_L + +remove mod4 = Hyper_L +add mod3 = Hyper_L + diff --git a/external/xconfig/Xresources b/external/xconfig/Xresources new file mode 100644 index 0000000..ab3701b --- /dev/null +++ b/external/xconfig/Xresources @@ -0,0 +1,57 @@ + + +#define bg #0f0c19 +#define fg #d8dee9 +#define acc #4e3aA3 +! #383F6B +! #5587BA + +! Special +*.foreground: fg +*.background: bg +*.cursorColor: fg +*.accent: acc + +! Colors +*.color0: #15121f +*.color8: #555555 + +*.color1: #e06c75 +*.color9: #bf616a + +*.color2: #98C379 +*.color10: #a3be8c + +*.color3: #E5C07B +*.color11: #f7b731 + +*.color4: #60a3bc +*.color12: #5e81ac + +*.color5: #4e3aA3 +*.color13: #4e3aA3 + +*.color6: #56B6C2 +*.color14: #0fb9b1 + +*.color7: #ABB2BF +*.color15: #ebdbb2 + +dmenu.background: bg +dmenu.foreground: fg +dmenu.selbackground: acc +dmenu.selforeground: fg + +dmenu.highlightbg: bg +dmenu.highlightfg: acc +dmenu.highlightselbg: acc +dmenu.highlightselfg: bg + +dwm.normbordercolor: bg +dwm.normbgcolor: bg +dwm.normfgcolor: fg + +dwm.selbordercolor: acc +dwm.selbgcolor: acc +dwm.selfgcolor: fg + diff --git a/external/xconfig/init.sh b/external/xconfig/init.sh new file mode 100755 index 0000000..d51f6df --- /dev/null +++ b/external/xconfig/init.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env sh + +NIX_X="$HOME/nixos/external/xconfig"; + +# Xresources (theme) +xrdb -merge $NIX_X/Xresources; + +# Xmodmap (keymapping) +xmodmap $NIX_X/Xmodmap; + +# No screen saver +xset s off; +xset -dpms; +xset s noblank; + +# Typing rate +xset r rate 350 30; + +# Display settings +# ~/scripts/commands/:day + +# Sound +#~/scripts/sound.sh mic-vol full; +#~/scripts/sound.sh mute-mic; +#~/scripts/sound.sh mute; + diff --git a/packages/dwm/autostart.sh b/packages/dwm/autostart.sh new file mode 100755 index 0000000..78a54c8 --- /dev/null +++ b/packages/dwm/autostart.sh @@ -0,0 +1,104 @@ +# source ~/.zshrc; + +##### Helpers {{{ +action="$1"; + +# Is logout command (Cleanup) +is_kill() { [[ "$action" == "kill" ]]; } + +# Focus on a tag/ws +focus_tag() { [[ ! -z "$1" ]] && dwmc view $(($1 - 1)); sleep 0.2; } + +# Only run when there are no windows on the screen +on_startup() { is_kill || [[ "$(wmctrl -l | wc -l)" = "0" ]] && $@ & } + +# Run only once. If an instance is already running, noop +once() { + local name=$1; shift; + if (is_kill); then + killall "$name"; + else + pgrep $name || $@ & + fi; +} + +# Kill previous instance and run again +run() { + local name=$1; shift; + [[ ! -z "$name" ]] && killall -9 $name && sleep 0.05; + is_kill || $@ & +} +# }}} + + +##### Autostart {{{ + echo "[Autostart]: Running daemons"; + + # Wallpaper + run "" ~/.fehbg; + + # Key daemon + run "shotkey" shotkey; + + # Dwm blocks status text + run "dwmblocks" dwmblocks; + + # Notification daemon + run "dunst" dunst -config ~/.config/dunst/dunstrc; + + # Compositor + run "picom" picom --experimental-backends --config ~/.config/compton.conf; + + # Cron jobs + run "crond" crond -n -f ~/.config/crontab/crontab; + + # Battery watcher + run "" ~/scripts/battery-watch.sh start; + + # Disk automount + once "udiskie" ~/.bin/with_zsh udiskie; + + # Clipboard history + once "clipmenud" clipmenud; + + # Network manager applet + once "nm-applet" nm-applet; + + # Syncthing + run "syncthing" syncthing -logflags=0 -no-browser 2>&1 >/dev/null; + + # Torrent daemon + #once "btpd" btpd -d "$HOME/.config/btpd"; + once "transmission" transmission-daemon --download-dir ~/Downloads/dl; + + # Music daemon + once "mpd" mpd ~/.config/mpd/mpd.conf --stdout --no-daemon; + + # Hide mouse pointer + once "unclutter" unclutter; +# }}} + + +##### Initialized applications {{{ +echo "[Autostart]: Checking applications"; +#on_startup sensible-browser; + +applications() { + #sleep 0.5; + + #focus_tag 9; + #on_startup :today; + #on_startup :tasks; + + #focus_tag 6; + #on_startup sensible-browser; + + #focus_tag 1; +} + +applications & + +# }}} + + +disown; diff --git a/packages/dwm/source b/packages/dwm/source -Subproject e4af14ef0f2d198e36ae26896071dd3fe77f36b +Subproject 3dd70306618f086e473bb9650bfa9b79b1fc844 |
