Compare commits

...
4 Commits
Author SHA1 Message Date
Daniele Fucini a41afe4983 Enlarge xmobar font to 10 and fit the bar's contents to its width
Workspaces show only their icon, layouts show an icon instead of their name, and window titles share a 60-character budget (8–30 each), so more windows get shorter titles instead of overflowing the bar.
2026-10-28 19:50:11 +01:00
Daniele Fucini 4e431d6710 Make xmobar and trayer 24px tall and match trayer's background to xmobar
xmobar was auto-sized (17px) and trayer 18px; both are now 24px. trayer only
honours --tint with --transparent, so it drew the GTK background instead.
2026-10-26 17:55:26 +01:00
Daniele Fucini 68bbcaeb82 Add a keybinding list on M-F1; match games by class pattern; update workspace icons
All keys get descriptions (NamedActions) and M-F1 lists them in dmenu. Proton
and Wine games go to ws 3 by class prefix/suffix instead of one rule per game;
GIMP and Audacity go to ws 5; small tools float; new icons for ws 2-7.
2026-10-26 17:49:04 +01:00
Daniele Fucini efea899ccb Pause dunst while the screen is locked; add notification history keys
screen-lock holds notifications until unlock, and M-S-l now goes through
loginctl lock-session so it uses the same locker. M-S-n pops dunst history,
M-C-n closes all notifications.
2026-10-26 17:31:03 +01:00
6 changed files with 161 additions and 64 deletions

No files matched your search

