setup jade

This commit is contained in:
♥ Minnie ♥ 2023-05-02 08:52:44 +08:00
parent fb35749e62
commit 296b80ec16
14 changed files with 262 additions and 162 deletions

View file

@ -1,157 +0,0 @@
-- Base
import XMonad
import System.Exit
import qualified XMonad.StackSet as W
-- Actions
import XMonad.Actions.CycleWS
-- Hooks
import XMonad.Hooks.EwmhDesktops
-- Layouts
import XMonad.Layout.ThreeColumns
-- Layout modifiers
import XMonad.Layout.Spacing
import XMonad.Layout.Renamed
-- Utilities
import XMonad.Util.EZConfig (additionalKeysP)
-- xmobar dependencies
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Util.Loggers
-- | Configuration
myTerminal = "wezterm"
myModMask = mod4Mask
myBorderWidth = 5
myNormalBorderColor = "#282828"
myFocusedBorderColor = "#282828"
myWorkspaces = ["code", "chat", "web", "games", "misc"]
-- | Keybindings
myKeys =
-- launching and killing programs
[ ("M-n" , spawn myTerminal ) -- %! Launch terminal
, ("M-e" , spawn "dmenu_run" ) -- %! Launch dmenu
, ("M-C-w" , kill ) -- %! Close the focused window
-- layouts
, ("M-<Space>" , sendMessage NextLayout ) -- %! Rotate through the available layout algorithms
-- move focus up or down the window stack
, ("M-<Down>" , windows W.focusDown ) -- %! Move focus to the next window
, ("M-<Up>" , windows W.focusUp ) -- %! Move focus to the previous window
, ("M-<Return>" , windows W.focusMaster ) -- %! Move focus to the master window
-- modifying the window order
, ("M-S-<Down>" , windows W.swapDown ) -- %! Swap the focused window with the next window
, ("M-S-<Up>" , windows W.swapUp ) -- %! Swap the focused window with the previous window
, ("M-S-<Return>" , windows W.swapMaster ) -- %! Swap the focused window with the master window
-- resizing the master/slave ratio
, ("M-<Page_Up>" , sendMessage Expand ) -- %! Expand the master area
, ("M-<Page_Down>" , sendMessage Shrink ) -- %! Shrink the master area
-- number of windows in the master area
, ("M-S-<Page_Up>" , sendMessage (IncMasterN 1) ) -- %! Increase the number of windows in the master area
, ("M-S-<Page_Down>", sendMessage (IncMasterN (-1)) ) -- %! Decrease the number of windows in the master area
-- floating layer support
, ("M-t" , withFocused $ windows . W.sink ) -- %! Push window back into tiling
-- workspace navigation
, ("M-<Right>" , moveTo Next hiddenWS ) -- %! Move focus to the next hidden workspace
, ("M-<Left>" , moveTo Prev hiddenWS ) -- %! Move focus to the previous hidden workspace
-- move window to workspace
, ("M-S-<Right>" , shiftTo Next hiddenWS ) -- %! Move focused window to the next hidden workspace
, ("M-S-<Left)" , shiftTo Prev hiddenWS ) -- %! Move focused window to the previous hidden workspace
-- move focus up or down the screen stack
, ("M-<End>" , nextScreen ) -- %! Move focus to the next screen
, ("M-<Home>" , prevScreen ) -- %! Move focus to the previous screen
-- move windows between screens
, ("M-S-<End>" , shiftNextScreen ) -- %! Move focused window to the next screen
, ("M-S-<Home>" , shiftPrevScreen ) -- %! Move focused window to the previous screen
-- quit, or restart
, ("M-S-q" , io exitSuccess ) -- %! Quit xmonad
]
-- | Layouts
myLayout = gaps $ tiled ||| threeCol ||| full
where
-- Add a configurable amount of space around windows.
gaps = spacingRaw False (Border 50 50 50 50) True (Border 10 10 10 10) True
-- Our layouts
tiled = renamed [Replace "Tiled"] $ Tall nmaster delta ratio
threeCol = renamed [Replace "Three Column"] $ ThreeColMid nmaster delta ratio
full = renamed [Replace "Fullscreen"] $ Full
-- Layout settings
nmaster = 1 -- Default number of windows in the master pane
ratio = 1/2 -- Default proportion of screen occupied by master pane
delta = 3/100 -- Percent of screen to increment by when resizing panes
-- | Xmobar
xmobarTop = statusBarPropTo "_XMONAD_LOG_1" "xmobar-top" (pure ppTop)
xmobarBottom = statusBarPropTo "_XMONAD_LOG_2" "xmobar-bottom" (pure ppBottom)
ppTop :: PP
ppTop = def
{ ppSep = grey0 " | "
, ppTitleSanitize = xmobarStrip
-- workspace labels
, ppCurrent = purple . wrap " " ""
, ppVisible = blue . wrap " " ""
, ppHidden = grey0 . wrap " " ""
, ppHiddenNoWindows = grey0 . wrap " " ""
, ppUrgent = red . wrap " " ""
-- misc
, ppOrder = \[ws, l, _, wins] -> [ws, l, wins]
, ppExtras = [logTitles formatFocused formatUnfocused]
}
where
formatFocused = wrap (grey0 "") (grey0 " ") . purple . ppWindow
formatUnfocused = wrap (grey0 "") (grey0 " ") . blue . ppWindow
-- | Windows should have *some* title, which should not not exceed a
-- sane length.
ppWindow :: String -> String
ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30
-- | Gruvbox material
bg0, bg1, fg0, fg1, red, orange, yellow, green, aqua, blue, purple :: String -> String
-- backgrounds
bg0 = xmobarColor "#1d2021" ""
bg1 = xmobarColor "#282828" ""
-- foregrounds
fg0 = xmobarColor "#d4be98" ""
fg1 = xmobarColor "#ddc7a1" ""
-- greys
grey0 = xmobarColor "#7c6f64" ""
-- colors
red = xmobarColor "#ea6962" ""
orange = xmobarColor "#e78a4e" ""
yellow = xmobarColor "#d8a658" ""
green = xmobarColor "#a9b665" ""
aqua = xmobarColor "#89b482" ""
blue = xmobarColor "#7daea3" ""
purple = xmobarColor "#d3869b" ""
ppBottom :: PP
ppBottom = def
-- | The main function
main :: IO ()
main = xmonad
. ewmhFullscreen
. ewmh
. withEasySB (xmobarTop <> xmobarBottom) defToggleStrutsKey
$ myConfig
myConfig = def
{ modMask = myModMask
, layoutHook = myLayout
, terminal = myTerminal
, borderWidth = myBorderWidth
, normalBorderColor = myNormalBorderColor
, focusedBorderColor = myFocusedBorderColor
, workspaces = myWorkspaces
} `additionalKeysP` myKeys

