-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Built-in background opacity control #73
Comments
@Grendel-Grendel-Grendel thanks for posting about this as well. Let me give short explanation of what would be needed to implement this.
I'm setting this issue as |
Playing around with set opacity on |
@Grendel-Grendel-Grendel Thanks for taking a look at this. As far as the GTK layout goes, the GTK Also, maybe you do actually have to mess with the I can think of three other possible ways of trying to figure this out:
|
There's been a small update about this. @dakotaclemenceplaza figured out that there was a bug in Termonad where the background colors of the terminal weren't getting their alpha set correctly. That could have been what was causing this to not work. This was fixed in #111 and #110. Someone needs to take another look at this, now that #111 has been merged in. It might work better this time. |
I've been looking into this and found that the background colour opacity is now properly applied. However, the ApplicationWindow is set behind the notebook and is opaque. Calling
Then the terminal opacity will correspond to the opacity of the background set in the colorscheme. Unfortunately the menubar seems to not have a background of its own, and so the menubar background will also become fully transparent. We can just set the menubar background color in the CSS as well:
Would this suffice, or would it be better to inherit this colour from the GTK theme? I'm not sure yet how to do the latter, but will continue investigating. |
@n4074 Thanks for looking into this. To be honest, I don't use opacity, so I'm happy to go with whatever solution you think is best :-) |
I've managed to get this somewhat working by adapting this stack overflow answer. It works beautifully with picom, but is a mess with KWin. KWin appears to include the window itself when rendering what is behind the window, creating a feedback loop. I have no idea why this happens or how to fix it. Here is a minimal working config: import Control.Concurrent.MVar (readMVar)
import Control.Monad (join)
import Data.Foldable (traverse_)
import GI.Gdk.Objects.Screen (screenGetDefault, screenGetRgbaVisual)
import GI.Gtk.Objects.Widget (widgetSetVisual)
import Termonad
( ConfigHooks(ConfigHooks), defaultMain, defaultTMConfig, hooks, Option(Set)
)
import Termonad.Config.Colour
( addColourExtension, backgroundColour, createColourExtension
, defaultColourConfig, sRGB32
)
import Termonad.Types (TMState, tmStateAppWin)
main :: IO ()
main = do
colExt <- createColourExtension $ defaultColourConfig
{ backgroundColour = Set $ sRGB32 0 0 0 128 -- Opacity: 128
}
defaultMain $ defaultTMConfig
{ hooks = ConfigHooks $ transparencyHook
} `addColourExtension` colExt
transparencyHook :: TMState -> terminal -> IO ()
transparencyHook tmState _terminal = do
appWin <- tmStateAppWin <$> readMVar tmState
maybeScreen <- screenGetDefault
maybeVisual <- join <$> traverse (screenGetRgbaVisual) maybeScreen
traverse_ (widgetSetVisual appWin . Just) maybeVisual |
Roxterm allows the user to set custom opacity for the terminal background. It would be nice to have this feature in Termonad. This can be done with functions in the
VTE
library I believe.The text was updated successfully, but these errors were encountered: