From ddcc8c65e30a9ca3b56e25466e749cb100b28510 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 22 Oct 2022 19:33:45 +0200 Subject: ... --- accounts/gkleen@sif/default.nix | 23 +++++++++------- accounts/gkleen@sif/ssh-hosts.nix | 4 +++ accounts/gkleen@sif/xmonad/xmonad.hs | 51 ++++++++++++++++++------------------ 3 files changed, 43 insertions(+), 35 deletions(-) (limited to 'accounts') diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index 2cfaa620..842f7538 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix @@ -1,4 +1,7 @@ { flake, flakeInputs, userName, pkgs, customUtils, lib, config, sources, ... }@inputs: + +with lib; + let cfg = config.home-manager.users.${userName}; xmonad = import ./xmonad pkgs.haskell.packages.ghc8107; @@ -29,16 +32,18 @@ let --prefix PATH : ${pkgs.pulseaudio}/bin ''; }; - wrapElectron = { package, bin ? package.meta.mainProgram or package.pname or (pkgs.lib.strings.nameFromURL package.name "-"), outBin ? bin }: pkgs.runCommand "${package.name}-wrapped" { buildInputs = with pkgs; [ makeWrapper ]; } '' + wrapElectron = { package, bin ? package.meta.mainProgram or package.pname or (pkgs.lib.strings.nameFromURL package.name "-"), outBin ? bin, sandbox ? true }: pkgs.runCommand "${package.name}-wrapped" { buildInputs = with pkgs; [ makeWrapper ]; } '' mkdir -p "$out/bin" makeWrapper ${package}/bin/${bin} $out/bin/${outBin} \ - --add-flags '--force-device-scale-factor=1.6' + --add-flags '--force-device-scale-factor=1.6' \ + ${optionalString (!sandbox) "--add-flags '--no-sandbox'"} ''; - + wrappedChrome = wrapElectron { package = pkgs.google-chrome; outBin = "google-chrome"; }; wrappedZulip = wrapElectron { package = pkgs.zulip; bin = "zulip"; outBin = "zulip"; }; wrappedElementDesktop = wrapElectron { package = pkgs.element-desktop; bin = "element-desktop"; outBin = "element"; }; wrappedRocketChatDesktop = wrapElectron { package = pkgs.rocketchat-desktop; bin = "rocketchat-desktop"; outBin = "rocketchat"; }; + wrappedYTMDesktop = wrapElectron { package = pkgs.ytmdesktop; sandbox = false; }; in { imports = with flake.nixosModules.userProfiles.${userName}; [ mpv yt-dlp (args: import ./xcompose.nix (inputs // args)) @@ -47,7 +52,7 @@ in { config = { services.xserver = { displayManager.defaultSession = "none+xmonad"; - + windowManager.session = [{ name = "xmonad"; start = '' @@ -155,7 +160,7 @@ in { zsh.initExtra = "source ${./zshrc}"; zsh.dirHashes = let - flakeHashes = lib.mapAttrs' (n: v: lib.nameValuePair (inputNames.${n} or n) (toString v)) flakeInputs; + flakeHashes = mapAttrs' (n: v: nameValuePair (inputNames.${n} or n) (toString v)) flakeInputs; inputNames = { "nixpkgs" = "nixos"; }; @@ -193,7 +198,7 @@ in { enable = true; client = { enable = true; - arguments = lib.mkForce ["-a" "\"\""]; + arguments = mkForce ["-a" "\"\""]; }; }; gpg-agent = { @@ -318,7 +323,7 @@ in { fira fira-code powerline-fonts nerdfonts pavucontrol keepassxc sxiv xclip mumble pulseaudio-ctl pamixer libnotify synergy xorg.xbacklight screen-message - ytmdesktop qt5ct playerctl evince + wrappedYTMDesktop qt5ct playerctl evince thunderbird wrappedZulip zoom-us steam steam-run wireshark virt-manager rclone cached-nix-shell xournal xmonad worktime fira-code-symbols libreoffice xournalpp wrappedChrome @@ -403,8 +408,8 @@ in { defaultApplications = let filters = { }; - filter = n: v: (filters.${n} or lib.id) (lib.filter (d: d != "emacs.desktop") v); - in lib.mapAttrs filter (cfg.lib.xdg.mimeAssociations [ + doFilter = n: v: (filters.${n} or id) (filter (d: d != "emacs.desktop") v); + in mapAttrs doFilter (cfg.lib.xdg.mimeAssociations [ cfg.programs.zathura.package pkgs.sxiv cfg.programs.emacs.package diff --git a/accounts/gkleen@sif/ssh-hosts.nix b/accounts/gkleen@sif/ssh-hosts.nix index 24d1f18c..d041ede0 100644 --- a/accounts/gkleen@sif/ssh-hosts.nix +++ b/accounts/gkleen@sif/ssh-hosts.nix @@ -48,6 +48,10 @@ { user = "git"; identityFile = "~/.ssh/gkleen@sif.midgard.yggdrasil"; }; + "gitlab.ifi.lmu.de" = + { user = "git"; + identityFile = "~/.ssh/kleen@gitlab.ifi.lmu.de"; + }; "hel".hostname = "hel.midgard.yggdrasil"; "blackbeard" = { hostname = "blackbeard.tcs.ifi.lmu.de"; diff --git a/accounts/gkleen@sif/xmonad/xmonad.hs b/accounts/gkleen@sif/xmonad/xmonad.hs index 830bb2dd..3dc017a9 100644 --- a/accounts/gkleen@sif/xmonad/xmonad.hs +++ b/accounts/gkleen@sif/xmonad/xmonad.hs @@ -340,7 +340,7 @@ hostFromName h , NS "toggl" "toggldesktop" (className =? "Toggl Desktop") centerFloat , NS "calendar" "minetime -- --force-device-scale-factor=1.6" (className =? "MineTime") centerFloat , NS "emacs" "emacsclient -c -F \"'(title . \\\"Scratchpad\\\")\"" (className =? "Emacs" <&&> title =? "Scratchpad") centerFloat - -- , NS "music" "google-play-music-desktop-player --force-device-scale-factor=1.6" (className =? "Google Play Music Desktop Player") centerFloat + , NS "music" "ytmdesktop" (className =? "youtube-music-desktop-app") centerFloat ] centerFloat = customFloating $ RationalRect (1 % 16) (1 % 16) (7 % 8) (7 % 8) centerFloatSmall = customFloating $ RationalRect (1 % 4) (1 % 4) (1 % 2) (1 % 2) @@ -414,10 +414,10 @@ hostFromName h (first : rest) = filter (not . null) $ lines result notification = Notify.summary first <> Notify.body (unlines rest) <> Notify.timeout Infinite <> Notify.urgency Normal <> Notify.appName "dc" void $ Notify.display notification - synergyCompl = mkComplFunFromList' xPConfigMonospace ["mathw86"] + synergyCompl = mkComplFunFromList' xPConfigMonospace ["mathw86"] synergyStart host = safeSpawn "systemctl" ["--user", "start", "synergy-rtunnel@" ++ host ++ ".service"] synergyStop host = safeSpawn "systemctl" ["--user", "stop", "synergy-rtunnel@" ++ host ++ ".service"] - + hostFromName _ = defaultHost -- muteRef :: IORef (Maybe (String, Notification)) @@ -530,13 +530,13 @@ main = do -- We canĀ“t define per-host layout modifiers because we lack dependent types layout' = onHost "skadhi" ( onWorkspace (wsp 1) (Full ||| withIM (1%5) (Title "Buddy List") tabbedLayout') $ onWorkspace (wsp 10) Full $ - onWorkspace (wsp 2) (Full ||| tabbedLayout') $ + onWorkspace (wsp 2) (Full ||| tabbedLayout') $ onWorkspace (wsp 5) tabbedLayout' $ onWorkspace (wsp 8) (withIM (1%5) (Title "Friends") tabbedLayout') $ defaultLayouts ) $ onHost "vali" ( onWorkspace (wsp 2) (Full ||| tabbedLayout' ||| combineTwo (TwoPane 0.01 0.57) Full tabbedLayout') $ - onWorkspace (wsp 3) workLayouts $ + onWorkspace (wsp 3) workLayouts $ defaultLayouts ) $ onHost "hel" ( onWorkspace (wsp 1) (withIM (1 % 8) (Title "Buddy List") $ trackFloating tabbedLayout') $ @@ -565,7 +565,7 @@ main = do tabbedLayoutHoriz' = tabbedLayoutHoriz tabbedLeftAlways defaultLayouts = {- spiralWithDir East CW (1 % 2) -} Dwindle R CW 1 (5 % 100) ||| tabbedLayout' ||| Full -- workLayouts = {- spiralWithDir East CW (1 % 2) -} Dwindle R CW (2 % 1) (5 % 100) ||| tabbedLayout' ||| Full - workLayouts = tabbedLayout' ||| (renamed [Replace "Combined"] $ combineTwoP (TwoPane (1 % 100) (1891 % 2560)) tabbedLayout''' (Column 1.6) (ClassName "Postman" `Or` ClassName "Emacs" `Or` ClassName "jetbrains-idea-ce" `Or` (Resource "Devtools" `And` ClassName "Firefox"))) ||| Full ||| Dwindle R CW 1 (5 % 100) + workLayouts = tabbedLayout' ||| (renamed [Replace "Combined"] $ combineTwoP (TwoPane (1 % 100) (1891 % 2560)) tabbedLayout''' (Column 1.6) (ClassName "Postman" `Or` ClassName "Emacs" `Or` ClassName "jetbrains-idea-ce" `Or` (Resource "Devtools" `And` ClassName "Firefox"))) ||| Full ||| Dwindle R CW 1 (5 % 100) sqrtTwo = approxRational (sqrt 2) (1 / 2560) xmobarPP' = xmobarPP { ppTitle = shorten 80 , ppSort = (liftM2 (.)) getSortByIndex $ return scratchpadFilterOutWorkspace @@ -607,7 +607,7 @@ main = do | otherwise = return () handle _ = return () handle shutdown $ launch myConfig =<< getDirectories - + secs :: Int -> Int secs = (* 1000000) @@ -651,7 +651,7 @@ isDisabled :: String -> X Bool isDisabled str = do out <- runProcessWithInput "xinput" ["list", str] "" return $ "disabled" `isInfixOf` out - + spawnKeychain :: X () spawnKeychain = do @@ -790,7 +790,7 @@ myKeys' conf host = Map.fromList $ -- launch a terminal [ ((modm, xK_Return), spawn $ (XMonad.terminal conf) ++ " -e tmux") , ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) - + -- launch dmenu --, ((modm, xK_d ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"") , ((modm, xK_d ), shellPrompt "Run: " xPConfigMonospace) @@ -800,31 +800,31 @@ myKeys' conf host = Map.fromList $ -- close focused window , ((modm .|. shiftMask, xK_q ), kill) , ((modm .|. controlMask .|. shiftMask, xK_q ), spawn "xkill") - + -- Rotate through the available layout algorithms , ((modm, xK_space ), sendMessage NextLayout) - + -- Reset the layouts on the current workspace to default , ((modm .|. controlMask, xK_r ), (setLayout $ XMonad.layoutHook conf) >> refresh) - + -- Resize viewed windows to the correct size , ((modm, xK_r ), refresh) -- Move focus to the next window , ((modm, xK_t ), windows W.focusDown) - + -- Move focus to the previous window , ((modm, xK_n ), windows W.focusUp ) - + -- Move focus to the master window , ((modm, xK_m ), windows W.focusMaster ) - + -- Swap the focused window and the master window , ((modm .|. shiftMask, xK_m ), windows W.swapMaster) - + -- Swap the focused window with the next window , ((modm .|. shiftMask, xK_t ), windows W.swapDown ) - + -- Swap the focused window with the previous window , ((modm .|. shiftMask, xK_n ), windows W.swapUp ) @@ -845,18 +845,18 @@ myKeys' conf host = Map.fromList $ -- , ((modm .|. controlMask, xK_Down ), withFocused $ keysMoveWindow (0, 10)) -- Shrink the master area , ((modm, xK_h ), sendMessage Shrink) - + -- Expand the master area , ((modm, xK_s ), sendMessage Expand) - + -- Push window back into tiling , ((modm .|. shiftMask, xK_space ), withFocused $ windows . W.sink) , ((modm, xK_BackSpace), focusUrgent) , ((modm .|. shiftMask, xK_BackSpace), clearUrgents) - + -- Increment the number of windows in the master area , ((modm , xK_comma ), sendMessage (IncMasterN 1)) - + -- Deincrement the number of windows in the master area , ((modm , xK_period), sendMessage (IncMasterN (-1))) @@ -875,7 +875,7 @@ myKeys' conf host = Map.fromList $ , ((modm , xK_Escape), cycleKbLayout (hKbLayouts host)) , ((modm .|. controlMask, xK_Escape), safeSpawn "setxkbmap" $ fst (head $ hKbLayouts host) : maybeToList (snd . head $ hKbLayouts host)) - + -- Toggle the status bar gap -- Use this binding with avoidStruts from Hooks.ManageDocks. -- See also the statusBar function from Hooks.DynamicLog. @@ -883,10 +883,10 @@ myKeys' conf host = Map.fromList $ , ((modm , xK_b ), sendMessage ToggleStruts) , ((modm .|. shiftMask, xK_p ), safeSpawn "playerctl" ["-a", "pause"]) - + -- Quit xmonad , ((modm .|. shiftMask, xK_e ), io (exitWith ExitSuccess)) - + -- Restart xmonad -- , ((modm .|. shiftMask .|. controlMask, xK_r ), void . xfork $ recompile False >>= flip when (safeSpawn "xmonad" ["--restart"])) , ((modm .|. shiftMask, xK_r ), void . liftIO $ executeFile "xmonad" True [] Nothing) @@ -902,7 +902,7 @@ myKeys' conf host = Map.fromList $ , ((modm , xK_g ), windowPrompt xPConfig Bring allWindows) ] ++ - + -- -- mod-[1..9], Switch to workspace N -- @@ -924,4 +924,3 @@ myKeys' conf host = Map.fromList $ modm = XMonad.modMask conf brCycle = [0, 1 % 100, 1 % 10, 1 % 4, 1 % 2, 3 % 4, 1] - -- cgit v1.2.3