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
iconFont :: Sometimes T.FontBuilder
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)
iconOffset :: BarFont -> Int
@ -208,7 +208,7 @@ getBt = xmobarDBus "bluetooth status indicator" xpfBluetooth btDep btCmd
getAlsa :: BarFeature
getAlsa = iconIO_ "volume level indicator" (const True) root
$ Only_ $ sysExe [Package True "alsa-utils"] "alsactl"
$ Only_ $ sysExe [Package Official "alsa-utils"] "alsactl"
where
root useIcon = IORoot_ (alsaCmd useIcon)

View File

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

View File

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

View File

@ -97,21 +97,21 @@ myNotificationCtrl = "dunstctl"
-- | Packages
myTermPkgs :: [Fulfillment]
myTermPkgs = [ Package True "rxvt-unicode"
, Package True "urxvt-perls"
myTermPkgs = [ Package Official "rxvt-unicode"
, Package Official "urxvt-perls"
]
myEditorPkgs :: [Fulfillment]
myEditorPkgs = [Package True "emacs-nativecomp"]
myEditorPkgs = [Package Official "emacs-nativecomp"]
notifyPkgs :: [Fulfillment]
notifyPkgs = [Package True "dunst"]
notifyPkgs = [Package Official "dunst"]
bluetoothPkgs :: [Fulfillment]
bluetoothPkgs = [Package True "bluez-utils"]
bluetoothPkgs = [Package Official "bluez-utils"]
networkManagerPkgs :: [Fulfillment]
networkManagerPkgs = [Package True "networkmanager"]
networkManagerPkgs = [Package Official "networkmanager"]
--------------------------------------------------------------------------------
-- | Misc constants
@ -144,11 +144,11 @@ runTMux = sometimesIO_ "terminal multiplexer" "tmux" deps act
runCalc :: SometimesX
runCalc = sometimesIO_ "calculator" "R" deps act
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"]
runBrowser :: SometimesX
runBrowser = sometimesExe "web browser" "brave" [Package False "brave-bin"]
runBrowser = sometimesExe "web browser" "brave" [Package AUR "brave-bin"]
False myBrowser
runEditor :: SometimesX
@ -161,7 +161,7 @@ runEditor = sometimesIO_ "text editor" "emacs" tree cmd
tree = toAnd_ (sysExe myEditorPkgs myEditor) $ process [] myEditorServer
runFileManager :: SometimesX
runFileManager = sometimesExe "file browser" "pcmanfm" [Package True "pcmanfm"]
runFileManager = sometimesExe "file browser" "pcmanfm" [Package Official "pcmanfm"]
True "pcmanfm"
--------------------------------------------------------------------------------
@ -169,7 +169,7 @@ runFileManager = sometimesExe "file browser" "pcmanfm" [Package True "pcmanfm"]
runMultimediaIfInstalled :: String -> String -> SometimesX
runMultimediaIfInstalled n cmd = sometimesExeArgs (n ++ " multimedia control")
"playerctl" [Package True "playerctl"] True myMultimediaCtl [cmd]
"playerctl" [Package Official "playerctl"] True myMultimediaCtl [cmd]
runTogglePlay :: SometimesX
runTogglePlay = runMultimediaIfInstalled "play/pause" "play-pause"
@ -201,7 +201,7 @@ featureSound n file pre post =
sometimesIO_ ("volume " ++ n ++ " control") "paplay" tree
$ pre >> playSound file >> post
where
tree = Only_ $ sysExe [Package True "libpulse"] "paplay"
tree = Only_ $ sysExe [Package Official "libpulse"] "paplay"
runVolumeDown :: SometimesX
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"]
where
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"
runToggleBluetooth :: Maybe Client -> SometimesX
@ -310,7 +310,7 @@ runFlameshot :: String -> String -> Maybe Client -> SometimesX
runFlameshot n mode cl = sometimesDBus cl n myCapture tree cmd
where
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"
-- TODO this will steal focus from the current window (and puts it
@ -328,6 +328,6 @@ runScreenCapture = runFlameshot "screen capture" "screen"
runCaptureBrowser :: SometimesX
runCaptureBrowser = sometimesIO_ "screen capture browser" "feh"
(Only_ $ sysExe [Package True "feh"] myImageBrowser) $ do
(Only_ $ sysExe [Package Official "feh"] myImageBrowser) $ do
dir <- io getCaptureDir
spawnCmd myImageBrowser [dir]

View File

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

View File

@ -91,7 +91,7 @@ acpiPath :: FilePath
acpiPath = "/var/run/acpid.socket"
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
-- Xmonad's event hook)

View File

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

View File

@ -33,7 +33,7 @@ memRemoved :: MemberName
memRemoved = memberName_ "InterfacesRemoved"
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 = dbusDep memAdded

View File

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

View File

@ -48,6 +48,7 @@ module XMonad.Internal.Dependency
, UnitType(..)
, Result
, Fulfillment(..)
, ArchPkg(..)
-- dumping
, dumpFeature
@ -387,11 +388,15 @@ instance Hashable DBusMember where
-- TODO there is a third type of package: not in aur or official
-- | A means to fulfill a dependency
-- 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
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
--
@ -1227,7 +1232,7 @@ dataFulfillments = jsonArray . fmap (JSON_UQ . dataFulfillment)
dataFulfillment :: Fulfillment -> JSONUnquotable
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)
]

View File

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