From dc1d2b7c2bd657efa2ee3bdbac52466bb61dae23 Mon Sep 17 00:00:00 2001 From: Jade Date: Sat, 22 Apr 2023 14:57:32 +0200 Subject: [PATCH] statusbar & tray set up --- haskell/xmonad/xmonad.hs | 57 ++++++++++++++-------------- modules/desktop/default.nix | 2 +- modules/desktop/polybar.nix | 15 ++++---- other/scripts/desktop/desktopctl.nix | 2 +- 4 files changed, 39 insertions(+), 37 deletions(-) diff --git a/haskell/xmonad/xmonad.hs b/haskell/xmonad/xmonad.hs index 318c927..fee1f3c 100644 --- a/haskell/xmonad/xmonad.hs +++ b/haskell/xmonad/xmonad.hs @@ -11,6 +11,9 @@ import XMonad import Data.Monoid import System.Exit +import XMonad.Hooks.StatusBar +import XMonad.Hooks.StatusBar.PP + import qualified XMonad.StackSet as W import qualified Data.Map as M @@ -61,18 +64,24 @@ myFocusedBorderColor = "#504945" -- myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ - -- launch a terminal [ ((modm, xK_Return), spawn $ XMonad.terminal conf) - - -- launch gmrun - , ((modm, xK_d ), spawn "rofi -show drun") - - -- close focused window - , ((modm .|. shiftMask, xK_q ), kill) - + , ((modm .|. shiftMask, xK_q), kill) -- Rotate through the available layout algorithms , ((modm, xK_space ), sendMessage NextLayout) + -- rofiing + , ((modm, xK_d), spawn "rofi -show drun") + , ((modm .|. shiftMask, xK_e), spawn "rofi -show \"desktopctl\" -modes \"desktopctl:$(which desktopctl)\"") + , ((modm, xK_m), spawn "menu-qalc") + , ((modm, xK_i), spawn "rofimoji -f alchemical_symbols anatolian_hieroglyphs emojis braille_patterns box_drawing chess_symbols emoticons geometric_shapes gothic greek_extended math mathematical_alphanumeric_symbols mathematical_operators miscellaneous_symbols miscellaneous_mathematical_symbols-a miscellaneous_mathematical_symbols-b miscellaneous_symbols_and_arrows miscellaneous_symbols_and_pictographs miscellaneous_technical modi modifier_tone_letters musical_symbols nerd_font number_forms shorthand_format_controls specials variation_selectors vertical_forms -a copy") + + -- screenshotting + -- TODO: Fix/rewrite window-screenshot.sh + , ((modm, xK_w), spawn "window-screenshot.sh") + , ((modm, xK_s), spawn "flameshot gui -c -p $HOME/Pictures/screenshots") + , ((modm, xK_a), spawn "flameshot screen -c -p $HOME/Pictures/screenshots") + , ((modm, xK_t), spawn "ocr-screenshot.sh") + -- Reset the layouts on the current workspace to default , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) @@ -82,37 +91,23 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ -- Move focus to the next window , ((modm, xK_Tab ), windows W.focusDown) - -- Move focus to the next window + -- Move focus , ((modm, xK_j ), windows W.focusDown) - - -- Move focus to the previous window , ((modm, xK_k ), windows W.focusUp ) - -- Move focus to the master window - , ((modm, xK_m ), windows W.focusMaster ) - - -- Swap the focused window and the master window - , ((modm, xK_Return), windows W.swapMaster) - -- Swap the focused window with the next window , ((modm .|. shiftMask, xK_j ), windows W.swapDown ) - - -- Swap the focused window with the previous window , ((modm .|. shiftMask, xK_k ), windows W.swapUp ) -- Shrink the master area , ((modm, xK_h ), sendMessage Shrink) - - -- Expand the master area , ((modm, xK_l ), sendMessage Expand) -- Push window back into tiling - , ((modm, xK_t ), withFocused $ windows . W.sink) + --, ((modm, xK_t ), withFocused $ windows . W.sink) -- 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))) -- Toggle the status bar gap @@ -121,7 +116,7 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ -- -- , ((modm , xK_b ), sendMessage ToggleStruts) - , ((modm .|. shiftMask, xK_e ), io (exitWith ExitSuccess)) + --, ((modm .|. shiftMask, xK_e ), io (exitWith ExitSuccess)) -- Restart xmonad --, ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart") @@ -241,14 +236,20 @@ myLogHook = return () -- per-workspace layout choices. -- -- By default, do nothing. -myStartupHook = return () +myStartupHook = do + spawn "pkill oneko; oneko -tofocus -tora -position +-1+5 -fg palevioletred3 -bg pink -name 'Rose the desktop kitty'" + --spawn "pkill polybar; polybar" + spawn "pkill volumeicon; volumeicon" + spawn "pkill nm-applet; nm-applet" + spawn "mullvad-vpn --background" ------------------------------------------------------------------------ -- Now run xmonad with all the defaults we set up. -- Run xmonad with the settings you specify. No need to modify this. -- -main = xmonad defaults +mySB = statusBarProp "polybar" (pure xmobarPP) +main = xmonad $ withEasySB mySB defToggleStrutsKey defaults -- A structure containing your configuration settings, overriding -- fields in the default config. Any you don't override, will @@ -271,7 +272,7 @@ defaults = def , keys = myKeys , mouseBindings = myMouseBindings -- hooks, layouts - , layoutHook = spacingRaw True (Border 0 10 10 10) True (Border 10 10 10 10) True $ myLayout + , layoutHook = spacingRaw True (Border 0 0 0 0) True (Border 7 7 7 7) True $ myLayout , manageHook = myManageHook , handleEventHook = myEventHook , logHook = myLogHook diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 158cebb..99c5888 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -155,7 +155,7 @@ in with lib; { # external libnotify i3lock-fancy rofi rofimoji feh xorg.xinput dunst arandr - flameshot tesseract5 imagemagick xclip polybar kitty xmacro + flameshot tesseract5 imagemagick xclip kitty xmacro brightnessctl drawing libqalculate ddgr jq brillo # custom scripts diff --git a/modules/desktop/polybar.nix b/modules/desktop/polybar.nix index a22592b..cbba4ad 100644 --- a/modules/desktop/polybar.nix +++ b/modules/desktop/polybar.nix @@ -3,14 +3,15 @@ { config = { home-manager.users.jade = { pkgs, ... }: { - xsession.windowManager.i3.config.startup = [ - { - command = "pkill polybar; polybar"; - always = true; - } - ]; + #xsession.windowManager.i3.config.startup = [ + #{ + #command = "pkill polybar; polybar"; + #always = true; + #} + #]; services.polybar = { enable = true; + package = pkgs.polybarFull; script = ""; settings = { @@ -44,7 +45,7 @@ cursor-click = "pointer"; cursor-scroll = "ns-resize"; enable-ipc = true; - wm-restack = "i3"; + wm-restack = "generic"; override-redirect = false; }; diff --git a/other/scripts/desktop/desktopctl.nix b/other/scripts/desktop/desktopctl.nix index a369eda..4946067 100644 --- a/other/scripts/desktop/desktopctl.nix +++ b/other/scripts/desktop/desktopctl.nix @@ -6,7 +6,7 @@ pkgs.writeShellScriptBin "desktopctl" '' exit 0 ;; "Log Out") - pkill i3 + pkill xmonad exit 0 ;; "Shut Down")