This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

reorganize desktop/wm code

+1092 -825
-193
2configs/baseX.nix
··· 1 - { self, config, lib, pkgs, ... }: 2 - { 3 - imports = [ 4 - ./alacritty.nix 5 - ./mpv.nix 6 - ./power-action.nix 7 - ./urxvt.nix 8 - ./xdg-open.nix 9 - ./yubikey.nix 10 - ./pipewire.nix 11 - ./tmux.nix 12 - ./xmonad.nix 13 - ./themes.nix 14 - ./fonts.nix 15 - { 16 - users.users.mainUser.packages = [ 17 - pkgs.sshuttle 18 - ]; 19 - security.sudo.extraConfig = '' 20 - lass ALL= (root) NOPASSWD:SETENV: ${pkgs.sshuttle}/bin/.sshuttle-wrapped 21 - ''; 22 - } 23 - { #font magic 24 - options.lass.fonts = { 25 - regular = lib.mkOption { 26 - type = lib.types.str; 27 - default = "xft:Iosevka Term SS15:style=regular"; 28 - }; 29 - bold = lib.mkOption { 30 - type = lib.types.str; 31 - default = "xft:Iosevka Term SS15:style=bold"; 32 - }; 33 - italic = lib.mkOption { 34 - type = lib.types.str; 35 - default = "xft:Iosevka Term SS15:style=italic"; 36 - }; 37 - }; 38 - config.krebs.xresources.resources.X = '' 39 - *.font: ${config.lass.fonts.regular} 40 - *.boldFont: ${config.lass.fonts.bold} 41 - *.italicFont: ${config.lass.fonts.italic} 42 - ''; 43 - } 44 - ]; 45 - 46 - users.users.mainUser.extraGroups = [ "audio" "pipewire" "video" ]; 47 - 48 - time.timeZone = "Europe/Berlin"; 49 - 50 - programs.ssh.agentTimeout = "10m"; 51 - programs.ssh.startAgent = false; 52 - services.openssh.forwardX11 = true; 53 - 54 - environment.systemPackages = with pkgs; [ 55 - acpi 56 - acpilight 57 - ripgrep 58 - cabal2nix 59 - dic 60 - dmenu 61 - font-size 62 - fzfmenu 63 - gimp 64 - gitAndTools.gh 65 - git-crypt 66 - git-preview 67 - dconf 68 - iodine 69 - libarchive 70 - lm_sensors 71 - ncdu 72 - nix-index 73 - nixpkgs-review 74 - nmap 75 - pavucontrol 76 - ponymix 77 - powertop 78 - rxvt-unicode 79 - sshvnc 80 - sxiv 81 - nsxiv 82 - taskwarrior 83 - termite 84 - transgui 85 - wirelesstools 86 - x11vnc 87 - xclip 88 - xephyrify 89 - xorg.xmodmap 90 - xorg.xhost 91 - xdotool 92 - xsel 93 - zathura 94 - flameshot 95 - (pkgs.writers.writeDashBin "screenshot" '' 96 - set -efu 97 - 98 - ${pkgs.flameshot}/bin/flameshot gui && 99 - ${pkgs.klem}/bin/klem 100 - '') 101 - (pkgs.writers.writeDashBin "IM" '' 102 - ${pkgs.mosh}/bin/mosh green.r -- tmux new-session -A -s IM -- weechat 103 - '') 104 - (pkgs.writers.writeDashBin "deploy_hm" '' 105 - target=$1 106 - shift 107 - 108 - hm_profile=$(${pkgs.home-manager}/bin/home-manager -f ~/sync/stockholm/lass/2configs/home-manager.nix build "$@") 109 - nix-copy-closure --to "$target" "$hm_profile" 110 - ssh "$target" -- "$hm_profile"/activate 111 - '') 112 - zbar 113 - ]; 114 - 115 - services.udev.extraRules = '' 116 - SUBSYSTEM=="backlight", ACTION=="add", \ 117 - RUN+="${pkgs.coreutils}/bin/chgrp video /sys/class/backlight/%k/brightness", \ 118 - RUN+="${pkgs.coreutils}/bin/chmod g+w /sys/class/backlight/%k/brightness" 119 - ''; 120 - 121 - services.xserver = { 122 - enable = true; 123 - layout = "us"; 124 - display = lib.mkForce 0; 125 - xkbVariant = "altgr-intl"; 126 - xkbOptions = "caps:escape"; 127 - libinput.enable = true; 128 - exportConfiguration = true; 129 - displayManager = { 130 - lightdm.enable = true; 131 - defaultSession = "none+xmonad"; 132 - sessionCommands = '' 133 - ${pkgs.xorg.xhost}/bin/xhost +LOCAL: 134 - ''; 135 - }; 136 - }; 137 - 138 - nixpkgs.config.packageOverrides = super: { 139 - dmenu = pkgs.writers.writeDashBin "dmenu" '' 140 - ${pkgs.fzfmenu}/bin/fzfmenu "$@" 141 - ''; 142 - }; 143 - 144 - krebs.xresources.enable = true; 145 - 146 - lass.klem = { 147 - kpaste.script = pkgs.writeDash "kpaste-wrapper" '' 148 - ${pkgs.kpaste}/bin/kpaste \ 149 - | ${pkgs.coreutils}/bin/tail -1 \ 150 - | ${pkgs.coreutils}/bin/tr -d '\r\n' 151 - ''; 152 - go = { 153 - target = "STRING"; 154 - script = "${pkgs.goify}/bin/goify"; 155 - }; 156 - "go.lassul.us" = { 157 - target = "STRING"; 158 - script = pkgs.writeDash "go.lassul.us" '' 159 - export GO_HOST='go.lassul.us' 160 - ${pkgs.goify}/bin/goify 161 - ''; 162 - }; 163 - qrcode = { 164 - target = "image"; 165 - script = pkgs.writeDash "zbar" '' 166 - ${pkgs.zbar}/bin/zbarimg -q --raw - 167 - ''; 168 - }; 169 - ocr = { 170 - target = "image"; 171 - script = pkgs.writeDash "gocr" '' 172 - ${pkgs.netpbm}/bin/pngtopnm - \ 173 - | ${pkgs.gocr}/bin/gocr - 174 - ''; 175 - }; 176 - }; 177 - 178 - services.clipmenu.enable = true; 179 - 180 - # synchronize all the clipboards 181 - systemd.user.services.autocutsel = { 182 - enable = true; 183 - wantedBy = [ "graphical-session.target" ]; 184 - after = [ "graphical-session.target" ]; 185 - serviceConfig = { 186 - Type = "forking"; 187 - ExecStart = pkgs.writers.writeDash "autocutsel" '' 188 - ${pkgs.autocutsel}/bin/autocutsel -fork -selection PRIMARY 189 - ${pkgs.autocutsel}/bin/autocutsel -fork -selection CLIPBOARD 190 - ''; 191 - }; 192 - }; 193 - }
-236
2configs/xmonad.nix
··· 1 - { config, lib, pkgs, ... }: 2 - 3 - { 4 - services.xserver.windowManager.xmonad = { 5 - enable = true; 6 - extraPackages = hs: [ 7 - hs.extra 8 - hs.xmonad-contrib 9 - ]; 10 - config = /* haskell */ '' 11 - {-# LANGUAGE LambdaCase #-} 12 - 13 - 14 - module Main where 15 - import XMonad 16 - 17 - import qualified XMonad.StackSet as W 18 - import Control.Monad.Extra (whenJustM) 19 - import Data.List (isInfixOf) 20 - import Data.Monoid (Endo) 21 - import System.Environment (getArgs, lookupEnv) 22 - import System.Exit (exitFailure) 23 - import System.IO (hPutStrLn, stderr) 24 - import System.Posix.Process (executeFile) 25 - import Data.Ratio 26 - 27 - import XMonad.Actions.Commands (defaultCommands, runCommand) 28 - import XMonad.Actions.CopyWindow (copy, copyToAll, kill1) 29 - import XMonad.Actions.CycleWS (toggleWS) 30 - import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace, removeEmptyWorkspace) 31 - import XMonad.Actions.DynamicWorkspaces (withWorkspace) 32 - import XMonad.Actions.GridSelect (GSConfig(..), gridselectWorkspace, navNSearch) 33 - import XMonad.Actions.Minimize (minimizeWindow, maximizeWindow, withLastMinimized) 34 - import XMonad.Hooks.EwmhDesktops (ewmh) 35 - import XMonad.Hooks.FloatNext (floatNext) 36 - import XMonad.Hooks.FloatNext (floatNextHook) 37 - import XMonad.Hooks.ManageDocks (avoidStruts, ToggleStruts(ToggleStruts)) 38 - import XMonad.Hooks.ManageHelpers (doCenterFloat, doRectFloat, (-?>)) 39 - import XMonad.Hooks.Place (placeHook, smart) 40 - import XMonad.Hooks.UrgencyHook (focusUrgent) 41 - import XMonad.Hooks.UrgencyHook (withUrgencyHook, UrgencyHook(..)) 42 - import XMonad.Layout.BoringWindows (boringWindows, focusDown, focusUp) 43 - import XMonad.Layout.FixedColumn (FixedColumn(..)) 44 - import XMonad.Layout.Grid (Grid(..)) 45 - import XMonad.Layout.Minimize (minimize) 46 - import XMonad.Layout.NoBorders (smartBorders, noBorders) 47 - import XMonad.Layout.MouseResizableTile (mouseResizableTile) 48 - import XMonad.Layout.SimplestFloat (simplestFloat) 49 - import XMonad.Layout.StateFull 50 - import XMonad.ManageHook (composeAll) 51 - import XMonad.Prompt (autoComplete, font, height, searchPredicate, XPConfig) 52 - import XMonad.Prompt.Window (windowPromptGoto, windowPromptBringCopy) 53 - import XMonad.Util.EZConfig (additionalKeysP) 54 - import XMonad.Util.NamedWindows (getName) 55 - import XMonad.Util.Run (safeSpawn) 56 - import XMonad.Util.Ungrab (unGrab) 57 - import XMonad.Util.Paste (sendKey) 58 - 59 - data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show) 60 - 61 - instance UrgencyHook LibNotifyUrgencyHook where 62 - urgencyHook LibNotifyUrgencyHook w = do 63 - name <- getName w 64 - Just idx <- fmap (W.findTag w) $ gets windowset 65 - 66 - safeSpawn "${pkgs.libnotify}/bin/notify-send" [show name, "workspace " ++ idx] 67 - 68 - myTerm :: FilePath 69 - myTerm = "/run/current-system/sw/bin/alacritty" 70 - 71 - myFont :: String 72 - myFont = "${config.lass.fonts.regular}" 73 - 74 - main :: IO () 75 - main = do 76 - xmonad $ ewmh 77 - $ withUrgencyHook LibNotifyUrgencyHook 78 - $ def 79 - { terminal = myTerm 80 - , modMask = mod4Mask 81 - , layoutHook = myLayoutHook 82 - , manageHook = floatHooks 83 - , startupHook = 84 - whenJustM (liftIO (lookupEnv "XMONAD_STARTUP_HOOK")) 85 - (\path -> forkFile path [] Nothing) 86 - , normalBorderColor = "#1c1c1c" 87 - , focusedBorderColor = "#ff0000" 88 - , workspaces = [ "dashboard", "sys", "wp" ] 89 - } `additionalKeysP` myKeyMap 90 - 91 - myLayoutHook = defLayout 92 - where 93 - defLayout = smartBorders $ 94 - minimize . 95 - boringWindows $ 96 - ( 97 - noBorders StateFull ||| 98 - (avoidStruts $ Mirror (Tall 1 (3/100) (1/2))) ||| 99 - FixedColumn 2 80 80 1 ||| 100 - Tall 1 (3/100) (1/2) ||| 101 - simplestFloat ||| 102 - mouseResizableTile ||| 103 - Grid 104 - ) 105 - 106 - floatHooks = composeAll 107 - [ className =? "Pinentry" --> doCenterFloat 108 - , className =? "Pager" --> doCenterFloat 109 - , title =? "pager" --> doCenterFloat 110 - , title =? "fzfmenu" --> doCenterFloat 111 - , title =? "glxgears" --> doCenterFloat 112 - , resource =? "Dialog" --> doFloat 113 - , title =? "Upload to Imgur" --> 114 - doRectFloat (W.RationalRect 0 0 (1 % 8) (1 % 8)) 115 - , placeHook (smart (1,0)) 116 - , floatNextHook 117 - ] 118 - 119 - myKeyMap :: [([Char], X ())] 120 - myKeyMap = 121 - [ ("M4-p", forkFile "${pkgs.pass}/bin/passmenu" [ "--type" ] Nothing) 122 - , ("M4-S-p", forkFile "${pkgs.otpmenu}/bin/otpmenu" [] Nothing) 123 - , ("M4-z", forkFile "${pkgs.unimenu}/bin/unimenu" [] Nothing) 124 - 125 - , ("M4-S-q", restart "xmonad" True) 126 - 127 - , ("<XF86AudioMute>", spawn "${pkgs.pulseaudio.out}/bin/pactl -- set-sink-mute @DEFAULT_SINK@ toggle") 128 - , ("<XF86AudioRaiseVolume>", spawn "${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ +4%") 129 - , ("<XF86AudioLowerVolume>", spawn "${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ -4%") 130 - , ("<XF86MonBrightnessDown>", spawn "${pkgs.acpilight}/bin/xbacklight -time 0 -dec 1") 131 - , ("<XF86MonBrightnessUp>", spawn "${pkgs.acpilight}/bin/xbacklight -time 0 -inc 1") 132 - , ("M4-C-k", spawn "${pkgs.xorg.xkill}/bin/xkill") 133 - 134 - , ("M4-<Tab>", focusDown) 135 - , ("M4-S-<Tab>", focusUp) 136 - , ("M4-j", focusDown) 137 - , ("M4-k", focusUp) 138 - 139 - , ("M4-a", focusUrgent) 140 - , ("M4-S-r", renameWorkspace myXPConfig) 141 - , ("M4-S-a", addWorkspacePrompt myXPConfig) 142 - , ("M4-S-<Backspace>", removeEmptyWorkspace) 143 - , ("M4-S-c", kill1) 144 - , ("M4-<Esc>", toggleWS) 145 - , ("M4-S-<Enter>", spawn myTerm) 146 - , ("M4-x", floatNext True >> spawn myTerm) 147 - , ("M4-c", spawn "/run/current-system/sw/bin/emacsclient -c") 148 - -- , ("M4-c", unGrab) 149 - , ("M4-f", floatNext True) 150 - , ("M4-b", spawn "/run/current-system/sw/bin/klem") 151 - 152 - , ("M4-c", defaultCommands >>= runCommand) 153 - -- , ("M4-v", spawn "${pkgs.pager}/bin/pager view") 154 - -- , ("M4-S-v", spawn "${pkgs.pager}/bin/pager shift") 155 - , ("M4-v", withWorkspace autoXPConfig (windows . W.greedyView)) 156 - , ("M4-S-v", withWorkspace autoXPConfig (windows . W.shift)) 157 - , ("M4-C-v", withWorkspace autoXPConfig (windows . copy)) 158 - 159 - , ("M4-m", withFocused minimizeWindow) 160 - , ("M4-S-m", withLastMinimized maximizeWindow) 161 - 162 - , ("M4-q", windowPromptGoto infixAutoXPConfig) 163 - , ("M4-C-q", windowPromptBringCopy infixAutoXPConfig) 164 - 165 - , ("M4-S-q", return ()) 166 - 167 - , ("M4-d", floatNext True >> spawn "${pkgs.writers.writeDash "clipmenu" '' 168 - PATH=${lib.makeBinPath [ 169 - pkgs.coreutils 170 - pkgs.gawk 171 - pkgs.dmenu 172 - ]} 173 - ${pkgs.clipmenu}/bin/clipmenu 174 - ''}") 175 - 176 - , ("M4-<Insert>", spawn "${pkgs.writers.writeDash "paste" '' 177 - ${pkgs.coreutils}/bin/sleep 0.4 178 - ${pkgs.xclip}/bin/xclip -o | ${pkgs.xdotool}/bin/xdotool type -f - 179 - ''}") 180 - 181 - , ("M4-<F1>", spawn "/run/current-system/sw/bin/gamepad_mouse_toggle") 182 - , ("M4-<F2>", windows copyToAll) 183 - , ("M4-<F4>", spawn "${pkgs.nm-dmenu}/bin/nm-dmenu") 184 - , ("M4-<F5>", spawn "${pkgs.acpilight}/bin/xbacklight -set 1") 185 - , ("M4-<F6>", spawn "${pkgs.acpilight}/bin/xbacklight -set 10") 186 - , ("M4-<F7>", spawn "${pkgs.acpilight}/bin/xbacklight -set 33") 187 - , ("M4-<F8>", spawn "${pkgs.acpilight}/bin/xbacklight -set 100") 188 - 189 - , ("M4-<F9>", spawn "${pkgs.redshift}/bin/redshift -O 4000 -g 0.9:0.8:0.8") 190 - , ("M4-<F10>", spawn "${pkgs.redshift}/bin/redshift -x") 191 - 192 - , ("M4-<F11>", spawn "${config.lass.screenlock.command}") 193 - 194 - , ("M4-u", spawn "${pkgs.xcalib}/bin/xcalib -invert -alter") 195 - , ("M4-y", spawn "/run/current-system/sw/bin/switch-theme toggle") 196 - 197 - ${lib.optionalString (builtins.hasAttr "warpd" pkgs) '', ("M4-s", spawn "${pkgs.warpd}/bin/warpd --hint")''} 198 - , ("M4-i", spawn "/run/current-system/sw/bin/screenshot") 199 - 200 - --, ("M4-w", screenWorkspace 0 >>= (windows . W.greedyView)) 201 - --, ("M4-e", screenWorkspace 1 >>= (windows . W.greedyView)) 202 - --, ("M4-r", screenWorkspace 2 >>= (windows . W.greedyView)) 203 - ] 204 - 205 - forkFile :: FilePath -> [String] -> Maybe [(String, String)] -> X () 206 - forkFile path args env = 207 - xfork (executeFile path True args env) >> return () 208 - 209 - myXPConfig :: XPConfig 210 - myXPConfig = def 211 - { font = myFont 212 - , height = 40 213 - } 214 - 215 - autoXPConfig :: XPConfig 216 - autoXPConfig = myXPConfig 217 - { autoComplete = Just 5000 218 - } 219 - 220 - infixAutoXPConfig :: XPConfig 221 - infixAutoXPConfig = autoXPConfig 222 - { searchPredicate = isInfixOf 223 - } 224 - 225 - gridConfig :: GSConfig WorkspaceId 226 - gridConfig = def 227 - { gs_cellwidth = 100 228 - , gs_cellheight = 30 229 - , gs_cellpadding = 2 230 - , gs_navigate = navNSearch 231 - , gs_font = myFont 232 - } 233 - 234 - ''; 235 - }; 236 - }
-10
4lib/default.nix
··· 1 - { lib, ... }: 2 - 3 - with lib; 4 - 5 - rec { 6 - 7 - getDefaultGateway = ip: 8 - concatStringsSep "." (take 3 (splitString "." ip) ++ ["1"]); 9 - 10 - }
-346
2configs/wayland/sway.nix
··· 1 - { config, lib, pkgs, ... }: let 2 - 3 - term = "/run/current-system/sw/bin/alacritty"; 4 - 5 - in { 6 - imports = [ 7 - ../alacritty.nix 8 - ../mpv.nix 9 - ../power-action.nix 10 - ../urxvt.nix 11 - ../xdg-open.nix 12 - ../yubikey.nix 13 - ../tmux.nix 14 - ../themes.nix 15 - ../fonts.nix 16 - # ./pipewire.nix 17 - # ./tty-share.nix 18 - { 19 - users.users.mainUser.packages = [ 20 - pkgs.sshuttle 21 - ]; 22 - security.sudo.extraConfig = '' 23 - lass ALL= (root) NOPASSWD:SETENV: ${pkgs.sshuttle}/bin/.sshuttle-wrapped 24 - ''; 25 - } 26 - ]; 27 - users.users.mainUser.extraGroups = [ "audio" "pipewire" "video" "input" ]; 28 - 29 - services.clipmenu.enable = true; 30 - 31 - services.udev.extraRules = '' 32 - SUBSYSTEM=="backlight", ACTION=="add", \ 33 - RUN+="${pkgs.coreutils}/bin/chgrp video /sys/class/backlight/%k/brightness", \ 34 - RUN+="${pkgs.coreutils}/bin/chmod g+w /sys/class/backlight/%k/brightness" 35 - ''; 36 - 37 - nixpkgs.config.packageOverrides = super: { 38 - dmenu = pkgs.writeDashBin "dmenu" '' 39 - unset TERM 40 - ${pkgs.fzfmenu}/bin/fzfmenu "$@" 41 - ''; 42 - }; 43 - 44 - environment.systemPackages = [ 45 - (pkgs.writers.writeDashBin "dmenu-wl" '' 46 - unset TERM 47 - ${pkgs.fzfmenu}/bin/fzfmenu "$@" 48 - '') 49 - pkgs.ydotool 50 - pkgs.wl-clipboard 51 - pkgs.fzfmenu 52 - pkgs.glib 53 - pkgs.dracula-theme 54 - pkgs.gnome3.adwaita-icon-theme 55 - ]; 56 - 57 - services.dbus.enable = true; 58 - xdg.portal = { 59 - enable = true; 60 - wlr.enable = true; 61 - # gtk portal needed to make gtk apps happy 62 - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; 63 - }; 64 - programs.sway = { 65 - enable = true; 66 - wrapperFeatures.gtk = true; 67 - }; 68 - 69 - environment.etc."sway/config".text = '' 70 - # Default config for sway 71 - # 72 - # Copy this to ~/.config/sway/config and edit it to your liking. 73 - # 74 - # Read `man 5 sway` for a complete reference. 75 - 76 - ### Variables 77 - # 78 - # Logo key. Use Mod1 for Alt. 79 - set $mod Mod4 80 - # Home row direction keys, like vim 81 - set $left h 82 - set $down j 83 - set $up k 84 - set $right l 85 - # Your preferred terminal emulator 86 - set $term ${term} 87 - # Your preferred application launcher 88 - # Note: pass the final command to swaymsg so that the resulting window can be opened 89 - # on the original workspace that the command was run on. 90 - set $menu ${pkgs.dmenu}/bin/dmenu_path | fzfmenu | xargs swaymsg exec -- 91 - 92 - ### Output configuration 93 - # 94 - # Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) 95 - # output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill 96 - # 97 - # Example configuration: 98 - # 99 - # output HDMI-A-1 resolution 1920x1080 position 1920,0 100 - # 101 - # You can get the names of your outputs by running: swaymsg -t get_outputs 102 - 103 - ### Idle configuration 104 - # 105 - # Example configuration: 106 - # 107 - # exec swayidle -w \ 108 - # timeout 300 'swaylock -f -c 000000' \ 109 - # timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ 110 - # before-sleep 'swaylock -f -c 000000' 111 - # 112 - # This will lock your screen after 300 seconds of inactivity, then turn off 113 - # your displays after another 300 seconds, and turn your screens back on when 114 - # resumed. It will also lock your screen before your computer goes to sleep. 115 - 116 - ### Input configuration 117 - # 118 - # Example configuration: 119 - # 120 - # input "2:14:SynPS/2_Synaptics_TouchPad" { 121 - # dwt enabled 122 - # tap enabled 123 - # natural_scroll enabled 124 - # middle_emulation enabled 125 - # } 126 - # 127 - # You can get the names of your inputs by running: swaymsg -t get_inputs 128 - # Read `man 5 sway-input` for more information about this section. 129 - 130 - ### Key bindings 131 - # 132 - # Basics: 133 - # 134 - # Start a terminal 135 - bindsym $mod+Shift+Return exec $term 136 - 137 - # Kill focused window 138 - bindsym $mod+Shift+c kill 139 - 140 - # Start your launcher 141 - bindsym $mod+d exec $menu 142 - 143 - # Drag floating windows by holding down $mod and left mouse button. 144 - # Resize them with right mouse button + $mod. 145 - # Despite the name, also works for non-floating windows. 146 - # Change normal to inverse to use left mouse button for resizing and right 147 - # mouse button for dragging. 148 - floating_modifier $mod normal 149 - 150 - # Reload the configuration file 151 - bindsym $mod+Shift+r reload 152 - 153 - # Exit sway (logs you out of your Wayland session) 154 - bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' 155 - # 156 - # Moving around: 157 - # 158 - # Move your focus around 159 - bindsym $mod+Left focus left 160 - bindsym $mod+Down focus down 161 - bindsym $mod+Up focus up 162 - bindsym $mod+Right focus right 163 - 164 - # Move the focused window with the same, but add Shift 165 - bindsym $mod+Shift+Left move left 166 - bindsym $mod+Shift+Down move down 167 - bindsym $mod+Shift+Up move up 168 - bindsym $mod+Shift+Right move right 169 - # Layout stuff: 170 - # 171 - # You can "split" the current object of your focus with 172 - # $mod+b or $mod+v, for horizontal and vertical splits 173 - # respectively. 174 - bindsym $mod+b splith 175 - bindsym $mod+v splitv 176 - 177 - # Switch the current container between different layout styles 178 - bindsym $mod+s layout stacking 179 - bindsym $mod+w layout tabbed 180 - bindsym $mod+e layout toggle split 181 - 182 - # Make the current focus fullscreen 183 - bindsym $mod+f fullscreen 184 - 185 - # Toggle the current focus between tiling and floating mode 186 - bindsym $mod+Shift+space floating toggle 187 - 188 - # Swap focus between the tiling area and the floating area 189 - bindsym $mod+space focus mode_toggle 190 - 191 - # Move focus to the parent container 192 - bindsym $mod+Shift+a focus parent 193 - # 194 - # Scratchpad: 195 - # 196 - # Sway has a "scratchpad", which is a bag of holding for windows. 197 - # You can send windows there and get them back later. 198 - 199 - # Move the currently focused window to the scratchpad 200 - bindsym $mod+Shift+minus move scratchpad 201 - 202 - # Show the next scratchpad window or hide the focused scratchpad window. 203 - # If there are multiple scratchpad windows, this command cycles through them. 204 - bindsym $mod+minus scratchpad show 205 - # 206 - # Resizing containers: 207 - # 208 - mode "resize" { 209 - # left will shrink the containers width 210 - # right will grow the containers width 211 - # up will shrink the containers height 212 - # down will grow the containers height 213 - bindsym $left resize shrink width 10px 214 - bindsym $down resize grow height 10px 215 - bindsym $up resize shrink height 10px 216 - bindsym $right resize grow width 10px 217 - 218 - # Ditto, with arrow keys 219 - bindsym Left resize shrink width 10px 220 - bindsym Down resize grow height 10px 221 - bindsym Up resize shrink height 10px 222 - bindsym Right resize grow width 10px 223 - 224 - # Return to default mode 225 - bindsym Return mode "default" 226 - bindsym Escape mode "default" 227 - } 228 - bindsym $mod+r mode "resize" 229 - 230 - # 231 - # Status Bar: 232 - # 233 - # Read `man 5 sway-bar` for more information about this section. 234 - bar { 235 - position top 236 - 237 - # When the status_command prints a new line to stdout, swaybar updates. 238 - # The default just shows the current date and time. 239 - status_command while date +'%Y-%m-%d %H:%M:%S'; do sleep 1; done 240 - 241 - colors { 242 - statusline #ffffff 243 - background #323232 244 - inactive_workspace #32323200 #32323200 #5c5c5c 245 - } 246 - } 247 - 248 - default_border pixel 1 249 - default_floating_border none 250 - smart_borders on 251 - 252 - bindsym $mod+q exec ${pkgs.writers.writeDash "goto_workspace" '' 253 - set -efux 254 - unset TERM # we want fzfmenu to start a new terminal 255 - CURRENT_OUTPUT=$(swaymsg -r -t get_outputs | jq '.[] | select(.focused == true).name') 256 - FZFMENU_FZF_DEFAULT_OPTS="--select-1" 257 - WS=$(swaymsg -r -t get_workspaces | 258 - jq -r '.[].name' | 259 - fzfmenu -p 'Workspace name: ' 260 - ) 261 - if [ -n "$WS" ]; then 262 - swaymsg workspace "$WS" 263 - swaymsg move workspace to output "$CURRENT_OUTPUT" 264 - fi 265 - ''} 266 - 267 - bindsym $mod+Shift+q exec ${pkgs.writers.writeDash "moveto_workspace" '' 268 - set -efux 269 - unset TERM # we want fzfmenu to start a new terminal 270 - FZFMENU_FZF_DEFAULT_OPTS="--select-1" 271 - WS=$(swaymsg -r -t get_workspaces | 272 - jq -r '.[].name' | 273 - fzfmenu -p 'Workspace name: ' 274 - ) 275 - if [ -n "$WS" ]; then 276 - swaymsg move container to workspace "$WS" 277 - fi 278 - ''} 279 - 280 - bindsym $mod+x exec ${./starter} floating enable -- ${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yaml 281 - bindsym $mod+y exec /run/current-system/sw/bin/switch-theme toggle 282 - 283 - for_window [title="fzfmenu"] floating enable 284 - bindsym $mod+Tab focus next 285 - bindsym $mod+Escape workspace back_and_forth 286 - 287 - bindsym $mod+p exec ${pkgs.writers.writeDash "passmenu" '' 288 - set -efux 289 - unset TERM # we want fzfmenu to start a new terminal 290 - (cd $HOME/.password-store; find -type f -name '*.gpg') | 291 - sed -e 's/\.gpg$//' | 292 - fzfmenu -p 'Password: ' | 293 - xargs -I{} pass show {} | 294 - tr -d '\n' | 295 - ${pkgs.wtype}/bin/wtype -s 1 - 296 - ''} 297 - bindsym $mod+Shift+p exec ${pkgs.writers.writeDash "otpmenu" '' 298 - unset TERM 299 - ${pkgs.otpmenu}/bin/otpmenu 300 - ''} 301 - 302 - # screenlock 303 - bindsym $mod+F11 exec ${pkgs.swaylock}/bin/swaylock -f -c 000000 304 - 305 - # media buttons 306 - bindsym XF86AudioMute exec ${pkgs.pulseaudio.out}/bin/pactl -- set-sink-mute @DEFAULT_SINK@ toggle 307 - bindsym XF86AudioRaiseVolume exec ${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ +4% 308 - bindsym XF86AudioLowerVolume exec ${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ -4% 309 - bindsym XF86MonBrightnessDown exec ${pkgs.acpilight}/bin/xbacklight -time 0 -dec 1 310 - bindsym XF86MonBrightnessUp exec ${pkgs.acpilight}/bin/xbacklight -time 0 -inc 1 311 - 312 - # background programs 313 - exec ydotoold 314 - exec_always pkill kanshi; exec ${pkgs.kanshi}/bin/kanshi 315 - 316 - # theme and env specific stuff 317 - exec_always ${pkgs.writers.writeDash "dbus-sway-environment" '' 318 - set -efux 319 - dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway 320 - systemctl --user stop xdg-desktop-portal xdg-desktop-portal-wlr 321 - systemctl --user start xdg-desktop-portal xdg-desktop-portal-wlr 322 - ''} 323 - 324 - exec_always ${let 325 - schema = pkgs.gsettings-desktop-schemas; 326 - datadir = "${schema}/share/gsettings-schemas/${schema.name}"; 327 - in pkgs.writers.writeDash "gsettings" '' 328 - set -efux 329 - export XDG_DATA_DIRS=${pkgs.gsettings-desktop-schemas}:$XDG_DATA_DIRS 330 - gnome_schema=org.gnome.desktop.interface 331 - gsettings set $gnome_schema gtk-theme 'Dracula' 332 - ''} 333 - 334 - # keyboard 335 - input type:keyboard { 336 - xkb_layout us 337 - xkb_variant altgr-intl 338 - xkb_options caps:hyper 339 - } 340 - 341 - # flameshot 342 - for_window [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0 343 - exec ${pkgs.flameshot}/bin/flameshot 344 - ''; 345 - 346 - }
+2 -40
machines/ignavia/config.nix
··· 4 4 imports = [ 5 5 ../../2configs/retiolum.nix 6 6 ../../2configs/exim-retiolum.nix 7 - ../../2configs/baseX.nix 7 + # ../../2configs/baseX.nix 8 + ../../2configs/desktops/qtile 8 9 ../../2configs/yubikey.nix 9 10 ../../2configs/pipewire.nix 10 11 ../../2configs/browsers.nix ··· 137 138 boot.cleanTmpDir = true; 138 139 programs.noisetorch.enable = true; 139 140 140 - # wayland stuff 141 - environment.systemPackages = [ 142 - pkgs.rofi-wayland 143 - pkgs.wtype 144 - pkgs.otpmenu 145 - pkgs.qtile 146 - pkgs.swaylock 147 - pkgs.copyq 148 - (pkgs.writers.writeDashBin "pass_menu" '' 149 - set -efux 150 - password=$( 151 - (cd $HOME/.password-store; find -type f -name '*.gpg') | 152 - sed -e 's/\.gpg$//' | 153 - rofi -dmenu -p 'Password: ' | 154 - xargs -I{} pass show {} | 155 - tr -d '\n' 156 - ) 157 - echo -n "$password" | ${pkgs.wtype}/bin/wtype -d 10 -s 400 - 158 - '') 159 - (pkgs.writeTextFile { 160 - name = "configure-gtk"; 161 - destination = "/bin/configure-gtk"; 162 - executable = true; 163 - text = let 164 - schema = pkgs.gsettings-desktop-schemas; 165 - datadir = "${schema}/share/gsettings-schemas/${schema.name}"; 166 - in '' 167 - export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS 168 - gnome_schema=org.gnome.desktop.interface 169 - gsettings set $gnome_schema gtk-theme 'Dracula' 170 - ''; 171 - }) 172 - ]; 173 - 174 - security.pam.services.swaylock.text = '' 175 - # PAM configuration file for the swaylock screen locker. By default, it includes 176 - # the 'login' configuration file (see /etc/pam.d/login) 177 - auth include login 178 - ''; 179 141 180 142 }
+60
2configs/desktops/lib/wayland.nix
··· 1 + { pkgs, lib, ... }: 2 + { 3 + imports = [ 4 + ../../alacritty.nix 5 + ../../mpv.nix 6 + ../../power-action.nix 7 + ../../urxvt.nix 8 + ../../xdg-open.nix 9 + ../../yubikey.nix 10 + ../../tmux.nix 11 + ../../themes.nix 12 + ../../fonts.nix 13 + # ./pipewire.nix 14 + # ./tty-share.nix 15 + { 16 + users.users.mainUser.packages = [ 17 + pkgs.sshuttle 18 + ]; 19 + security.sudo.extraConfig = '' 20 + lass ALL= (root) NOPASSWD:SETENV: ${pkgs.sshuttle}/bin/.sshuttle-wrapped 21 + ''; 22 + } 23 + ]; 24 + users.users.mainUser.extraGroups = [ "audio" "pipewire" "video" "input" ]; 25 + 26 + security.polkit.enable = true; 27 + security.pam.services.swaylock = { }; 28 + 29 + environment.systemPackages = [ 30 + pkgs.ydotool 31 + pkgs.wl-clipboard 32 + pkgs.rofi 33 + pkgs.swaylock 34 + pkgs.glib 35 + pkgs.dracula-theme 36 + pkgs.gnome3.adwaita-icon-theme 37 + (pkgs.writers.writeDashBin "pass_menu" '' 38 + set -efu 39 + password=$( 40 + (cd $HOME/.password-store; find -type f -name '*.gpg') | 41 + sed -e 's/\.gpg$//' | 42 + rofi -dmenu -p 'Password: ' | 43 + xargs -I{} pass show {} | 44 + tr -d '\n' 45 + ) 46 + echo -n "$password" | ${pkgs.wtype}/bin/wtype -d 10 -s 400 - 47 + '') 48 + ]; 49 + 50 + services.dbus.enable = true; 51 + xdg.portal = { 52 + enable = true; 53 + wlr.enable = true; 54 + # gtk portal needed to make gtk apps happy 55 + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; 56 + }; 57 + fonts.enableDefaultPackages = true; 58 + programs.dconf.enable = lib.mkDefault true; 59 + 60 + }
+192
2configs/desktops/lib/x11.nix
··· 1 + { self, config, lib, pkgs, ... }: 2 + { 3 + imports = [ 4 + ../../alacritty.nix 5 + ../../mpv.nix 6 + ../../power-action.nix 7 + ../../xdg-open.nix 8 + ../../yubikey.nix 9 + ../../pipewire.nix 10 + ../../tmux.nix 11 + ../../xmonad.nix 12 + ../../themes.nix 13 + ../../fonts.nix 14 + { 15 + users.users.mainUser.packages = [ 16 + pkgs.sshuttle 17 + ]; 18 + security.sudo.extraConfig = '' 19 + lass ALL= (root) NOPASSWD:SETENV: ${pkgs.sshuttle}/bin/.sshuttle-wrapped 20 + ''; 21 + } 22 + { #font magic 23 + options.lass.fonts = { 24 + regular = lib.mkOption { 25 + type = lib.types.str; 26 + default = "xft:Iosevka Term SS15:style=regular"; 27 + }; 28 + bold = lib.mkOption { 29 + type = lib.types.str; 30 + default = "xft:Iosevka Term SS15:style=bold"; 31 + }; 32 + italic = lib.mkOption { 33 + type = lib.types.str; 34 + default = "xft:Iosevka Term SS15:style=italic"; 35 + }; 36 + }; 37 + config.krebs.xresources.resources.X = '' 38 + *.font: ${config.lass.fonts.regular} 39 + *.boldFont: ${config.lass.fonts.bold} 40 + *.italicFont: ${config.lass.fonts.italic} 41 + ''; 42 + } 43 + ]; 44 + 45 + users.users.mainUser.extraGroups = [ "audio" "pipewire" "video" ]; 46 + 47 + time.timeZone = "Europe/Berlin"; 48 + 49 + programs.ssh.agentTimeout = "10m"; 50 + programs.ssh.startAgent = false; 51 + services.openssh.forwardX11 = true; 52 + 53 + environment.systemPackages = with pkgs; [ 54 + acpi 55 + acpilight 56 + ripgrep 57 + cabal2nix 58 + dic 59 + dmenu 60 + font-size 61 + fzfmenu 62 + gimp 63 + gitAndTools.gh 64 + git-crypt 65 + git-preview 66 + dconf 67 + iodine 68 + libarchive 69 + lm_sensors 70 + ncdu 71 + nix-index 72 + nixpkgs-review 73 + nmap 74 + pavucontrol 75 + ponymix 76 + powertop 77 + rxvt-unicode 78 + sshvnc 79 + sxiv 80 + nsxiv 81 + taskwarrior 82 + termite 83 + transgui 84 + wirelesstools 85 + x11vnc 86 + xclip 87 + xephyrify 88 + xorg.xmodmap 89 + xorg.xhost 90 + xdotool 91 + xsel 92 + zathura 93 + flameshot 94 + (pkgs.writers.writeDashBin "screenshot" '' 95 + set -efu 96 + 97 + ${pkgs.flameshot}/bin/flameshot gui && 98 + ${pkgs.klem}/bin/klem 99 + '') 100 + (pkgs.writers.writeDashBin "IM" '' 101 + ${pkgs.mosh}/bin/mosh green.r -- tmux new-session -A -s IM -- weechat 102 + '') 103 + (pkgs.writers.writeDashBin "deploy_hm" '' 104 + target=$1 105 + shift 106 + 107 + hm_profile=$(${pkgs.home-manager}/bin/home-manager -f ~/sync/stockholm/lass/2configs/home-manager.nix build "$@") 108 + nix-copy-closure --to "$target" "$hm_profile" 109 + ssh "$target" -- "$hm_profile"/activate 110 + '') 111 + zbar 112 + ]; 113 + 114 + services.udev.extraRules = '' 115 + SUBSYSTEM=="backlight", ACTION=="add", \ 116 + RUN+="${pkgs.coreutils}/bin/chgrp video /sys/class/backlight/%k/brightness", \ 117 + RUN+="${pkgs.coreutils}/bin/chmod g+w /sys/class/backlight/%k/brightness" 118 + ''; 119 + 120 + services.xserver = { 121 + enable = true; 122 + layout = "us"; 123 + display = lib.mkForce 0; 124 + xkbVariant = "altgr-intl"; 125 + xkbOptions = "caps:escape"; 126 + libinput.enable = true; 127 + exportConfiguration = true; 128 + displayManager = { 129 + lightdm.enable = true; 130 + defaultSession = "none+xmonad"; 131 + sessionCommands = '' 132 + ${pkgs.xorg.xhost}/bin/xhost +LOCAL: 133 + ''; 134 + }; 135 + }; 136 + 137 + nixpkgs.config.packageOverrides = super: { 138 + dmenu = pkgs.writers.writeDashBin "dmenu" '' 139 + ${pkgs.fzfmenu}/bin/fzfmenu "$@" 140 + ''; 141 + }; 142 + 143 + krebs.xresources.enable = true; 144 + 145 + lass.klem = { 146 + kpaste.script = pkgs.writeDash "kpaste-wrapper" '' 147 + ${pkgs.kpaste}/bin/kpaste \ 148 + | ${pkgs.coreutils}/bin/tail -1 \ 149 + | ${pkgs.coreutils}/bin/tr -d '\r\n' 150 + ''; 151 + go = { 152 + target = "STRING"; 153 + script = "${pkgs.goify}/bin/goify"; 154 + }; 155 + "go.lassul.us" = { 156 + target = "STRING"; 157 + script = pkgs.writeDash "go.lassul.us" '' 158 + export GO_HOST='go.lassul.us' 159 + ${pkgs.goify}/bin/goify 160 + ''; 161 + }; 162 + qrcode = { 163 + target = "image"; 164 + script = pkgs.writeDash "zbar" '' 165 + ${pkgs.zbar}/bin/zbarimg -q --raw - 166 + ''; 167 + }; 168 + ocr = { 169 + target = "image"; 170 + script = pkgs.writeDash "gocr" '' 171 + ${pkgs.netpbm}/bin/pngtopnm - \ 172 + | ${pkgs.gocr}/bin/gocr - 173 + ''; 174 + }; 175 + }; 176 + 177 + services.clipmenu.enable = true; 178 + 179 + # synchronize all the clipboards 180 + systemd.user.services.autocutsel = { 181 + enable = true; 182 + wantedBy = [ "graphical-session.target" ]; 183 + after = [ "graphical-session.target" ]; 184 + serviceConfig = { 185 + Type = "forking"; 186 + ExecStart = pkgs.writers.writeDash "autocutsel" '' 187 + ${pkgs.autocutsel}/bin/autocutsel -fork -selection PRIMARY 188 + ${pkgs.autocutsel}/bin/autocutsel -fork -selection CLIPBOARD 189 + ''; 190 + }; 191 + }; 192 + }
+77
2configs/desktops/qtile/default.nix
··· 1 + { pkgs, ... }: 2 + { 3 + imports = [ 4 + ../lib/wayland.nix 5 + ]; 6 + # xdg.portal.enable = true; 7 + # xdg.portal.wlr.enable = true; 8 + # fonts.enableDefaultPackages = true; 9 + 10 + # security.polkit.enable = true; 11 + # security.pam.services.swaylock = { }; 12 + 13 + # programs.dconf.enable = lib.mkDefault true; 14 + # programs.xwayland.enable = lib.mkDefault true; 15 + 16 + # environment.sessionVariables = { 17 + # MOZ_ENABLE_WAYLAND = "1"; 18 + # XDG_SESSION_TYPE = "wayland"; 19 + # XDG_CURRENT_DESKTOP = "qtile"; 20 + # SDL_VIDEODRIVER = "wayland"; 21 + # QT_QPA_PLATFORM = "wayland"; 22 + # QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; 23 + # _JAVA_AWT_WM_NONREPARENTING = "1"; 24 + # }; 25 + 26 + # # wayland stuff 27 + # environment.systemPackages = [ 28 + # pkgs.rofi-wayland 29 + # pkgs.wtype 30 + # pkgs.otpmenu 31 + # pkgs.qtile 32 + # pkgs.swaylock 33 + # pkgs.copyq 34 + # (pkgs.writers.writeDashBin "pass_menu" '' 35 + # set -efux 36 + # password=$( 37 + # (cd $HOME/.password-store; find -type f -name '*.gpg') | 38 + # sed -e 's/\.gpg$//' | 39 + # rofi -dmenu -p 'Password: ' | 40 + # xargs -I{} pass show {} | 41 + # tr -d '\n' 42 + # ) 43 + # echo -n "$password" | ${pkgs.wtype}/bin/wtype -d 10 -s 400 - 44 + # '') 45 + # (pkgs.writeTextFile { 46 + # name = "configure-gtk"; 47 + # destination = "/bin/configure-gtk"; 48 + # executable = true; 49 + # text = let 50 + # schema = pkgs.gsettings-desktop-schemas; 51 + # datadir = "${schema}/share/gsettings-schemas/${schema.name}"; 52 + # in '' 53 + # export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS 54 + # gnome_schema=org.gnome.desktop.interface 55 + # gsettings set $gnome_schema gtk-theme 'Dracula' 56 + # ''; 57 + # }) 58 + # ]; 59 + 60 + services.xserver.windowManager.qtile = { 61 + enable = true; 62 + backend = "wayland"; 63 + }; 64 + 65 + environment.etc."qtile.py".source = ./qtile.py; 66 + environment.systemPackages = [ 67 + (pkgs.writeTextFile { 68 + name = "qtile.py"; 69 + destination = "/etc/xdg/qtile.py"; 70 + text = builtins.readFile ./qtile.py; 71 + }) 72 + (pkgs.writeScriptBin "startx" '' 73 + qtile start -b wayland -c /etc/qtile.py 74 + '') 75 + pkgs.copyq 76 + ]; 77 + }
+231
2configs/desktops/qtile/qtile.py
··· 1 + import subprocess 2 + import threading 3 + import json 4 + import os 5 + from typing import Callable 6 + 7 + from libqtile import bar, layout, widget, extension 8 + from libqtile.config import Click, Drag, Group, Key, Match, Screen, ScratchPad, DropDown 9 + from libqtile.lazy import lazy 10 + from libqtile.utils import guess_terminal 11 + from libqtile.command.client import InteractiveCommandClient 12 + from libqtile.core.manager import Qtile 13 + from libqtile.backend.wayland import InputConfig 14 + 15 + prompt = widget.Prompt() 16 + state_file = "/home/lass/.local/share/qtile/state" 17 + 18 + 19 + def dmenu(candidates: list[str], callback: Callable) -> None: 20 + def thread() -> None: 21 + dmenu = subprocess.Popen(["rofi", "-dmenu"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) 22 + output = dmenu.communicate(input=("\n".join(candidates)).encode()) 23 + callback(output[0].decode().rstrip()) 24 + threading.Thread(target=thread).start() 25 + 26 + @lazy.function 27 + def goto_workspace(qtile: Qtile) -> None: 28 + def callback(name: str) -> None: 29 + c=InteractiveCommandClient() 30 + c.group[name].toscreen() 31 + dmenu(candidates=qtile.items("group")[1], callback=callback) 32 + 33 + @lazy.function 34 + def moveto_workspace(qtile: Qtile) -> None: 35 + def callback(name: str) -> None: 36 + c=InteractiveCommandClient() 37 + c.window.togroup(name) 38 + dmenu(candidates=qtile.items("group")[1], callback=callback) 39 + 40 + @lazy.function 41 + def add_group(qtile: Qtile) -> None: 42 + def callback(name: str) -> None: 43 + qtile.addgroup(name) 44 + prompt.start_input("Add group: ", callback=callback) 45 + 46 + @lazy.function 47 + def del_group(qtile: Qtile) -> None: 48 + qtile.delgroup(qtile.current_group.name) 49 + 50 + @lazy.function 51 + def reload_config(qtile: Qtile) -> None: 52 + with open(state_file, "w") as f: 53 + f.write(json.dumps(qtile.get_groups(), default=tuple)) 54 + qtile.reload_config() 55 + 56 + mod = "mod4" 57 + terminal = guess_terminal() 58 + 59 + if os.path.exists(state_file): 60 + with open(state_file, "r") as f: 61 + state = json.loads(f.read()) 62 + groups = [Group(name) for name, _ in state.items()] 63 + else: 64 + groups = [ 65 + Group("dashboard"), 66 + Group("ff"), 67 + ] 68 + 69 + keys = [ 70 + # A list of available commands that can be bound to keys can be found 71 + # at https://docs.qtile.org/en/latest/manual/config/lazy.html 72 + # Switch between windows 73 + Key([mod], "Tab", lazy.layout.next(), desc="Move window focus to other window"), 74 + Key([mod, "shift"], "Tab", lazy.layout.previous(), desc="Move window focus to other window"), 75 + 76 + Key([mod], "Escape", lazy.screen.toggle_group(), desc="Switch to last active group"), 77 + # Move windows between left/right columns or move up/down in current stack. 78 + # Moving out of range in Columns layout will create new column. 79 + Key([mod, "shift"], "a", add_group, desc="add group"), 80 + Key([mod, "shift"], "backspace", del_group, desc="delete group"), 81 + Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"), 82 + Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"), 83 + Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"), 84 + Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"), 85 + # Grow windows. If current window is on the edge of screen and direction 86 + # will be to screen edge - window would shrink. 87 + Key([mod, "control"], "h", lazy.layout.grow_left(), desc="Grow window to the left"), 88 + Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"), 89 + Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"), 90 + Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"), 91 + Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen",), 92 + Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), 93 + Key([mod], "d", lazy.spawn("copyq show")), 94 + Key([mod, "shift"], "Return", lazy.spawn(terminal), desc="Launch terminal"), 95 + # Toggle between different layouts as defined below 96 + Key([mod], "Space", lazy.next_layout(), desc="Toggle between layouts"), 97 + Key([mod, "shift"], "c", lazy.window.kill(), desc="Kill focused window"), 98 + Key([mod], "F11", lazy.spawn("swaylock --image /var/lib/wallpaper/wallpaper")), 99 + Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"), 100 + Key([mod, "shift"], "r", reload_config, desc="Reload the config"), 101 + Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), 102 + Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"), 103 + Key([mod], "F1", lazy.group["scratchpad"].dropdown_toggle("term")), 104 + Key([mod], "p", lazy.spawn("pass_menu")), 105 + Key([mod, "shift"], "p", lazy.spawn("otpmenu")), 106 + Key([mod], "v", goto_workspace, desc="Switch to group"), 107 + Key([mod, "shift"], "v", moveto_workspace, desc="move window to group"), 108 + Key([], "XF86AudioRaiseVolume", lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%")), 109 + Key([], "XF86AudioLowerVolume", lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%")), 110 + Key([], "XF86MonBrightnessUp", lazy.spawn("xbacklight -inc 10")), 111 + Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 10")), 112 + ] 113 + 114 + layouts = [ 115 + layout.Max(), 116 + layout.Columns(border_focus_stack=["#d75f5f", "#8f3d3d"], border_width=4), 117 + # Try more layouts by unleashing below layouts. 118 + # layout.Stack(num_stacks=2), 119 + # layout.Bsp(), 120 + layout.Matrix(), 121 + # layout.MonadTall(), 122 + # layout.MonadWide(), 123 + # layout.RatioTile(), 124 + # layout.Tile(), 125 + # layout.TreeTab(), 126 + # layout.VerticalTile(), 127 + # layout.Zoomy(), 128 + ] 129 + 130 + widget_defaults = dict( 131 + font="sans", 132 + fontsize=12, 133 + padding=3, 134 + ) 135 + extension_defaults = widget_defaults.copy() 136 + 137 + screens = [ 138 + Screen( 139 + bottom=bar.Bar( 140 + [ 141 + widget.CurrentLayout(), 142 + widget.GenPollUrl( 143 + url="http://radio.r:8002/current", 144 + parse=lambda r: "/".join(r["filename"].split("/")[-2:]), 145 + update_interval=15, 146 + ), 147 + widget.Spacer(), 148 + widget.Wlan(interface="wlp170s0"), 149 + widget.HDDBusyGraph(device="nvme0n1", graph_color="#4fbe4f"), 150 + widget.MemoryGraph(graph_color="#eed563"), 151 + widget.CPUGraph(graph_color="#8575bf"), 152 + widget.ThermalZone(zone="/sys/class/thermal/thermal_zone1/temp", background="#440000"), 153 + widget.PulseVolume(background="#009900"), 154 + widget.Backlight(background="#b18f00", backlight_name="intel_backlight"), 155 + widget.Battery(background="#e52383"), 156 + widget.Clock(format="%Y-%m-%d %a %H:%M"), 157 + # NB Systray is incompatible with Wayland, consider using StatusNotifier instead 158 + widget.StatusNotifier(), 159 + ], 160 + 24, 161 + # border_width=[2, 0, 2, 0], # Draw top and bottom borders 162 + # border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta 163 + ), 164 + top=bar.Bar( 165 + [ 166 + widget.GroupBox(), 167 + prompt, 168 + widget.WindowName(), 169 + widget.Chord( 170 + chords_colors={ 171 + "launch": ("#ff0000", "#ffffff"), 172 + }, 173 + name_transform=lambda name: name.upper(), 174 + ), 175 + ], 176 + 24, 177 + ), 178 + # You can uncomment this variable if you see that on X11 floating resize/moving is laggy 179 + # By default we handle these events delayed to already improve performance, however your system might still be struggling 180 + # This variable is set to None (no cap) by default, but you can set it to 60 to indicate that you limit it to 60 events per second 181 + # x11_drag_polling_rate = 60, 182 + ), 183 + ] 184 + 185 + # Drag floating layouts. 186 + mouse = [ 187 + Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()), 188 + Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()), 189 + Click([mod], "Button2", lazy.window.bring_to_front()), 190 + ] 191 + 192 + dgroups_key_binder = None 193 + dgroups_app_rules = [] # type: list 194 + follow_mouse_focus = True 195 + bring_front_click = False 196 + floats_kept_above = True 197 + cursor_warp = False 198 + floating_layout = layout.Floating( 199 + float_rules=[ 200 + # Run the utility of `xprop` to see the wm class and name of an X client. 201 + *layout.Floating.default_float_rules, 202 + Match(wm_class="confirmreset"), # gitk 203 + Match(wm_class="makebranch"), # gitk 204 + Match(wm_class="maketag"), # gitk 205 + Match(wm_class="ssh-askpass"), # ssh-askpass 206 + Match(title="branchdialog"), # gitk 207 + Match(title="pinentry"), # GPG key password entry 208 + ] 209 + ) 210 + auto_fullscreen = True 211 + focus_on_window_activation = "smart" 212 + reconfigure_screens = True 213 + 214 + # If things like steam games want to auto-minimize themselves when losing 215 + # focus, should we respect this or not? 216 + auto_minimize = True 217 + 218 + # When using the Wayland backend, this can be used to configure input devices. 219 + wl_input_rules = { 220 + "type:keyboard": InputConfig(kb_options="ctrl:nocaps", kb_layout="us", kb_variant="altgr-intl"), 221 + } 222 + 223 + # XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this 224 + # string besides java UI toolkits; you can see several discussions on the 225 + # mailing lists, GitHub issues, and other WM documentation that suggest setting 226 + # this string if your java app doesn't work correctly. We may as well just lie 227 + # and say that we're a working one by default. 228 + # 229 + # We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in 230 + # java that happens to be on java's whitelist. 231 + wmname = "LG3D"
+291
2configs/desktops/sway/default.nix
··· 1 + { config, lib, pkgs, ... }: let 2 + 3 + term = "/run/current-system/sw/bin/alacritty"; 4 + 5 + in { 6 + imports = [ 7 + ../lib/wayland.nix 8 + ]; 9 + programs.sway = { 10 + enable = true; 11 + wrapperFeatures.gtk = true; 12 + }; 13 + 14 + environment.etc."sway/config".text = '' 15 + # Default config for sway 16 + # 17 + # Copy this to ~/.config/sway/config and edit it to your liking. 18 + # 19 + # Read `man 5 sway` for a complete reference. 20 + 21 + ### Variables 22 + # 23 + # Logo key. Use Mod1 for Alt. 24 + set $mod Mod4 25 + # Home row direction keys, like vim 26 + set $left h 27 + set $down j 28 + set $up k 29 + set $right l 30 + # Your preferred terminal emulator 31 + set $term ${term} 32 + # Your preferred application launcher 33 + # Note: pass the final command to swaymsg so that the resulting window can be opened 34 + # on the original workspace that the command was run on. 35 + set $menu ${pkgs.dmenu}/bin/dmenu_path | fzfmenu | xargs swaymsg exec -- 36 + 37 + ### Output configuration 38 + # 39 + # Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) 40 + # output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill 41 + # 42 + # Example configuration: 43 + # 44 + # output HDMI-A-1 resolution 1920x1080 position 1920,0 45 + # 46 + # You can get the names of your outputs by running: swaymsg -t get_outputs 47 + 48 + ### Idle configuration 49 + # 50 + # Example configuration: 51 + # 52 + # exec swayidle -w \ 53 + # timeout 300 'swaylock -f -c 000000' \ 54 + # timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ 55 + # before-sleep 'swaylock -f -c 000000' 56 + # 57 + # This will lock your screen after 300 seconds of inactivity, then turn off 58 + # your displays after another 300 seconds, and turn your screens back on when 59 + # resumed. It will also lock your screen before your computer goes to sleep. 60 + 61 + ### Input configuration 62 + # 63 + # Example configuration: 64 + # 65 + # input "2:14:SynPS/2_Synaptics_TouchPad" { 66 + # dwt enabled 67 + # tap enabled 68 + # natural_scroll enabled 69 + # middle_emulation enabled 70 + # } 71 + # 72 + # You can get the names of your inputs by running: swaymsg -t get_inputs 73 + # Read `man 5 sway-input` for more information about this section. 74 + 75 + ### Key bindings 76 + # 77 + # Basics: 78 + # 79 + # Start a terminal 80 + bindsym $mod+Shift+Return exec $term 81 + 82 + # Kill focused window 83 + bindsym $mod+Shift+c kill 84 + 85 + # Start your launcher 86 + bindsym $mod+d exec $menu 87 + 88 + # Drag floating windows by holding down $mod and left mouse button. 89 + # Resize them with right mouse button + $mod. 90 + # Despite the name, also works for non-floating windows. 91 + # Change normal to inverse to use left mouse button for resizing and right 92 + # mouse button for dragging. 93 + floating_modifier $mod normal 94 + 95 + # Reload the configuration file 96 + bindsym $mod+Shift+r reload 97 + 98 + # Exit sway (logs you out of your Wayland session) 99 + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' 100 + # 101 + # Moving around: 102 + # 103 + # Move your focus around 104 + bindsym $mod+Left focus left 105 + bindsym $mod+Down focus down 106 + bindsym $mod+Up focus up 107 + bindsym $mod+Right focus right 108 + 109 + # Move the focused window with the same, but add Shift 110 + bindsym $mod+Shift+Left move left 111 + bindsym $mod+Shift+Down move down 112 + bindsym $mod+Shift+Up move up 113 + bindsym $mod+Shift+Right move right 114 + # Layout stuff: 115 + # 116 + # You can "split" the current object of your focus with 117 + # $mod+b or $mod+v, for horizontal and vertical splits 118 + # respectively. 119 + bindsym $mod+b splith 120 + bindsym $mod+v splitv 121 + 122 + # Switch the current container between different layout styles 123 + bindsym $mod+s layout stacking 124 + bindsym $mod+w layout tabbed 125 + bindsym $mod+e layout toggle split 126 + 127 + # Make the current focus fullscreen 128 + bindsym $mod+f fullscreen 129 + 130 + # Toggle the current focus between tiling and floating mode 131 + bindsym $mod+Shift+space floating toggle 132 + 133 + # Swap focus between the tiling area and the floating area 134 + bindsym $mod+space focus mode_toggle 135 + 136 + # Move focus to the parent container 137 + bindsym $mod+Shift+a focus parent 138 + # 139 + # Scratchpad: 140 + # 141 + # Sway has a "scratchpad", which is a bag of holding for windows. 142 + # You can send windows there and get them back later. 143 + 144 + # Move the currently focused window to the scratchpad 145 + bindsym $mod+Shift+minus move scratchpad 146 + 147 + # Show the next scratchpad window or hide the focused scratchpad window. 148 + # If there are multiple scratchpad windows, this command cycles through them. 149 + bindsym $mod+minus scratchpad show 150 + # 151 + # Resizing containers: 152 + # 153 + mode "resize" { 154 + # left will shrink the containers width 155 + # right will grow the containers width 156 + # up will shrink the containers height 157 + # down will grow the containers height 158 + bindsym $left resize shrink width 10px 159 + bindsym $down resize grow height 10px 160 + bindsym $up resize shrink height 10px 161 + bindsym $right resize grow width 10px 162 + 163 + # Ditto, with arrow keys 164 + bindsym Left resize shrink width 10px 165 + bindsym Down resize grow height 10px 166 + bindsym Up resize shrink height 10px 167 + bindsym Right resize grow width 10px 168 + 169 + # Return to default mode 170 + bindsym Return mode "default" 171 + bindsym Escape mode "default" 172 + } 173 + bindsym $mod+r mode "resize" 174 + 175 + # 176 + # Status Bar: 177 + # 178 + # Read `man 5 sway-bar` for more information about this section. 179 + bar { 180 + position top 181 + 182 + # When the status_command prints a new line to stdout, swaybar updates. 183 + # The default just shows the current date and time. 184 + status_command while date +'%Y-%m-%d %H:%M:%S'; do sleep 1; done 185 + 186 + colors { 187 + statusline #ffffff 188 + background #323232 189 + inactive_workspace #32323200 #32323200 #5c5c5c 190 + } 191 + } 192 + 193 + default_border pixel 1 194 + default_floating_border none 195 + smart_borders on 196 + 197 + bindsym $mod+q exec ${pkgs.writers.writeDash "goto_workspace" '' 198 + set -efux 199 + unset TERM # we want fzfmenu to start a new terminal 200 + CURRENT_OUTPUT=$(swaymsg -r -t get_outputs | jq '.[] | select(.focused == true).name') 201 + FZFMENU_FZF_DEFAULT_OPTS="--select-1" 202 + WS=$(swaymsg -r -t get_workspaces | 203 + jq -r '.[].name' | 204 + fzfmenu -p 'Workspace name: ' 205 + ) 206 + if [ -n "$WS" ]; then 207 + swaymsg workspace "$WS" 208 + swaymsg move workspace to output "$CURRENT_OUTPUT" 209 + fi 210 + ''} 211 + 212 + bindsym $mod+Shift+q exec ${pkgs.writers.writeDash "moveto_workspace" '' 213 + set -efux 214 + unset TERM # we want fzfmenu to start a new terminal 215 + FZFMENU_FZF_DEFAULT_OPTS="--select-1" 216 + WS=$(swaymsg -r -t get_workspaces | 217 + jq -r '.[].name' | 218 + fzfmenu -p 'Workspace name: ' 219 + ) 220 + if [ -n "$WS" ]; then 221 + swaymsg move container to workspace "$WS" 222 + fi 223 + ''} 224 + 225 + bindsym $mod+x exec ${./starter} floating enable -- ${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yaml 226 + bindsym $mod+y exec /run/current-system/sw/bin/switch-theme toggle 227 + 228 + for_window [title="fzfmenu"] floating enable 229 + bindsym $mod+Tab focus next 230 + bindsym $mod+Escape workspace back_and_forth 231 + 232 + bindsym $mod+p exec ${pkgs.writers.writeDash "passmenu" '' 233 + set -efux 234 + unset TERM # we want fzfmenu to start a new terminal 235 + (cd $HOME/.password-store; find -type f -name '*.gpg') | 236 + sed -e 's/\.gpg$//' | 237 + fzfmenu -p 'Password: ' | 238 + xargs -I{} pass show {} | 239 + tr -d '\n' | 240 + ${pkgs.wtype}/bin/wtype -s 1 - 241 + ''} 242 + bindsym $mod+Shift+p exec ${pkgs.writers.writeDash "otpmenu" '' 243 + unset TERM 244 + ${pkgs.otpmenu}/bin/otpmenu 245 + ''} 246 + 247 + # screenlock 248 + bindsym $mod+F11 exec ${pkgs.swaylock}/bin/swaylock -f -c 000000 249 + 250 + # media buttons 251 + bindsym XF86AudioMute exec ${pkgs.pulseaudio.out}/bin/pactl -- set-sink-mute @DEFAULT_SINK@ toggle 252 + bindsym XF86AudioRaiseVolume exec ${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ +4% 253 + bindsym XF86AudioLowerVolume exec ${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ -4% 254 + bindsym XF86MonBrightnessDown exec ${pkgs.acpilight}/bin/xbacklight -time 0 -dec 1 255 + bindsym XF86MonBrightnessUp exec ${pkgs.acpilight}/bin/xbacklight -time 0 -inc 1 256 + 257 + # background programs 258 + exec ydotoold 259 + exec_always pkill kanshi; exec ${pkgs.kanshi}/bin/kanshi 260 + 261 + # theme and env specific stuff 262 + exec_always ${pkgs.writers.writeDash "dbus-sway-environment" '' 263 + set -efux 264 + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway 265 + systemctl --user stop xdg-desktop-portal xdg-desktop-portal-wlr 266 + systemctl --user start xdg-desktop-portal xdg-desktop-portal-wlr 267 + ''} 268 + 269 + exec_always ${let 270 + schema = pkgs.gsettings-desktop-schemas; 271 + datadir = "${schema}/share/gsettings-schemas/${schema.name}"; 272 + in pkgs.writers.writeDash "gsettings" '' 273 + set -efux 274 + export XDG_DATA_DIRS=${pkgs.gsettings-desktop-schemas}:$XDG_DATA_DIRS 275 + gnome_schema=org.gnome.desktop.interface 276 + gsettings set $gnome_schema gtk-theme 'Dracula' 277 + ''} 278 + 279 + # keyboard 280 + input type:keyboard { 281 + xkb_layout us 282 + xkb_variant altgr-intl 283 + xkb_options caps:hyper 284 + } 285 + 286 + # flameshot 287 + for_window [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0 288 + exec ${pkgs.flameshot}/bin/flameshot 289 + ''; 290 + 291 + }
+239
2configs/desktops/xmonad/default.nix
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + { 4 + imports = [ 5 + ../lib/x11.nix 6 + ]; 7 + services.xserver.windowManager.xmonad = { 8 + enable = true; 9 + extraPackages = hs: [ 10 + hs.extra 11 + hs.xmonad-contrib 12 + ]; 13 + config = /* haskell */ '' 14 + {-# LANGUAGE LambdaCase #-} 15 + 16 + 17 + module Main where 18 + import XMonad 19 + 20 + import qualified XMonad.StackSet as W 21 + import Control.Monad.Extra (whenJustM) 22 + import Data.List (isInfixOf) 23 + import Data.Monoid (Endo) 24 + import System.Environment (getArgs, lookupEnv) 25 + import System.Exit (exitFailure) 26 + import System.IO (hPutStrLn, stderr) 27 + import System.Posix.Process (executeFile) 28 + import Data.Ratio 29 + 30 + import XMonad.Actions.Commands (defaultCommands, runCommand) 31 + import XMonad.Actions.CopyWindow (copy, copyToAll, kill1) 32 + import XMonad.Actions.CycleWS (toggleWS) 33 + import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace, removeEmptyWorkspace) 34 + import XMonad.Actions.DynamicWorkspaces (withWorkspace) 35 + import XMonad.Actions.GridSelect (GSConfig(..), gridselectWorkspace, navNSearch) 36 + import XMonad.Actions.Minimize (minimizeWindow, maximizeWindow, withLastMinimized) 37 + import XMonad.Hooks.EwmhDesktops (ewmh) 38 + import XMonad.Hooks.FloatNext (floatNext) 39 + import XMonad.Hooks.FloatNext (floatNextHook) 40 + import XMonad.Hooks.ManageDocks (avoidStruts, ToggleStruts(ToggleStruts)) 41 + import XMonad.Hooks.ManageHelpers (doCenterFloat, doRectFloat, (-?>)) 42 + import XMonad.Hooks.Place (placeHook, smart) 43 + import XMonad.Hooks.UrgencyHook (focusUrgent) 44 + import XMonad.Hooks.UrgencyHook (withUrgencyHook, UrgencyHook(..)) 45 + import XMonad.Layout.BoringWindows (boringWindows, focusDown, focusUp) 46 + import XMonad.Layout.FixedColumn (FixedColumn(..)) 47 + import XMonad.Layout.Grid (Grid(..)) 48 + import XMonad.Layout.Minimize (minimize) 49 + import XMonad.Layout.NoBorders (smartBorders, noBorders) 50 + import XMonad.Layout.MouseResizableTile (mouseResizableTile) 51 + import XMonad.Layout.SimplestFloat (simplestFloat) 52 + import XMonad.Layout.StateFull 53 + import XMonad.ManageHook (composeAll) 54 + import XMonad.Prompt (autoComplete, font, height, searchPredicate, XPConfig) 55 + import XMonad.Prompt.Window (windowPromptGoto, windowPromptBringCopy) 56 + import XMonad.Util.EZConfig (additionalKeysP) 57 + import XMonad.Util.NamedWindows (getName) 58 + import XMonad.Util.Run (safeSpawn) 59 + import XMonad.Util.Ungrab (unGrab) 60 + import XMonad.Util.Paste (sendKey) 61 + 62 + data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show) 63 + 64 + instance UrgencyHook LibNotifyUrgencyHook where 65 + urgencyHook LibNotifyUrgencyHook w = do 66 + name <- getName w 67 + Just idx <- fmap (W.findTag w) $ gets windowset 68 + 69 + safeSpawn "${pkgs.libnotify}/bin/notify-send" [show name, "workspace " ++ idx] 70 + 71 + myTerm :: FilePath 72 + myTerm = "/run/current-system/sw/bin/alacritty" 73 + 74 + myFont :: String 75 + myFont = "${config.lass.fonts.regular}" 76 + 77 + main :: IO () 78 + main = do 79 + xmonad $ ewmh 80 + $ withUrgencyHook LibNotifyUrgencyHook 81 + $ def 82 + { terminal = myTerm 83 + , modMask = mod4Mask 84 + , layoutHook = myLayoutHook 85 + , manageHook = floatHooks 86 + , startupHook = 87 + whenJustM (liftIO (lookupEnv "XMONAD_STARTUP_HOOK")) 88 + (\path -> forkFile path [] Nothing) 89 + , normalBorderColor = "#1c1c1c" 90 + , focusedBorderColor = "#ff0000" 91 + , workspaces = [ "dashboard", "sys", "wp" ] 92 + } `additionalKeysP` myKeyMap 93 + 94 + myLayoutHook = defLayout 95 + where 96 + defLayout = smartBorders $ 97 + minimize . 98 + boringWindows $ 99 + ( 100 + noBorders StateFull ||| 101 + (avoidStruts $ Mirror (Tall 1 (3/100) (1/2))) ||| 102 + FixedColumn 2 80 80 1 ||| 103 + Tall 1 (3/100) (1/2) ||| 104 + simplestFloat ||| 105 + mouseResizableTile ||| 106 + Grid 107 + ) 108 + 109 + floatHooks = composeAll 110 + [ className =? "Pinentry" --> doCenterFloat 111 + , className =? "Pager" --> doCenterFloat 112 + , title =? "pager" --> doCenterFloat 113 + , title =? "fzfmenu" --> doCenterFloat 114 + , title =? "glxgears" --> doCenterFloat 115 + , resource =? "Dialog" --> doFloat 116 + , title =? "Upload to Imgur" --> 117 + doRectFloat (W.RationalRect 0 0 (1 % 8) (1 % 8)) 118 + , placeHook (smart (1,0)) 119 + , floatNextHook 120 + ] 121 + 122 + myKeyMap :: [([Char], X ())] 123 + myKeyMap = 124 + [ ("M4-p", forkFile "${pkgs.pass}/bin/passmenu" [ "--type" ] Nothing) 125 + , ("M4-S-p", forkFile "${pkgs.otpmenu}/bin/otpmenu" [] Nothing) 126 + , ("M4-z", forkFile "${pkgs.unimenu}/bin/unimenu" [] Nothing) 127 + 128 + , ("M4-S-q", restart "xmonad" True) 129 + 130 + , ("<XF86AudioMute>", spawn "${pkgs.pulseaudio.out}/bin/pactl -- set-sink-mute @DEFAULT_SINK@ toggle") 131 + , ("<XF86AudioRaiseVolume>", spawn "${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ +4%") 132 + , ("<XF86AudioLowerVolume>", spawn "${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ -4%") 133 + , ("<XF86MonBrightnessDown>", spawn "${pkgs.acpilight}/bin/xbacklight -time 0 -dec 1") 134 + , ("<XF86MonBrightnessUp>", spawn "${pkgs.acpilight}/bin/xbacklight -time 0 -inc 1") 135 + , ("M4-C-k", spawn "${pkgs.xorg.xkill}/bin/xkill") 136 + 137 + , ("M4-<Tab>", focusDown) 138 + , ("M4-S-<Tab>", focusUp) 139 + , ("M4-j", focusDown) 140 + , ("M4-k", focusUp) 141 + 142 + , ("M4-a", focusUrgent) 143 + , ("M4-S-r", renameWorkspace myXPConfig) 144 + , ("M4-S-a", addWorkspacePrompt myXPConfig) 145 + , ("M4-S-<Backspace>", removeEmptyWorkspace) 146 + , ("M4-S-c", kill1) 147 + , ("M4-<Esc>", toggleWS) 148 + , ("M4-S-<Enter>", spawn myTerm) 149 + , ("M4-x", floatNext True >> spawn myTerm) 150 + , ("M4-c", spawn "/run/current-system/sw/bin/emacsclient -c") 151 + -- , ("M4-c", unGrab) 152 + , ("M4-f", floatNext True) 153 + , ("M4-b", spawn "/run/current-system/sw/bin/klem") 154 + 155 + , ("M4-c", defaultCommands >>= runCommand) 156 + -- , ("M4-v", spawn "${pkgs.pager}/bin/pager view") 157 + -- , ("M4-S-v", spawn "${pkgs.pager}/bin/pager shift") 158 + , ("M4-v", withWorkspace autoXPConfig (windows . W.greedyView)) 159 + , ("M4-S-v", withWorkspace autoXPConfig (windows . W.shift)) 160 + , ("M4-C-v", withWorkspace autoXPConfig (windows . copy)) 161 + 162 + , ("M4-m", withFocused minimizeWindow) 163 + , ("M4-S-m", withLastMinimized maximizeWindow) 164 + 165 + , ("M4-q", windowPromptGoto infixAutoXPConfig) 166 + , ("M4-C-q", windowPromptBringCopy infixAutoXPConfig) 167 + 168 + , ("M4-S-q", return ()) 169 + 170 + , ("M4-d", floatNext True >> spawn "${pkgs.writers.writeDash "clipmenu" '' 171 + PATH=${lib.makeBinPath [ 172 + pkgs.coreutils 173 + pkgs.gawk 174 + pkgs.dmenu 175 + ]} 176 + ${pkgs.clipmenu}/bin/clipmenu 177 + ''}") 178 + 179 + , ("M4-<Insert>", spawn "${pkgs.writers.writeDash "paste" '' 180 + ${pkgs.coreutils}/bin/sleep 0.4 181 + ${pkgs.xclip}/bin/xclip -o | ${pkgs.xdotool}/bin/xdotool type -f - 182 + ''}") 183 + 184 + , ("M4-<F1>", spawn "/run/current-system/sw/bin/gamepad_mouse_toggle") 185 + , ("M4-<F2>", windows copyToAll) 186 + , ("M4-<F4>", spawn "${pkgs.nm-dmenu}/bin/nm-dmenu") 187 + , ("M4-<F5>", spawn "${pkgs.acpilight}/bin/xbacklight -set 1") 188 + , ("M4-<F6>", spawn "${pkgs.acpilight}/bin/xbacklight -set 10") 189 + , ("M4-<F7>", spawn "${pkgs.acpilight}/bin/xbacklight -set 33") 190 + , ("M4-<F8>", spawn "${pkgs.acpilight}/bin/xbacklight -set 100") 191 + 192 + , ("M4-<F9>", spawn "${pkgs.redshift}/bin/redshift -O 4000 -g 0.9:0.8:0.8") 193 + , ("M4-<F10>", spawn "${pkgs.redshift}/bin/redshift -x") 194 + 195 + , ("M4-<F11>", spawn "${config.lass.screenlock.command}") 196 + 197 + , ("M4-u", spawn "${pkgs.xcalib}/bin/xcalib -invert -alter") 198 + , ("M4-y", spawn "/run/current-system/sw/bin/switch-theme toggle") 199 + 200 + ${lib.optionalString (builtins.hasAttr "warpd" pkgs) '', ("M4-s", spawn "${pkgs.warpd}/bin/warpd --hint")''} 201 + , ("M4-i", spawn "/run/current-system/sw/bin/screenshot") 202 + 203 + --, ("M4-w", screenWorkspace 0 >>= (windows . W.greedyView)) 204 + --, ("M4-e", screenWorkspace 1 >>= (windows . W.greedyView)) 205 + --, ("M4-r", screenWorkspace 2 >>= (windows . W.greedyView)) 206 + ] 207 + 208 + forkFile :: FilePath -> [String] -> Maybe [(String, String)] -> X () 209 + forkFile path args env = 210 + xfork (executeFile path True args env) >> return () 211 + 212 + myXPConfig :: XPConfig 213 + myXPConfig = def 214 + { font = myFont 215 + , height = 40 216 + } 217 + 218 + autoXPConfig :: XPConfig 219 + autoXPConfig = myXPConfig 220 + { autoComplete = Just 5000 221 + } 222 + 223 + infixAutoXPConfig :: XPConfig 224 + infixAutoXPConfig = autoXPConfig 225 + { searchPredicate = isInfixOf 226 + } 227 + 228 + gridConfig :: GSConfig WorkspaceId 229 + gridConfig = def 230 + { gs_cellwidth = 100 231 + , gs_cellheight = 30 232 + , gs_cellpadding = 2 233 + , gs_navigate = navNSearch 234 + , gs_font = myFont 235 + } 236 + 237 + ''; 238 + }; 239 + }