View file

@ -11,6 +11,11 @@
# inputs.nix-colors.homeManagerModules.default
# You can also split up your configuration and import pieces of it here:
# Jasmine's Desktop Environment
./jade/default.nix
# Programs
./programs/discocss.nix
./programs/git.nix
./programs/mangohud.nix
@ -60,11 +65,8 @@
packages = with pkgs; [
discord
spotify
# pkgs.unstable
unstable.prismlauncher
prismlauncher
];
file.".xinitrc".source = ./xinitrc;
};
# Copy user configuration

View file

@ -0,0 +1,20 @@
{ inputs, outputs, lib, config, pkgs, ... }:
{
imports = [
./xmonad
];
home.packages = with pkgs; [
dmenu
feh
wezterm
];
xdg.configFile = {
wezterm = { source = ./wezterm; recursive = true; };
};
home.file.".xinitrc".source = ./xinitrc;
}

View file

@ -4,7 +4,7 @@
xrandr --output HDMI-A-0 --mode 1920x1080 --output DisplayPort-0 --mode 2560x1440 --right-of HDMI-A-0
# Apply our wallpaper
feh --bg-scale ~/dotfiles.nix/assets/chinatown.png
feh --bg-scale /etc/nixos/assets/chinatown.png
# Launch our window manager
exec xmonad

View file

View file

@ -0,0 +1,28 @@
BSD 3-Clause License
Copyright (c) 2023, sajenim
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1 @@
# xmobar-jsm

View file

