You are not logged in.

#1 2019-02-24 05:09:18

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 730

I like Geany, but..

Having looked at KDE for the first time in years Kate has nearly turned my head.

It's not the UI it's the graceful handling of root owned files:
If you need root to read them you get a password dialogue to open.
If you have read access but root owns them you can open, make changes if needed, and only see a password dialogue if you hit save.

They've done a stunning job with elevation only when needed.
Uncluttered the menus some too, no "text editor as root" items required.

You don't get that awful moment when you inspect a config, see a change you'd like to make & "Oh crap I gots to close & reopen as root!" which leads to the temptation to leave geany as root open.

Last edited by Bearded_Blunder (2019-02-24 05:15:14)


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Offline

#2 2019-02-24 08:19:40

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,702

Re: I like Geany, but..

Agreed, visual studio code will present a popup with a button 'Retry as sudo'. p.s. Running a full editor as root is most likely a bad idea to start with.

Last edited by brontosaurusrex (2019-02-24 08:23:55)

Offline

#3 2019-02-24 08:30:41

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,091
Website

Re: I like Geany, but..

Have heard good reports of kate over the years. It brings in a mighty list of kde dependencies though. Anyway, now installing to give it a try...

EDIT
...it does a lot of database writing after closing. Don't like the appearance much either. Hmm...

Last edited by johnraff (2019-02-24 08:34:19)


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#4 2019-02-24 09:39:09

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 730

Re: I like Geany, but..

You're talking to a man who does the actual majority of his config file editing in Windows running notepad.exe as Administrator, compared to that Kate is *pretty*.  Theres ways & things I prefer about geany, appearance being one, but boy that privelidge elevation only at the point of need is slick. It's also a trick Windows doesn't have.

Running a full editor as root is most likely a bad idea to start with.

if you're dealing with a biggish file doing search & replace.. find & such I'm sorry.. but that's just what's going to happen.. nano is great for quick edits on small files, wouldn't dream of firing up geany as root for say sources.list or /etc/hosts, but for big stuff nano becomes too cumbersome.


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Offline

#5 2019-02-24 10:39:33

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,702

Re: I like Geany, but..

I'am just saying one needs privilege elevation when file is saved and not before.

Last edited by brontosaurusrex (2019-02-24 12:19:57)

Offline

#6 2019-02-24 16:56:34

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 730

Re: I like Geany, but..

Which is what I'm pointing out Kate does seamlessly & for Geany in Bunsenlabs one has to pick the "As root" menu item & authenticate at startup, regardless if one attempts saving or decides not to edit. Or one simply can't save edits on root owned config files. Maybe if pkexec is used it *might* do so in the background, it also might very well not & instead be an exact analogue of gksudo geany.

Would you care to download the source & inspect it to see which it is?
The way Kate handles it you're certain without that & without understanding the code.


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Offline

#7 2019-02-24 17:45:38

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,702

Re: I like Geany, but..

So i guess there are at least two types of situations one will get into:
a. reading and writing requires some sort of elevation or user setup (for example stuff in /var/log)
b. writing requires super user or some sort of elevation or user setup (for example /etc/hosts)

