mirror of
https://github.com/ellmau/nixos.git
synced 2025-12-20 09:39:39 +01:00
First setup for xmonad
This commit is contained in:
parent
f814107ee1
commit
dd50e786ff
@ -27,7 +27,8 @@
|
||||
enable = true;
|
||||
sway.enable = false;
|
||||
i3.enable = false;
|
||||
plasma.enable = true;
|
||||
plasma.enable = false;
|
||||
xmonad.enable = true;
|
||||
# set dpi if used in mobile applications
|
||||
# dpi = 180;
|
||||
};
|
||||
|
||||
@ -571,6 +571,26 @@
|
||||
|
||||
(use-package lsp-ui)
|
||||
|
||||
;; haskell
|
||||
(use-package haskell-mode
|
||||
:diminish subword-mode
|
||||
:hook
|
||||
(haskell-mode . turn-on-haskell-doc)
|
||||
(haskell-mode . subword-mode))
|
||||
(use-package haskell
|
||||
:ensure haskell-mode)
|
||||
(use-package haskell-font-lock
|
||||
:ensure haskell-mode)
|
||||
(use-package lsp-haskell
|
||||
:if die-orga/workstation
|
||||
:demand t)
|
||||
(use-package shakespeare-mode)
|
||||
(use-package company-cabal
|
||||
:defer t
|
||||
:init
|
||||
(with-eval-after-load 'company
|
||||
(add-to-list 'company-backends '(company-cabal))))
|
||||
|
||||
;; misc
|
||||
(use-package academic-phrases
|
||||
:defer t
|
||||
|
||||
@ -22,6 +22,7 @@ with lib; {
|
||||
'';
|
||||
};
|
||||
i3.enable = mkEnableOption "enable i3";
|
||||
xmonad.enable = mkEnableOption "Use xmonad";
|
||||
};
|
||||
config = let
|
||||
cfg = config.elss.graphical;
|
||||
@ -40,7 +41,7 @@ with lib; {
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
elss.users.x11.enable =
|
||||
if cfg.i3.enable
|
||||
if cfg.i3.enable || cfg.xmonad.enable
|
||||
then true
|
||||
else false;
|
||||
elss.networking.useNetworkManager = true;
|
||||
@ -74,6 +75,8 @@ with lib; {
|
||||
printing.enable = true;
|
||||
};
|
||||
|
||||
security.pam.services.lightdm.enableGnomeKeyring = true;
|
||||
|
||||
sound.enable = true;
|
||||
|
||||
hardware = {
|
||||
|
||||
25
modules/xmonad.nix
Normal file
25
modules/xmonad.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
config = let
|
||||
cfg = config.elss.graphical.xmonad;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
services = {
|
||||
xserver = {
|
||||
enable = true;
|
||||
windowManager.xmonad.enable = true;
|
||||
layout = "us";
|
||||
xkbOptions = "eurosign:e";
|
||||
};
|
||||
gnome.gnome-keyring.enable = true;
|
||||
|
||||
printing.enable = true;
|
||||
};
|
||||
security.pam.services.lightdm.enableGnomeKeyring = true;
|
||||
};
|
||||
}
|
||||
81
users/ellmau/conf/xmonad/xmonad.hs
Normal file
81
users/ellmau/conf/xmonad/xmonad.hs
Normal file
@ -0,0 +1,81 @@
|
||||
module Main where
|
||||
|
||||
import Data.Ratio
|
||||
import XMonad hiding ((|||))
|
||||
import XMonad.Hooks.FadeInactive
|
||||
import XMonad.Hooks.FadeWindows
|
||||
import XMonad.Hooks.EwmhDesktops
|
||||
import XMonad.Hooks.ManageDocks
|
||||
import XMonad.Hooks.ManageHelpers
|
||||
import XMonad.Hooks.StatusBar
|
||||
import XMonad.Util.EZConfig
|
||||
import Network.HostName (getHostName)
|
||||
-- Imports for Polybar --
|
||||
import qualified Codec.Binary.UTF8.String as UTF8
|
||||
import qualified DBus as D
|
||||
import qualified DBus.Client as D
|
||||
import XMonad.Hooks.DynamicLog
|
||||
|
||||
main :: IO ()
|
||||
main' :: D.Client -> IO ()
|
||||
main = mkDbusClient >>= main'
|
||||
|
||||
main' dbus = do
|
||||
hostname <- io $ getHostName
|
||||
xmonad . docks . ewmhFullscreen . ewmh $ def
|
||||
{ terminal = "alacritty"
|
||||
, logHook = polybarLogHook dbus
|
||||
}
|
||||
|
||||
mkDbusClient :: IO D.Client
|
||||
mkDbusClient = do
|
||||
dbus <- D.connectSession
|
||||
D.requestName dbus (D.busName_ "org.xmonad.log") opts
|
||||
return dbus
|
||||
where
|
||||
opts = [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]
|
||||
|
||||
-- Emit a DBus signal on log updates
|
||||
dbusOutput :: D.Client -> String -> IO ()
|
||||
dbusOutput dbus str =
|
||||
let opath = D.objectPath_ "/org/xmonad/Log"
|
||||
iname = D.interfaceName_ "org.xmonad.Log"
|
||||
mname = D.memberName_ "Update"
|
||||
signal = D.signal opath iname mname
|
||||
body = [D.toVariant $ UTF8.decodeString str]
|
||||
in D.emit dbus $ signal { D.signalBody = body }
|
||||
|
||||
polybarHook :: D.Client -> PP
|
||||
polybarHook dbus =
|
||||
let wrapper c s | s /= "NSP" = wrap ("%{F" <> c <> "} ") " %{F-}" s
|
||||
| otherwise = mempty
|
||||
blue = "#2E9AFE"
|
||||
gray = "#7F7F7F"
|
||||
orange = "#ea4300"
|
||||
purple = "#9058c7"
|
||||
red = "#722222"
|
||||
in def { ppOutput = dbusOutput dbus
|
||||
, ppCurrent = wrapper blue
|
||||
, ppVisible = wrapper gray
|
||||
, ppUrgent = wrapper orange
|
||||
, ppHidden = wrapper gray
|
||||
, ppHiddenNoWindows = wrapper red
|
||||
, ppTitle = shorten 100 . wrapper purple
|
||||
}
|
||||
|
||||
fadeHook :: Rational -> Rational -> X ()
|
||||
fadeHook act inact = fadeOutLogHook $ fadeAllBut exceptions act inact
|
||||
where exceptions = isFullscreen
|
||||
<||> className =? "firefox"
|
||||
<||> className =? "Chromium-browser"
|
||||
|
||||
fadeAllBut :: Query Bool -> Rational -> Rational -> Query Rational
|
||||
fadeAllBut qry amt inact = do isInactive <- isUnfocused
|
||||
isQry <- qry
|
||||
if isQry
|
||||
then return 1
|
||||
else if isInactive
|
||||
then return inact
|
||||
else return amt
|
||||
|
||||
polybarLogHook dbus = fadeHook 0.95 0.75 <+> dynamicLogWithPP (polybarHook dbus)
|
||||
@ -15,6 +15,7 @@
|
||||
./mako.nix
|
||||
./nextcloud.nix
|
||||
./polybar.nix
|
||||
./xmonad.nix
|
||||
./zsh.nix
|
||||
|
||||
./sway.nix
|
||||
|
||||
@ -7,7 +7,14 @@
|
||||
}:
|
||||
with lib; {
|
||||
config = let
|
||||
cfg = nixosConfig.elss.graphical.i3;
|
||||
cfg = nixosConfig.elss.graphical.xmonad;
|
||||
xmonad = ''
|
||||
[module/xmonad]
|
||||
type = custom/script
|
||||
exec = ${pkgs.xmonad-log}/bin/xmonad-log
|
||||
|
||||
tail = true
|
||||
'';
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
services.polybar = {
|
||||
@ -357,6 +364,7 @@ with lib; {
|
||||
MONITOR=$m polybar --reload aux &
|
||||
done;
|
||||
'';
|
||||
extraConfig = xmonad;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
28
users/ellmau/xmonad.nix
Normal file
28
users/ellmau/xmonad.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
nixosConfig,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
config = let
|
||||
cfg = nixosConfig.elss.graphical.xmonad;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
xsession = {
|
||||
enable = true;
|
||||
|
||||
windowManager.xmonad = {
|
||||
enable = true;
|
||||
enableContribAndExtras = true;
|
||||
extraPackages = haskellPackages: [
|
||||
haskellPackages.dbus
|
||||
haskellPackages.monad-logger
|
||||
haskellPackages.hostname
|
||||
];
|
||||
config = mkDefault conf/xmonad/xmonad.hs;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user