Skip to content

Set correct application title in GNOME shell #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions GUI/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,32 @@
-- Platform-specific application functionality
-------------------------------------------------------------------------------

module GUI.App (initApp) where
module GUI.App (appTitle, initApp) where

-- Mac OS X-specific GTK imports
#if defined(darwin_HOST_OS)
import Control.Monad (void)
import qualified Graphics.UI.Gtk as Gtk
import qualified Graphics.UI.Gtk.OSX as OSX
import GUI.DataFiles (loadLogo)
#else
import Control.Monad (void)
import qualified Graphics.UI.Gtk as Gtk
import System.Glib.Utils (setProgramName)
#endif

-------------------------------------------------------------------------------

appTitle :: String
appTitle = "ThreadScope"

#if defined(darwin_HOST_OS)

-- | Initialize application
-- Perform Mac OS X-specific application initialization
initApp :: IO ()
initApp = do
void Gtk.initGUI
app <- OSX.applicationNew
menuBar <- Gtk.menuBarNew
OSX.applicationSetMenuBar app menuBar
Expand All @@ -36,6 +45,8 @@ initApp = do
-- | Initialize application
-- Perform application initialization for non-Mac OS X platforms
initApp :: IO ()
initApp = return ()
initApp = do
setProgramName appTitle
void Gtk.initGUI

#endif
3 changes: 2 additions & 1 deletion GUI/Dialogs.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE TemplateHaskell #-}
module GUI.Dialogs where

import GUI.App (appTitle)
import GUI.DataFiles (loadLogo)
import Paths_threadscope (version)

Expand All @@ -17,7 +18,7 @@ aboutDialog parent
= do dialog <- aboutDialogNew
logo <- $loadLogo
set dialog [
aboutDialogName := "ThreadScope",
aboutDialogName := appTitle,
aboutDialogVersion := showVersion version,
aboutDialogCopyright := "Released under the GHC license as part of the Glasgow Haskell Compiler.",
aboutDialogComments := "A GHC eventlog profile viewer",
Expand Down
2 changes: 0 additions & 2 deletions GUI/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,6 @@ eventLoop uienv@UIEnv{..} eventlogState = do

runGUI :: Maybe (Either FilePath String) -> IO ()
runGUI initialTrace = do
Gtk.initGUI

App.initApp

uiEnv <- constructUI
Expand Down
5 changes: 3 additions & 2 deletions GUI/MainWindow.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module GUI.MainWindow (
import Graphics.UI.Gtk as Gtk
import qualified System.Glib.GObject as Glib

import GUI.App (appTitle)
import GUI.DataFiles (loadLogo)

-------------------------------------------------------------------------------
Expand Down Expand Up @@ -69,11 +70,11 @@ data MainWindowActions = MainWindowActions {
setFileLoaded :: MainWindow -> Maybe FilePath -> IO ()
setFileLoaded mainWin Nothing =
set (mainWindow mainWin) [
windowTitle := "ThreadScope"
windowTitle := appTitle
]
setFileLoaded mainWin (Just file) =
set (mainWindow mainWin) [
windowTitle := file ++ " - ThreadScope"
windowTitle := file ++ " - " ++ appTitle
]

setStatusMessage :: MainWindow -> String -> IO ()
Expand Down