Example prototype script, that might cover situation b.  (doesn't really solve anything, since you have to run in advance), but might be usable for someone smarter to see some nice workarounds?

#!/bin/bash

# elevation

# tmp dir 
tmp="/tmp/$RANDOM-$$"
trap '[ -n "$tmp" ] && rm -fr "$tmp"' EXIT
mkdir -m 700 "$tmp" || { echo '!! unable to create a tmpdir' >&2; tmp=; exit 1; }

# single input allowed
cp "$1" "$tmp/woot.txt"
geany -i "$tmp/woot.txt"

# geany is closed here
cp "$tmp/woot.txt" "$1" || sudo cp "$tmp/woot.txt" "$1"

echo "i did something"

Example usage: elevation /etc/hosts

Last edited by brontosaurusrex (2019-02-24 17:48:30)

Offline

#8 2019-02-24 21:08:59

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 730

Re: I like Geany, but..

Or if you don't mind nano (it offers you vi as an alternative first run IIRC)

sudo -e /some/file  # optionally -u user if you need to edit something owned by !root !yourself

Which creates a temp file you edit, & elevates to write, at least that's how I understood `man sudo` shame it's such an arse to get line numbers showing with sudo -e compared to sudo nano -l if my installs lasted longer I'd dig into nano's config & default line numbers.

No help for a gui editor though wink  Nor will it stop people running whatever editor via [gk,lxqt,kde,plain]sudo or pkexec even if "chosen editor" runs elevated the whole time.  They just will without thinking.

I just thought it was really cool how Kate handles it, perhaps I should have kept the place tidier by simply posting about Kate in the "cool apps" thread smile


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Offline

#9 2019-02-24 21:39:08

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,702

Re: I like Geany, but..

What version of kate is that?

Offline

#10 2019-02-25 04:00:15

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 730

Re: I like Geany, but..

The one in the current buster, as installed temporarily sometime last week.


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Offline

#11 2019-02-25 04:48:47

Dobbie03
Resident Metalhead
From: New Zealand
Registered: 2015-09-29
Posts: 2,129
Website

Re: I like Geany, but..

Bearded_Blunder wrote:

It's not the UI it's the graceful handling of root owned files:
If you need root to read them you get a password dialogue to open.
If you have read access but root owns them you can open, make changes if needed, and only see a password dialogue if you hit save.

That's what I like about Sublime Text.


I like my Metal like my coffee.......Black!
Resident Metalhead Poser

Offline

#12 2019-02-25 05:20:01

MALsPa
Member
From: albuquerque
Registered: 2016-06-20
Posts: 99

Re: I like Geany, but..

brontosaurusrex wrote:

p.s. Running a full editor as root is most likely a bad idea to start with.

I read something like this somewhere before, so I started using only nano when I need to edit files as root. Which really isn't all that often. I do like Geany, though -- I even use it when I'm booted into KDE. Maybe I'll take a closer look at Kate; haven't spent any time with it in quite some time.

I have only one installation with KDE, which is Kubuntu 18.04. And I've added Openbox to that. Half the time when I'm using Kubuntu, I'm logged into the Openbox session, and then it's kinda nice having access to KDE apps under Openbox.

Offline

#13 2019-02-25 06:33:48

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 730

Re: I like Geany, but..

Well, I have occasionally wondered what a mainly Qt spin approximating BL would be like, some of the obvious substitutions would almost need to be from KDE geany > Kate Gparted > KDE partition manager, though I guess a possible Qt sub for geany might also be Scite, which is quite good too, my go-to syntax highlighting editor on Windows, most stuff seems to have some plausible substitute available..

It'd be hell to make it look decent though, I'll never build a distro, if I install by picking a wm & adding software, I always end up with something looking like uuuummm.. hey, sudden inspiration Psychobilly Cadillac Linux.. I may be onto something.... Thanks J. Cash


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Offline

#14 2019-02-25 06:51:39

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,091
Website

Re: I like Geany, but..

It's not too hard to add custom entries to geany's build menu. I've got "Terminal here" and "Open as root" which opens the same file in a pkexec privileged text editor. I was using bl-text-editor but you can also get nano or even vim - whatever you've set as "editor" in Debian alternatives - by invoking bl-cli-editor.

In BL helium it requires an edit to polkit permissions for pkexec to work for bl-cli-editor. Add this block of code to /usr/share/polkit-1/actions/org.bunsenlabs.pkexec.policy, just under the one for bl-text-editor:

  <action id="org.bunsenlabs.pkexec.bl-cli-editor">
    <description>Run BunsenLabs default cli text editor as root</description>
    <message>Authentication is required to run bl-cli-editor as root.</message>
    <icon_name>accessories-text-editor</icon_name>
    <defaults>
      <allow_any>no</allow_any>
      <allow_inactive>no</allow_inactive>
      <allow_active>auth_admin</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/bl-cli-editor</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
  </action>

and use this as the geany menu command:

pkexec bl-cli-editor %d/%f

The polkit permission for bl-cli-editor will be added in Lithium - nano in a terminal is an obvious use case for root privileges - and maybe we can add the geany menu item too.

(Or of course you can just open a terminal and call sudo nano...)


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#15 2019-02-25 07:00:39

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,091
Website

Re: I like Geany, but..

Bearded_Blunder wrote:

I guess a possible Qt sub for geany might also be Scite, which is quite good too...

Agreed, though it's a GTK app, not Qt. In fact geany is based on scite I think - or they're both based on the Scintilla library. I also used to use SciTE on Windows (98).

But if someone wanted to work on a GTK -> Qt migration of BL it might be interesting to see just how much heavier it got - or not.


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#16 2019-02-25 07:14:00

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 730

Re: I like Geany, but..

nano in a terminal is a frequent use case for root here and I may well add that command, I might try tweaking it marginally though, especially when switching editors on same file, line numbers become extremely useful.


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Offline

#17 2019-02-25 20:37:26

ohnonot
...again
Registered: 2015-09-29
Posts: 3,484
Website

Re: I like Geany, but..

Bearded_Blunder wrote:

a possible Qt sub for geany

notepadqq

Offline

#18 2019-02-27 09:40:44

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,091
Website

Re: I like Geany, but..

Bearded_Blunder wrote:

nano in a terminal is a frequent use case for root here and I may well add that command
I might try tweaking it marginally though, especially when switching editors on same file, line numbers become extremely useful.

Sure, please try some nano options, and if you hit something nice, post here.

The pkexec permission for bl-cli-editor should have gone in with Helium, but was overlooked. It'll definitely be in Lithium.

Last edited by johnraff (2019-02-27 09:41:21)


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

Board footer

Powered by FluxBB