@ -0,0 +1,80 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1680392223,
"narHash": "sha256-n3g7QFr85lDODKt250rkZj2IFS3i4/8HBU2yKHO3tqw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "dcc36e45d054d7bb554c9cdab69093debd91a0b5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"haskell-flake": {
"locked": {
"lastModified": 1682714267,
"narHash": "sha256-DsGj9AIKqKcWQQOuwbFU77rkehaICzISHhH7aezZ6OQ=",
"owner": "srid",
"repo": "haskell-flake",
"rev": "a904caac3e4638f84a28102762bf767dd1ae50c0",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "haskell-flake",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1682779028,
"narHash": "sha256-tFfSbwSLobpHRznAa35KEU3R+fsFWTlmpFhTUdXq8RE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "54abe781c482f51ff4ff534ebaba77db5bd97442",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1680213900,
"narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e3652e0735fbec227f342712f180f4f21f0594f2",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"haskell-flake": "haskell-flake",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -0,0 +1,46 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [ inputs.haskell-flake.flakeModule ];
perSystem = { self', pkgs, ... }: {
# Typically, you just want a single project named "default". But
# multiple projects are also possible, each using different GHC version.
haskellProjects.default = {
# If you have a .cabal file in the root, this option is determined
# automatically. Otherwise, specify all your local packages here.
# packages.example.root = ./.;
# The base package set representing a specific GHC version.
# By default, this is pkgs.haskellPackages.
# You may also create your own. See https://haskell.flake.page/package-set
# basePackages = pkgs.haskellPackages;
# Dependency overrides go here. See https://haskell.flake.page/dependency
# source-overrides = { };
# overrides = self: super: { };
# devShell = {
# # Enabled by default
# enable = true;
#
# # Programs you want to make available in the shell.
# # Default programs can be disabled by setting to 'null'
# tools = hp: { fourmolu = hp.fourmolu; ghcid = null; };
#
# hlsCheck.enable = true;
# };
};
# haskell-flake doesn't set the default package, but you can do it here.
packages.default = self'.packages.xmobar-jsm;
};
};
}

View file

@ -0,0 +1,47 @@
import Xmobar
-- | Configuration
config :: Config
config = defaultConfig
-- general settings
{ font = "Fira Code Semi Bold 9"
, additionalFonts = [ "Symbols Nerd Font 2048-em 24" ]
, bgColor = bg1
, fgColor = fg0
, position = Static { xpos = 1920, ypos = 0, width = 2560, height = 24 }
-- commands to run
, commands =
[ Run $ XPropertyLog "_XMONAD_LOG_1"
, Run $ Com "uname" ["-r","-s"] "" 0
, Run $ Date "%a %b %_d %Y <fc=#d8a657>%H:%M:%S</fc>" "date" 10
, Run $ Weather "YPJT"
[ "-t", "Temp: <fc=#d3869b><tempC>C</fc> <fc=#7c6f64>|</fc> Wind: <fc=#a9b665><windKmh>km/h</fc> <fc=#7c6f64>|</fc> Humidity: <fc=#e78a4e><rh>%</fc>" ]
18000
]
-- format our bar
, sepChar = "%"
, alignSep = "}{"
, template = "<hspace=6/><fn=1>\59255</fn> <fc=#a9b665>%uname%</fc> <fc=#7c6f64>|</fc>%_XMONAD_LOG_1%}{%YPJT% <fc=#7c6f64>|</fc> %date%<hspace=6/>"
}
-- | Gruvbox material
bg0, bg1, fg0, fg1, red, orange, yellow, green, aqua, blue, purple :: String
-- backgrounds
bg0 = "#1d2021"
bg1 = "#282828"
-- foregrounds
fg0 = "#d4be98"
fg1 = "#ddc7a1"
-- greys
grey0 = "#7c6f64"
-- colors
red = "#ea6962"
orange = "#e78a4e"
yellow = "#d8a658"
green = "#a9b665"
aqua = "#89b482"
blue = "#7daea3"
purple = "#d3869b"
main :: IO ()
main = configFromArgs config >>= xmobar

View file

@ -0,0 +1,21 @@
cabal-version: 3.0
name: xmobar-jsm
version: 0.1.0.0
synopsis: A Minimalistic Text Based Status Bar
description: my xmobar configuration
license: BSD-3-Clause
license-file: LICENSE
author: sajenim
maintainer: its.jassy@pm.me
homepage: https://github.com/sajenim/jade
build-type: Simple
extra-source-files: README.md
executable xmobar-top
main-is: xmobar-top.hs
hs-source-dirs: src
ghc-options: -Wall -threaded
build-depends: base,
xmobar
default-language: Haskell2010

View file

@ -0,0 +1,10 @@
{ inputs, outputs, lib, config, pkgs, ... }:
{
xsession.windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
config = /etc/nixos/home-manager/jade/xmonad/xmonad-jsm/src/xmonad.hs;
};
}

@ -0,0 +1 @@
Subproject commit 9b39c82ae4bb5f29fa81eaf7d6a7111653cedcf0

View file

@ -191,6 +191,7 @@
enable = true;
layout = "au";
videoDrivers = [ "amdgpu" ];
displayManager.startx.enable = true;
};
};