diff options
| author | Akshay Nair <phenax5@gmail.com> | 2021-09-14 15:56:36 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2021-09-14 15:57:11 +0530 |
| commit | ed38fee5dee70777e467636e45258922c3167f95 (patch) | |
| tree | 1058b074396b16e73748e34048185909400b1cb0 /packages | |
| parent | a733440955e40888d34e165c2b4fcd23680b78c6 (diff) | |
| download | nixos-config-ed38fee5dee70777e467636e45258922c3167f95.tar.gz nixos-config-ed38fee5dee70777e467636e45258922c3167f95.zip | |
adds xmonad submodule
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/default.nix | 1 | ||||
| -rwxr-xr-x | packages/xmonad/autostart.sh | 108 | ||||
| -rw-r--r-- | packages/xmonad/pkg.nix | 58 | ||||
| m--------- | packages/xmonad/source | 0 |
4 files changed, 167 insertions, 0 deletions
diff --git a/packages/default.nix b/packages/default.nix index 9e0f39c..7ac6593 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -8,4 +8,5 @@ dwmblocks = pkgs.callPackage ./dwmblocks/pkg.nix {}; st = pkgs.callPackage ./st/pkg.nix {}; anypinentry = pkgs.callPackage ./anypinentry/pkg.nix {}; + xmonad = pkgs.callPackage ./xmonad/pkg.nix {}; } diff --git a/packages/xmonad/autostart.sh b/packages/xmonad/autostart.sh new file mode 100755 index 0000000..5421000 --- /dev/null +++ b/packages/xmonad/autostart.sh @@ -0,0 +1,108 @@ +source ~/.config/zsh/paths.zsh; +source ~/.config/zsh/config.zsh; + +##### 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 + pkill "$name"; + else + pgrep $name || $@ & + fi; +} + +# Kill previous instance and run again +run() { + local name=$1; shift; + [[ ! -z "$name" ]] && pkill "$name" && sleep 0.05; + is_kill || $@ & +} +# }}} + + +##### Autostart {{{ + echo "[Autostart]: Running daemons"; + + # Key daemon + run "shotkey" shotkey; + + # Wallpaper + run "" ~/.fehbg; + + # Dwm blocks status text + # run "dwmblocks" dwmblocks; + + # Notification daemon + run "dunst" dunst -config ~/.config/dunst/dunstrc; + + # Compositor + run "picom" picom --experimental-backends --config ~/.config/picom.conf; + + # Cron jobs + #run "crond" crond -n -f ~/.config/crontab/crontab; + + # Scheduler + run "remind" remind -k"notify-send -a reminder %s" -z10 $REMINDER_FILE; + + # 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/xmonad/pkg.nix b/packages/xmonad/pkg.nix new file mode 100644 index 0000000..b7e4d3a --- /dev/null +++ b/packages/xmonad/pkg.nix @@ -0,0 +1,58 @@ +{ pkgs +, lib +, stdenv +, ghc +, haskellPackages +}: +let + xmobar_custom = haskellPackages.xmobar.overrideAttrs ( + _: { + configureFlags = [ + "-fwith_xft" + "-fwith_threaded" + "-fwith_rtsopts" + "-fwith_alsa" + "-fwith_utf8" + "-fwith_nl80211" + ]; + } + ); +in +haskellPackages.mkDerivation rec { + pname = "local-xmonad-${version}"; + version = "0.0.0"; + license = lib.licenses.mit; + + src = ./source; + + isLibrary = false; + isExecutable = true; + doHaddock = false; + + libraryHaskellDepends = with haskellPackages; [ + base + containers + extensible-exceptions + parsec + process + X11 + xmonad + xmonad-contrib + + xmobar_custom + ]; + + librarySystemDepends = with pkgs; [ + pkgs.pkgconfig + xorg.libXext + xorg.libXScrnSaver + xorg.libXinerama + xorg.libXrender + xorg.libX11 + xorg.libXrandr + xorg.libXft + xorg.libXpm + alsaLib + wirelesstools + ]; +} diff --git a/packages/xmonad/source b/packages/xmonad/source new file mode 160000 +Subproject bd6e810dc5965fa9e9b75c04bae8d5a468d1f70 |
