ENH be more detailed when describing package source

This commit is contained in:
Nathan Dwarshuis 2022-07-09 14:59:42 -04:00
parent a91a5cf690
commit f968078c06
11 changed files with 40 additions and 35 deletions

View File

@ -89,7 +89,7 @@ textFontData = T.defFontData { T.weight = Just T.Bold, T.size = Just 11 }
-- | The icon font family -- | The icon font family
iconFont :: Sometimes T.FontBuilder iconFont :: Sometimes T.FontBuilder
iconFont = fontSometimes "XMobar Icon Font" "Symbols Nerd Font" iconFont = fontSometimes "XMobar Icon Font" "Symbols Nerd Font"
[Package True "ttf-nerd-fonts-symbols"] [Package Official "ttf-nerd-fonts-symbols"]
-- | Offsets for the icons in the bar (relative to the text offset) -- | Offsets for the icons in the bar (relative to the text offset)
iconOffset :: BarFont -> Int iconOffset :: BarFont -> Int
@ -208,7 +208,7 @@ getBt = xmobarDBus "bluetooth status indicator" xpfBluetooth btDep btCmd
getAlsa :: BarFeature getAlsa :: BarFeature
getAlsa = iconIO_ "volume level indicator" (const True) root getAlsa = iconIO_ "volume level indicator" (const True) root
$ Only_ $ sysExe [Package True "alsa-utils"] "alsactl" $ Only_ $ sysExe [Package Official "alsa-utils"] "alsactl"
where where
root useIcon = IORoot_ (alsaCmd useIcon) root useIcon = IORoot_ (alsaCmd useIcon)

View File

