お知らせ

  • 利用規約を守って投稿してください。また、よくある質問および投稿の手引きも参照してください。
  • メッセージの投稿にはアカウントが必要です。未登録の方は、ユーザ登録ページからアカウントを作成することができます。

#1 2013-07-21 04:02:15

thunderdragon
メンバ
登録日: 2012-09-18

Emacsのウィンドウを半透明にしたい

題名の件で質問させて頂きます。

現在、Lubuntu 12.04とXubuntu 12.04を使用しております。
~/.emacs.d/init.el内に半透明処理を以下のように設定しています。

;テーマ設定
(require 'color-theme)
(color-theme-initialize)
(color-theme-comidia)
(set-frame-parameter nil 'alpha 90) ;←ここです

上記設定でLubuntu12.04上では半透明になりません。
セクションを変えて(ログオフした後)Xubuntu 12.04に切り替えてEmacsを起動すると
半透明になります。
色々調べたのですがCompizを使用して半透明にする方法しかヒットせず途方に暮れています。
メインでよく使う環境がLubuntuなのでどうしてもLubuntu上でEmacsを半透明にしたいです。
何かライブラリをインストール、また上記init.el以外で何か設定することによって半透明にできるのでしょうか?
また、Lubuntu上では仕様でCompizを使用しない限り半透明にできないのでしょうか?
ご提示宜しくお願い致します。

オフライン

 

#2 2013-07-22 13:30:10

taka.zoo.n
メンバ
登録日: 2013-05-30

Re: Emacsのウィンドウを半透明にしたい

私は lubuntu も X window 対応の emacs も使ったことがないので的外れかもしれませんが、まず、問題点が emacs, composite manager, X-server(及びそれよりも遠いところ)にあるのか切り分けた方が良いと思います。

(1) emacs 以外の半透明なウィンドーのアプリケーションはちゃんと半透明に表示されますか?
「半透明なウィンドーのアプリケーション」は例えば gnome-terminal で構いませんが、gnome-terminal で試す場合には
*プロファイル編集の「背景」タブで、「背景を透明にする」を選択してプロファイルを作成しただけではそのプロファイルは使われません。メニューの端末->プロファイルの変更で作成したプロファイルに変更にする必要があります。
*gnome-terminal は composite manager が動いていなくとも壁紙を半透明にして表示することがあります。composite manager の動作を確認するために壁紙ではなく他のウインドーの表示内容が透けて見えるかどうかを確かめてください。

(2) xdpyinfo を実行して 32bit visual があるか、32bit pixmap format  が使えるか、Composite, DAMAGE, RENDER の各extension がすべて有効になっているかどうか確認してください。もし、xdpyinfo の結果の見方がお分かりならなければ、ちょっと長くなりますけど、xdpyinfo の結果をそのまま教えてください。

オフライン

 

#3 2013-07-22 15:09:18

thunderdragon
メンバ
登録日: 2012-09-18

Re: Emacsのウィンドウを半透明にしたい

taka.zoo.n様

お返事ありがとうございます。

(1)私はterminatorというターミナルツールを使用していますがこのツールにも
terminator自体を半透明にする機能があり、このツールでの半透明化は
正常に動作しています。また、xfce4-terminal及び記載して頂いたgnome-terminalでも
正常に半透明化していることを確認できました。

(2)記載して頂いたxdpyinfoでComposite extensionsが有効になっているか否かは
自分で確認できましたがその他の
・32bit visual
・32bit pixmap format
・DAMAGE
・RENDER
上記4点については見方がわかりませんので解析宜しくお願い致します。

また、丸投げのような形になってしまい申し訳ございませんが宜しくお願い致します。

以下、xdpyinfoの結果

name of display:    :0
version number:    11.0
vendor string:    The X.Org Foundation
vendor release number:    11103000
X.Org version: 1.11.3
maximum request size:  16777212 bytes
motion buffer size:  256
bitmap unit, bit order, padding:    32, LSBFirst, 32
image byte order:    LSBFirst
number of supported pixmap formats:    7
supported pixmap formats:
    depth 1, bits_per_pixel 1, scanline_pad 32
    depth 4, bits_per_pixel 8, scanline_pad 32
    depth 8, bits_per_pixel 8, scanline_pad 32
    depth 15, bits_per_pixel 16, scanline_pad 32
    depth 16, bits_per_pixel 16, scanline_pad 32
    depth 24, bits_per_pixel 32, scanline_pad 32
    depth 32, bits_per_pixel 32, scanline_pad 32
keycode range:    minimum 8, maximum 255
focus:  window 0x1600004, revert to Parent
number of extensions:    27
    BIG-REQUESTS
    Composite
    DAMAGE
    DOUBLE-BUFFER
    DPMS
    DRI2
    GLX
    Generic Event Extension
    MIT-SCREEN-SAVER
    MIT-SHM
    RANDR
    RECORD
    RENDER
    SECURITY
    SGI-GLX
    SHAPE
    SYNC
    X-Resource
    XC-MISC
    XFIXES
    XFree86-DGA
    XFree86-VidModeExtension
    XINERAMA
    XInputExtension
    XKEYBOARD
    XTEST
    XVideo
default screen number:    0
number of screens:    1

screen #0:
  dimensions:    1024x768 pixels (270x203 millimeters)
  resolution:    96x96 dots per inch
  depths (7):    24, 1, 4, 8, 15, 16, 32
  root window id:    0x9b
  depth of root window:    24 planes
  number of colormaps:    minimum 1, maximum 1
  default colormap:    0x20
  default number of colormap cells:    256
  preallocated pixels:    black 0, white 16777215
  options:    backing-store NO, save-unders NO
  largest cursor:    64x64
  current input event mask:    0x7a003c
    ButtonPressMask          ButtonReleaseMask        EnterWindowMask         
    LeaveWindowMask          StructureNotifyMask      SubstructureNotifyMask   
    SubstructureRedirectMask FocusChangeMask          PropertyChangeMask       
  number of visuals:    32
  default visual id:  0x21
  visual:
    visual id:    0x21
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x22
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x7d
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x7e
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x7f
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x80
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x81
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x82
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x83
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x84
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x85
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x86
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x87
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x88
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x89
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x8a
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x8b
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x8c
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x8d
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x8e
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x8f
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x90
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x91
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x92
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x93
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x94
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x95
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x96
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x97
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x98
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x99
    class:    DirectColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits
  visual:
    visual id:    0x4c
    class:    TrueColor
    depth:    32 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits

オフライン

 

#4 2013-07-22 19:16:50

taka.zoo.n
メンバ
登録日: 2013-05-30

Re: Emacsのウィンドウを半透明にしたい

拝見したところ、サーバー回りは問題なさそうです。
問題が emacs にあるのかないのかを切り分けるため、もう少し情報が必要です。

xprop -root | grep SUPPORTED | grep OPAC
_NET_WM_WINDOW_OPACITY
を実行してみてください。_NET_WM で始まる文字列がいくつも表示されるはずですが
_NET_WM_WINDOW_OPACITY
があることを確認してください。もし、これがなければ、お使いの window manager では emacs を(というか、アトム _NET_WM_WINDOW_OPACITY を使って透明度を指定するアプリケーションを)半透明にすることは emacs の中からはできないように思います。(_NET_WM_WINDOW_OPACITY がサポートされているが _NET_SUPPORTED に入れ忘れているとか、ちょっとありそうもない状況が起きているなら話は別ですが....)

もし上のコマンドで _NET_WM_WINDOW_OPACITY が表示された場合、emacs -q で emacs を起動して
端末 window から

オフライン

 

#5 2013-07-22 19:47:40

taka.zoo.n
メンバ
登録日: 2013-05-30

Re: Emacsのウィンドウを半透明にしたい

すいません、ミスタイプで途中で投稿されてしまいました。

emacs -q で emacs を起動して、端末 window から

コード:

xprop | grep OPAC

を実行して、マウスを emacs のウィンドーの上でクリックしてください。クリックすると上のコマンドが何も出力しないで終わるはずです。
次に emacs で *scratch* buffer に移って

コード:

(set-frame-parameter nil 'alpha 80)

を実行してください。より具体的にいうと *scratch* buffer の末尾の新しい行に上のコードを打ち込んで最後の ) を入力したら CTRL-J を打ってください。(return や enter ではダメです。)nil が返ってくるはずです。そうでなければミスタイプ等を今一度確認してください。

その後で、先ほどと同様に端末 window から xprop | grep OPAC を実行して、emacs window の上でマウスをクリックすると
   _NET_WM_WINDOW_OPACITY(CARDINAL) = 3435973836
が端末 window に表示されますでしょうか?(末尾の数値は alpha の値に応じて変わりますが80なら上に一致するはずです。)

もし、表示されなければ emacs 本体(color theme ではありません)に問題があります。
もし、この時点で emacs が半透明になったら、多分お使いの color theme がなんらかの問題を引き起こしているものと思われます。

もし grep の結果が予期されるとおりでしかも emacs が半透明になっていなかったら、

コード:

xprop -frame -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY 3435973836

を実行して再度マウスを emacs の上でクリックしてみてください。もし、これで半透明にならなければ、すいません、私にはこの先どうすればよいのかわかりません。

#端末window を半透明にしてその中で emacs -nw で emacs を起動するというのは、即却下ですよね。

オフライン

 

#6 2013-07-23 00:26:20

thunderdragon
メンバ
登録日: 2012-09-18

Re: Emacsのウィンドウを半透明にしたい

taka.zoo.n様

早速のご返信ありがとうございます。

xprop -root | grep SUPPORTED | grep OPAC
_NET_WM_WINDOW_OPACITY
を実行してみてください。_NET_WM で始まる文字列がいくつも表示されるはずですが
_NET_WM_WINDOW_OPACITY
があることを確認してください。もし、これがなければ、お使いの window manager では emacs を(というか、アトム _NET_WM_WINDOW_OPACITY を使って透明度を指定するアプリケーションを)半透明にすることは emacs の中からはできないように思います。(_NET_WM_WINDOW_OPACITY がサポートされているが _NET_SUPPORTED に入れ忘れているとか、ちょっとありそうもない状況が起きているなら話は別ですが....)

記載して頂いたコマンドで検索したところ_NET_WM_WINDOW_OPACITYは見つかりませんでしたが、
Xubuntuにセッションを切り替えて上記コマンドで_NET_WM_WINDOW_OPACITYを検索したところ
・_NET_WM_WINDOW_OPACITY
・_NET_WM_WINDOW_OPACITY_LOCKED
上記2点の_NET_WM_WINDOW_OPACITYが見つかりました。

emacs -q で emacs を起動して、端末 window から

コード:

xprop | grep OPAC

を実行して、マウスを emacs のウィンドーの上でクリックしてください。クリックすると上のコマンドが何も出力しないで終わるはずです。
次に emacs で *scratch* buffer に移って

コード:

(set-frame-parameter nil 'alpha 80)

を実行してください。より具体的にいうと *scratch* buffer の末尾の新しい行に上のコードを打ち込んで最後の ) を入力したら CTRL-J を打ってください。(return や enter ではダメです。)nil が返ってくるはずです。そうでなければミスタイプ等を今一度確認してください。

その後で、先ほどと同様に端末 window から xprop | grep OPAC を実行して、emacs window の上でマウスをクリックすると
   _NET_WM_WINDOW_OPACITY(CARDINAL) = 3435973836
が端末 window に表示されますでしょうか?(末尾の数値は alpha の値に応じて変わりますが80なら上に一致するはずです。)

もし、表示されなければ emacs 本体(color theme ではありません)に問題があります。
もし、この時点で emacs が半透明になったら、多分お使いの color theme がなんらかの問題を引き起こしているものと思われます。

もし grep の結果が予期されるとおりでしかも emacs が半透明になっていなかったら、

コード:

xprop -frame -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY 3435973836

を実行して再度マウスを emacs の上でクリックしてみてください。もし、これで半透明にならなければ、すいません、私にはこの先どうすればよいのかわかりません。

上記手順も行なって見ましたがEmacsは半透明にならずでした。

やはり、Lubuntu(LXDE)上でEmacsを半透明化することは不可能ですよね。

#端末window を半透明にしてその中で emacs -nw で emacs を起動するというのは、即却下ですよね。

上記の方法もあったのですね。
この方法も視野にいれて見たいと思います。

本当に色々ご提示して頂きありがとうございました。
また、お手間取らせてしまい本当に申し訳ございませんでした。

オフライン

 

#7 2013-07-23 13:24:39

taka.zoo.n
メンバ
登録日: 2013-05-30

Re: Emacsのウィンドウを半透明にしたい

thunderdragon による投稿:

やはり、Lubuntu(LXDE)上でEmacsを半透明化することは不可能ですよね。

現段階は問題点が composite manager にあることが判明したという段階なので結論を出すにはちょっと早いような気がします。しかし、一筋縄ではいかないのもはっきりしたように思えます。最初にも書きましたが、私が lubuntu を使っていないこともあり、明確にこうすればよいという事は申し上げられませんが、X window システム一般論ということで考えられる対処は二つあります。

* window manager を _NET_WM_WINDOW_OPACITY に対応する composite window manager に取り替える。
当初の #1 の内容から推測するにこれは thunderdragon さんが望んでいない解決策かもしれません。また、window manager を取り替えたために emacs が property を(X window システムの階層で)toplevel window に設定し損ねてしまうかもしれず、必ずしも emacs が半透明になってくれるとは限りません。

* composite manager を _NET_WM_WINDOW_OPACITY に対応するものに取り替える、あるいはインストールして LXDE から composition を横取りするようにする。
Linux系OSの基本的な操作ができることが前提になりますが、(インストール以外に)設定を変えずに試すことができます。ですが、composite manager を変えたことで他のアプリケーションや壁紙に影響が出るかもしれません。(archlinux のxcompmgr 参照。)また、window manager は変わっていないので、emacs を半透明にするにはその都度 property を手で設定するか transset-df を使うことになります。

LXDE と composite manager で検索して役立ちそうな情報を探してみてください。

# 私はソースから起こしましたが、今 synaptic で検索してみたら xcompmgr は package があるみたいですね。
# xcompmgr が LXDE 下で動くかどうか私には全く分かりませんが。

老婆心ながら:何であれ composite manager を試す前に、以下の手順を確認しておく事を強くおすすめします。
* ps と kill、あるいは killall の使い方(他の制御端末から動かしたプロセスを強制終了しないといけなくなるかも)
* CTRL+ALT+Fnで文字端末モードにする、あるいは X-window に戻す方法。(どのファンクションキーを使うかは設定に依存します。手元の Ubuntu 12.04 では F1 と F7 ですが、lubuntu でどうなっているかは分かりません。)
* 上記の様に文字端末にした状態でログインして、マシンを reboot する方法。


「こんなことは百も承知だ!」と思われるかもしれません。ですが composite manager が止まる(または誤って CTRL-Z で suspend する)とその時点で画面表示が一切行われなくなります。普通ならプロセスを suspend すると「停止」とか「suspended」とか表示されますが、composite manager が suspend されているためそのメッセージ自体も表示されず、何かがおかしくなっていること、あるいはその原因に気がつきにくいのです。運が良ければ(X serevr がおかしくなってしまう前に)そのままキーボードから停止したプロセスを再開させるコマンドを打ち込んで回復させることができます。ですが、フォーカスが外れてしまったり、既に X server もハングアップしていたりすると、composite manager を kill して、それがダメなら reboot というのを端末から行わなければならなくなります。

# 私が不注意なだけかもしれませんが、何度も(思い出せませんが10回以上)そういう状況になってしまいました。

オフライン

 

Board footer

Powered by FluxBB