summaryrefslogtreecommitdiff
path: root/awesome/default.nix
diff options
context:
space:
mode:
authormediocregopher <mediocregopher@gmail.com>2023-08-13 21:34:14 +0200
committermediocregopher <mediocregopher@gmail.com>2023-08-13 21:35:17 +0200
commit1957081c122fe231eb6120192489dd979d214317 (patch)
treeb8cd0812ec3c0452d54cb789ba938e6f0c0e8278 /awesome/default.nix
parentef8da74f1ae38d9eceb68846fe9ef402c8e30fcf (diff)
Update branch with all changes which could be brought in from private branches
For a while I was keeping a private branch where there were a lot of non-public things included, and that became the de-facto branch while this one lagged. This one is now up-to-date, all private stuff is dealt with via config files which are not committed.
Diffstat (limited to 'awesome/default.nix')
-rw-r--r--awesome/default.nix113
1 files changed, 103 insertions, 10 deletions
diff --git a/awesome/default.nix b/awesome/default.nix
index 03fe298..d5cff69 100644
--- a/awesome/default.nix
+++ b/awesome/default.nix
@@ -1,29 +1,122 @@
{
- pkgs ? (import ../pkgs.nix) {},
+ config,
+
}: rec {
- cfg = ./.;
+ pkgs = (import ../pkgs.nix).stable {};
+ pkgs2305 = (import ../pkgs.nix).stable2305 {};
+ pkgsEdge = (import ../pkgs.nix).edge {};
+
+ # nativeWrap is used for apps which are not installed via nix which don't play
+ # nicely with it.
+ nativeWrap = pkgs.writeScriptBin "native-wrap" ''
+ #!${pkgs.bash}/bin/bash
+
+ unset XDG_CONFIG_DIRS
+ unset XDG_DATA_DIRS
+ unset GDK_PIXBUF_MODULE_FILE
+
+ exec "$@"
+ '';
+
+ browser = pkgs.writeScriptBin "browser" ''
+ #!${pkgs.bash}/bin/bash
+ exec ${nativeWrap}/bin/native-wrap ${config.browser} "$@"
+ '';
+
+ env = pkgs.buildEnv {
+ name = "awesome-env";
+ paths = [
+
+ pkgs.awesome
+ pkgs.tela-icon-theme
+
+ nativeWrap
+ browser
+
+ pkgs.xorg.xrandr
+ pkgs.xsel
+ pkgs.pavucontrol
+ pkgs.xdg-utils
+ pkgs.arandr
+
+ pkgs.i3lock
+ pkgs.scrot
+ pkgs.feh
+ pkgs.brightnessctl
+
+ pkgs.cbatticon
+ pkgs.phwmon
+
+ pkgs.castor
+ pkgs2305.libreoffice
+ pkgs.gimp
+ pkgs.inkscape
+ pkgs.vlc
+ pkgs.sylpheed
+
+ pkgsEdge.lagrange
+ ];
+ };
+
wp = ../wallpapers;
dirsLua = pkgs.writeTextDir "dirs.lua" ''
home_dir = os.getenv("HOME").."/"
- conf_dir = "${cfg}/"
+ bin_dir = "${./bin}/"
+ share_dir = "${./share}/"
wp_dir = "${wp}/"
'';
awesome = pkgs.writeScriptBin "awesome" ''
#!${pkgs.bash}/bin/bash
- export BROWSER=/usr/bin/google-chrome
+ export BROWSER=${browser}/bin/browser
+
+ # Turn off powersaving (fuck the environment)
+ xset -dpms
+ xset s off
+
+ export PATH=${env}/bin:$PATH
+
+ export XDG_CONFIG_DIRS=${./config}
+
+ export XDG_DATA_DIRS=${env}/share
+ export XDG_DATA_DIRS=$XDG_DATA_DIRS:/home/mediocregopher/.nix-profile/share
+
+ ${config.awesome.startupExtra}
+
+ # HACK: This sleep is here because phwmon actually creates a separate tray
+ # icon for each thing it monitors, and if the process runs at the same time
+ # as another process which creates a tray icon they can get interleaved.
+ (sleep 5 && phwmon.py) &
- echo "[$(date)] New awesome session starting" > ~/.awesome.log
- exec ${pkgs.awesome}/bin/awesome \
- -c ${cfg}/rc.lua \
+ ############################################################################
+ # Init awesome
+
+ data_dir="$HOME/.local/share/awesome";
+ mkdir -p "$dataDir"
+
+ log_dir="$data_dir"/logs
+ mkdir -p $log_dir
+
+ # only keep last N awesome.log files
+ ls "$log_dir" | sort -n | head -n -5 | while read f; do rm "$log_dir"/"$f"; done
+
+ ############################################################################
+ # Exec
+
+ this_log=$log_dir/awesome.$(date '+%Y%m%d.%H%M%S').log
+
+ echo "New awesome session starting" > $this_log
+
+ exec awesome \
+ -c ${./rc.lua} \
--search ${dirsLua} \
- --search ${cfg} \
- 2>&1 2>>~/.awesome.log
+ --search ${./share} \
+ --search ${env}/share/awesome/themes \
+ 2>&1 2>>$this_log
'';
-
}