@ -236,7 +236,7 @@ f5Tag = "F5VPN"
gimpDynamicWorkspace :: Sometimes DynWorkspace gimpDynamicWorkspace :: Sometimes DynWorkspace
gimpDynamicWorkspace = sometimesIO_ "gimp workspace" "gimp" tree dw gimpDynamicWorkspace = sometimesIO_ "gimp workspace" "gimp" tree dw
where where
tree = Only_ $ sysExe [Package True "gimp"] exe tree = Only_ $ sysExe [Package Official "gimp"] exe
dw = DynWorkspace dw = DynWorkspace
{ dwName = "Gimp" { dwName = "Gimp"
, dwTag = gimpTag , dwTag = gimpTag
@ -259,7 +259,7 @@ vmDynamicWorkspace :: Sometimes DynWorkspace
vmDynamicWorkspace = Sometimes "virtualbox workspace" xpfVirtualBox vmDynamicWorkspace = Sometimes "virtualbox workspace" xpfVirtualBox
[Subfeature root "windows 8 VM"] [Subfeature root "windows 8 VM"]
where where
root = IORoot_ dw $ toAnd_ (sysExe [Package True "virtualbox"] "VBoxManage") root = IORoot_ dw $ toAnd_ (sysExe [Package Official "virtualbox"] "VBoxManage")
$ IOTest_ name [] $ vmExists vm $ IOTest_ name [] $ vmExists vm
name = unwords ["test if", vm, "exists"] name = unwords ["test if", vm, "exists"]
c = "VirtualBoxVM" c = "VirtualBoxVM"
@ -277,7 +277,7 @@ xsaneDynamicWorkspace :: Sometimes DynWorkspace
xsaneDynamicWorkspace = Sometimes "scanner workspace" xpfXSANE xsaneDynamicWorkspace = Sometimes "scanner workspace" xpfXSANE
[Subfeature (IORoot_ dw tree) "xsane"] [Subfeature (IORoot_ dw tree) "xsane"]
where where
tree = Only_ $ sysExe [Package True "xsane"] "xsane" tree = Only_ $ sysExe [Package Official "xsane"] "xsane"
dw = DynWorkspace dw = DynWorkspace
{ dwName = "XSane" { dwName = "XSane"
, dwTag = xsaneTag , dwTag = xsaneTag
@ -292,7 +292,7 @@ f5vpnDynamicWorkspace :: Sometimes DynWorkspace
f5vpnDynamicWorkspace = Sometimes "F5 VPN workspace" xpfF5VPN f5vpnDynamicWorkspace = Sometimes "F5 VPN workspace" xpfF5VPN
[Subfeature (IORoot_ dw tree) "f5vpn"] [Subfeature (IORoot_ dw tree) "f5vpn"]
where where
tree = Only_ $ sysExe [Package False "f5vpn"] "f5vpn" tree = Only_ $ sysExe [Package AUR "f5vpn"] "f5vpn"
dw = DynWorkspace dw = DynWorkspace
{ dwName = "F5Vpn" { dwName = "F5Vpn"
, dwTag = f5Tag , dwTag = f5Tag

View File

@ -68,10 +68,10 @@ myClipboardManager = "greenclip"
-- | Packages -- | Packages
dmenuPkgs :: [Fulfillment] dmenuPkgs :: [Fulfillment]
dmenuPkgs = [Package True "rofi"] dmenuPkgs = [Package Official "rofi"]
clipboardPkgs :: [Fulfillment] clipboardPkgs :: [Fulfillment]
clipboardPkgs = [Package False "rofi-greenclip"] clipboardPkgs = [Package AUR "rofi-greenclip"]
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | Other internal functions -- | Other internal functions
@ -144,7 +144,7 @@ runNetMenu cl =
cmd _ = spawnCmd myDmenuNetworks $ themeArgs "#ff3333" cmd _ = spawnCmd myDmenuNetworks $ themeArgs "#ff3333"
tree = And_ (Only_ $ Bus networkManagerPkgs networkManagerBus) tree = And_ (Only_ $ Bus networkManagerPkgs networkManagerBus)
$ toAnd_ (DBusIO dmenuDep) $ DBusIO $ toAnd_ (DBusIO dmenuDep) $ DBusIO
$ sysExe [Package False "networkmanager-dmenu-git"] myDmenuNetworks $ sysExe [Package AUR "networkmanager-dmenu-git"] myDmenuNetworks
runAutorandrMenu :: SometimesX runAutorandrMenu :: SometimesX
runAutorandrMenu = sometimesIO_ "autorandr menu" "rofi autorandr" tree cmd runAutorandrMenu = sometimesIO_ "autorandr menu" "rofi autorandr" tree cmd

View File

@ -97,21 +97,21 @@ myNotificationCtrl = "dunstctl"
-- | Packages -- | Packages
myTermPkgs :: [Fulfillment] myTermPkgs :: [Fulfillment]
myTermPkgs = [ Package True "rxvt-unicode" myTermPkgs = [ Package Official "rxvt-unicode"
, Package True "urxvt-perls" , Package Official "urxvt-perls"
] ]
myEditorPkgs :: [Fulfillment] myEditorPkgs :: [Fulfillment]
myEditorPkgs = [Package True "emacs-nativecomp"] myEditorPkgs = [Package Official "emacs-nativecomp"]
notifyPkgs :: [Fulfillment] notifyPkgs :: [Fulfillment]
notifyPkgs = [Package True "dunst"] notifyPkgs = [Package Official "dunst"]
bluetoothPkgs :: [Fulfillment] bluetoothPkgs :: [Fulfillment]
bluetoothPkgs = [Package True "bluez-utils"] bluetoothPkgs = [Package Official "bluez-utils"]
networkManagerPkgs :: [Fulfillment] networkManagerPkgs :: [Fulfillment]
networkManagerPkgs = [Package True "networkmanager"] networkManagerPkgs = [Package Official "networkmanager"]
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | Misc constants -- | Misc constants
@ -144,11 +144,11 @@ runTMux = sometimesIO_ "terminal multiplexer" "tmux" deps act
runCalc :: SometimesX runCalc :: SometimesX
runCalc = sometimesIO_ "calculator" "R" deps act runCalc = sometimesIO_ "calculator" "R" deps act
where where
deps = toAnd_ (sysExe myTermPkgs myTerm) (sysExe [Package True "bc"] myCalc) deps = toAnd_ (sysExe myTermPkgs myTerm) (sysExe [Package Official "bc"] myCalc)
act = spawnCmd myTerm ["-e", myCalc, "-l"] act = spawnCmd myTerm ["-e", myCalc, "-l"]
runBrowser :: SometimesX runBrowser :: SometimesX
runBrowser = sometimesExe "web browser" "brave" [Package False "brave-bin"] runBrowser = sometimesExe "web browser" "brave" [Package AUR "brave-bin"]
False myBrowser False myBrowser
runEditor :: SometimesX runEditor :: SometimesX
@ -161,7 +161,7 @@ runEditor = sometimesIO_ "text editor" "emacs" tree cmd
tree = toAnd_ (sysExe myEditorPkgs myEditor) $ process [] myEditorServer tree = toAnd_ (sysExe myEditorPkgs myEditor) $ process [] myEditorServer
runFileManager :: SometimesX runFileManager :: SometimesX
runFileManager = sometimesExe "file browser" "pcmanfm" [Package True "pcmanfm"] runFileManager = sometimesExe "file browser" "pcmanfm" [Package Official "pcmanfm"]
True "pcmanfm" True "pcmanfm"
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -169,7 +169,7 @@ runFileManager = sometimesExe "file browser" "pcmanfm" [Package True "pcmanfm"]
runMultimediaIfInstalled :: String -> String -> SometimesX runMultimediaIfInstalled :: String -> String -> SometimesX
runMultimediaIfInstalled n cmd = sometimesExeArgs (n ++ " multimedia control") runMultimediaIfInstalled n cmd = sometimesExeArgs (n ++ " multimedia control")
"playerctl" [Package True "playerctl"] True myMultimediaCtl [cmd] "playerctl" [Package Official "playerctl"] True myMultimediaCtl [cmd]
runTogglePlay :: SometimesX runTogglePlay :: SometimesX
runTogglePlay = runMultimediaIfInstalled "play/pause" "play-pause" runTogglePlay = runMultimediaIfInstalled "play/pause" "play-pause"
@ -201,7 +201,7 @@ featureSound n file pre post =
sometimesIO_ ("volume " ++ n ++ " control") "paplay" tree sometimesIO_ ("volume " ++ n ++ " control") "paplay" tree
$ pre >> playSound file >> post $ pre >> playSound file >> post
where where
tree = Only_ $ sysExe [Package True "libpulse"] "paplay" tree = Only_ $ sysExe [Package Official "libpulse"] "paplay"
runVolumeDown :: SometimesX runVolumeDown :: SometimesX
runVolumeDown = featureSound "up" volumeChangeSound (return ()) $ void (lowerVolume 2) runVolumeDown = featureSound "up" volumeChangeSound (return ()) $ void (lowerVolume 2)
@ -248,7 +248,7 @@ runNetAppDaemon cl = Sometimes "network applet" xpfVPN
[Subfeature (DBusRoot_ cmd tree cl) "NM-applet"] [Subfeature (DBusRoot_ cmd tree cl) "NM-applet"]
where where
tree = toAnd_ app $ Bus networkManagerPkgs networkManagerBus tree = toAnd_ app $ Bus networkManagerPkgs networkManagerBus
app = DBusIO $ sysExe [Package True "network-manager-applet"] "nm-applet" app = DBusIO $ sysExe [Package Official "network-manager-applet"] "nm-applet"
cmd _ = snd <$> spawnPipe "nm-applet" cmd _ = snd <$> spawnPipe "nm-applet"
runToggleBluetooth :: Maybe Client -> SometimesX runToggleBluetooth :: Maybe Client -> SometimesX
@ -310,7 +310,7 @@ runFlameshot :: String -> String -> Maybe Client -> SometimesX
runFlameshot n mode cl = sometimesDBus cl n myCapture tree cmd runFlameshot n mode cl = sometimesDBus cl n myCapture tree cmd
where where
cmd _ = spawnCmd myCapture [mode] cmd _ = spawnCmd myCapture [mode]
tree = toAnd_ (DBusIO $ sysExe [Package True "flameshot"] myCapture) tree = toAnd_ (DBusIO $ sysExe [Package Official "flameshot"] myCapture)
$ Bus [] $ busName_ "org.flameshot.Flameshot" $ Bus [] $ busName_ "org.flameshot.Flameshot"
-- TODO this will steal focus from the current window (and puts it -- TODO this will steal focus from the current window (and puts it
@ -328,6 +328,6 @@ runScreenCapture = runFlameshot "screen capture" "screen"
runCaptureBrowser :: SometimesX runCaptureBrowser :: SometimesX
runCaptureBrowser = sometimesIO_ "screen capture browser" "feh" runCaptureBrowser = sometimesIO_ "screen capture browser" "feh"
(Only_ $ sysExe [Package True "feh"] myImageBrowser) $ do (Only_ $ sysExe [Package Official "feh"] myImageBrowser) $ do
dir <- io getCaptureDir dir <- io getCaptureDir
spawnCmd myImageBrowser [dir] spawnCmd myImageBrowser [dir]

View File

@ -62,14 +62,14 @@ myPrimeOffload = "prime-offload"
-- | Packages -- | Packages
optimusPackages :: [Fulfillment] optimusPackages :: [Fulfillment]
optimusPackages = [Package False "optimus-manager"] optimusPackages = [Package AUR "optimus-manager"]
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | Core commands -- | Core commands
runScreenLock :: SometimesX runScreenLock :: SometimesX
runScreenLock = sometimesExe "screen locker" "i3lock script" runScreenLock = sometimesExe "screen locker" "i3lock script"
[Package False "i3lock-color"] False myScreenlock [Package AUR "i3lock-color"] False myScreenlock
runPowerOff :: X () runPowerOff :: X ()
runPowerOff = spawn "systemctl poweroff" runPowerOff = spawn "systemctl poweroff"
@ -89,7 +89,7 @@ runReboot = spawn "systemctl reboot"
runAutolock :: Sometimes (IO ProcessHandle) runAutolock :: Sometimes (IO ProcessHandle)
runAutolock = sometimesIO_ "automatic screen lock" "xss-lock" tree cmd runAutolock = sometimesIO_ "automatic screen lock" "xss-lock" tree cmd
where where
tree = And_ (Only_ $ sysExe [Package True "xss-lock"] "xss-lock") tree = And_ (Only_ $ sysExe [Package Official "xss-lock"] "xss-lock")
$ Only_ $ IOSometimes_ runScreenLock $ Only_ $ IOSometimes_ runScreenLock
cmd = snd <$> spawnPipeArgs "xss-lock" ["--ignore-sleep", "screenlock"] cmd = snd <$> spawnPipeArgs "xss-lock" ["--ignore-sleep", "screenlock"]
@ -100,7 +100,7 @@ promptFontDep :: IOTree T.FontBuilder
promptFontDep = fontTreeAlt T.defFontFamily defFontPkgs promptFontDep = fontTreeAlt T.defFontFamily defFontPkgs
defFontPkgs :: [Fulfillment] defFontPkgs :: [Fulfillment]
defFontPkgs = [Package True "ttf-dejavu"] defFontPkgs = [Package Official "ttf-dejavu"]
confirmPrompt' :: String -> X () -> T.FontBuilder -> X () confirmPrompt' :: String -> X () -> T.FontBuilder -> X ()
confirmPrompt' s x fb = confirmPrompt (T.promptTheme fb) s x confirmPrompt' s x fb = confirmPrompt (T.promptTheme fb) s x

View File

@ -91,7 +91,7 @@ acpiPath :: FilePath
acpiPath = "/var/run/acpid.socket" acpiPath = "/var/run/acpid.socket"
socketDep :: IOTree_ socketDep :: IOTree_
socketDep = Only_ $ pathR acpiPath [Package True "acpid"] socketDep = Only_ $ pathR acpiPath [Package Official "acpid"]
-- | Handle ClientMessage event containing and ACPI event (to be used in -- | Handle ClientMessage event containing and ACPI event (to be used in
-- Xmonad's event hook) -- Xmonad's event hook)

View File

@ -108,10 +108,10 @@ clevoKeyboardConfig = BrightnessConfig
-- | Exported haskell API -- | Exported haskell API
stateFileDep :: IODependency_ stateFileDep :: IODependency_
stateFileDep = pathRW stateFile [Package True "tuxedo-keyboard"] stateFileDep = pathRW stateFile [Package AUR "tuxedo-keyboard"]
brightnessFileDep :: IODependency_ brightnessFileDep :: IODependency_
brightnessFileDep = pathR brightnessFile [Package True "tuxedo-keyboard"] brightnessFileDep = pathR brightnessFile [Package AUR "tuxedo-keyboard"]
clevoKeyboardSignalDep :: DBusDependency_ clevoKeyboardSignalDep :: DBusDependency_
clevoKeyboardSignalDep = signalDep clevoKeyboardConfig clevoKeyboardSignalDep = signalDep clevoKeyboardConfig

View File

@ -33,7 +33,7 @@ memRemoved :: MemberName
memRemoved = memberName_ "InterfacesRemoved" memRemoved = memberName_ "InterfacesRemoved"
dbusDep :: MemberName -> DBusDependency_ dbusDep :: MemberName -> DBusDependency_
dbusDep m = Endpoint [Package True "udisks2"] bus path interface $ Signal_ m dbusDep m = Endpoint [Package Official "udisks2"] bus path interface $ Signal_ m
addedDep :: DBusDependency_ addedDep :: DBusDependency_
addedDep = dbusDep memAdded addedDep = dbusDep memAdded

View File

@ -117,7 +117,7 @@ exportScreensaver client =
] ]
} }
bus = Bus [] xmonadBusName bus = Bus [] xmonadBusName
ssx = DBusIO $ sysExe [Package True "xorg-xset"] ssExecutable ssx = DBusIO $ sysExe [Package Official "xorg-xset"] ssExecutable
callToggle :: Maybe Client -> SometimesIO callToggle :: Maybe Client -> SometimesIO
callToggle = sometimesEndpoint "screensaver toggle" "dbus switch" [] callToggle = sometimesEndpoint "screensaver toggle" "dbus switch" []

View File

@ -48,6 +48,7 @@ module XMonad.Internal.Dependency
, UnitType(..) , UnitType(..)
, Result , Result
, Fulfillment(..) , Fulfillment(..)
, ArchPkg(..)
-- dumping -- dumping
, dumpFeature , dumpFeature
@ -387,11 +388,15 @@ instance Hashable DBusMember where
-- TODO there is a third type of package: not in aur or official -- TODO there is a third type of package: not in aur or official
-- | A means to fulfill a dependency -- | A means to fulfill a dependency
-- For now this is just the name of an Arch Linux package (AUR or official) -- For now this is just the name of an Arch Linux package (AUR or official)
data Fulfillment = Package Bool String deriving (Eq, Show) data Fulfillment = Package ArchPkg String deriving (Eq, Show)
instance Hashable Fulfillment where instance Hashable Fulfillment where
hashWithSalt s (Package a n) = s `hashWithSalt` a `hashWithSalt` n hashWithSalt s (Package a n) = s `hashWithSalt` a `hashWithSalt` n
data ArchPkg = Official | AUR | Custom deriving (Eq, Show, Generic)
instance Hashable ArchPkg
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | Tested dependency tree -- | Tested dependency tree
-- --
@ -1227,7 +1232,7 @@ dataFulfillments = jsonArray . fmap (JSON_UQ . dataFulfillment)
dataFulfillment :: Fulfillment -> JSONUnquotable dataFulfillment :: Fulfillment -> JSONUnquotable
dataFulfillment (Package a n) = jsonObject [ ("type", JSON_Q $ Q "package") dataFulfillment (Package a n) = jsonObject [ ("type", JSON_Q $ Q "package")
, ("official", JSON_UQ $ jsonBool a) , ("type", JSON_Q $ Q $ show a)
, ("name", JSON_Q $ Q n) , ("name", JSON_Q $ Q n)
] ]

View File

@ -57,7 +57,7 @@ btAlias :: String
btAlias = "bluetooth" btAlias = "bluetooth"
btDep :: DBusDependency_ btDep :: DBusDependency_
btDep = Endpoint [Package True "bluez"] btBus btOMPath omInterface btDep = Endpoint [Package Official "bluez"] btBus btOMPath omInterface
$ Method_ getManagedObjects $ Method_ getManagedObjects
data Bluetooth = Bluetooth Icons Colors deriving (Read, Show) data Bluetooth = Bluetooth Icons Colors deriving (Read, Show)