File tree Expand file tree Collapse file tree 5 files changed +12
-0
lines changed
Expand file tree Collapse file tree 5 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 5858| ` /topic <topic> ` | Set the current channel's topic (header) |
5959| ` /user ` | Show users to initiate a private DM chat channel |
6060| ` /username-attribute <@user> ` | Display the attribute used to color the specified username |
61+ | ` /write-theme <path> ` | Write the current theme to a theme settings file |
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import Prelude ()
1212import Matterhorn.Prelude
1313
1414import Brick.Main ( invalidateCache )
15+ import Brick.Themes ( saveTheme )
1516import qualified Control.Exception as Exn
1617import qualified Data.Char as Char
1718import qualified Data.Text as T
@@ -133,6 +134,12 @@ commandList =
133134 NoArg $ \ () -> do
134135 withCurrentTeam enterChannelMembersUserList
135136
137+ , Cmd " write-theme" " Write the current theme to a theme settings file"
138+ (TokenArg " path" NoArg ) $ \ (path, () ) -> do
139+ theme <- use (csResources. crThemeOriginal)
140+ liftIO $ saveTheme (T. unpack path) theme
141+ postInfoMessage $ " Current theme written to " <> path
142+
136143 , Cmd " leave" " Leave a normal channel or hide a DM channel" NoArg $ \ () -> do
137144 withCurrentTeam startLeaveCurrentChannel
138145
Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ setupState mkVty mLogLocation config = do
161161 , _crSubprocessLog = slc
162162 , _crWebsocketActionChan = wac
163163 , _crTheme = themeToAttrMap custTheme
164+ , _crThemeOriginal = custTheme
164165 , _crStatusUpdateChan = userStatusChan
165166 , _crConfiguration = config
166167 , _crFlaggedPosts = mempty
Original file line number Diff line number Diff line change @@ -85,3 +85,4 @@ setTheme tId name =
8585 Just it -> do
8686 mh invalidateCache
8787 csResources. crTheme .= (themeToAttrMap $ internalTheme it)
88+ csResources. crThemeOriginal .= internalTheme it
Original file line number Diff line number Diff line change @@ -235,6 +235,7 @@ module Matterhorn.Types
235235 , crUserPreferences
236236 , crEventQueue
237237 , crTheme
238+ , crThemeOriginal
238239 , crStatusUpdateChan
239240 , crSubprocessLog
240241 , crWebsocketActionChan
@@ -1070,6 +1071,7 @@ data ChatResources =
10701071 , _crSubprocessLog :: STM. TChan ProgramOutput
10711072 , _crWebsocketActionChan :: STM. TChan WebsocketAction
10721073 , _crTheme :: AttrMap
1074+ , _crThemeOriginal :: Theme
10731075 , _crStatusUpdateChan :: STM. TChan [UserId ]
10741076 , _crConfiguration :: Config
10751077 , _crFlaggedPosts :: Set PostId
You can’t perform that action at this time.
0 commit comments