+1 -2
View File
@@ -15,8 +15,7 @@ alias sort='sort -n'
alias scrcpy='scrcpy --disable-screensaver'
alias ssh='kitten ssh'
alias sudo='doas'
#alias trayer='trayer -l --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --transparent true --tint 0x232634 --height 18 --monitor 1'
alias trayer='trayer -l --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0x232634 --height 18 --monitor 1'
alias trayer='trayer -l --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --transparent true --alpha 0 --tint 0x24283b --height 24 --monitor 1'
alias trc='trash-empty'
alias trl='trash-list'
alias trm='trash-rm'
+2 -2
View File
@@ -1,9 +1,9 @@
Config { overrideRedirect = True
, lowerOnStart = True
, font = "Jetbrains Mono Nerd Font Bold 9"
, font = "Jetbrains Mono Nerd Font Bold 10"
, bgColor = "#24283b"
, fgColor = "#737aa2"
, position = Top
, position = TopH 24
, border = NoBorder
, borderColor = "#24283b"
, allDesktops = True
+2 -2
View File
@@ -1,9 +1,9 @@
Config { overrideRedirect = True
, lowerOnStart = True
, font = "Jetbrains Mono Nerd Font Bold 9"
, font = "Jetbrains Mono Nerd Font Bold 10"
, bgColor = "#24283b"
, fgColor = "#737aa2"
, position = Top
, position = TopH 24
, border = NoBorder
, borderColor = "#24283b"
, allDesktops = True
+141 -55
View File
@@ -1,7 +1,7 @@
-- Import
import Data.Monoid
import Graphics.X11.ExtraTypes.XF86
import Data.Char (toLower)
import Control.Monad (forM_, liftM2, when)
import Data.Maybe (isJust)
import XMonad
@@ -27,9 +27,11 @@ import XMonad.Util.ClickableWorkspaces
import XMonad.Util.EZConfig
import qualified XMonad.Util.Hacks as Hacks
import XMonad.Util.Loggers
import XMonad.Util.NamedActions
import XMonad.Util.NamedScratchpad
import XMonad.Util.Run (runProcessWithInput)
import XMonad.Util.Run (runProcessWithInput, spawnPipe)
import XMonad.Util.SpawnOnce
import System.IO (hClose, hPutStr)
-- Main
main :: IO ()
@@ -105,7 +107,7 @@ myScratchpads =
-- Config
myConfig =
def
addDescrKeys' ((myModMask, xK_F1), showKeys) myKeys $ def
{ modMask = myModMask,
terminal = myTerminal,
workspaces = myWorkspaces,
@@ -117,42 +119,96 @@ myConfig =
handleEventHook = myHandleEventHook,
logHook = myLogHook
}
`additionalKeysP` [ ("M-b", sendMessage ToggleStruts),
("M-S-l", spawn "slock"),
("<Print>", unGrab *> spawn ("scrot " ++ myScreenshotDir ++ myScreenshotName)),
("S-<Print>", unGrab *> spawn ("scrot -s " ++ myScreenshotDir ++ myScreenshotName)),
("M-S-<Print>", unGrab *> spawn ("scrot -u " ++ myScreenshotDir ++ myScreenshotName)),
("M-d", spawn "dmenu_run"),
("M-p", spawn "passmenu -i"),
("M-f", sendMessage $ JumpToLayout "Tabbed"),
("M-i", spawn $ "setxkbmap" ++ myKeyboardLayoutIT),
("M-u", spawn $ "setxkbmap" ++ myKeyboardLayoutUS),
("M-s", spawn $ "setxkbmap" ++ myKeyboardLayoutSK),
("M-S-v", namedScratchpadAction myScratchpads "Riseup-vpn"),
("M-S-s", namedScratchpadAction myScratchpads "Terminal"),
("M-S-a", namedScratchpadAction myScratchpads "Cal"),
("M-o", namedScratchpadAction myScratchpads "Btop"),
("M-x", spawn "bluetoothctl connect F4:9D:8A:B9:8C:EE"),
("M-S-x", spawn "bluetoothctl disconnect F4:9D:8A:B9:8C:EE")
]
`additionalKeys` [ ((0, xF86XK_AudioMute), spawn "pactl set-sink-mute $(pactl get-default-sink) toggle"),
((0, xF86XK_AudioLowerVolume), spawn "pactl set-sink-volume $(pactl get-default-sink) -10%"),
((0, xF86XK_AudioRaiseVolume), spawn "wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 10%+"),
((0, xF86XK_AudioPlay), spawn "playerctl play-pause"),
((0, xF86XK_AudioPause), spawn "playerctl pause"),
((0, xF86XK_AudioStop), spawn "playerctl stop"),
((0, xF86XK_AudioNext), spawn "playerctl next"),
((0, xF86XK_AudioPrev), spawn "playerctl previous"),
((0, xF86XK_Calculator), spawn "qalculate-gtk"),
((0, xF86XK_HomePage), spawn myBrowser),
((0, xF86XK_Mail), namedScratchpadAction myScratchpads "Mail"),
((0, xF86XK_Tools), namedScratchpadAction myScratchpads "Music")
]
++ [ ((myModMask .|. mask, key), f sc)
| (key, sc) <- zip [xK_w, xK_e] [0 ..],
(f, mask) <- [(viewScreen def, 0), (sendToScreen def, shiftMask)]
]
++ [((myModMask, key), windows $ safeView ws) | (ws, key) <- zip myWorkspaces [xK_1 .. xK_9]]
-- Keys
-- xmonad's described defaults minus the ones overridden here, so M-<F1> lists each key once
myKeys :: XConfig Layout -> [((KeyMask, KeySym), NamedAction)]
myKeys c = dropEmptyGroups (filter ((`notElem` overridden) . fst) (defaultKeysDescr c)) ++ custom
where
custom = myCustomKeys c
-- M-r/M-S-r: there's no third screen
overridden = (myModMask, xK_r) : (myModMask .|. shiftMask, xK_r) : filter (/= (0, 0)) (map fst custom)
-- (0, 0) is a subtitle or separator; drop it when nothing follows before the next one
dropEmptyGroups (((0, 0), _) : rest@(((0, 0), _) : _)) = dropEmptyGroups rest
dropEmptyGroups [((0, 0), _)] = []
dropEmptyGroups (x : rest) = x : dropEmptyGroups rest
dropEmptyGroups [] = []
myCustomKeys :: XConfig Layout -> [((KeyMask, KeySym), NamedAction)]
myCustomKeys c =
concatMap
(\(t, ks) -> subtitle t : mkNamedKeymap c ks)
[ ( "launchers",
[ ("M-d", addName "Run a program (dmenu)" $ spawn "dmenu_run"),
("M-p", addName "Passwords (passmenu)" $ spawn "passmenu -i"),
("<XF86HomePage>", addName "Browser" $ spawn myBrowser),
("<XF86Calculator>", addName "Calculator" $ spawn "qalculate-gtk")
]
),
( "scratchpads",
[ ("M-S-s", addName "Terminal" $ namedScratchpadAction myScratchpads "Terminal"),
("M-S-a", addName "Calendar (calcurse)" $ namedScratchpadAction myScratchpads "Cal"),
("M-o", addName "btop" $ namedScratchpadAction myScratchpads "Btop"),
("M-S-v", addName "RiseupVPN" $ namedScratchpadAction myScratchpads "Riseup-vpn"),
("<XF86Mail>", addName "Mail (mutt)" $ namedScratchpadAction myScratchpads "Mail"),
("<XF86Tools>", addName "Music (ncmpcpp)" $ namedScratchpadAction myScratchpads "Music")
]
),
( "session and layout",
[ ("M-S-l", addName "Lock the screen" $ spawn "loginctl lock-session"),
("M-S-n", addName "Show older notification" $ spawn "dunstctl history-pop"),
("M-C-n", addName "Close all notifications" $ spawn "dunstctl close-all"),
("M-b", addName "Toggle the status bar gap" $ sendMessage ToggleStruts),
("M-f", addName "Tabbed layout" $ sendMessage $ JumpToLayout "Tabbed"),
("M-i", addName "Keyboard: Italian" $ spawn $ "setxkbmap" ++ myKeyboardLayoutIT),
("M-u", addName "Keyboard: US" $ spawn $ "setxkbmap" ++ myKeyboardLayoutUS),
("M-s", addName "Keyboard: Slovak" $ spawn $ "setxkbmap" ++ myKeyboardLayoutSK),
("M-x", addName "Connect earbuds" $ spawn "bluetoothctl connect F4:9D:8A:B9:8C:EE"),
("M-S-x", addName "Disconnect earbuds" $ spawn "bluetoothctl disconnect F4:9D:8A:B9:8C:EE")
]
),
( "screenshots",
[ ("<Print>", addName "Whole screen" $ unGrab *> spawn ("scrot " ++ myScreenshotDir ++ myScreenshotName)),
("S-<Print>", addName "Select an area" $ unGrab *> spawn ("scrot -s " ++ myScreenshotDir ++ myScreenshotName)),
("M-S-<Print>", addName "Focused window" $ unGrab *> spawn ("scrot -u " ++ myScreenshotDir ++ myScreenshotName))
]
),
( "media keys",
[ ("<XF86AudioMute>", addName "Mute" $ spawn "pactl set-sink-mute $(pactl get-default-sink) toggle"),
("<XF86AudioLowerVolume>", addName "Volume down" $ spawn "pactl set-sink-volume $(pactl get-default-sink) -10%"),
("<XF86AudioRaiseVolume>", addName "Volume up" $ spawn "wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 10%+"),
("<XF86AudioPlay>", addName "Play/pause" $ spawn "playerctl play-pause"),
("<XF86AudioPause>", addName "Pause" $ spawn "playerctl pause"),
("<XF86AudioStop>", addName "Stop" $ spawn "playerctl stop"),
("<XF86AudioNext>", addName "Next track" $ spawn "playerctl next"),
("<XF86AudioPrev>", addName "Previous track" $ spawn "playerctl previous")
]
),
( "workspaces and screens",
[ (m ++ show n, addName (d ++ show n ++ " (" ++ name ++ ")") $ windows $ f ws)
| (n, ws, name) <- zip3 [1 :: Int ..] myWorkspaces ["terminal", "web", "games", "chat", "media", "docs", "VM", "free", "free"],
(m, d, f) <- [("M-", "Workspace ", safeView), ("M-S-", "Send window to workspace ", W.shift)]
]
++ [ (m ++ k, addName (d ++ side) $ f def sc)
| (k, sc, side) <- [("w", 0, "left screen"), ("e", 1, "right screen")],
(m, d, f) <- [("M-", "Focus ", viewScreen), ("M-S-", "Send window to ", sendToScreen)]
]
)
]
-- Shows the key list in dmenu (type to filter; picking a line does nothing).
-- spawnPipe rather than runProcessWithInput, which would block xmonad while dmenu is open.
showKeys :: [((KeyMask, KeySym), NamedAction)] -> NamedAction
showKeys ks = addName "Show keybindings" $ do
h <- spawnPipe "dmenu -i -l 30 -p Keys"
io $ hPutStr h (unlines $ map tidy $ filter (not . null) $ lines $ unlines $ showKm ks) >> hClose h
where
-- showKm writes the mod key as M4- (it doesn't know modMask); re-pad after shortening it
tidy l@('>' : _) = l
tidy l = let (k, d) = break (== ' ') l in take 24 (fixMod k ++ repeat ' ') ++ dropWhile (== ' ') d
fixMod ('M' : '4' : '-' : r) = "M-" ++ fixMod r
fixMod (x : r) = x : fixMod r
fixMod [] = []
-- greedyView that keeps wsGames on screen 0 (HDMI): Wine games lose the mouse when moved between screens
safeView :: WorkspaceId -> WindowSet -> WindowSet
@@ -183,14 +239,15 @@ safeRescreen = do
myWorkspaces :: [String]
myWorkspaces = [wsTerm, wsWeb, wsGames, wsChat, wsMedia, wsDocs, wsVM] ++ map show [8, 9]
-- Icons spill past their advance in the non-Mono Nerd Font: keep them ~1000-1160 units wide or gaps look uneven
wsTerm, wsWeb, wsGames, wsChat, wsMedia, wsDocs, wsVM :: String
wsTerm = "1:\xf489 "
wsWeb = "2:\xe743 "
wsGames = "3:\xf1b6 "
wsChat = "4:\xf10b "
wsMedia = "5:\xead9 "
wsDocs = "6:\xeb69 "
wsVM = "7:\xea7a "
wsWeb = "2:\xf0ac "
wsGames = "3:\xf11b "
wsChat = "4:\xf086 "
wsMedia = "5:\xefab "
wsDocs = "6:\xede2 "
wsVM = "7:\xf108 "
-- Layout
myLayoutHook = onWorkspace wsWeb myWebLayout $ onWorkspace wsGames myGamesLayout $ onWorkspace wsMedia myVideoLayout myDefaultLayout
@@ -242,17 +299,41 @@ myXmobarPP =
ppHidden = cultured . wrap " " "",
ppHiddenNoWindows = outerspace . wrap " " "",
ppUrgent = sunsetorange . wrap (keylime "!") (keylime "!"),
-- Show "1:<icon>" as just the icon; tags stay as they are (clickablePP uses the index)
ppRename = \tag _ -> case break (== ':') tag of
(_, ':' : icon) -> icon
_ -> tag,
-- NamedScratchpad never removes NSP once created; hide it while it's empty
ppSort = (. filter (\w -> W.tag w /= scratchpadWorkspaceTag || isJust (W.stack w))) <$> ppSort def,
ppOrder = \[ws, l, _, wins] -> [ws, l, wins],
ppExtras = [logTitles formatFocused formatUnfocused]
ppLayout = layoutIcon,
ppExtras = [budgetTitles]
}
where
formatFocused = wrap (cultured "[") (cultured "]") . pink . ppWindow
formatUnfocused = wrap (outerspace "[") (outerspace "]") . cultured . ppWindow
layoutIcon :: String -> String
layoutIcon l = case l of
"Tall" -> "\xf0bcc"
"Mirror Tall" -> "\xf0bcb"
"Tabbed" -> "\xf04e9"
"ThreeCol" -> "\xf056d"
"Grid" -> "\xf0570"
"Spiral" -> "\xf056e"
"Full" -> "\xf0293"
_ -> l
ppWindow :: String -> String
ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 20
-- Titles share one width budget, so more windows get shorter titles instead of overflowing the bar
budgetTitles :: Logger
budgetTitles = do
n <- gets $ length . W.integrate' . W.stack . W.workspace . W.current . windowset
let width = max 8 . min 30 $ 60 `div` max 1 n
logTitles (formatFocused width) (formatUnfocused width)
formatFocused, formatUnfocused :: Int -> String -> String
formatFocused w = wrap (cultured "[") (cultured "]") . pink . ppWindow w
formatUnfocused w = wrap (outerspace "[") (outerspace "]") . cultured . ppWindow w
ppWindow :: Int -> String -> String
ppWindow w = xmobarRaw . (\t -> if null t then "untitled" else t) . shorten' "…" w
outerspace, pink, sunsetorange, cultured, keylime :: String -> String
pink = xmobarColor "#ff79c6" ""
@@ -288,10 +369,15 @@ myStartupHook = do
myManageHook :: ManageHook
myManageHook =
composeAll
[ className =? "Gpodder" --> doShift wsMedia,
[ -- Proton games are steam_app_<id>; Wine windows are named after their .exe
className ^? "steam_app_" --> doShift wsGames,
className $? ".exe" --> doShift wsGames,
className =? "Gpodder" --> doShift wsMedia,
className =? "An Anime Game Launcher" --> doShift wsGames,
className =? "Qalculate-gtk" --> doFloat,
title =? "Genshin Impact" --> doShift wsGames,
classIn ["gimp", "audacity"] --> doShift wsMedia,
classIn ["pavucontrol", "org.pulseaudio.pavucontrol", "zenity", "org.gnome.zenity", "lxappearance", "qt5ct", "qt6ct"] --> doFloat,
className =? "Signal" --> doShift wsChat,
className =? "Spotify" --> doShift wsMedia,
className =? "Transmission-gtk" --> doShift wsWeb,
@@ -301,7 +387,6 @@ myManageHook =
className =? "Xreader" --> doShift wsDocs,
className =? "calibre" --> doShift wsDocs,
className =? "discord" --> doShift wsChat,
className =? "explorer.exe" --> doShift wsGames,
className =? "feh" --> doFloat,
title =? "glxgears" --> doFloat,
className =? "library_manager" --> doShift wsDocs,
@@ -314,9 +399,7 @@ myManageHook =
className =? "scrcpy" --> doShift wsMedia,
className =? "steam" --> doShift wsGames,
className =? "steam_app_109600" --> doFloat,
className =? "steam_app_109600" --> doShift wsGames,
className =? "steam_app_289070" --> doFloat,
className =? "steam_app_289070" --> doShift wsGames,
className =? "VirtualBox Machine" --> doShift wsVM,
className =? "VirtualBox Machine" --> doFullFloat,
className =? "VirtualBox Manager" --> doShift wsVM,
@@ -326,7 +409,10 @@ myManageHook =
isFullscreen --> doFullFloat
]
<+> namedScratchpadManageHook myScratchpads
where viewShift = doF . liftM2 (.) safeView W.shift
where
viewShift = doF . liftM2 (.) safeView W.shift
-- Case-insensitive, as GTK4 and firejailed apps capitalise their class differently
classIn names = (`elem` names) . map toLower <$> className
-- Handle event hook
myHandleEventHook :: Event -> X All
+1 -1
View File
@@ -22,5 +22,5 @@ pkill -x trayer
while pgrep -x trayer > /dev/null; do sleep 0.1; done
trayer -l --edge top --align right --SetDockType true \
--SetPartialStrut true --expand true --widthtype request \
--tint 0x232634 --height 18 --monitor "$tray" > /dev/null 2>&1 &
--transparent true --alpha 0 --tint 0x24283b --height 24 --monitor "$tray" > /dev/null 2>&1 &
disown
+14 -2
View File
@@ -3,12 +3,24 @@
image=/usr/share/backgrounds/arch_1920x1080.png
# Hold notifications while locked; dunst shows them on unlock. A signal to this
# script is passed on to i3lock, as the old exec did.
was_paused=$(dunstctl is-paused 2>/dev/null)
dunstctl set-paused true 2>/dev/null
trap 'kill "$pid" 2>/dev/null' INT TERM HUP
# -n: stay in the foreground, as xss-lock needs to see when the screen is unlocked.
# --indicator keeps the ring (and the layout text) visible before typing.
# The layout's default spot (dx:dy+30) falls inside the ring: put it below.
exec i3lock -n -i "$image" -F -c 000000ff \
i3lock -n -i "$image" -F -c 000000ff \
-e -f --indicator --keylayout 0 \
--layout-pos='ix:iy+r+40' --layout-color=ffffffff \
--layout-size=24 \
--time-color=ffffffff --date-color=ffffffff --date-str='%A, %d %B' \
--ring-color=1793d1ff --line-uses-ring "$@"
--ring-color=1793d1ff --line-uses-ring "$@" &
pid=$!
# A trapped signal interrupts the first wait; the second waits for i3lock to exit.
wait "$pid"
wait "$pid" 2>/dev/null
[ "$was_paused" = true ] || dunstctl set-paused false 2>/dev/null