lemonbar: temp fixes
lemonbar: temp
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import subprocess, os, getpass
|
||||
import subprocess, os
|
||||
import re # regexp
|
||||
from enum import Enum
|
||||
|
||||
@@ -10,8 +10,8 @@ kill_on_unfocus = []
|
||||
logger = None
|
||||
health_logger = None
|
||||
|
||||
screen = None
|
||||
parsing_queue = None
|
||||
screen_send_cmd = lambda s : None # TODO temporary until move actions to modules
|
||||
parsing_queue = None
|
||||
|
||||
class bar_mode(Enum):
|
||||
power, normal, control = range(-1,2) # Don't cycle through power
|
||||
@@ -26,7 +26,7 @@ mode = bar_mode.normal
|
||||
|
||||
floatterm_args = lambda prog : ['terminator', '-r', 'FLOAT_TERM', '-p'
|
||||
, 'dark', '-e', 'echo kill_unfocus $$ > {}; exec {}'.format(
|
||||
config.fifo_file_executor, prog)]
|
||||
config.fifo_file_executor, prog)] # TODO URGENT solve without fifo
|
||||
def date_comm(args):
|
||||
subprocess.Popen(['yad', '--no-buttons', '--calendar', '--sticky'
|
||||
, '--on-top' , '--class' , '"YADWIN"', '--posx=1650', '--posy=24'
|
||||
@@ -67,7 +67,7 @@ def bluetooth(args):
|
||||
btcargs = args.split()[1:]
|
||||
btcargs = [a.replace('pxc550', '00:16:94:22:29:0E') for a in btcargs]
|
||||
inp = ' '.join(btcargs)
|
||||
screen.send_cmd('bluetoothctl ' + inp)
|
||||
screen_send_cmd('bluetoothctl ' + inp)
|
||||
|
||||
show_secs = False
|
||||
def toggle_secs(args):
|
||||
@@ -122,32 +122,3 @@ def create_new_fifo(fifo_file):
|
||||
logger.error('''Failed, couldn't create fifo file''')
|
||||
os.remove(config.pid_file) # Clean up own PID file
|
||||
sys.exit(0)
|
||||
|
||||
class LemonbarScreen:
|
||||
# Start, stop and send commands to screen instance
|
||||
|
||||
# Start detached, in UTF-8 mode. Log to fifo
|
||||
start_flags = ['-d', '-m', '-U', '-L', '-Logfile', config.fifo_screen_log]
|
||||
|
||||
def __init__(self):
|
||||
self.identifier = 'lemonbar_{}_{}'.format(getpass.getuser(), os.getpid())
|
||||
|
||||
create_new_fifo(config.fifo_screen_log)
|
||||
self.send(self.start_flags) # Start screen
|
||||
self.send_cmd('stty -echo') # Do not echo what is written to screen terminal
|
||||
self.send_colon('logfile flush 0.1') # Log quickly
|
||||
|
||||
def destroy(self):
|
||||
self.send_colon('kill')
|
||||
|
||||
def send(self, args):
|
||||
# Send something to our screen instance
|
||||
subprocess.call(['screen', '-S', self.identifier] + args)
|
||||
|
||||
def send_cmd(self, cmd):
|
||||
# Send terminal input to our screen instance
|
||||
self.send(['-X', 'stuff', cmd + '\n'])
|
||||
|
||||
def send_colon(self, cmd):
|
||||
# Send colon command to our screen instance
|
||||
self.send(['-X', 'colon', cmd + '\n'])
|
||||
|
||||
Reference in New Issue
Block a user