fluxboxからlabwcに切り替えてみた下記インストールする必要があり
sudo add-apt-repository ppa:samoilov-lex/labwc sudo apt-get install labwc sudo apt-get install waybar sudo apt-get install swaylock sudo apt-get install fonts-font-awesome sudo apt-get install fonts-fork-awesome sudo apt-get install fcitx5 sudo apt-get install wl-clipboard sudo apt install fcitx5-mozc sudo apt-get isntall dmenu labwcに切り替えたが、fluxboxからgnome-terminalから入力できなくなる。。。 原因はwaylandが含まれるbus情報があるとx11で行っていた入力ができなくなるらしい・・・ (例) ~/.config/ibus/bus/49ba92f181ac4a7caf727f7c56429585-unix-wayland-0 |
mkfifoを使うと標準出力と標準入力を用いてインタプリタのプログラムを組むことが容易になる。
pythonプログラム(subprocessを用いていない) import re def send(s): RET = "@@RETURN VALUE@@" print(s+";echo {} $?".format(RET)) outputs = [] while True: output = input() if re.search("^{} ".format(RET), output): m = re.match("^{} (.*)".format(RET), output) return (int(m.groups()[0]), outputs) outputs.append(output) import sys print(send("ping www.google.co.jp -c 4"), file=sys.stderr) print(send("ls ----"), file=sys.stderr)subprocessなしでシェルをキック $ mkfifo net $ bash < net 2>&1 | tee /dev/stderr | python ls.py | tee net ping www.google.co.jp -c 4;echo @@RETURN VALUE@@ $? PING www.google.co.jp (142.250.206.195) 56(84) bytes of data. 64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=1 ttl=56 time=14.8 ms 64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=2 ttl=56 time=16.6 ms 64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=3 ttl=56 time=15.8 ms 64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=4 ttl=56 time=15.4 ms --- www.google.co.jp ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3005ms rtt min/avg/max/mdev = 14.760/15.666/16.645/0.681 ms @@RETURN VALUE@@ 0 (0, ['PING www.google.co.jp (142.250.206.195) 56(84) bytes of data.', '64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=1 ttl=56 time=14.8 ms', '64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=2 ttl=56 time=16.6 ms', '64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=3 ttl=56 time=15.8 ms', '64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=4 ttl=56 time=15.4 ms', '', '--- www.google.co.jp ping statistics ---', '4 packets transmitted, 4 received, 0% packet loss, time 3005ms', 'rtt min/avg/max/mdev = 14.760/15.666/16.645/0.681 ms']) ls ----;echo @@RETURN VALUE@@ $? ls: unrecognized option '----' Try 'ls --help' for more information. @@RETURN VALUE@@ 2 (2, ["ls: unrecognized option '----'", "Try 'ls --help' for more information."]) ほかにも、通信系のインタプリタをライブラリなしで実行することができる。 便利なり。 その代わり、標準出力は使えないが(笑)簡易RPA的なコンソールプログラムはすぐに作れる。 |
令和SECCONに参加するのでTSURUGI Linuxを入れてみました。
fluxboxに切り替えて「fbmenugen」を使ったら「Other」に「TSURUGI」メニューが全て入ってカテゴリが分からなくなってしまいました。 仕方がないのでpythonでmateからfluxboxのmenuに変換するプログラムを作成、すっきりしましたとさ。 ■変換用python import sys from xml.dom import minidom from os import path from collections import OrderedDict APP_Directory = None DIR_Directory = None def main(): global APP_Directory global DIR_Directory if len(sys.argv)!=2: print("Using: {} mate.conf".format(sys.argv[0])) return fileName = sys.argv[1] APP_Directory = path.abspath(path.dirname(fileName)+"/../applications") DIR_Directory = path.abspath(path.dirname(fileName)+"/../desktop-directories") print(fileName) with open(fileName, "r", True, "UTF-8") as r: x = "\n".join(r.readlines()) myDom = minidom.parseString(x) recurseDict(myDom, 0, []) def recurseDict(dic, layer, stack): #dic = minidom.parseString("") layer+=1 if sum(1 for x in dic.childNodes if not isinstance(x, minidom.Text)): if dic.nodeName != "Layout": for d in dic.childNodes: if not isinstance(d, minidom.Text): recurseDict(d, layer, stack) else: if dic.nodeName == "Directory": lidx = 0 for lidx in range(len(stack), 0, -1): if layer > stack[lidx-1][0]: break for _ in range(lidx, len(stack)): stack.pop() print("{}[end]".format(" "*(len(stack)*2))) v = readFile(DIR_Directory+"/"+dic.childNodes[0].nodeValue) print("{}[submenu] ({}) <{}>".format(" "*(len(stack)*2), v["Name"], v["Icon"])) stack.append((layer, v)) if dic.nodeName == "Filename": v = readFile(APP_Directory+"/"+dic.childNodes[0].nodeValue) print("{}[exec] ({}) {{{}}} <{}>".format(" "*(len(stack)*2), v["Name"], v["Exec"], v["Icon"])) if layer==1: for _ in range(len(stack)): stack.pop() print("{}[end]".format(" "*(len(stack)*2))) def readFile(fileName): with open(fileName, "r", True, "UTF-8") as r: rec=dict() while True: line = r.readline() if line=="": break line = line[:-1] pos = line.find("=") if pos >=0: key = line[0:pos] if ["Icon", "Name", "Exec"].count(key): rec[key] = line[pos+1:] return rec if __name__ == "__main__": main()■fbmenugenにinclude機能を追加 diff --git a/fbmenugen b/fbmenugen index 84e268b..fa5e784 100755 --- a/fbmenugen +++ b/fbmenugen @@ -401,6 +401,14 @@ ITEM_WITH_ICON ITEM } +sub prepare_include { + my $path= shift() =~ s/\)/\\)/gr; + + return <<"EOF" + [include] ($path) +EOF +} + sub begin_category { $with_icons ? <<"MENU_WITH_ICON" @@ -479,6 +487,9 @@ foreach my $schema (@$SCHEMA) { elsif (exists $schema->{item}) { $generated_menu .= prepare_item(@{$schema->{item}}); } + elsif (exists $schema->{include}) { + $generated_menu .= prepare_include(@{$schema->{include}}); + } elsif (exists $schema->{sep}) { $generated_menu .= "[separator]\n"; } diff --git a/schema.pl b/schema.pl index 18a824a..50ae0dd 100644 --- a/schema.pl +++ b/schema.pl @@ -5,6 +5,7 @@ =for comment item: add an item inside the menu {item => ["command", "label", "icon"]}, + include: add include another file {include => ["path"]}, cat: add a category inside the menu {cat => ["name", "label", "icon"]}, sep: horizontal line separator {sep => undef}, {sep => "label"}, raw: any valid Fluxbox menu entry {raw => q(...)}, |
リカバリの仕方
# mount -t /dev/mapper/VG-LV root # mount --bind /dev root/dev # mount -t tmpfs tmpfs root/run # mount -t proc proc root/proc # mount -t sysfs sysfs root/sys # chroot root■参考文献 http://www.linuxfromscratch.org/lfs/view/stable-systemd/chapter06/kernfs.html |
忍者ブログ [PR] |