AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / ubuntu / Perguntas / 1523324
Accepted
anmomu92
anmomu92
Asked: 2024-08-14 18:32:44 +0800 CST2024-08-14 18:32:44 +0800 CST 2024-08-14 18:32:44 +0800 CST

Os temas do aplicativo não são aplicados automaticamente ao alterar os temas GTK ou QT

  • 772

Problemático

Estou trabalhando com o xmonad WM e quero adicionar um atalho de teclado para alternar temas. Eu já fiz isso e parece funcionar.

O problema é que aplicativos como Brave ou Firefox não atualizam seu tema durante a execução e tenho que fechar e abrir os aplicativos novamente para que o tema seja aplicado.

Alguém sabe o que está acontecendo?

Minha configuração

Optei por mudar de tema substituindo o tema diretamente nos arquivos de configuração GTK e QT ( $HOME/.config/gtk-3.0/settings.inie $HOME/.config/qt5ct/qt5ct.conf, respectivamente) via sed. Eu coloquei os comandos no arquivo de configuração do xmonad.

O que eu tentei

  1. Configurando o tema via: gsettings set org.gnome.desktop.interface gtk-theme "<theme-name>".
  2. Enviando sinais como HUPou USR1 para os aplicativos:pkill -HUP -x brave
themes
  • 1 1 respostas
  • 23 Views

1 respostas

  • Voted
  1. Best Answer
    anmomu92
    2024-08-23T23:12:22+08:002024-08-23T23:12:22+08:00

    Resolvi instalando o xsettingsdpacote( sudo apt install xsettingsd) e colocando no xmonad.hsarquivo de configuração uma função que altera o tema via sed. Toda a função que usei é a seguinte:

    toggleTheme :: X ()
    toggleTheme = do
      let themeFile = "/tmp/current_theme"  -- Temporary file to track the theme
      fileExists <- io $ doesFileExist themeFile
      if fileExists
          then do
              -- If the file exists, switch to the dark theme and delete the file
              spawn "sed -i 's#color_scheme_path=/usr/share/qt5ct/colors/airy.conf#color_scheme_path=/usr/share/qt5ct/colors/darker.conf#' ~/.config/qt5ct/qt5ct.conf"
              spawn "sed -i 's/gtk-theme-name=Yaru/gtk-theme-name=Yaru-dark/' ~/.config/gtk-3.0/settings.ini"
              spawn "sed -i 's#Net/ThemeName \"Yaru\"#Net/ThemeName \"Yaru-dark\"#' ~/.config/xsettingsd/xsettingsd.conf"
              spawn "killall -HUP xsettingsd"
              io $ removeFile themeFile  -- Create the file to indicate dark theme
          else do
              -- If the file does not exist, switch to the light theme and create the file
              spawn "sed -i 's#color_scheme_path=/usr/share/qt5ct/colors/darker.conf#color_scheme_path=/usr/share/qt5ct/colors/airy.conf#' ~/.config/qt5ct/qt5ct.conf"
              spawn "sed -i 's/gtk-theme-name=Yaru-dark/gtk-theme-name=Yaru/' ~/.config/gtk-3.0/settings.ini"
              spawn "sed -i 's#Net/ThemeName \"Yaru-dark\"#Net/ThemeName \"Yaru\"#' ~/.config/xsettingsd/xsettingsd.conf"
              spawn "killall -HUP xsettingsd"
              io $ writeFile themeFile ""  -- Create the file to indicate light theme
    

    Observe que deixei os sedcomandos anteriores por precaução, e que depois de substituir o arquivo de configuração do xsettingsd, fiz com que o xsettingsd o recarregasse novamente com o killall -HUP xsettingsdcomando.

    No mesmo xmonad.hsarquivo, vincule a função a uma chave e ela funciona.

    ((modm, xK_s), toggleTheme)
    
    • 0

relate perguntas

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Existe um comando para listar todos os usuários? Também para adicionar, excluir, modificar usuários, no terminal?

    • 9 respostas
  • Marko Smith

    Como excluir um diretório não vazio no Terminal?

    • 4 respostas
  • Marko Smith

    Como descompactar um arquivo zip do Terminal?

    • 9 respostas
  • Marko Smith

    Como instalo um arquivo .deb por meio da linha de comando?

    • 11 respostas
  • Marko Smith

    Como instalo um arquivo .tar.gz (ou .tar.bz2)?

    • 14 respostas
  • Marko Smith

    Como listar todos os pacotes instalados

    • 24 respostas
  • Martin Hope
    Flimm Como posso usar o docker sem sudo? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    led-Zepp Como faço para salvar a saída do terminal em um arquivo? 2014-02-15 11:49:07 +0800 CST
  • Martin Hope
    ubuntu-nerd Como descompactar um arquivo zip do Terminal? 2011-12-11 20:37:54 +0800 CST
  • Martin Hope
    TheXed Como instalo um arquivo .deb por meio da linha de comando? 2011-05-07 09:40:28 +0800 CST
  • Martin Hope
    Ivan Como listar todos os pacotes instalados 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    David Barry Como determino o tamanho total de um diretório (pasta) na linha de comando? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher "Os seguintes pacotes foram retidos:" Por que e como resolvo isso? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford Como os PPAs podem ser removidos? 2010-07-30 01:09:42 +0800 CST

Hot tag

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve